aboutsummaryrefslogtreecommitdiff
path: root/h-source/Application/Models
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2010-10-17 13:29:57 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2010-10-17 13:29:57 +0000
commit232aa1924c8c0f10d87b210b46c9f061af5c844c (patch)
tree2351f2aaff7ad244f60358954e4711692fb8aadc /h-source/Application/Models
parenta17e3e0495bee3705d3c1e5ead2db1a8359e64e9 (diff)
added files
Diffstat (limited to 'h-source/Application/Models')
-rw-r--r--h-source/Application/Models/BaseModel.php66
-rw-r--r--h-source/Application/Models/BoxesModel.php40
-rw-r--r--h-source/Application/Models/DeletionModel.php51
-rw-r--r--h-source/Application/Models/HardwareModel.php198
-rw-r--r--h-source/Application/Models/HistoryModel.php48
-rw-r--r--h-source/Application/Models/IssuesModel.php131
-rw-r--r--h-source/Application/Models/MessagesModel.php56
-rw-r--r--h-source/Application/Models/NewsModel.php42
-rw-r--r--h-source/Application/Models/NotebooksModel.php69
-rw-r--r--h-source/Application/Models/ParamsModel.php41
-rw-r--r--h-source/Application/Models/PrintersModel.php68
-rw-r--r--h-source/Application/Models/ProfileModel.php70
-rw-r--r--h-source/Application/Models/RevisionsModel.php48
-rw-r--r--h-source/Application/Models/ScannersModel.php68
-rw-r--r--h-source/Application/Models/TalkModel.php52
-rwxr-xr-xh-source/Application/Models/UsersModel.php221
-rw-r--r--h-source/Application/Models/VideocardsModel.php64
-rw-r--r--h-source/Application/Models/WifiModel.php67
18 files changed, 1400 insertions, 0 deletions
diff --git a/h-source/Application/Models/BaseModel.php b/h-source/Application/Models/BaseModel.php
new file mode 100644
index 0000000..b40482e
--- /dev/null
+++ b/h-source/Application/Models/BaseModel.php
@@ -0,0 +1,66 @@
+<?php
+
+// h-source, a web software to build a community of people that want to share their hardware information.
+// Copyright (C) 2010 Antonio Gallo (h-source-copyright.txt)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if (!defined('EG')) die('Direct access not allowed!');
+
+class BaseModel extends Model_Tree {
+
+ public $type = ''; //device type
+ public $diffFields = array();
+
+ public function __construct() {
+ $this->_tables = 'hardware';
+ $this->_idFields = 'id_hard';
+
+ $this->_where=array(
+ 'type' => 'hardware',
+ 'vendor' => 'hardware',
+ 'compatibility' => 'hardware',
+ 'comm_year' => 'hardware',
+ );
+
+ $this->orderBy = 'hardware.id_hard desc';
+ parent::__construct();
+ }
+
+ public function checkType($id_hard = 0)
+ {
+ $clean['id_hard'] = (int)$id_hard;
+ $res = $this->db->select('hardware','type','id_hard='.$clean['id_hard']);
+ if (count($res) > 0)
+ {
+ return (strcmp($this->type,$res[0]['hardware']['type']) === 0 ) ? true : false;
+ }
+ return false;
+ }
+
+ public function getDiffArray($oldArray, $newArray)
+ {
+ $diffArray = array();
+ foreach ($this->diffFields as $field => $label)
+ {
+ if (array_key_exists($field,$oldArray) and array_key_exists($field,$newArray))
+ {
+// echo htmlDiff($oldArray[$field], $newArray[$field]);
+// echo $oldArray[$field].$newArray[$field];
+ $diffArray[$label] = htmlDiff($oldArray[$field], $newArray[$field]);
+ }
+ }
+ return $diffArray;
+ }
+} \ No newline at end of file
diff --git a/h-source/Application/Models/BoxesModel.php b/h-source/Application/Models/BoxesModel.php
new file mode 100644
index 0000000..0e6eee1
--- /dev/null
+++ b/h-source/Application/Models/BoxesModel.php
@@ -0,0 +1,40 @@
+<?php
+
+// h-source, a web software to build a community of people that want to share their hardware information.
+// Copyright (C) 2010 Antonio Gallo (h-source-copyright.txt)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if (!defined('EG')) die('Direct access not allowed!');
+
+class BoxesModel extends Model_Tree {
+
+ public function __construct() {
+ $this->_tables = 'boxes';
+ $this->_idFields = 'id_box';
+
+ parent::__construct();
+ }
+
+ public $formStruct = array(
+ 'entries' => array(
+ 'title' => array(),
+ 'message' => array('type'=>'Textarea'),
+ 'id_box' => array(
+ 'type' => 'Hidden'
+ )
+ ),
+ );
+
+} \ No newline at end of file
diff --git a/h-source/Application/Models/DeletionModel.php b/h-source/Application/Models/DeletionModel.php
new file mode 100644
index 0000000..ea3c4e6
--- /dev/null
+++ b/h-source/Application/Models/DeletionModel.php
@@ -0,0 +1,51 @@
+<?php
+
+// h-source, a web software to build a community of people that want to share their hardware information.
+// Copyright (C) 2010 Antonio Gallo (h-source-copyright.txt)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if (!defined('EG')) die('Direct access not allowed!');
+
+class DeletionModel extends Model_Tree
+{
+
+ public function __construct()
+ {
+ $this->_tables = 'deletion';
+ $this->_idFields = 'id_del';
+
+// $this->_where=array(
+// 'id_hard' => 'talk'
+// );
+//
+ $this->_popupItemNames = array(
+ 'object' => 'object',
+ );
+
+ $this->_popupLabels = array(
+ 'object' => 'OBJECT',
+ );
+//
+ $this->orderBy = 'deletion.id_del desc';
+
+ $this->strongConditions['insert'] = array(
+ "checkIsStrings|duplication,other" => 'object',
+ "+checkLength|500" => 'message'
+ );
+
+ parent::__construct();
+ }
+
+} \ No newline at end of file
diff --git a/h-source/Application/Models/HardwareModel.php b/h-source/Application/Models/HardwareModel.php
new file mode 100644
index 0000000..710ddaf
--- /dev/null
+++ b/h-source/Application/Models/HardwareModel.php
@@ -0,0 +1,198 @@
+<?php
+
+// h-source, a web software to build a community of people that want to share their hardware information.
+// Copyright (C) 2010 Antonio Gallo (h-source-copyright.txt)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if (!defined('EG')) die('Direct access not allowed!');
+
+class HardwareModel extends Model_Map {
+
+ public $id_user = 0;
+ public $type = ''; //device type
+ public $lastId = 0; //the id of the last record inserted
+
+ public $formStruct = array(
+ 'entries' => array(
+ 'deleted'=> array('type'=>'Select','options'=>'no,yes'),
+ 'id_hard' => array(
+ 'type' => 'Hidden'
+ )
+ ),
+ );
+
+ public function __construct() {
+ $this->_tables='hardware,regusers,hardware_users';
+ $this->_idFields='id_hard,id_user';
+ $this->_where=array(
+ 'type' => 'hardware',
+ 'username' => 'regusers',
+ 'has_confirmed' => 'regusers',
+ 'deleted' => 'regusers',
+ '-deleted' => 'hardware'
+ );
+ $this->orderBy = 'hardware.id_hard desc';
+ $this->printAssError = "no";
+
+ $this->_popupItemNames = array(
+ 'type'=>'type',
+ 'ask_for_del'=>'ask_for_del',
+ '-deleted'=>'deleted',
+ );
+
+ $this->_popupLabels = array(
+ 'type'=>'TYPE',
+ 'ask_for_del'=>'ASK FOR DEL?',
+ '-deleted'=>'DELETED?',
+ );
+
+ $this->databaseConditions['insert'] = array(
+ 'checkUnique' => 'model',
+ );
+
+ $this->databaseConditions['update'] = array(
+ 'checkUniqueCompl' => 'model',
+ );
+
+ parent::__construct();
+ }
+
+ public function insert()
+ {
+ $this->values['created_by'] = (int)$this->id_user;
+ $this->values['updated_by'] = (int)$this->id_user;
+ $this->values['update_date'] = date('Y-m-d H:i:s');
+
+ //random ID
+ $randomId = md5(uniqid(mt_rand(),true));
+ $this->values["type"] = $randomId;
+
+ parent::insert();
+
+ //associate the user to the record
+ if ($this->queryResult)
+ {
+ $resId = $this->db->select("hardware","id_hard","type='$randomId'");
+ $clean['id'] = $resId[0]['hardware']['id_hard'];
+ $this->lastId = $clean['id'];
+ $this->db->update('hardware','type',array($this->type),'id_hard='.$clean['id']);
+
+ $this->associate($clean['id']);
+ }
+
+ }
+
+ public function update($id)
+ {
+ $clean['id'] = (int)$id;
+
+ $this->values['updated_by'] = (int)$this->id_user;
+ $this->values['update_date'] = date('Y-m-d H:i:s');
+
+ //save the old fields in the revisions table
+ $this->setWhereQueryClause(array('id_hard' => $clean['id']));
+ $oldStruct = $this->getFields($this->fields.',created_by,updated_by,update_date,type,id_hard');
+
+ if (count($oldStruct > 0))
+ {
+ if (strcmp($oldStruct[0]['hardware']['type'],$this->type) === 0)
+ {
+ $oldValues = $oldStruct[0]['hardware'];
+
+ $revisions = new RevisionsModel();
+ $revisions->values = $oldValues;
+ if ($revisions->insert())
+ {
+ parent::update($clean['id']);
+ if ($this->queryResult)
+ {
+ $this->lastId = $clean['id'];
+ if (!$this->checkAssociation($clean['id'],(int)$this->id_user))
+ {
+ $this->associate($clean['id']);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public function makeCurrent($id_rev)
+ {
+ $clean['id_rev'] = (int)$id_rev;
+
+ $revisions = new RevisionsModel();
+
+ $clean['id_hard'] = (int)$revisions->getIdHard($clean['id_rev']);
+
+ //save the old fields in the revisions table
+ $this->setWhereQueryClause(array('id_hard'=>$clean['id_hard']));
+ $oldStruct = $this->getFields($this->fields.',created_by,updated_by,update_date,type,id_hard');
+
+ if (count($oldStruct > 0))
+ {
+ if (strcmp($oldStruct[0]['hardware']['type'],$this->type) === 0)
+ {
+ //get the values of the revision
+ $revisions->setWhereQueryClause(array('id_rev'=>$clean['id_rev']));
+ $newStruct = $revisions->getFields($this->fields.',created_by,updated_by,update_date,type,id_hard');
+
+ if (count($newStruct > 0))
+ {
+ $revisions->values = $oldStruct[0]['hardware'];
+
+ $this->values = $newStruct[0]['revisions'];
+ $this->values['updated_by'] = (int)$this->id_user;
+ $this->values['update_date'] = date('Y-m-d H:i:s');
+
+ if ($revisions->insert())
+ {
+ if (parent::update($clean['id_hard']))
+ {
+ $this->lastId = $clean['id_hard'];
+ if (!$this->checkAssociation($clean['id_hard'],(int)$this->id_user))
+ {
+ $this->associate($clean['id_hard']);
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ $this->notice = "<div class='alert'>Wrong type..</div>\n";
+ }
+ }
+
+ }
+
+ public function associate($id_record)
+ {
+ return parent::associate((int)$id_record,(int)$this->id_user);
+ }
+
+ //get the model name
+ public function getTheModelName($id)
+ {
+ $clean['id'] = (int)$id;
+ $this->setWhereQueryClause(array('id_hard' => $clean['id']));
+ $res = $this->getFields('model');
+ $name = count($res) > 0 ? $res[0]['hardware']['model'] : '';
+ return $name;
+ }
+
+
+
+} \ No newline at end of file
diff --git a/h-source/Application/Models/HistoryModel.php b/h-source/Application/Models/HistoryModel.php
new file mode 100644
index 0000000..309bc99
--- /dev/null
+++ b/h-source/Application/Models/HistoryModel.php
@@ -0,0 +1,48 @@
+<?php
+
+// h-source, a web software to build a community of people that want to share their hardware information.
+// Copyright (C) 2010 Antonio Gallo (h-source-copyright.txt)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if (!defined('EG')) die('Direct access not allowed!');
+
+class HistoryModel extends Model_Tree {
+
+ public function __construct() {
+ $this->_tables = 'history';
+ $this->_idFields = 'id_history';
+
+ $this->orderBy = 'history.id_history';
+
+ $this->_popupFunctions = array(
+ 'created_by'=> 'getUserName',
+ );
+
+ $this->_popupItemNames = array(
+ 'type' => 'type',
+ 'action' => 'action',
+ 'created_by'=> 'created_by',
+ );
+
+ $this->_popupLabels = array(
+ 'type' => 'TYPE',
+ 'action' => 'ACTION',
+ 'created_by'=> 'MODERATOR',
+ );
+
+ parent::__construct();
+ }
+
+} \ No newline at end of file
diff --git a/h-source/Application/Models/IssuesModel.php b/h-source/Application/Models/IssuesModel.php
new file mode 100644
index 0000000..8ca8a52
--- /dev/null
+++ b/h-source/Application/Models/IssuesModel.php
@@ -0,0 +1,131 @@
+<?php
+
+// h-source, a web software to build a community of people that want to share their hardware information.
+// Copyright (C) 2010 Antonio Gallo (h-source-copyright.txt)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if (!defined('EG')) die('Direct access not allowed!');
+
+class IssuesModel extends Model_Tree {
+
+ public function __construct() {
+ $this->_tables = 'issues';
+ $this->_idFields = 'id_issue';
+
+ $this->_onDelete = 'nocheck';
+
+ $this->_where = array(
+ 'priority' => 'issues',
+ 'status' => 'issues',
+ 'topic' => 'issues',
+ );
+
+ $this->_popupItemNames = array(
+ 'priority' => 'priority',
+ 'status' => 'status',
+ 'topic' => 'topic',
+ 'deleted' => 'deleted',
+ );
+
+ $this->_popupLabels = array(
+ 'priority' => 'PRIORITY',
+ 'status' => 'STATUS',
+ 'topic' => 'TOPIC',
+ 'deleted' => 'DELETED?',
+ );
+
+ $this->orderBy = 'issues.id_issue desc';
+
+ $this->strongConditions['insert'] = array(
+ "checkLength|99" => 'title',
+ "+checkLength|34" => 'topic',
+ "++checkLength|15" => 'priority',
+ "+++checkLength|5000" => 'message',
+ "checkisStrings|low,medium,high" => 'priority',
+ "+checkisStrings|maybe-a-bug,new-categories-of-hardware,add-a-vendor-name,other" => 'topic',
+ );
+
+ $this->formStruct = array(
+ 'entries' => array(
+ 'title' => array('labelString' => gtext("TITLE").':'),
+ 'topic' => array(
+ 'type'=>'Select',
+ 'options'=>array(
+ 'Add a vendor name' => 'add-a-vendor-name',
+ 'Maybe a bug' => 'maybe-a-bug',
+ 'Add new categories of hardware' => 'new-categories-of-hardware',
+ 'Other' => 'other'
+ ),
+ 'labelString' => gtext("TOPIC").':',
+ ),
+ 'deleted'=> array(
+ 'type' => 'Select',
+ 'options' => 'no,yes',
+ ),
+ 'priority' => array(
+ 'type'=>'Select',
+ 'options'=>'low,medium,high',
+ 'labelString' => gtext("PRIORITY").':',
+ ),
+ 'message' => array('type'=>'Textarea','idName'=>'bb_code','labelString' => gtext("MESSAGE").':',),
+ 'status' => array(
+ 'type' => 'Select',
+ 'options' => 'opened,closed'
+ ),
+ 'notice' => array(
+ 'type' => 'Textarea',
+ 'idName' => 'bb_code_notice',
+ ),
+ 'id_issue' => array(
+ 'type' => 'Hidden'
+ )
+ ),
+ );
+
+ parent::__construct();
+ }
+
+// public $formStruct = array(
+// 'entries' => array(
+// 'title' => array(),
+// 'topic' => array(
+// 'type'=>'Select',
+// 'options'=>array(
+// 'Add a vendor name' => 'add-a-vendor-name',
+// 'Maybe a bug' => 'maybe-a-bug',
+// 'Add new categories of hardware' => 'new-categories-of-hardware',
+// 'Other' => 'other'
+// ),
+// ),
+// 'deleted'=> array(
+// 'type' => 'Select',
+// 'options' => 'no,yes',
+// ),
+// 'priority' => array('type'=>'Select','options'=>'low,medium,high'),
+// 'message' => array('type'=>'Textarea','idName'=>'bb_code'),
+// 'status' => array(
+// 'type' => 'Select',
+// 'options' => 'opened,closed'
+// ),
+// 'notice' => array(
+// 'type' => 'Textarea',
+// 'idName' => 'bb_code_notice',
+// ),
+// 'id_issue' => array(
+// 'type' => 'Hidden'
+// )
+// ),
+// );
+} \ No newline at end of file
diff --git a/h-source/Application/Models/MessagesModel.php b/h-source/Application/Models/MessagesModel.php
new file mode 100644
index 0000000..64b2bed
--- /dev/null
+++ b/h-source/Application/Models/MessagesModel.php
@@ -0,0 +1,56 @@
+<?php
+
+// h-source, a web software to build a community of people that want to share their hardware information.
+// Copyright (C) 2010 Antonio Gallo (h-source-copyright.txt)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if (!defined('EG')) die('Direct access not allowed!');
+
+class MessagesModel extends Model_Tree {
+
+ public function __construct() {
+ $this->_tables = 'messages';
+ $this->_idFields = 'id_mes';
+
+ $this->orderBy = 'messages.id_mes';
+
+ $this->_popupItemNames = array(
+ 'deleted' => 'deleted',
+ 'has_read' => 'has_read',
+ );
+
+ $this->_popupLabels = array(
+ 'deleted' => 'DELETED?',
+ 'has_read' => 'ALREADY READ?',
+ );
+
+ $this->strongConditions['insert'] = array(
+ "checkLength|5000" => 'message',
+ );
+
+ parent::__construct();
+ }
+
+ public $formStruct = array(
+ 'entries' => array(
+ 'deleted' => array('type'=>'Select','options'=>'no,yes'),
+ 'has_read' => array('type'=>'Select','options'=>'no,yes'),
+ 'message' => array('type'=>'Textarea','idName'=>'bb_code'),
+ 'id_mes' => array(
+ 'type' => 'Hidden'
+ )
+ ),
+ );
+} \ No newline at end of file
diff --git a/h-source/Application/Models/NewsModel.php b/h-source/Application/Models/NewsModel.php
new file mode 100644
index 0000000..fae053b
--- /dev/null
+++ b/h-source/Application/Models/NewsModel.php
@@ -0,0 +1,42 @@
+<?php
+
+// h-source, a web software to build a community of people that want to share their hardware information.
+// Copyright (C) 2010 Antonio Gallo (h-source-copyright.txt)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if (!defined('EG')) die('Direct access not allowed!');
+
+class NewsModel extends Model_Tree {
+
+ public function __construct() {
+ $this->_tables = 'news';
+ $this->_idFields = 'id_news';
+
+ $this->orderBy = 'news.id_news desc';
+
+ parent::__construct();
+ }
+
+ public $formStruct = array(
+ 'entries' => array(
+ 'title' => array(),
+ 'message' => array('type'=>'Textarea','idName'=>'bb_code'),
+ 'id_news' => array(
+ 'type' => 'Hidden'
+ )
+ ),
+ );
+
+} \ No newline at end of file
diff --git a/h-source/Application/Models/NotebooksModel.php b/h-source/Application/Models/NotebooksModel.php
new file mode 100644
index 0000000..456f75f
--- /dev/null
+++ b/h-source/Application/Models/NotebooksModel.php
@@ -0,0 +1,69 @@
+<?php
+
+// h-source, a web software to build a community of people that want to share their hardware information.
+// Copyright (C) 2010 Antonio Gallo (h-source-copyright.txt)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if (!defined('EG')) die('Direct access not allowed!');
+
+class NotebooksModel extends BaseModel {
+
+ public $type = 'notebook'; //device type
+
+ public function __construct()
+ {
+
+ $this->_popupItemNames = array(
+ 'vendor' => 'vendor',
+ 'compatibility' => 'compatibility',
+ 'comm_year' => 'comm_year',
+ 'subtype' => 'subtype',
+ );
+
+ $this->_popupLabels = array(
+ 'vendor' => gtext("vendor"),
+ 'compatibility' => gtext("compatibility"),
+ 'comm_year' => gtext("year"),
+ 'subtype' => gtext("subtype"),
+ );
+
+ $this->_popupWhere = array(
+ 'vendor' => 'type="notebook" and deleted="no"',
+ 'compatibility' => 'type="notebook" and deleted="no"',
+ 'comm_year' => 'type="notebook" and deleted="no"',
+ 'subtype' => 'type="notebook" and deleted="no"',
+ );
+
+ $this->diffFields = array(
+ 'vendor' => gtext("vendor"),
+ 'model' => gtext('model name'),
+ 'subtype' => gtext('subtype (notebook or netbook)'),
+ 'comm_year' => gtext('year of commercialization'),
+ 'distribution' => gtext('GNU/Linux distribution used for the test'),
+ 'compatibility' => gtext('compatibility with free software'),
+ 'kernel' => gtext('tested with the following kernel libre'),
+ 'video_card_type' => gtext('video card model'),
+ 'video_card_works' => gtext('does the video card work?'),
+ 'wifi_type' => gtext('wifi model'),
+ 'wifi_works' => gtext('does the wifi card work?'),
+ 'description' => gtext('Description'),
+ );
+
+ $this->fieldsWithBreaks = array(gtext('Description'));
+
+ parent::__construct();
+ }
+
+} \ No newline at end of file
diff --git a/h-source/Application/Models/ParamsModel.php b/h-source/Application/Models/ParamsModel.php
new file mode 100644
index 0000000..d1347fe
--- /dev/null
+++ b/h-source/Application/Models/ParamsModel.php
@@ -0,0 +1,41 @@
+<?php
+
+// h-source, a web software to build a community of people that want to share their hardware information.
+// Copyright (C) 2010 Antonio Gallo (h-source-copyright.txt)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if (!defined('EG')) die('Direct access not allowed!');
+
+class ParamsModel extends Model_Tree {
+
+ public function __construct() {
+ $this->_tables = 'params';
+ $this->_idFields = 'id_par';
+
+ parent::__construct();
+ }
+
+ public $formStruct = array(
+ 'entries' => array(
+ 'updating' => array(
+ 'type'=>'Select',
+ 'options'=>'no,yes',
+ ),
+ 'id_par' => array(
+ 'type' => 'Hidden'
+ )
+ ),
+ );
+} \ No newline at end of file
diff --git a/h-source/Application/Models/PrintersModel.php b/h-source/Application/Models/PrintersModel.php
new file mode 100644
index 0000000..8d5991e
--- /dev/null
+++ b/h-source/Application/Models/PrintersModel.php
@@ -0,0 +1,68 @@
+<?php
+
+// h-source, a web software to build a community of people that want to share their hardware information.
+// Copyright (C) 2010 Antonio Gallo (h-source-copyright.txt)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if (!defined('EG')) die('Direct access not allowed!');
+
+class PrintersModel extends BaseModel
+{
+
+ public $type = 'printer'; //device type
+
+ public function __construct()
+ {
+
+ $this->_popupItemNames = array(
+ 'vendor' => 'vendor',
+ 'compatibility' => 'compatibility',
+ 'comm_year' => 'comm_year',
+ 'interface' => 'interface',
+ );
+
+ $this->_popupLabels = array(
+ 'vendor' => gtext("vendor"),
+ 'compatibility' => gtext("compatibility"),
+ 'comm_year' => gtext("year"),
+ 'interface' => gtext("interface"),
+ );
+
+ $this->_popupWhere = array(
+ 'vendor' => 'type="printer" and deleted="no"',
+ 'compatibility' => 'type="printer" and deleted="no"',
+ 'comm_year' => 'type="printer" and deleted="no"',
+ 'interface' => 'type="printer" and deleted="no"',
+ );
+
+ $this->diffFields = array(
+ 'vendor' => gtext("vendor"),
+ 'model' => gtext('model name'),
+ 'pci_id' => gtext("VendorID:ProductID code of the device"),
+ 'comm_year' => gtext('year of commercialization'),
+ 'interface' => gtext("interface"),
+ 'distribution' => gtext('GNU/Linux distribution used for the test'),
+ 'compatibility' => gtext('compatibility with free software'),
+ 'kernel' => gtext('tested with the following kernel libre'),
+ 'driver' => gtext("free driver used"),
+ 'description' => gtext('Description'),
+ );
+
+ $this->fieldsWithBreaks = array(gtext('Description'));
+
+ parent::__construct();
+ }
+
+} \ No newline at end of file
diff --git a/h-source/Application/Models/ProfileModel.php b/h-source/Application/Models/ProfileModel.php
new file mode 100644
index 0000000..c282b4f
--- /dev/null
+++ b/h-source/Application/Models/ProfileModel.php
@@ -0,0 +1,70 @@
+<?php
+
+// h-source, a web software to build a community of people that want to share their hardware information.
+// Copyright (C) 2010 Antonio Gallo (h-source-copyright.txt)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if (!defined('EG')) die('Direct access not allowed!');
+
+class ProfileModel extends Model_Tree {
+
+ public function __construct() {
+ $this->_tables = 'profile';
+ $this->_idFields = 'id_prof';
+
+ $this->_where=array(
+ 'username' => 'regusers',
+ 'has_confirmed' => 'regusers',
+ 'deleted' => 'regusers'
+ );
+
+ $this->softConditions['update'] = array(
+ "checkLength|90" => "real_name,where_you_are,fav_distro,birth_date,website|the fields 'real name', 'where_you_are', 'favorite distro', 'website' and 'birthdate' don't have to have more than 90 characters",
+ "checkLength|1000" => "projects,description|the fields 'projects' and 'description' don't have to have more than 1000 characters",
+ "checkIsStrings|no,yes" => "publish_mail"
+ );
+
+ parent::__construct();
+ }
+
+ public $formStruct = array(
+
+ 'entries' => array(
+ 'real_name' => array('labelString'=>'Your real name'),
+ 'website' => array('labelString'=>'Your website address (add http://)'),
+ 'where_you_are' => array('labelString'=>'I\'m from...'),
+ 'birth_date' => array('labelString'=>'My birthdate'),
+ 'fav_distro' => array('labelString'=>'My favourite distribution'),
+ 'projects' => array(
+ 'type' => 'Textarea',
+ 'labelString'=>'Free software projects I\'m working on'
+ ),
+ 'publish_mail' => array(
+ 'type' => 'Select',
+ 'options' => 'no,yes',
+ 'labelString'=> 'Would you like to publish your e-mail address?'
+ ),
+ 'description' => array(
+ 'type' => 'Textarea',
+ 'labelString'=> 'Your description'
+ ),
+ 'id_prof' => array(
+ 'type' => 'Hidden'
+ )
+ ),
+
+ );
+
+} \ No newline at end of file
diff --git a/h-source/Application/Models/RevisionsModel.php b/h-source/Application/Models/RevisionsModel.php
new file mode 100644
index 0000000..203da64
--- /dev/null
+++ b/h-source/Application/Models/RevisionsModel.php
@@ -0,0 +1,48 @@
+<?php
+
+// h-source, a web software to build a community of people that want to share their hardware information.
+// Copyright (C) 2010 Antonio Gallo (h-source-copyright.txt)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if (!defined('EG')) die('Direct access not allowed!');
+
+class RevisionsModel extends Model_Tree {
+
+ public $id_user = 0;
+ public $type = ''; //device type
+
+ public function __construct() {
+ $this->_tables='revisions';
+ $this->_idFields='id_rev';
+
+ $this->_where=array(
+ 'id_hard'=>'revisions'
+ );
+
+ $this->orderBy = 'id_rev desc';
+
+ parent::__construct();
+ }
+
+ public function getIdHard($id_rev = 0)
+ {
+ $clean['id_rev'] = (int)$id_rev;
+
+ $res = $this->db->select('revisions','id_hard','id_rev='.$clean['id_rev']);
+
+ return (count($res) > 0) ? $res[0]['revisions']['id_hard'] : 0;
+ }
+
+} \ No newline at end of file
diff --git a/h-source/Application/Models/ScannersModel.php b/h-source/Application/Models/ScannersModel.php
new file mode 100644
index 0000000..74e2bdd
--- /dev/null
+++ b/h-source/Application/Models/ScannersModel.php
@@ -0,0 +1,68 @@
+<?php
+
+// h-source, a web software to build a community of people that want to share their hardware information.
+// Copyright (C) 2010 Antonio Gallo (h-source-copyright.txt)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if (!defined('EG')) die('Direct access not allowed!');
+
+class ScannersModel extends BaseModel
+{
+
+ public $type = 'scanner'; //device type
+
+ public function __construct()
+ {
+
+ $this->_popupItemNames = array(
+ 'vendor' => 'vendor',
+ 'compatibility' => 'compatibility',
+ 'comm_year' => 'comm_year',
+ 'interface' => 'interface',
+ );
+
+ $this->_popupLabels = array(
+ 'vendor' => gtext("vendor"),
+ 'compatibility' => gtext("compatibility"),
+ 'comm_year' => gtext("year"),
+ 'interface' => gtext("interface"),
+ );
+
+ $this->_popupWhere = array(
+ 'vendor' => 'type="scanner" and deleted="no"',
+ 'compatibility' => 'type="scanner" and deleted="no"',
+ 'comm_year' => 'type="scanner" and deleted="no"',
+ 'interface' => 'type="scanner" and deleted="no"',
+ );
+
+ $this->diffFields = array(
+ 'vendor' => gtext("vendor"),
+ 'model' => gtext('model name'),
+ 'pci_id' => gtext("VendorID:ProductID code of the device"),
+ 'comm_year' => gtext('year of commercialization'),
+ 'interface' => gtext("interface"),
+ 'distribution' => gtext('GNU/Linux distribution used for the test'),
+ 'compatibility' => gtext('compatibility with free software'),
+ 'kernel' => gtext('tested with the following kernel libre'),
+ 'driver' => gtext("free driver used"),
+ 'description' => gtext('Description'),
+ );
+
+ $this->fieldsWithBreaks = array(gtext('Description'));
+
+ parent::__construct();
+ }
+
+} \ No newline at end of file
diff --git a/h-source/Application/Models/TalkModel.php b/h-source/Application/Models/TalkModel.php
new file mode 100644
index 0000000..992ffa9
--- /dev/null
+++ b/h-source/Application/Models/TalkModel.php
@@ -0,0 +1,52 @@
+<?php
+
+// h-source, a web software to build a community of people that want to share their hardware information.
+// Copyright (C) 2010 Antonio Gallo (h-source-copyright.txt)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if (!defined('EG')) die('Direct access not allowed!');
+
+class TalkModel extends Model_Tree {
+
+ public function __construct() {
+ $this->_tables = 'talk';
+ $this->_idFields = 'id_talk';
+
+ $this->_where=array(
+ 'id_hard' => 'talk'
+ );
+
+ $this->orderBy = 'talk.id_talk desc';
+
+ $this->strongConditions['insert'] = array(
+ "checkLength|99" => 'title',
+ "+checkNotEmpty" => 'message',
+ "++checkLength|5000" => 'message',
+ );
+
+ parent::__construct();
+ }
+
+ public $formStruct = array(
+ 'entries' => array(
+ 'title' => array(),
+ 'message' => array('type'=>'Textarea'),
+ 'id_talk' => array(
+ 'type' => 'Hidden'
+ )
+ ),
+ );
+
+} \ No newline at end of file
diff --git a/h-source/Application/Models/UsersModel.php b/h-source/Application/Models/UsersModel.php
new file mode 100755
index 0000000..c425079
--- /dev/null
+++ b/h-source/Application/Models/UsersModel.php
@@ -0,0 +1,221 @@
+<?php
+
+// h-source, a web software to build a community of people that want to share their hardware information.
+// Copyright (C) 2010 Antonio Gallo (h-source-copyright.txt)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if (!defined('EG')) die('Direct access not allowed!');
+
+class UsersModel extends Model_Map
+{
+
+ public static $usersList = array();
+
+ public function __construct()
+ {
+ $this->_tables='regusers,reggroups,regusers_groups';
+ $this->_idFields='id_user,id_group';
+
+ $this->_where=array(
+ 'id_group' => 'reggroups',
+ 'id_user' => 'regusers',
+ 'name' => 'reggroups',
+ 'confirmation_token'=> 'regusers',
+ 'has_confirmed' => 'regusers',
+ 'deleted' => 'regusers',
+ 'forgot_token' => 'regusers'
+ );
+
+ $this->_popupItemNames = array(
+ 'has_confirmed'=>'has_confirmed',
+ 'deleted'=>'deleted',
+ 'id_group'=>'name',
+ );
+
+ $this->_popupLabels = array(
+ 'has_confirmed'=>'HAS CONFIRMED?',
+ 'deleted'=>'DELETED?',
+ 'id_group'=>'GROUP'
+ );
+
+ $this->orderBy = 'regusers.id_user desc';
+
+ parent::__construct();
+
+ $this->deleteNotRegistered();
+ }
+
+ public function deleteNotRegistered()
+ {
+ $limit = time() - Account::$confirmTime;
+ $this->db->del('regusers','has_confirmed = 1 and deleted = "no" and creation_time < '.$limit);
+ }
+
+ public function getUser($id_user = 0)
+ {
+ $clean['id_user'] = (int)$id_user;
+ if (array_key_exists($clean['id_user'],self::$usersList))
+ {
+ return self::$usersList[$clean['id_user']];
+ }
+ else
+ {
+ $user = $this->db->select('regusers','username,has_confirmed','id_user='.$clean['id_user']);
+ if (count($user) > 0)
+ {
+ $fuser = (strcmp($user[0]['regusers']['has_confirmed'],0) === 0) ? $user[0]['regusers']['username'] : "__".$user[0]['regusers']['username'];
+ self::$usersList[$clean['id_user']] = $fuser;
+ return $fuser;
+ }
+ else
+ {
+ return "__";
+ }
+ }
+ }
+
+ public function insert()
+ {
+ //create the token
+ $confirmation_token = md5(randString(20));
+ $this->values['confirmation_token'] = $confirmation_token;
+ //has_confirmed flag
+ $this->values['has_confirmed'] = 1;
+ $this->values['creation_time'] = time();
+
+ //random ID
+ $randomId = md5(randString(5).uniqid(mt_rand(),true));
+ $this->values["temp_field"] = $randomId;
+
+ if (isset($_POST['captcha']))
+ {
+ if ( strcmp($_SESSION['captchaString'],$_POST['captcha']) === 0 )
+ {
+
+ parent::insert();
+
+ if ($this->queryResult)
+ {
+ $resId = $this->db->select("regusers","id_user","temp_field='$randomId'");
+ $clean['id_user'] = $resId[0]['regusers']['id_user'];
+ $this->db->update("regusers",'temp_field',array(''),'id_user='.$clean['id_user']);
+
+ $result = Account::confirm($this->values['username'],$this->values['e_mail'],$clean['id_user'],$confirmation_token);
+
+ if ($result)
+ {
+ $_SESSION['status'] = 'sent';
+ }
+ else
+ {
+ $_SESSION['status'] = 'regerror';
+ }
+
+ $hed = new HeaderObj(DOMAIN_NAME);
+ $hed->redirect('users/notice/'.Lang::$current);
+ }
+
+ }
+ else
+ {
+ $this->result = false;
+ $this->queryResult = false;
+ $this->notice = "<div class='alert'>Wrong captcha code...</div>\n";
+ }
+ }
+ }
+
+ public function close($id_user)
+ {
+ $clean['id_user'] = (int)$id_user;
+
+ $this->values = array(
+ 'has_confirmed' => 1,
+ 'deleted' => 'yes',
+ 'e_mail' => ''
+ );
+
+ if ($this->update($clean['id_user']))
+ {
+ $_SESSION['status'] = 'deleted';
+
+ $profile = new ProfileModel();
+ $res = $profile->db->select('profile','id_prof','created_by='.$clean['id_user']);
+
+ if (count($res) > 0)
+ {
+ $clean['id_prof'] = (int)$res[0]['profile']['id_prof'];
+ $profile->values = array(
+ 'real_name' => '',
+ 'where_you_are' => '',
+ 'birth_date' => '',
+ 'fav_distro' => '',
+ 'projects' => '',
+ 'description' => ''
+ );
+ $profile->update($clean['id_prof']);
+ }
+ }
+
+ }
+
+ public function forgot($username)
+ {
+ $clean['username'] = ctype_alnum($username) ? sanitizeAll($username) : '';
+
+ if (isset($_POST['captcha']))
+ {
+ if ( strcmp($_SESSION['captchaString'],$_POST['captcha']) === 0 )
+ {
+ $res = $this->db->select('regusers','e_mail,id_user','username="'.$clean['username'].'" and has_confirmed = 0 and deleted = "no"');
+ if (count($res) > 0)
+ {
+ $e_mail = $res[0]['regusers']['e_mail'];
+ $id_user = (int)$res[0]['regusers']['id_user'];
+ $forgot_token = md5(randString(20));
+ $forgot_time = time();
+ $updateArray = array($forgot_token, $forgot_time);
+ $this->db->update('regusers','forgot_token,forgot_time',$updateArray,'username="'.$clean['username'].'"');
+
+ $result = Account::sendnew($clean['username'],$e_mail,$id_user,$forgot_token);
+
+ if ($result)
+ {
+ $_SESSION['status'] = 'sent_new';
+ }
+ else
+ {
+ $_SESSION['status'] = 'sent_new_error';
+ }
+
+ $hed = new HeaderObj(DOMAIN_NAME);
+ $hed->redirect('users/notice/'.Lang::$current,1);
+
+ }
+ else
+ {
+ $this->notice = "<div class='alert'>the user does not exist</div>\n";
+ }
+ }
+ else
+ {
+ $this->result = false;
+ $this->queryResult = false;
+ $this->notice = "<div class='alert'>Wrong captcha code...</div>\n";
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/h-source/Application/Models/VideocardsModel.php b/h-source/Application/Models/VideocardsModel.php
new file mode 100644
index 0000000..fb90a31
--- /dev/null
+++ b/h-source/Application/Models/VideocardsModel.php
@@ -0,0 +1,64 @@
+<?php
+
+// h-source, a web software to build a community of people that want to share their hardware information.
+// Copyright (C) 2010 Antonio Gallo (h-source-copyright.txt)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if (!defined('EG')) die('Direct access not allowed!');
+
+class VideocardsModel extends BaseModel
+{
+
+ public $type = 'videocard'; //device type
+
+ public function __construct()
+ {
+
+ $this->_popupItemNames = array(
+ 'vendor' => 'vendor',
+ 'comm_year' => 'comm_year',
+ 'interface' => 'interface',
+ );
+
+ $this->_popupLabels = array(
+ 'vendor' => gtext("vendor"),
+ 'comm_year' => gtext("year"),
+ 'interface' => gtext("interface"),
+ );
+
+ $this->_popupWhere = array(
+ 'vendor' => 'type="videocard" and deleted="no"',
+ 'comm_year' => 'type="videocard" and deleted="no"',
+ 'interface' => 'type="videocard" and deleted="no"',
+ );
+
+ $this->diffFields = array(
+ 'vendor' => gtext("vendor"),
+ 'model' => gtext('model name'),
+ 'pci_id' => gtext("VendorID:ProductID code of the device"),
+ 'comm_year' => gtext('year of commercialization'),
+ 'interface' => gtext("interface"),
+ 'distribution' => gtext('GNU/Linux distribution used for the test'),
+ 'kernel' => gtext('tested with the following kernel libre'),
+ 'video_card_works' => gtext("how does it work with free software?"),
+ 'description' => gtext('Description'),
+ );
+
+ $this->fieldsWithBreaks = array(gtext('Description'));
+
+ parent::__construct();
+ }
+
+} \ No newline at end of file
diff --git a/h-source/Application/Models/WifiModel.php b/h-source/Application/Models/WifiModel.php
new file mode 100644
index 0000000..1322cdd
--- /dev/null
+++ b/h-source/Application/Models/WifiModel.php
@@ -0,0 +1,67 @@
+<?php
+
+// h-source, a web software to build a community of people that want to share their hardware information.
+// Copyright (C) 2010 Antonio Gallo (h-source-copyright.txt)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if (!defined('EG')) die('Direct access not allowed!');
+
+class WifiModel extends BaseModel
+{
+
+ public $type = 'wifi'; //device type
+
+ public function __construct()
+ {
+
+ $this->_popupItemNames = array(
+ 'vendor' => 'vendor',
+ 'comm_year' => 'comm_year',
+ 'wifi_works' => 'wifi_works',
+ 'interface' => 'interface',
+ );
+
+ $this->_popupLabels = array(
+ 'vendor' => gtext("vendor"),
+ 'comm_year' => gtext("year"),
+ 'wifi_works' => gtext("does it work?"),
+ 'interface' => gtext("interface"),
+ );
+
+ $this->_popupWhere = array(
+ 'vendor' => 'type="wifi" and deleted="no"',
+ 'comm_year' => 'type="wifi" and deleted="no"',
+ 'wifi_works' => 'type="wifi" and deleted="no"',
+ 'interface' => 'type="wifi" and deleted="no"',
+ );
+
+ $this->diffFields = array(
+ 'vendor' => gtext("vendor"),
+ 'model' => gtext('model name'),
+ 'pci_id' => gtext("VendorID:ProductID code of the device"),
+ 'comm_year' => gtext('year of commercialization'),
+ 'interface' => gtext("interface"),
+ 'distribution' => gtext('GNU/Linux distribution used for the test'),
+ 'kernel' => gtext('tested with the following kernel libre'),
+ 'wifi_works' => gtext("does it work with free software?"),
+ 'description' => gtext('Description'),
+ );
+
+ $this->fieldsWithBreaks = array(gtext('Description'));
+
+ parent::__construct();
+ }
+
+} \ No newline at end of file