aboutsummaryrefslogtreecommitdiff
path: root/h-source/Application/Models
diff options
context:
space:
mode:
authorYuchen Pei <hi@ypei.me>2021-10-15 09:52:00 +1100
committerYuchen Pei <hi@ypei.me>2021-10-15 09:52:00 +1100
commit71b0e901f5fb1cfcd162d8acc23120d3f77a3152 (patch)
tree323c00faef1edc7dea2e88ff581cc2258b2b6432 /h-source/Application/Models
parent72cce24864b064b5762f4fe97fdf40d8d2ad4b51 (diff)
parent07f5140771388c9e0c8a99b0dd2e5d950bdb173b (diff)
Merge branch 'development' into h-node
Diffstat (limited to 'h-source/Application/Models')
-rw-r--r--h-source/Application/Models/AcquisitioncardsModel.php68
-rw-r--r--h-source/Application/Models/BaseModel.php43
-rw-r--r--h-source/Application/Models/BluetoothModel.php68
-rw-r--r--h-source/Application/Models/BoxesModel.php42
-rw-r--r--h-source/Application/Models/DeletionModel.php53
-rw-r--r--h-source/Application/Models/DistrosModel.php34
-rw-r--r--h-source/Application/Models/EthernetcardsModel.php68
-rw-r--r--h-source/Application/Models/FingerprintreadersModel.php68
-rw-r--r--h-source/Application/Models/GenericModel.php103
-rw-r--r--h-source/Application/Models/HardwareModel.php348
-rw-r--r--h-source/Application/Models/HistoryModel.php56
-rw-r--r--h-source/Application/Models/HostcontrollersModel.php69
-rw-r--r--h-source/Application/Models/IssuesModel.php116
-rw-r--r--h-source/Application/Models/MessagesModel.php73
-rw-r--r--h-source/Application/Models/ModemsModel.php68
-rw-r--r--h-source/Application/Models/NewsModel.php44
-rw-r--r--h-source/Application/Models/NotebooksModel.php94
-rw-r--r--h-source/Application/Models/ParamsModel.php43
-rw-r--r--h-source/Application/Models/PrintersModel.php70
-rw-r--r--h-source/Application/Models/ProfileModel.php78
-rw-r--r--h-source/Application/Models/RaidadaptersModel.php68
-rw-r--r--h-source/Application/Models/RevisionsModel.php50
-rw-r--r--h-source/Application/Models/ScannersModel.php68
-rw-r--r--h-source/Application/Models/SdcardreadersModel.php68
-rw-r--r--h-source/Application/Models/SoundcardsModel.php68
-rw-r--r--h-source/Application/Models/TalkModel.php116
-rw-r--r--h-source/Application/Models/ThreegcardsModel.php68
-rwxr-xr-xh-source/Application/Models/UsersModel.php295
-rw-r--r--h-source/Application/Models/VendorsModel.php82
-rw-r--r--h-source/Application/Models/VideocardsModel.php68
-rw-r--r--h-source/Application/Models/WebcamsModel.php72
-rw-r--r--h-source/Application/Models/WifiModel.php68
-rw-r--r--h-source/Application/Models/WikiModel.php319
-rw-r--r--h-source/Application/Models/WikirevisionsModel.php45
-rw-r--r--h-source/Application/Models/WikitalkModel.php112
35 files changed, 0 insertions, 3173 deletions
diff --git a/h-source/Application/Models/AcquisitioncardsModel.php b/h-source/Application/Models/AcquisitioncardsModel.php
deleted file mode 100644
index 147aa94..0000000
--- a/h-source/Application/Models/AcquisitioncardsModel.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class AcquisitioncardsModel extends GenericModel
-{
-
- public $type = 'acquisition-card'; //device type
-
- public function __construct()
- {
-
- $this->_popupItemNames = array(
- 'vendor' => 'vendor',
- 'comm_year' => 'comm_year',
- 'compatibility' => 'compatibility',
- 'interface' => 'interface',
- );
-
- $this->_popupLabels = array(
- 'vendor' => gtext("vendor"),
- 'comm_year' => gtext("year"),
- 'compatibility' => gtext("does it work?"),
- 'interface' => gtext("interface"),
- );
-
- $this->setPopupFunctions();
-
- $this->createPopupWhere('vendor,compatibility,comm_year,interface');
-
- $this->diffFields = array(
- 'vendor' => gtext("vendor"),
- 'model' => gtext('model name'),
- 'other_names' => gtext('possible other names of the device'),
- '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'),
- 'compatibility' => gtext("does it work with free software?"),
- 'driver' => gtext("free driver used"),
- 'description' => gtext('Description'),
- );
-
- $this->fieldsWithBreaks = array(gtext('Description'),gtext('possible other names of the device'));
-
- parent::__construct();
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Models/BaseModel.php b/h-source/Application/Models/BaseModel.php
deleted file mode 100644
index 2f3a142..0000000
--- a/h-source/Application/Models/BaseModel.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class BaseModel extends Model_Tree
-{
-
- public function updateHistory($type)
- {
- $clean['created_by'] = (int)$this->values['created_by'];
- $clean['last_id'] = (int)$this->lastId();
-
- $history = new HistoryModel();
- $history->values = array(
- 'created_by' => $clean['created_by'],
- 'type' => sanitizeAll($type),
- 'action' => "insert",
- 'id' => $clean['last_id'],
- 'message' => '',
- 'gr' => 'registered',
- );
- $history->insert();
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Models/BluetoothModel.php b/h-source/Application/Models/BluetoothModel.php
deleted file mode 100644
index 022c889..0000000
--- a/h-source/Application/Models/BluetoothModel.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class BluetoothModel extends GenericModel
-{
-
- public $type = 'bluetooth'; //device type
-
- public function __construct()
- {
-
- $this->_popupItemNames = array(
- 'vendor' => 'vendor',
- 'comm_year' => 'comm_year',
- 'bluetooth_works' => 'bluetooth_works',
- 'interface' => 'interface',
- );
-
- $this->_popupLabels = array(
- 'vendor' => gtext("vendor"),
- 'comm_year' => gtext("year"),
- 'bluetooth_works' => gtext("does it work?"),
- 'interface' => gtext("interface"),
- );
-
- $this->createPopupWhere('vendor,bluetooth_works,comm_year,interface');
-
- $this->setPopupFunctions();
-
- $this->diffFields = array(
- 'vendor' => gtext("vendor"),
- 'model' => gtext('model name'),
- 'other_names' => gtext('possible other names of the device'),
- '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'),
- 'bluetooth_works' => gtext("does it work with free software?"),
- 'driver' => gtext("free driver used"),
- 'description' => gtext('Description'),
- );
-
- $this->fieldsWithBreaks = array(gtext('Description'),gtext('possible other names of the device'));
-
- parent::__construct();
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Models/BoxesModel.php b/h-source/Application/Models/BoxesModel.php
deleted file mode 100644
index a6035cb..0000000
--- a/h-source/Application/Models/BoxesModel.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. 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
deleted file mode 100644
index 9b5dc1a..0000000
--- a/h-source/Application/Models/DeletionModel.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. 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/DistrosModel.php b/h-source/Application/Models/DistrosModel.php
deleted file mode 100644
index 58cd435..0000000
--- a/h-source/Application/Models/DistrosModel.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class DistrosModel extends Model_Tree {
-
- public function __construct() {
- $this->_tables = 'distros';
- $this->_idFields = 'id_distro';
-
- $this->_idOrder = 'id_order';
-
- parent::__construct();
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Models/EthernetcardsModel.php b/h-source/Application/Models/EthernetcardsModel.php
deleted file mode 100644
index 08dc997..0000000
--- a/h-source/Application/Models/EthernetcardsModel.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class EthernetcardsModel extends GenericModel
-{
-
- public $type = 'ethernet-card'; //device type
-
- public function __construct()
- {
-
- $this->_popupItemNames = array(
- 'vendor' => 'vendor',
- 'comm_year' => 'comm_year',
- 'ethernet_card_works' => 'ethernet_card_works',
- 'interface' => 'interface',
- );
-
- $this->_popupLabels = array(
- 'vendor' => gtext("vendor"),
- 'comm_year' => gtext("year"),
- 'ethernet_card_works' => gtext("does it work?"),
- 'interface' => gtext("interface"),
- );
-
- $this->setPopupFunctions();
-
- $this->createPopupWhere('vendor,ethernet_card_works,comm_year,interface');
-
- $this->diffFields = array(
- 'vendor' => gtext("vendor"),
- 'model' => gtext('model name'),
- 'other_names' => gtext('possible other names of the device'),
- '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'),
- 'ethernet_card_works' => gtext("does it work with free software?"),
- 'driver' => gtext("free driver used"),
- 'description' => gtext('Description'),
- );
-
- $this->fieldsWithBreaks = array(gtext('Description'),gtext('possible other names of the device'));
-
- parent::__construct();
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Models/FingerprintreadersModel.php b/h-source/Application/Models/FingerprintreadersModel.php
deleted file mode 100644
index 7a2f3e8..0000000
--- a/h-source/Application/Models/FingerprintreadersModel.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class FingerprintreadersModel extends GenericModel
-{
-
- public $type = 'fingerprint-reader'; //device type
-
- public function __construct()
- {
-
- $this->_popupItemNames = array(
- 'vendor' => 'vendor',
- 'comm_year' => 'comm_year',
- 'fingerprint_works' => 'fingerprint_works',
- 'interface' => 'interface',
- );
-
- $this->_popupLabels = array(
- 'vendor' => gtext("vendor"),
- 'comm_year' => gtext("year"),
- 'fingerprint_works' => gtext("does it work?"),
- 'interface' => gtext("interface"),
- );
-
- $this->setPopupFunctions();
-
- $this->createPopupWhere('vendor,fingerprint_works,comm_year,interface');
-
- $this->diffFields = array(
- 'vendor' => gtext("vendor"),
- 'model' => gtext('model name'),
- 'other_names' => gtext('possible other names of the device'),
- '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'),
- 'fingerprint_works' => gtext("does it work with free software?"),
- 'driver' => gtext("free driver used"),
- 'description' => gtext('Description'),
- );
-
- $this->fieldsWithBreaks = array(gtext('Description'),gtext('possible other names of the device'));
-
- parent::__construct();
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Models/GenericModel.php b/h-source/Application/Models/GenericModel.php
deleted file mode 100644
index 3a0f8fa..0000000
--- a/h-source/Application/Models/GenericModel.php
+++ /dev/null
@@ -1,103 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class GenericModel extends Model_Tree {
-
- public $type = ''; //device type
- public $diffFields = array();
- public $fieldsWithBreaks = 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)
- {
- return getDiffArray($this->diffFields, $oldArray, $newArray);
- }
-
- //create the $_popupWhere property
- public function createPopupWhere($list)
- {
- $listArray = explode(',',$list);
- foreach ($listArray as $field)
- {
- $this->_popupWhere[$field] = 'type="'.$this->type.'" and deleted="no" and cleared="no"';
- }
- }
-
- //set the fuction to be applied upon each popup name
- public function setPopupFunctions()
- {
- foreach ($this->_popupItemNames as $name => $field)
- {
- $this->_popupFunctions[$name] = getTranslationFunction($name);
- }
- }
-
- //get the HTML of the popup labels
- public function getPopupLabel($viewArgs)
- {
- $html = null;
- $listArray = array('page','history_page','search_string');
-
- $count = 0;
-
- foreach ($viewArgs as $field => $value)
- {
- if ($count < 5)
- {
- if (!in_array($field,$listArray))
- {
- $value = call_user_func(getTranslationFunction($field),$value);
- $html .= "<div class='viewall_popup_menu_status_item'>".$value."</div>\n";
-
- $count++;
- }
- }
- }
- return $html;
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Models/HardwareModel.php b/h-source/Application/Models/HardwareModel.php
deleted file mode 100644
index 9c8a5db..0000000
--- a/h-source/Application/Models/HardwareModel.php
+++ /dev/null
@@ -1,348 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. 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',
- 'id_user' => '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();
- }
-
- //set the soft and strong conditions
- public function setConditions($worksOptions,$worksField,$interfaceOptions)
- {
- $this->strongConditions['update'] = array(
- "checkNotEmpty" => "model|you have to fill the <i>model name</i> entry",
- "checkMatch|".Hardware::$regExpressions['model'] => "model|characters not allowed in the <i>model name</i> entry",
- "+checkMatch|".Hardware::$regExpressions['vendorid_productid'] => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}",
- "checkLength|190" => "model",
- "+checkLength|299" => "distribution",
- "++checkIsStrings|".Hardware::getCommYears() => "comm_year",
- "+++checkIsStrings|".$worksOptions => $worksField,
- "++++checkIsStrings|".$interfaceOptions => "interface",
- );
-
- $this->strongConditions['insert'] = $this->strongConditions['update'];
-
- $this->softConditions['update'] = array(
- "checkMatch|".Hardware::$regExpressions['kernel'] => "kernel|characters not allowed in the <i>kernel</i> entry",
- "checkLength|40000" => "description",
- "+checkLength|99" => "kernel",
- "++checkLength|49" => "driver",
- "++checkMatch|".Hardware::$regExpressions['driver'] => "driver|only the following characters are allowed for the <i>driver</i> entry: a-z A-Z 0-9 - _ . + s / , : ; ( ) [ ]",
- "+++checkLength|1000" => "other_names|the <i>other names</i> entry exceeds the value of 1000 characters",
- );
-
- $this->softConditions['insert'] = $this->softConditions['update'];
- }
-
- public function permanentlyDelete($id)
- {
- $clean['id'] = (int)$id;
-
- $record = $this->selectId($clean['id']);
-
- $this->values['deleted'] = 'no';
- $this->values['approved'] = 'yes';
- $this->values['pci_id'] = '';
- $this->values['model'] = '[permanently deleted] '.$record['model'];
-
- return parent::update($clean['id']);
- }
-
- public function pUpdate($id)
- {
- if (isset($this->values['approved']))
- {
- if (strcmp($this->values['approved'],'yes') === 0)
- {
- $this->values['deleted'] = 'no';
- }
- }
- else if (isset($this->values['deleted']))
- {
- if (strcmp($this->values['deleted'],'no') === 0)
- {
- $this->values['approved'] = 'yes';
- }
- }
- return parent::update($id);
- }
-
- 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');
-
- if ($this->values['created_by'] === 0)
- {
- $this->values['deleted'] = 'yes';
- $this->values['approved'] = 'no';
- }
-
- //random ID
- $randomId = md5(uniqid(mt_rand(),true));
- $this->values["type"] = $randomId;
-
- parent::insert();
-// echo $this->getQuery();
- //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']);
-
- //update the history table
- $this->updateHistory('insert');
-
- if ($this->values['created_by'] !== 0)
- {
- $this->associate($clean['id']);
- }
- }
-
- }
-
- public function update($id = null, $where = null)
- {
- $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.',vendor,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;
- $revisions->sanitize();
-
- if ($revisions->insert())
- {
- parent::update($clean['id']);
- if ($this->queryResult)
- {
- $this->lastId = $clean['id'];
-
- //update the history table
- $this->updateHistory('update');
-
- 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.',vendor,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.',vendor,created_by,updated_by,update_date,type');
-
- if (count($newStruct > 0))
- {
- $revisions->values = $oldStruct[0]['hardware'];
- $revisions->sanitize();
-
- $this->values = $newStruct[0]['revisions'];
- $this->values['updated_by'] = (int)$this->id_user;
- $this->values['update_date'] = date('Y-m-d H:i:s');
-
- $this->sanitize();
-
- if ($revisions->insert())
- {
- if (parent::update($clean['id_hard']))
- {
- $this->lastId = $clean['id_hard'];
-
- //update the history table
- $this->updateHistory('update');
-
- 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 = null, $idGroup = null)
- {
- 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;
- }
-
- //get the model info by the vendorid:productid code
- public function getModelByCode($code)
- {
- $res = $this->clear()->where(array('pci_id'=>sanitizePciid($code)))->send();
-
- if (count($res) > 0)
- {
- return $res[0]['hardware'];
- }
- return false;
- }
-
- //save in the history all the action carried out by users
- protected function updateHistory($action)
- {
- $translations = array(
- 'insert' => 'inserted',
- 'update' => 'updated',
- );
-
- $allowedActions = array('insert','update');
-
- if (in_array($action,$allowedActions))
- {
- $users = new UsersModel();
-
- $clean['user'] = sanitizeAll($users->getUser($this->id_user));
-
- $history = new HistoryModel();
- $history->values = array(
- 'created_by' => $this->id_user,
- 'type' => 'hardware',
- 'action' => $action,
- 'id' => $this->lastId,
- 'message' => 'The device having id='.$this->lastId.' has been '.$translations[$action].' by the user ' . $clean['user'] . ' (id_user='.$this->id_user.') ',
- 'gr' => 'registered',
- );
- $history->insert();
- }
- }
-
- public function isDeleted($id)
- {
- $clean['id'] = (int)$id;
- $res = $this->select('hardware.deleted')->where(array('id_hard'=>$clean['id']))->send();
- if ( count($res) > 0 )
- {
- return strcmp($res[0]['hardware']['deleted'],'no') === 0 ? false : true;
- }
- return false;
- }
-
- public function isCleared($id)
- {
- $clean['id'] = (int)$id;
- $res = $this->select('hardware.cleared')->where(array('id_hard'=>$clean['id']))->send();
- if ( count($res) > 0 )
- {
- return strcmp($res[0]['hardware']['cleared'],'no') === 0 ? false : true;
- }
- return false;
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Models/HistoryModel.php b/h-source/Application/Models/HistoryModel.php
deleted file mode 100644
index d94f745..0000000
--- a/h-source/Application/Models/HistoryModel.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. 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->_where=array(
- 'approved' => 'hardware',
- 'deleted' => 'hardware',
- 'cleared' => 'hardware',
- 'username' => 'regusers',
- );
- $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/HostcontrollersModel.php b/h-source/Application/Models/HostcontrollersModel.php
deleted file mode 100644
index 8908052..0000000
--- a/h-source/Application/Models/HostcontrollersModel.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class HostcontrollersModel extends GenericModel
-{
-
- public $type = 'host-controller'; //device type
-
- public function __construct()
- {
-
- $this->_popupItemNames = array(
- 'vendor' => 'vendor',
- 'comm_year' => 'comm_year',
- 'compatibility' => 'compatibility',
- 'subtype' => 'subtype',
- );
-
- $this->_popupLabels = array(
- 'vendor' => gtext("vendor"),
- 'comm_year' => gtext("year"),
- 'compatibility' => gtext("does it work?"),
- 'subtype' => gtext("subtype"),
- );
-
- $this->setPopupFunctions();
-
- $this->createPopupWhere('vendor,compatibility,comm_year,subtype');
-
- $this->diffFields = array(
- 'vendor' => gtext("vendor"),
- 'model' => gtext('model name'),
- 'other_names' => gtext('possible other names of the device'),
- 'subtype' => gtext('subtype')." (laser, inkjet, ..)",
- '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'),
- 'compatibility' => gtext("does it work with free software?"),
- 'driver' => gtext("free driver used"),
- 'description' => gtext('Description'),
- );
-
- $this->fieldsWithBreaks = array(gtext('Description'),gtext('possible other names of the device'));
-
- parent::__construct();
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Models/IssuesModel.php b/h-source/Application/Models/IssuesModel.php
deleted file mode 100644
index 9d6a4ef..0000000
--- a/h-source/Application/Models/IssuesModel.php
+++ /dev/null
@@ -1,116 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class IssuesModel extends BaseModel {
-
- 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 function pUpdate($id)
- {
- return parent::update($id);
- }
-
- public function insert()
- {
- if (parent::insert())
- {
- //update the history
- $this->updateHistory('issue_ins');
- }
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Models/MessagesModel.php b/h-source/Application/Models/MessagesModel.php
deleted file mode 100644
index b36e76e..0000000
--- a/h-source/Application/Models/MessagesModel.php
+++ /dev/null
@@ -1,73 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class MessagesModel extends BaseModel {
-
- 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 function pUpdate($id)
- {
- return parent::update($id);
- }
-
- public function insert()
- {
- if (parent::insert())
- {
- //update the history
- $this->updateHistory('message_ins');
- }
- }
-
- 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/ModemsModel.php b/h-source/Application/Models/ModemsModel.php
deleted file mode 100644
index 92571d2..0000000
--- a/h-source/Application/Models/ModemsModel.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class ModemsModel extends GenericModel
-{
-
- public $type = 'modem'; //device type
-
- public function __construct()
- {
-
- $this->_popupItemNames = array(
- 'vendor' => 'vendor',
- 'comm_year' => 'comm_year',
- 'compatibility' => 'compatibility',
- 'interface' => 'interface',
- );
-
- $this->_popupLabels = array(
- 'vendor' => gtext("vendor"),
- 'comm_year' => gtext("year"),
- 'compatibility' => gtext("does it work?"),
- 'interface' => gtext("interface"),
- );
-
- $this->setPopupFunctions();
-
- $this->createPopupWhere('vendor,compatibility,comm_year,interface');
-
- $this->diffFields = array(
- 'vendor' => gtext("vendor"),
- 'model' => gtext('model name'),
- 'other_names' => gtext('possible other names of the device'),
- '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'),
- 'compatibility' => gtext("does it work with free software?"),
- 'driver' => gtext("free driver used"),
- 'description' => gtext('Description'),
- );
-
- $this->fieldsWithBreaks = array(gtext('Description'),gtext('possible other names of the device'));
-
- parent::__construct();
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Models/NewsModel.php b/h-source/Application/Models/NewsModel.php
deleted file mode 100644
index cab1641..0000000
--- a/h-source/Application/Models/NewsModel.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. 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
deleted file mode 100644
index d9b9008..0000000
--- a/h-source/Application/Models/NotebooksModel.php
+++ /dev/null
@@ -1,94 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class NotebooksModel extends GenericModel {
-
- 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->setPopupFunctions();
-
- $this->createPopupWhere('vendor,compatibility,comm_year,subtype');
-
- $this->diffFields = array(
- 'vendor' => gtext("vendor"),
- 'model' => gtext('model name'),
- 'subtype' => gtext('subtype (notebook or netbook)'),
- 'architecture' => gtext('architecture'),
- 'bios' => gtext('does it have a free bios?'),
- 'can_free_systems_be_installed' => gtext('can free operating systems be installed?'),
- 'prevent_wifi' => gtext('does the device prevent the installation of wifi cards not-approved by the vendor?'),
- '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?'),
- 'webcam_type' => gtext('webcam model'),
- 'webcam_works' => gtext('does the webcam work?'),
- 'description' => gtext('Description'),
- );
-
- $this->fieldsWithBreaks = array(gtext('Description'));
-
- parent::__construct();
- }
-
- public function morePopups()
- {
- $this->_popupItemNames = array(
- 'bios' => 'bios',
- 'architecture' => 'architecture',
- );
-
- $this->_popupLabels = array(
- 'bios' => gtext("free boot firmware?"),
- 'architecture' => gtext("architecture"),
- );
-
- $this->_popupFunctions = array(
- 'architecture' => 'translate_and_gtext',
- 'bios' => 'translate_and_gtext',
- );
-
- $this->createPopupWhere('bios,architecture');
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Models/ParamsModel.php b/h-source/Application/Models/ParamsModel.php
deleted file mode 100644
index cea99a1..0000000
--- a/h-source/Application/Models/ParamsModel.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. 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
deleted file mode 100644
index 355bb67..0000000
--- a/h-source/Application/Models/PrintersModel.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class PrintersModel extends GenericModel
-{
-
- 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->setPopupFunctions();
-
- $this->createPopupWhere('vendor,compatibility,comm_year,interface');
-
- $this->diffFields = array(
- 'vendor' => gtext("vendor"),
- 'model' => gtext('model name'),
- 'other_names' => gtext('possible other names of the device'),
- 'subtype' => gtext('subtype')." (laser, inkjet, ..)",
- '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'),
- 'it_tracks_users' => gtext('does it adopt any techniques to track users?'),
- 'kernel' => gtext('tested with the following kernel libre'),
- 'driver' => gtext("free driver used"),
- 'description' => gtext('Description'),
- );
-
- $this->fieldsWithBreaks = array(gtext('Description'),gtext('possible other names of the device'));
-
- parent::__construct();
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Models/ProfileModel.php b/h-source/Application/Models/ProfileModel.php
deleted file mode 100644
index c8818b4..0000000
--- a/h-source/Application/Models/ProfileModel.php
+++ /dev/null
@@ -1,78 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. 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",
- "+checkIsStrings|no,yes" => "send_notification"
- );
-
- 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?'
- ),
- 'send_notification' => array(
- 'type' => 'Select',
- 'options' => 'yes,no',
- 'labelString'=> 'Would you like to receive mail notifications?'
- ),
- '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/RaidadaptersModel.php b/h-source/Application/Models/RaidadaptersModel.php
deleted file mode 100644
index 2e140e8..0000000
--- a/h-source/Application/Models/RaidadaptersModel.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class RaidadaptersModel extends GenericModel
-{
-
- public $type = 'RAID-adapter'; //device type
-
- public function __construct()
- {
-
- $this->_popupItemNames = array(
- 'vendor' => 'vendor',
- 'comm_year' => 'comm_year',
- 'compatibility' => 'compatibility',
- 'interface' => 'interface',
- );
-
- $this->_popupLabels = array(
- 'vendor' => gtext("vendor"),
- 'comm_year' => gtext("year"),
- 'compatibility' => gtext("does it work?"),
- 'interface' => gtext("interface"),
- );
-
- $this->setPopupFunctions();
-
- $this->createPopupWhere('vendor,compatibility,comm_year,interface');
-
- $this->diffFields = array(
- 'vendor' => gtext("vendor"),
- 'model' => gtext('model name'),
- 'other_names' => gtext('possible other names of the device'),
- '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'),
- 'compatibility' => gtext("does it work with free software?"),
- 'driver' => gtext("free driver used"),
- 'description' => gtext('Description'),
- );
-
- $this->fieldsWithBreaks = array(gtext('Description'),gtext('possible other names of the device'));
-
- parent::__construct();
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Models/RevisionsModel.php b/h-source/Application/Models/RevisionsModel.php
deleted file mode 100644
index fd56db7..0000000
--- a/h-source/Application/Models/RevisionsModel.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. 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
deleted file mode 100644
index 4710503..0000000
--- a/h-source/Application/Models/ScannersModel.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class ScannersModel extends GenericModel
-{
-
- 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->createPopupWhere('vendor,compatibility,comm_year,interface');
-
- $this->setPopupFunctions();
-
- $this->diffFields = array(
- 'vendor' => gtext("vendor"),
- 'model' => gtext('model name'),
- 'other_names' => gtext('possible other names of the device'),
- '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'),gtext('possible other names of the device'));
-
- parent::__construct();
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Models/SdcardreadersModel.php b/h-source/Application/Models/SdcardreadersModel.php
deleted file mode 100644
index 85950a5..0000000
--- a/h-source/Application/Models/SdcardreadersModel.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class SdcardreadersModel extends GenericModel
-{
-
- public $type = 'sd-card-reader'; //device type
-
- public function __construct()
- {
-
- $this->_popupItemNames = array(
- 'vendor' => 'vendor',
- 'comm_year' => 'comm_year',
- 'sd_card_works' => 'sd_card_works',
- 'interface' => 'interface',
- );
-
- $this->_popupLabels = array(
- 'vendor' => gtext("vendor"),
- 'comm_year' => gtext("year"),
- 'sd_card_works' => gtext("does it work?"),
- 'interface' => gtext("interface"),
- );
-
- $this->setPopupFunctions();
-
- $this->createPopupWhere('vendor,sd_card_works,comm_year,interface');
-
- $this->diffFields = array(
- 'vendor' => gtext("vendor"),
- 'model' => gtext('model name'),
- 'other_names' => gtext('possible other names of the device'),
- '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'),
- 'sd_card_works' => gtext("does it work with free software?"),
- 'driver' => gtext("free driver used"),
- 'description' => gtext('Description'),
- );
-
- $this->fieldsWithBreaks = array(gtext('Description'),gtext('possible other names of the device'));
-
- parent::__construct();
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Models/SoundcardsModel.php b/h-source/Application/Models/SoundcardsModel.php
deleted file mode 100644
index 7137d79..0000000
--- a/h-source/Application/Models/SoundcardsModel.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class SoundcardsModel extends GenericModel
-{
-
- public $type = 'soundcard'; //device type
-
- public function __construct()
- {
-
- $this->_popupItemNames = array(
- 'vendor' => 'vendor',
- 'comm_year' => 'comm_year',
- 'sound_card_works' => 'sound_card_works',
- 'interface' => 'interface',
- );
-
- $this->_popupLabels = array(
- 'vendor' => gtext("vendor"),
- 'comm_year' => gtext("year"),
- 'sound_card_works' => gtext("does it work?"),
- 'interface' => gtext("interface"),
- );
-
- $this->setPopupFunctions();
-
- $this->createPopupWhere('vendor,sound_card_works,comm_year,interface');
-
- $this->diffFields = array(
- 'vendor' => gtext("vendor"),
- 'model' => gtext('model name'),
- 'other_names' => gtext('possible other names of the device'),
- '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'),
- 'sound_card_works' => gtext("does it work with free software?"),
- 'driver' => gtext("free driver used"),
- 'description' => gtext('Description'),
- );
-
- $this->fieldsWithBreaks = array(gtext('Description'),gtext('possible other names of the device'));
-
- parent::__construct();
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Models/TalkModel.php b/h-source/Application/Models/TalkModel.php
deleted file mode 100644
index 1d15ab7..0000000
--- a/h-source/Application/Models/TalkModel.php
+++ /dev/null
@@ -1,116 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class TalkModel extends BaseModel {
-
- public function __construct() {
- $this->_tables = 'talk';
- $this->_idFields = 'id_talk';
-
- $this->_where=array(
- 'id_hard' => 'talk',
- 'has_confirmed' => 'regusers',
- '-deleted' => 'regusers',
- );
-
- $this->orderBy = 'talk.id_talk desc';
-
- $this->strongConditions['insert'] = array(
- "checkLength|99" => 'title',
- "+checkNotEmpty" => 'message',
- "++checkLength|5000" => 'message',
- );
-
- parent::__construct();
- }
-
- public function pUpdate($id)
- {
- return parent::update($id);
- }
-
- public function insert()
- {
- if (parent::insert())
- {
- //update the history
- $this->updateHistory('talk_ins');
-
- if (strcmp($this->values['id_hard'],0) !== 0)
- {
- $clean['id_hard'] = (int)$this->values['id_hard'];
- $clean['created_by'] = (int)$this->values['created_by'];
-
- $hard = new HardwareModel();
- $users = $hard->select('username,e_mail')
- ->where(array('id_hard'=>$clean['id_hard'],'has_confirmed'=>0,'deleted'=>'no'))
- ->toList('regusers.username','regusers.e_mail')
- ->send('Boxes');
-
- $talkUsers = $this->select('username,e_mail')
- ->from('talk inner join regusers')
- ->on('talk.created_by = regusers.id_user')
- ->where(array('id_hard'=>$clean['id_hard'],'has_confirmed'=>0,'-deleted'=>'no'))
- ->toList('regusers.username','regusers.e_mail')
- ->send();
-
- $allUsers = array_merge($users,$talkUsers);
-
- $userObj = new UsersModel();
- $myName = $userObj->getUser($clean['created_by']);
-
- $arrayE = new ArrayExt();
- $fusers = $arrayE->subsetComplementary($allUsers,$myName);
-
- //remove users that do not want the email notification
- $inString = "'".implode("','",array_keys($fusers))."'";
- $profile = new ProfileModel();
- $ffusers = $profile->select('username,e_mail')
- ->from('regusers inner join profile')
- ->on('regusers.id_user = profile.created_by')
- ->where(array('send_notification'=>'yes','username'=>"in($inString)"))
- ->toList('regusers.username','regusers.e_mail')
- ->send();
-
- $ffusers = array_flip($ffusers);
-
- //send the notice
- Account::sendTalkNotice($myName,$ffusers,$clean['id_hard']);
-
- $domainName = rtrim(Url::getRoot(),"/");
- header('Refresh: 0;url='.$domainName.$_SERVER['REQUEST_URI']);
- exit;
- }
- }
- }
-
- 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/ThreegcardsModel.php b/h-source/Application/Models/ThreegcardsModel.php
deleted file mode 100644
index 88ae580..0000000
--- a/h-source/Application/Models/ThreegcardsModel.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class ThreegcardsModel extends GenericModel
-{
-
- public $type = '3G-card'; //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->setPopupFunctions();
-
- $this->createPopupWhere('vendor,wifi_works,comm_year,interface');
-
- $this->diffFields = array(
- 'vendor' => gtext("vendor"),
- 'model' => gtext('model name'),
- 'other_names' => gtext('possible other names of the device'),
- '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?"),
- 'driver' => gtext("free driver used"),
- 'description' => gtext('Description'),
- );
-
- $this->fieldsWithBreaks = array(gtext('Description'),gtext('possible other names of the device'));
-
- parent::__construct();
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Models/UsersModel.php b/h-source/Application/Models/UsersModel.php
deleted file mode 100755
index e666e36..0000000
--- a/h-source/Application/Models/UsersModel.php
+++ /dev/null
@@ -1,295 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. 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 pUpdate($id)
- {
- return parent::update($id);
- }
-
- 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 "<i>__anonymous__</i>";
- }
- }
- }
-
- public function getLinkToUser($user)
- {
- if (strstr($user,'__'))
- {
- return $user;
-// return str_replace('__',null,$user);
- }
- else
- {
- return "<a href='".Url::getRoot()."meet/user/".Lang::$current."/$user'>$user</a>";
- }
- }
-
- public function getLinkToUserFromId($id_user = 0)
- {
- $clean['id_user'] = (int)$id_user;
- return $this->getLinkToUser($this->getUser($clean['id_user']));
- }
-
- //check if the user exists
- public function userExists($user)
- {
- $clean['user'] = ctype_alnum($user) ? sanitizeAll($user) : '';
-
- if (strcmp($clean['user'],'') !== 0)
- {
- $res = $this->where(array("username"=>$clean['user'],"has_confirmed"=>"0","deleted"=>"no"))->send();
-// $res = $this->db->select('regusers','has_confirmed','username="'.$clean['user'].'" and has_confirmed=0 and deleted="no"');
-
- if (count($res) > 0)
- {
- return true;
- }
- }
- return false;
- }
-
- //get the user id from the username
- public function getUserId($username = '')
- {
- $clean['username'] = ctype_alnum($username) ? sanitizeAll($username) : '';
-
- $users = $this->select('id_user')->where(array('username'=>$clean['username'],'has_confirmed'=>0,'deleted'=>'no'))->send();
- if (count($users) > 0)
- {
- return $users[0]['regusers']['id_user'];
- }
- else
- {
- return 0;
- }
- }
-
- public function isBlocked($idUser)
- {
- $clean['id_user'] = (int)$idUser;
-
- $res = $this->select('blocked')->where(array('id_user'=>$clean['id_user'],'has_confirmed'=>0,'deleted'=>'no'))->toList('blocked')->send();
-
- if (count($res) > 0)
- {
- return strcmp($res[0],'yes') === 0 ? true : false;
- }
-
- return true;
- }
-
- 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/VendorsModel.php b/h-source/Application/Models/VendorsModel.php
deleted file mode 100644
index 0b06d52..0000000
--- a/h-source/Application/Models/VendorsModel.php
+++ /dev/null
@@ -1,82 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class VendorsModel extends Model_Tree {
-
- public function __construct() {
- $this->_tables = 'vendors';
- $this->_idFields = 'id_vendor';
-
- parent::__construct();
- }
-
- public function check($id,$interface = 'USB')
- {
- if (preg_match('/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/',$id))
- {
- $clean['bus'] = strcmp($interface,'USB') === 0 ? "USB" : "PCI";
-
- $temp = explode(':',$id);
- $clean['vendorId'] = sanitizeAlphanum($temp[0]);
-
- $number = $this->clear()->where(array("vendorid" => $clean['vendorId'], "bus" => $clean['bus']))->rowNumber();
-
- if ($number > 0)
- {
- return true;
- }
- }
- return false;
- }
-
- public function getName($id,$interface)
- {
- if ($this->check($id,$interface))
- {
- $clean['bus'] = strcmp($interface,'USB') === 0 ? "USB" : "PCI";
-
- $temp = explode(':',$id);
- $clean['vendorId'] = sanitizeAlphanum($temp[0]);
-
- $res = $this->clear()->where(array("vendorid" => $clean['vendorId'], "bus" => $clean['bus']))->send();
-
- if (count($res) > 0)
- {
- return $res[0]['vendors']['clean_name'];
- }
- }
- return 'not-known';
- }
-
- public function getFullName($name)
- {
- $clean['name'] = sanitizeAll($name);
-
- $res = $this->clear()->where(array("clean_name" => $clean['name']))->send();
-
- if (count($res) > 0)
- {
- return $res[0]['vendors']['full_name'];
- }
- return $clean['name'];
- }
-} \ No newline at end of file
diff --git a/h-source/Application/Models/VideocardsModel.php b/h-source/Application/Models/VideocardsModel.php
deleted file mode 100644
index 961340e..0000000
--- a/h-source/Application/Models/VideocardsModel.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class VideocardsModel extends GenericModel
-{
-
- public $type = 'videocard'; //device type
-
- public function __construct()
- {
-
- $this->_popupItemNames = array(
- 'vendor' => 'vendor',
- 'comm_year' => 'comm_year',
- 'video_card_works' => 'video_card_works',
- 'interface' => 'interface',
- );
-
- $this->_popupLabels = array(
- 'vendor' => gtext("vendor"),
- 'comm_year' => gtext("year"),
- 'video_card_works' => gtext("does it work?"),
- 'interface' => gtext("interface"),
- );
-
- $this->createPopupWhere('vendor,video_card_works,comm_year,interface');
-
- $this->setPopupFunctions();
-
- $this->diffFields = array(
- 'vendor' => gtext("vendor"),
- 'model' => gtext('model name'),
- 'other_names' => gtext('possible other names of the device'),
- '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?"),
- 'driver' => gtext("free driver used"),
- 'description' => gtext('Description'),
- );
-
- $this->fieldsWithBreaks = array(gtext('Description'),gtext('possible other names of the device'));
-
- parent::__construct();
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Models/WebcamsModel.php b/h-source/Application/Models/WebcamsModel.php
deleted file mode 100644
index 0942bcb..0000000
--- a/h-source/Application/Models/WebcamsModel.php
+++ /dev/null
@@ -1,72 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class WebcamsModel extends GenericModel
-{
-
- public $type = 'webcam'; //device type
-
- public function __construct()
- {
-
- $this->_popupItemNames = array(
- 'vendor' => 'vendor',
- 'comm_year' => 'comm_year',
- 'webcam_works' => 'webcam_works',
- 'interface' => 'interface',
- );
-
- $this->_popupLabels = array(
- 'vendor' => gtext("vendor"),
- 'comm_year' => gtext("year"),
- 'webcam_works' => gtext("does it work?"),
- 'interface' => gtext("interface"),
- );
-
- $this->_popupFunctions = array(
- 'vendor' => 'betterVendor',
- );
-
- $this->createPopupWhere('vendor,webcam_works,comm_year,interface');
-
- $this->setPopupFunctions();
-
- $this->diffFields = array(
- 'vendor' => gtext("vendor"),
- 'model' => gtext('model name'),
- 'other_names' => gtext('possible other names of the device'),
- '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'),
- 'webcam_works' => gtext("does it work with free software?"),
- 'driver' => gtext("free driver used"),
- 'description' => gtext('Description'),
- );
-
- $this->fieldsWithBreaks = array(gtext('Description'),gtext('possible other names of the device'));
-
- parent::__construct();
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Models/WifiModel.php b/h-source/Application/Models/WifiModel.php
deleted file mode 100644
index 0b6d6c2..0000000
--- a/h-source/Application/Models/WifiModel.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class WifiModel extends GenericModel
-{
-
- 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->setPopupFunctions();
-
- $this->createPopupWhere('vendor,wifi_works,comm_year,interface');
-
- $this->diffFields = array(
- 'vendor' => gtext("vendor"),
- 'model' => gtext('model name'),
- 'other_names' => gtext('possible other names of the device'),
- '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?"),
- 'driver' => gtext("free driver used"),
- 'description' => gtext('Description'),
- );
-
- $this->fieldsWithBreaks = array(gtext('Description'),gtext('possible other names of the device'));
-
- parent::__construct();
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Models/WikiModel.php b/h-source/Application/Models/WikiModel.php
deleted file mode 100644
index bb60b66..0000000
--- a/h-source/Application/Models/WikiModel.php
+++ /dev/null
@@ -1,319 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class WikiModel extends Model_Map {
-
- public $id_user = 0;
- public $lastId = 0; //the id of the last record inserted
- public $lastTitle = null; //the title of the last page inserted
- public $lastTitleClean = null; //the cleaned title of the last page inserted
-
- public $diffFields = array();
- public $fieldsWithBreaks = array();
-
- public function __construct() {
- $this->_tables='wiki,regusers,wiki_users';
- $this->_idFields='id_wiki,id_user';
- $this->_where=array(
- 'username' => 'regusers',
- 'id_user' => 'regusers',
- 'has_confirmed' => 'regusers',
- 'deleted' => 'regusers',
- '-deleted' => 'wiki',
- '-blocked' => 'wiki',
- );
-
- $this->printAssError = "no";
-
- $this->diffFields = array(
- 'title' => gtext("the title"),
- 'page' => gtext('the text of the wiki page'),
- );
-
- $this->fieldsWithBreaks = array(gtext('the text of the wiki page'));
-
- $this->strongConditions['insert'] = array(
- "checkNotEmpty" => 'title',
- "checkLength|99" => 'title|'.gtext('title is too long'),
- "+checkNotEmpty" => 'page',
- "+checkLength|49900" => 'page|'.gtext('the page text is too long'),
- );
-
- $this->strongConditions['update'] = array(
- "checkNotEmpty" => 'title',
- "checkLength|99" => 'title|'.gtext('title is too long'),
- "+checkNotEmpty" => 'page',
- "+checkLength|49900" => 'page|'.gtext('the page text is too long'),
- );
-
- $this->databaseConditions['insert'] = array(
- "checkUnique" => 'title|'.gtext('a page with the same title already exists'),
- );
-
- $this->databaseConditions['update'] = array(
- "checkUniqueCompl" => 'title|'.gtext('a page with the same title already exists'),
- );
-
- parent::__construct();
- }
-
- public function pUpdate($id)
- {
- return parent::update($id);
- }
-
- public function insert()
- {
- $this->values['created_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["title_clean"] = $randomId;
-
- parent::insert();
-
- //associate the user to the record
- if ($this->queryResult)
- {
- $resId = $this->select()->where(array('title_clean'=>$randomId))->send();
- $clean['id'] = $resId[0]['wiki']['id_wiki'];
- $this->lastId = $clean['id'];
- $this->lastTitle = $resId[0]['wiki']['title'];
- $this->lastTitleClean = titleForRedirect($resId[0]['wiki']['title']);
- $this->db->update('wiki','title_clean',array(encodeUrl(sanitizeDb($resId[0]['wiki']['title']))),'id_wiki='.$clean['id']);
-
- //update the history table
- $this->updateHistory('insert');
-
- $this->associate($clean['id']);
- }
-
- }
-
- public function update($id = null, $where = null)
- {
- $clean['id'] = (int)$id;
-
- $this->values['created_by'] = (int)$this->id_user;
- $this->values['update_date'] = date('Y-m-d H:i:s');
- $this->values['title_clean'] = encodeUrl($this->values['title']);
-
- //save the old fields in the revisions table
- $this->setWhereQueryClause(array('id_wiki' => $clean['id']));
- $oldStruct = $this->getFields($this->fields.',title_clean,created_by,update_date,id_wiki');
-
- if (count($oldStruct > 0))
- {
- $oldValues = $oldStruct[0]['wiki'];
-
- $revisions = new WikirevisionsModel();
- $revisions->values = $oldValues;
-
- $revisions->sanitize();
-
- if ($revisions->insert())
- {
-
- if ($this->isMain($clean['id']))
- {
- $this->values['title'] = 'Main Page';
- $this->values['title_clean'] = 'Main-Page';
- }
-
- parent::update($clean['id']);
- if ($this->queryResult)
- {
- $this->lastId = $clean['id'];
- $this->lastTitle = $this->values['title'];
- $this->lastTitleClean = html_entity_decode($this->values['title_clean'],ENT_QUOTES,DEFAULT_CHARSET);
-
- //update the history table
- $this->updateHistory('update');
-
- 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 WikirevisionsModel();
-
- $clean['id_wiki'] = (int)$revisions->getIdPage($clean['id_rev']);
-
- //save the old fields in the revisions table
- $this->where(array('id_wiki'=>$clean['id_wiki']));
- $oldStruct = $this->getFields($this->fields.',title_clean,created_by,update_date,id_wiki');
-
- if (count($oldStruct > 0))
- {
- //get the values of the revision
- $revisions->where(array('id_rev'=>$clean['id_rev']));
- $newStruct = $revisions->getFields($this->fields.',title_clean,created_by,update_date');
-
- if (count($newStruct > 0))
- {
- $revisions->values = $oldStruct[0]['wiki'];
- $revisions->sanitize();
-
- $this->values = $newStruct[0]['wiki_revisions'];
- $this->values['created_by'] = (int)$this->id_user;
- $this->values['update_date'] = date('Y-m-d H:i:s');
-
- $this->sanitize();
-
- if ($this->isMain($clean['id_wiki']))
- {
- $this->values['title'] = 'Main Page';
- $this->values['title_clean'] = 'Main-Page';
- }
-
- if ($revisions->insert())
- {
- if (parent::update($clean['id_wiki']))
- {
- $this->lastId = $clean['id_wiki'];
- $this->lastTitle = $this->values['title'];
- $this->lastTitleClean = html_entity_decode($this->values['title_clean'],ENT_QUOTES,DEFAULT_CHARSET);
-
- //update the history table
- $this->updateHistory('update');
-
- if (!$this->checkAssociation($clean['id_wiki'],(int)$this->id_user))
- {
- $this->associate($clean['id_wiki']);
- }
- }
- }
- }
- }
-
- }
-
- public function associate($id_record = null, $idGroup = null)
- {
- return parent::associate((int)$id_record,(int)$this->id_user);
- }
-
- //get the model name
- public function getTheModelName($id, $cleaned = false)
- {
- $clean['id'] = (int)$id;
- $this->setWhereQueryClause(array('id_wiki' => $clean['id']));
- $res = $this->getFields('title,title_clean');
- $name = '';
- if (count($res) > 0)
- {
- if ($cleaned)
- {
- $name = $res[0]['wiki']['title_clean'];
- }
- else
- {
- $name = $res[0]['wiki']['title'];
- }
- }
- return $name;
- }
-
- //save in the history all the action carried out by users
- protected function updateHistory($action)
- {
- $translations = array(
- 'insert' => 'inserted',
- 'update' => 'updated',
- );
-
- $allowedActions = array('insert','update');
-
- if (in_array($action,$allowedActions))
- {
- $users = new UsersModel();
-
- $clean['user'] = sanitizeAll($users->getUser($this->id_user));
-
- $history = new HistoryModel();
- $history->values = array(
- 'created_by' => $this->id_user,
- 'type' => 'wiki',
- 'action' => $action,
- 'id' => $this->lastId,
- 'message' => 'The wiki page having id='.$this->lastId.' has been '.$translations[$action].' by the user ' . $clean['user'] . ' (id_user='.$this->id_user.') ',
- 'gr' => 'registered',
- );
- $history->insert();
- }
- }
-
- public function isMain($id)
- {
- $clean['id'] = (int)$id;
- $res = $this->select('is_main')->where(array('id_wiki'=>$clean['id']))->send();
- if ( count($res) > 0 )
- {
- return strcmp($res[0]['wiki']['is_main'],'no') === 0 ? false : true;
- }
- return false;
- }
-
- public function isDeleted($id)
- {
- $clean['id'] = (int)$id;
- $res = $this->select('wiki.deleted')->where(array('id_wiki'=>$clean['id']))->send();
- if ( count($res) > 0 )
- {
- return strcmp($res[0]['wiki']['deleted'],'no') === 0 ? false : true;
- }
- return false;
- }
-
- public function isBlocked($id)
- {
- $clean['id'] = (int)$id;
- $res = $this->select('blocked')->where(array('id_wiki'=>$clean['id']))->send();
- if ( count($res) > 0 )
- {
- return strcmp($res[0]['wiki']['blocked'],'no') === 0 ? false : true;
- }
- return false;
- }
-
- public function toWikiPage($id)
- {
- $clean['id'] = (int)$id;
- $title = $this->getTheModelName($clean['id'], true);
- return Url::getRoot()."wiki/page/".Lang::$current."/".$title;
- }
-
- public function getDiffArray($oldArray, $newArray)
- {
- return getDiffArray($this->diffFields, $oldArray, $newArray);
- }
-} \ No newline at end of file
diff --git a/h-source/Application/Models/WikirevisionsModel.php b/h-source/Application/Models/WikirevisionsModel.php
deleted file mode 100644
index fdf5558..0000000
--- a/h-source/Application/Models/WikirevisionsModel.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class WikirevisionsModel extends Model_Tree {
-
- public $id_user = 0;
-
- public function __construct() {
- $this->_tables='wiki_revisions';
- $this->_idFields='id_rev';
-
- $this->orderBy = 'id_rev desc';
-
- parent::__construct();
- }
-
- public function getIdPage($id_rev = 0)
- {
- $clean['id_rev'] = (int)$id_rev;
-
- $res = $this->db->select('wiki_revisions','id_wiki','id_rev='.$clean['id_rev']);
-
- return (count($res) > 0) ? $res[0]['wiki_revisions']['id_wiki'] : 0;
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Models/WikitalkModel.php b/h-source/Application/Models/WikitalkModel.php
deleted file mode 100644
index 7dee896..0000000
--- a/h-source/Application/Models/WikitalkModel.php
+++ /dev/null
@@ -1,112 +0,0 @@
-<?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 file is part of h-source
-//
-// h-source 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.
-//
-// h-source 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 h-source. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-class WikitalkModel extends BaseModel
-{
-
- public function __construct() {
- $this->_tables = 'wiki_talk';
- $this->_idFields = 'id_talk';
-
- $this->_where=array(
- 'id_wiki' => 'wiki_talk',
- 'has_confirmed' => 'regusers',
- '-deleted' => 'regusers',
- );
-
- $this->orderBy = 'wiki_talk.id_talk';
-
- $this->strongConditions['insert'] = array(
- "checkLength|99" => 'title',
- "+checkLength|5000" => 'message',
- );
-
- parent::__construct();
- }
-
- public function pUpdate($id)
- {
- return parent::update($id);
- }
-
- public function insert()
- {
- if (parent::insert())
- {
- //update the history
- $this->updateHistory('wiki_talk_ins');
-
- $clean['id_wiki'] = (int)$this->values['id_wiki'];
- $clean['created_by'] = (int)$this->values['created_by'];
-
- $hard = new WikiModel();
- $users = $hard->select('username,e_mail')
- ->where(array('id_wiki'=>$clean['id_wiki'],'has_confirmed'=>0,'deleted'=>'no'))
- ->toList('regusers.username','regusers.e_mail')
- ->send('Boxes');
-
- $talkUsers = $this->select('username,e_mail')
- ->inner('regusers')
- ->on('wiki_talk.created_by = regusers.id_user')
- ->where(array('id_wiki'=>$clean['id_wiki'],'has_confirmed'=>0,'-deleted'=>'no'))
- ->toList('regusers.username','regusers.e_mail')
- ->send();
-
- $allUsers = array_merge($users,$talkUsers);
-
- $userObj = new UsersModel();
- $myName = $userObj->getUser($clean['created_by']);
-
- $arrayE = new ArrayExt();
- $fusers = $arrayE->subsetComplementary($allUsers,$myName);
-
- //remove users that do not want the email notification
- $inString = "'".implode("','",array_keys($fusers))."'";
- $profile = new ProfileModel();
- $ffusers = $profile->select('username,e_mail')
- ->from('regusers inner join profile')
- ->on('regusers.id_user = profile.created_by')
- ->where(array('send_notification'=>'yes','username'=>"in($inString)"))
- ->toList('regusers.username','regusers.e_mail')
- ->send();
-
- $ffusers = array_flip($ffusers);
-
- //send the notice
- Account::sendWikiTalkNotice($myName,$ffusers,$clean['id_wiki']);
-
- header('Refresh: 0;url='.Url::getRoot()."wiki/talk/".Lang::$current."/".$clean['id_wiki']);
- exit;
- }
- }
-
- public $formStruct = array(
- 'entries' => array(
- 'title' => array(),
- 'message' => array('type'=>'Textarea'),
- 'id_talk' => array(
- 'type' => 'Hidden'
- )
- ),
- );
-
-} \ No newline at end of file