aboutsummaryrefslogtreecommitdiff
path: root/h-source/Application/Controllers
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/Controllers
parent72cce24864b064b5762f4fe97fdf40d8d2ad4b51 (diff)
parent07f5140771388c9e0c8a99b0dd2e5d950bdb173b (diff)
Merge branch 'development' into h-node
Diffstat (limited to 'h-source/Application/Controllers')
-rw-r--r--h-source/Application/Controllers/AcquisitioncardsController.php131
-rw-r--r--h-source/Application/Controllers/BaseController.php303
-rw-r--r--h-source/Application/Controllers/BluetoothController.php131
-rw-r--r--h-source/Application/Controllers/ClientController.php55
-rw-r--r--h-source/Application/Controllers/ContactController.php43
-rw-r--r--h-source/Application/Controllers/CreditsController.php43
-rw-r--r--h-source/Application/Controllers/DownloadController.php275
-rw-r--r--h-source/Application/Controllers/EthernetcardsController.php131
-rw-r--r--h-source/Application/Controllers/FaqController.php41
-rw-r--r--h-source/Application/Controllers/FingerprintreadersController.php131
-rw-r--r--h-source/Application/Controllers/GenericController.php1001
-rw-r--r--h-source/Application/Controllers/HardwareController.php43
-rw-r--r--h-source/Application/Controllers/HelpController.php41
-rw-r--r--h-source/Application/Controllers/HistoryController.php650
-rw-r--r--h-source/Application/Controllers/HomeController.php47
-rw-r--r--h-source/Application/Controllers/HostcontrollersController.php137
-rw-r--r--h-source/Application/Controllers/ImageController.php41
-rw-r--r--h-source/Application/Controllers/IssuesController.php203
-rw-r--r--h-source/Application/Controllers/MeetController.php338
-rw-r--r--h-source/Application/Controllers/ModemsController.php131
-rw-r--r--h-source/Application/Controllers/MyController.php214
-rw-r--r--h-source/Application/Controllers/NewsController.php67
-rw-r--r--h-source/Application/Controllers/NotebooksController.php159
-rw-r--r--h-source/Application/Controllers/PrintersController.php154
-rw-r--r--h-source/Application/Controllers/ProjectController.php42
-rw-r--r--h-source/Application/Controllers/RaidadaptersController.php131
-rw-r--r--h-source/Application/Controllers/RssController.php64
-rw-r--r--h-source/Application/Controllers/ScannersController.php127
-rw-r--r--h-source/Application/Controllers/SdcardreadersController.php131
-rw-r--r--h-source/Application/Controllers/SearchController.php267
-rw-r--r--h-source/Application/Controllers/SoundcardsController.php127
-rw-r--r--h-source/Application/Controllers/SpecialController.php216
-rw-r--r--h-source/Application/Controllers/ThreegcardsController.php127
-rw-r--r--h-source/Application/Controllers/UsersController.php352
-rw-r--r--h-source/Application/Controllers/VideocardsController.php127
-rw-r--r--h-source/Application/Controllers/WebcamsController.php127
-rw-r--r--h-source/Application/Controllers/WifiController.php127
-rw-r--r--h-source/Application/Controllers/WikiController.php644
38 files changed, 0 insertions, 7119 deletions
diff --git a/h-source/Application/Controllers/AcquisitioncardsController.php b/h-source/Application/Controllers/AcquisitioncardsController.php
deleted file mode 100644
index e373682..0000000
--- a/h-source/Application/Controllers/AcquisitioncardsController.php
+++ /dev/null
@@ -1,131 +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 AcquisitioncardsController extends GenericController
-{
-
- public function __construct($model, $controller, $queryString)
- {
-
- $worksOptions = Acquisitioncards::$select;
- $worksField = 'compatibility';
- $interfaceOptions = Acquisitioncards::$interface;
-
- parent::__construct($model, $controller, $queryString);
-
- //load the model
- $this->model('HardwareModel');
- $this->model('RevisionsModel');
- $this->model('AcquisitioncardsModel');
- $this->model('TalkModel');
-
- $this->mod = $this->m['AcquisitioncardsModel'];
-
- $this->m['HardwareModel']->id_user = $this->s['registered']->status['id_user'];
- $this->m['HardwareModel']->type = 'acquisition-card';
-
- $this->m['HardwareModel']->setConditions($worksOptions,$worksField,$interfaceOptions);
-
- $this->m['HardwareModel']->setFields('model,kernel,description,distribution,comm_year,compatibility,pci_id,interface,driver,other_names','sanitizeAll');
-
- $argKeys = array(
- 'page:forceNat' => 1,
- 'history_page:forceNat' => 1,
- 'vendor:sanitizeString' => 'undef',
- 'comm_year:sanitizeString' => 'undef',
- 'compatibility:sanitizeString' => 'undef',
- 'interface:sanitizeString' => 'undef',
- 'sort-by:sanitizeString' => 'compatibility-desc',
- 'search_string:sanitizeString' => 'undef'
- );
-
- $this->setArgKeys($argKeys);
-
- $data['title'] = 'Acquisition cards';
-
- $data['intefaceOptions'] = $interfaceOptions;
- $data['worksOptions'] = $worksOptions;
- $data['worksField'] = $worksField;
-
- $data['notFoundString'] = "No acquisition card found";
-
- $this->append($data);
- }
-
- public function catalogue($lang = 'en')
- {
- $this->shift(1);
-
- $whereArray = array(
- 'type' => $this->mod->type,
- 'vendor' => $this->viewArgs['vendor'],
- 'comm_year' => $this->viewArgs['comm_year'],
- 'compatibility' => $this->viewArgs['compatibility'],
- 'interface' => $this->viewArgs['interface'],
- );
-
- $this->mod->setWhereQueryClause($whereArray);
-
- parent::catalogue($lang);
- }
-
- public function view($lang = 'en', $id = 0, $name = null)
- {
- parent::view($lang, $id, $name);
- }
-
- public function history($lang = 'en', $id = 0)
- {
- parent::history($lang, $id);
- }
-
- public function revision($lang = 'en', $id_rev = 0)
- {
- parent::revision($lang, $id_rev);
- }
-
- public function insert($lang = 'en', $token = '')
- {
- parent::insert($lang, $token);
- }
-
- public function update($lang = 'en', $token = '')
- {
- parent::update($lang, $token);
- }
-
- public function differences($lang = 'en', $id_hard = 0, $id_rev = 0)
- {
- parent::differences($lang, $id_hard, $id_rev);
- }
-
- public function climb($lang = 'en', $id_rev = 0, $token = '')
- {
- parent::climb($lang, $id_rev, $token);
- }
-
- public function talk($lang = 'en', $id_hard = 0, $token = '')
- {
- parent::talk($lang, $id_hard, $token);
- }
-
-}
diff --git a/h-source/Application/Controllers/BaseController.php b/h-source/Application/Controllers/BaseController.php
deleted file mode 100644
index ac2be1f..0000000
--- a/h-source/Application/Controllers/BaseController.php
+++ /dev/null
@@ -1,303 +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 BaseController extends Controller
-{
-
- protected $lang;
- protected $islogged = 'no';
- protected $ismoderator = false;
- protected $isadmin = false;
- protected $querySanitized = true;
- protected $token = 'token';
- protected $_updating = 'no';
-
- protected $_configXml = null;
-
- protected $_topMenuClasses = array(
- "home" => null,
- "hardware" => null,
- "credits" => null,
- "issues" => null,
- "contact" => null,
- "search" => null,
- "news" => null,
- "download" => null,
- "help" => null,
- "wiki" => null,
- "faq" => null,
- "project" => null,
- );
-
- public function __construct($model, $controller, $queryString) {
- parent::__construct($model, $controller, $queryString);
-
- header("Cache-Control: no-cache");
-
- $this->model('BoxesModel');
- $this->model('HistoryModel');
- $this->model('ParamsModel');
- $this->model('UsersModel');
-
- $this->load('header');
- $this->load('footer','last');
-
- $this->session('registered');
- $this->s['registered']->checkStatus();
-
- $data['username'] = null;
- $data['user_groups'] = null;
- $data['islogged'] = 'no';
- $data['token'] = 'token';
- $data['ismoderator'] = false;
- $data['isadmin'] = false;
-
- if ($this->s['registered']->status['status'] === 'logged')
- {
- $data['username'] = $this->s['registered']->status['user'];
- $groups = $this->s['registered']->status['groups'];
- $groups[] = 'registered';
- $data['user_groups'] = implode(',',$groups);
-
- $data['islogged'] = 'yes';
- $this->islogged = $data['islogged'];
-
- $data['token'] = $this->s['registered']->status['token'];
- $this->token = $data['token'];
-
- $data['ismoderator'] = in_array('moderator',$this->s['registered']->status['groups']) ? true : false;
- $this->ismoderator = $data['ismoderator'];
-
- $data['isadmin'] = in_array('admin',$this->s['registered']->status['groups']) ? true : false;
- $this->isadmin = $data['isadmin'];
- }
-
- $data['lang'] = 'en';
- $this->lang = 'en';
-
- if (isset($this->_queryString[0]))
- {
- $lang = (strcmp($this->_queryString[0],'') !== 0) ? $this->_queryString[0] : 'en';
- $data['lang'] = Lang::sanitize($lang);
- $this->lang = $data['lang'];
- Lang::$current = $data['lang'];
- }
-
- $data['langIcon'] = Lang::getIcon(Lang::$current);
- $data['langLabel'] = Lang::getLabel(Lang::$current);
-
- //set desktop or mobile version
- Version::set();
- //subfolder of the Views folder where to look for view files
- Params::$viewSubfolder = Version::getViewSubfolder();
-
- $data['tm'] = $this->_topMenuClasses;
-
- $this->_queryString = $this->sanitizeQueryString($this->_queryString);
-
- $data['querySanitized'] = $this->querySanitized;
- $data['queryString'] = Url::createUrl($this->_queryString);
-
- //check ft they are updating the website
- $updating = $this->m['ParamsModel']->select('updating')->where(array('id_par'=>1))->toList('updating')->send();
-
- $data['updating_flag'] = 'no';
- if (count($updating)>0)
- {
- $data['updating_flag'] = $updating[0];
- $this->_updating = $data['updating_flag'];
- }
-
- //get the configuration xml
- $xmlRes = $this->m['ParamsModel']->select('boxes_xml')->where(array('id_par'=>1))->toList('boxes_xml')->send();
- if (count($xmlRes)>0)
- {
- $configXml = htmlspecialchars_decode($xmlRes[0],ENT_QUOTES);
-
- if (Website::$useXmlConfigFile)
- {
- $xmlConfigFile = rtrim(Website::$xmlConfigFileFolder,'/') . '/config.xml';
- if (@simplexml_load_file($xmlConfigFile))
- {
- $this->_configXml = simplexml_load_file($xmlConfigFile);
- }
- }
- else
- {
- if (@simplexml_load_string($configXml))
- {
- $this->_configXml = simplexml_load_string($configXml);
- }
- }
- }
-
- //elements of the top menu from the config.xml file
- //help link
- $mod = new BoxParser($this->getBox(array("top_menu","help_page_link")));
- $data["topMenuHelpLink"] = $mod->modules[0]->render($this->_topMenuClasses["help"]);
- //faq link
- $mod = new BoxParser($this->getBox(array("top_menu","faq_link")));
- $data["topMenuFaqLink"] = $mod->modules[0]->render($this->_topMenuClasses["faq"]);
-
- //link to the "discover your hardware" wiki page
- $data['discoverYourHardwareLink'] = $this->getModule(array('right_column','discover_your_hardware'));
-
- Distributions::setAllowedList();
-
- $this->append($data);
- }
-
- //get the right box from the configuration xml
- protected function getBox($xmlPath,$xmlString = null)
- {
- if (!isset($xmlString))
- {
- $xmlString = $this->_configXml;
- }
-
- if (is_array($xmlPath))
- {
- if (isset($xmlString))
- {
- $tempXml = $xmlString->{$xmlPath[0]};
- if (count($xmlPath) === 1)
- {
- if (isset($tempXml->{$this->lang}))
- {
- return $tempXml->{$this->lang}->asXml();
- }
- else if (isset($tempXml->{"en"}))
- {
- return $tempXml->{"en"}->asXml();
- }
- else
- {
- return null;
- }
- }
- else
- {
- array_shift($xmlPath);
- return $this->getBox($xmlPath,$tempXml);
- }
- }
- }
- return null;
- }
-
-// get the HTML of a module from the xml configuration string
-// $xmlPath: array conitaining the path
- protected function getModule($xmlPath)
- {
- $tracksHelpLabel = null;
- $xml = $this->getBox($xmlPath);
- if ($xml)
- {
- $box_news = new BoxParser($xml);
- $tracksHelpLabel = $box_news->render();
- }
- return $tracksHelpLabel;
- }
-
- protected function right($lang = 'en')
- {
- $hard = new HardwareModel();
-
- $data['stat'] = $hard->clear()->select('type,count(*) AS numb')->where(array('-deleted'=>'no','cleared'=>'no'))->groupBy('type')->toList('type','aggregate.numb')->send();
-
- $logged = $this->s['registered']->getUsersLogged();
-
- $data['numbLogged'] = count($logged);
-
- //render the boxes inside the right column
- $data['htmlRightBox'] = $this->getModule(array('right_column'));
-
- $data['language_links'] = $this->buildLanguageLinks($this->lang);
-
- $data['lastModif'] = $this->m['HistoryModel']
- ->clear()->select()
- ->inner('hardware')
- ->on('hardware.id_hard=history.id')
- ->where(array('type'=>'hardware','gr'=>'registered','deleted'=>'no','cleared'=>'no',))
- ->orderBy('id_history desc')
- ->limit(5)
- ->send();
-
- $this->append($data);
- $this->load('right');
- }
-
- protected function sanitizeQueryString($queryArray)
- {
- $resArray = array();
- foreach ($queryArray as $item)
- {
- if (preg_match('/^[a-zA-Z0-9\-\_\.\+\s]+$/',$item))
- {
- $resArray[] = sanitizeAll($item);
- }
- else
- {
- $this->querySanitized = false;
- return array('en');
- }
- }
- return $resArray;
- }
-
- protected function buildLanguageLinks($lang)
- {
- $status = $this->_queryString;
- $cPage = $this->querySanitized ? $this->currPage : $this->baseUrl."/home/index";
-
- $mobileDataRole = Version::get() === "mobile" ? "data-role='listview'" : null;
-
- $link = "<ul $mobileDataRole class='languages_link_box'>\n";
- foreach (Lang::$complete as $abbr => $fullName)
- {
- $linkClass = (strcmp($abbr,$lang) === 0) ? "class='current_lang'" : null;
- $status[0] = $abbr;
- $href = Url::createUrl($status);
- $fullNameArray = explode(',',$fullName);
- $text = "<img class='ui-li-icon' src='".$this->baseUrl."/Public/Img/Famfamfam/".$fullNameArray[0]."'><span>".$fullNameArray[1]."</span>";
-
- $mobileRel = Version::get() === "mobile" ? "rel='external'" : null;
- $link .= "\t<li><a $mobileRel $linkClass href='".$cPage.$href."'>$text</a></li>\n";
- }
- $link .= "</ul>\n";
- return $link;
- }
-
- protected function cleverLoad($file)
- {
- $fileInt = $file."_".$this->lang;
- if (file_exists(ROOT . DS . APPLICATION_PATH . DS . 'Views' . DS . Params::$viewSubfolder . DS . ucwords($this->controller) . DS . $fileInt . '.php'))
- {
- $this->load($fileInt);
- }
- else
- {
- $this->load($file);
- }
- }
-
-}
diff --git a/h-source/Application/Controllers/BluetoothController.php b/h-source/Application/Controllers/BluetoothController.php
deleted file mode 100644
index eae4b74..0000000
--- a/h-source/Application/Controllers/BluetoothController.php
+++ /dev/null
@@ -1,131 +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 BluetoothController extends GenericController
-{
-
- public function __construct($model, $controller, $queryString)
- {
-
- $worksOptions = Bluetooth::$select;
- $worksField = 'bluetooth_works';
- $interfaceOptions = Bluetooth::$interface;
-
- parent::__construct($model, $controller, $queryString);
-
- //load the model
- $this->model('HardwareModel');
- $this->model('RevisionsModel');
- $this->model('BluetoothModel');
- $this->model('TalkModel');
-
- $this->mod = $this->m['BluetoothModel'];
-
- $this->m['HardwareModel']->id_user = $this->s['registered']->status['id_user'];
- $this->m['HardwareModel']->type = 'bluetooth';
-
- $this->m['HardwareModel']->setConditions($worksOptions,$worksField,$interfaceOptions);
-
- $this->m['HardwareModel']->setFields('model,kernel,description,distribution,comm_year,bluetooth_works,pci_id,interface,driver,other_names','sanitizeAll');
-
- $argKeys = array(
- 'page:forceNat' => 1,
- 'history_page:forceNat' => 1,
- 'vendor:sanitizeString' => 'undef',
- 'comm_year:sanitizeString' => 'undef',
- 'bluetooth_works:sanitizeString' => 'undef',
- 'interface:sanitizeString' => 'undef',
- 'sort-by:sanitizeString' => 'bluetooth-works',
- 'search_string:sanitizeString' => 'undef'
- );
-
- $this->setArgKeys($argKeys);
-
- $data['title'] = 'Bluetooth';
-
- $data['intefaceOptions'] = $interfaceOptions;
- $data['worksOptions'] = $worksOptions;
- $data['worksField'] = $worksField;
-
- $data['notFoundString'] = "No bluetooth devices found";
-
- $this->append($data);
- }
-
- public function catalogue($lang = 'en')
- {
- $this->shift(1);
-
- $whereArray = array(
- 'type' => $this->mod->type,
- 'vendor' => $this->viewArgs['vendor'],
- 'comm_year' => $this->viewArgs['comm_year'],
- 'bluetooth_works' => $this->viewArgs['bluetooth_works'],
- 'interface' => $this->viewArgs['interface'],
- );
-
- $this->mod->setWhereQueryClause($whereArray);
-
- parent::catalogue($lang);
- }
-
- public function view($lang = 'en', $id = 0, $name = null)
- {
- parent::view($lang, $id, $name);
- }
-
- public function history($lang = 'en', $id = 0)
- {
- parent::history($lang, $id);
- }
-
- public function revision($lang = 'en', $id_rev = 0)
- {
- parent::revision($lang, $id_rev);
- }
-
- public function insert($lang = 'en', $token = '')
- {
- parent::insert($lang, $token);
- }
-
- public function update($lang = 'en', $token = '')
- {
- parent::update($lang, $token);
- }
-
- public function differences($lang = 'en', $id_hard = 0, $id_rev = 0)
- {
- parent::differences($lang, $id_hard, $id_rev);
- }
-
- public function climb($lang = 'en', $id_rev = 0, $token = '')
- {
- parent::climb($lang, $id_rev, $token);
- }
-
- public function talk($lang = 'en', $id_hard = 0, $token = '')
- {
- parent::talk($lang, $id_hard, $token);
- }
-
-}
diff --git a/h-source/Application/Controllers/ClientController.php b/h-source/Application/Controllers/ClientController.php
deleted file mode 100644
index 51966c9..0000000
--- a/h-source/Application/Controllers/ClientController.php
+++ /dev/null
@@ -1,55 +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 ClientController extends BaseController
-{
-
- public function __construct($model, $controller, $queryString)
- {
- parent::__construct($model, $controller, $queryString);
- }
-
- public function licenseinfo($lang = 'en')
- {
- header ("Content-Type:text/xml");
-
- $data["xml"] = "<?xml version='1.0' encoding='UTF-8'?>\n";
-
- $this->append($data);
- $this->clean();
- $this->load("license");
- }
-
- public function userinfo($lang = 'en')
- {
- header ("Content-Type:text/xml");
-
- $this->s['registered']->checkStatus();
-
- $data['user_status'] = strcmp($this->islogged,'yes') === 0 ? 'logged' : 'not-logged';
-
- $this->append($data);
- $this->clean();
- $this->load('info');
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Controllers/ContactController.php b/h-source/Application/Controllers/ContactController.php
deleted file mode 100644
index 197ec9a..0000000
--- a/h-source/Application/Controllers/ContactController.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 ContactController extends BaseController
-{
-
- public function __construct($model, $controller, $queryString)
- {
-
- $this->_topMenuClasses['contact'] = " class='currentitem ui-btn-active'";
-
- parent::__construct($model, $controller, $queryString);
-
- $data['title'] = 'contact - '.Website::$generalName;
- $this->append($data);
- }
-
- public function index($lang = 'en')
- {
- $this->cleverLoad('index');
- $this->right();
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Controllers/CreditsController.php b/h-source/Application/Controllers/CreditsController.php
deleted file mode 100644
index 4dbcc4a..0000000
--- a/h-source/Application/Controllers/CreditsController.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 CreditsController extends BaseController
-{
-
- public function __construct($model, $controller, $queryString)
- {
-
- $this->_topMenuClasses['credits'] = " class='currentitem ui-btn-active'";
-
- parent::__construct($model, $controller, $queryString);
-
- $data['title'] = 'credits - '.Website::$generalName;
- $this->append($data);
- }
-
- public function index($lang = 'en')
- {
- $this->cleverLoad('index');
- $this->right();
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Controllers/DownloadController.php b/h-source/Application/Controllers/DownloadController.php
deleted file mode 100644
index b221095..0000000
--- a/h-source/Application/Controllers/DownloadController.php
+++ /dev/null
@@ -1,275 +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 DownloadController extends BaseController
-{
-
- public function __construct($model, $controller, $queryString)
- {
-
- $this->_topMenuClasses['download'] = " class='currentitem'";
-
- parent::__construct($model, $controller, $queryString);
-
- $this->model('HardwareModel');
-
- $data['title'] = 'download - '.Website::$generalName;
- $this->append($data);
- }
-
- public function index($lang = 'en')
- {
- $this->cleverLoad('index');
- $this->right($lang);
- }
-
- //get the xml of the archive
- private function getXml($res)
- {
- $xml = null;
- $xml = "<?xml version='1.0' encoding='UTF-8'?>\n";
- $xml .= "<hardware>\n";
- $xml .= "\t<general_information>\n";
- $xml .= "\t\t<credits>h-node project</credits>\n";
- $xml .= "\t\t<link>".Website::$generalName."</link>\n";
- $xml .= "\t\t<date>".date("Y-m-d H:i:s")."</date>\n";
- $xml .= "\t\t<license>".License::getInsideXml()."</license>\n";
- $xml .= "\t</general_information>\n";
-
- foreach ($res as $row)
- {
- $type = $row['hardware']['type'];
- $xml .= "\t<device>\n";
-
- $xml .= "\t\t<id>".$row['hardware']['id_hard']."</id>\n";
- $xml .= "\t\t<type>".$row['hardware']['type']."</type>\n";
-
- if ($type === 'notebook' or $type === 'printer' or $type === 'host-controller' )
- {
- $xml .= "\t\t<subtype>".$row['hardware']['subtype']."</subtype>\n";
- }
- if ($type === 'notebook')
- {
- $xml .= "\t\t<architecture>".translate($row['hardware']['architecture'])."</architecture>\n";
- $xml .= "\t\t<free_bios>".$row['hardware']['bios']."</free_bios>\n";
- $xml .= "\t\t<can_free_systems_be_installed>".$row['hardware']['can_free_systems_be_installed']."</can_free_systems_be_installed>\n";
- $xml .= "\t\t<prevent_wifi>".$row['hardware']['prevent_wifi']."</prevent_wifi>\n";
- }
-
- $xml .= "\t\t<model_name>".$row['hardware']['model']."</model_name>\n";
-
- if ($type !== 'notebook')
- {
- $xml .= "\t\t<other_names><![CDATA[".$row['hardware']['other_names']."]]></other_names>\n";
- $xml .= "\t\t<vendorid_productid>".$row['hardware']['pci_id']."</vendorid_productid>\n";
- }
-
- $xml .= "\t\t<vendor>".$row['hardware']['vendor']."</vendor>\n";
- $xml .= "\t\t<kernel_libre>".$row['hardware']['kernel']."</kernel_libre>\n";
- $xml .= "\t\t<distribution>".$row['hardware']['distribution']."</distribution>\n";
- $xml .= "\t\t<year>".$row['hardware']['comm_year']."</year>\n";
-
- if ($type !== 'notebook')
- {
- $xml .= "\t\t<interface>".$row['hardware']['interface']."</interface>\n";
- }
-
- if ($type === 'notebook' or $type === 'printer' or $type === 'scanner')
- {
- $xml .= "\t\t<compatibility>".$row['hardware']['compatibility']."</compatibility>\n";
- }
- else if ($type === '3G-card' or $type === 'wifi')
- {
- $xml .= "\t\t<it_works>".$row['hardware']['wifi_works']."</it_works>\n";
- }
- else if ($type === 'soundcard')
- {
- $xml .= "\t\t<it_works>".$row['hardware']['sound_card_works']."</it_works>\n";
- }
- else if ($type === 'bluetooth')
- {
- $xml .= "\t\t<it_works>".$row['hardware']['bluetooth_works']."</it_works>\n";
- }
- else if ($type === 'webcam')
- {
- $xml .= "\t\t<it_works>".$row['hardware']['webcam_works']."</it_works>\n";
- }
- else if ($type === 'videocard')
- {
- $xml .= "\t\t<it_works>".$row['hardware']['video_card_works']."</it_works>\n";
- }
- else if ($type === 'acquisition-card' or $type === 'modem' or $type === 'RAID-adapter' or $type === 'host-controller')
- {
- $xml .= "\t\t<it_works>".$row['hardware']['compatibility']."</it_works>\n";
- }
- else if ($type === 'fingerprint-reader')
- {
- $xml .= "\t\t<it_works>".$row['hardware']['fingerprint_works']."</it_works>\n";
- }
- else if ($type === 'ethernet-card')
- {
- $xml .= "\t\t<it_works>".$row['hardware']['ethernet_card_works']."</it_works>\n";
- }
- else if ($type === 'sd-card-reader')
- {
- $xml .= "\t\t<it_works>".$row['hardware']['sd_card_works']."</it_works>\n";
- }
-
- if ($type === 'printer')
- {
- $xml .= "\t\t<it_tracks_users>".$row['hardware']['it_tracks_users']."</it_tracks_users>\n";
- }
-
- if ($type === 'notebook')
- {
- $xml .= "\t\t<wifi_card>".$row['hardware']['wifi_type']."</wifi_card>\n";
- $xml .= "\t\t<videocard>".$row['hardware']['video_card_type']."</videocard>\n";
- $xml .= "\t\t<webcam>".$row['hardware']['webcam_type']."</webcam>\n";
- $xml .= "\t\t<wifi_works>".$row['hardware']['wifi_works']."</wifi_works>\n";
- $xml .= "\t\t<videocard_works>".$row['hardware']['video_card_works']."</videocard_works>\n";
- $xml .= "\t\t<webcam_works>".$row['hardware']['webcam_works']."</webcam_works>\n";
- }
-
- if ($type !== "notebook")
- {
- $xml .= "\t\t<driver>".$row['hardware']['driver']."</driver>\n";
- }
-
- $xml .= "\t\t<description><![CDATA[".$row['hardware']['description']."]]></description>\n";
-
- $xml .= "\t\t<link>".$this->baseUrl."/".Hardware::getControllerFromType($type)."/view/".$this->lang."/".$row['hardware']['id_hard']."/".encodeUrl($row['hardware']['model'])."</link>\n";
- $xml .= "\t\t<permalink>".$this->baseUrl."/".Hardware::getControllerFromType($type)."/view/".$this->lang."/".$row['hardware']['id_hard']."</permalink>\n";
- $xml .= "\t\t<created_by>".$this->baseUrl."/".Hardware::getControllerFromType($type)."/history/".$this->lang."/".$row['hardware']['id_hard']."</created_by>\n";
-
- $xml .= "\t</device>\n";
- }
-
- $xml .= "</hardware>\n";
-
- return $xml;
- }
-
- protected function printXml($lang = 'en', $whereArray)
- {
- header ("Content-Type:text/xml");
-
-// header("Content-Type: application/force-download");
-// header("Content-Type: application/octet-stream");
-// header("Content-Type: application/download");
-
- $filename = array_key_exists('type',$whereArray) ? $whereArray['type'] : "all";
- header("Content-Disposition: attachment; filename=h-node-".$filename.".xml;");
-
- $res = $this->m['HardwareModel']->clear()->select()->where($whereArray)->aWhere(array("cleared"=>"no"))->orderBy("type,hardware.id_hard")->send();
-
- $data['xml'] = $this->getXml($res);
-
- $this->append($data);
- $this->clean();
- $this->load('xml');
- }
-
- public function all($lang = 'en')
- {
- $this->printXml($lang, array('-deleted'=>'no'));
- }
-
- public function notebooks($lang = 'en')
- {
- $this->printXml($lang, array('type'=>'notebook','-deleted'=>'no'));
- }
-
- public function wifi($lang = 'en')
- {
- $this->printXml($lang, array('type'=>'wifi','-deleted'=>'no'));
- }
-
- public function videocards($lang = 'en')
- {
- $this->printXml($lang, array('type'=>'videocard','-deleted'=>'no'));
- }
-
- public function printers($lang = 'en')
- {
- $this->printXml($lang, array('type'=>'printer','-deleted'=>'no'));
- }
-
- public function scanners($lang = 'en')
- {
- $this->printXml($lang, array('type'=>'scanner','-deleted'=>'no'));
- }
-
- public function threegcards($lang = 'en')
- {
- $this->printXml($lang, array('type'=>'3G-card','-deleted'=>'no'));
- }
-
- public function soundcards($lang = 'en')
- {
- $this->printXml($lang, array('type'=>'soundcard','-deleted'=>'no'));
- }
-
- public function webcams($lang = 'en')
- {
- $this->printXml($lang, array('type'=>'webcam','-deleted'=>'no'));
- }
-
- public function bluetooth($lang = 'en')
- {
- $this->printXml($lang, array('type'=>'bluetooth','-deleted'=>'no'));
- }
-
- public function acquisitioncards($lang = 'en')
- {
- $this->printXml($lang, array('type'=>'acquisition-card','-deleted'=>'no'));
- }
-
- public function fingerprintreaders($lang = 'en')
- {
- $this->printXml($lang, array('type'=>'fingerprint-reader','-deleted'=>'no'));
- }
-
- public function ethernetcards($lang = 'en')
- {
- $this->printXml($lang, array('type'=>'ethernet-card','-deleted'=>'no'));
- }
-
- public function sdcardreaders($lang = 'en')
- {
- $this->printXml($lang, array('type'=>'sd-card-reader','-deleted'=>'no'));
- }
-
- public function modems($lang = 'en')
- {
- $this->printXml($lang, array('type'=>'modem','-deleted'=>'no'));
- }
-
- public function raidadapters($lang = 'en')
- {
- $this->printXml($lang, array('type'=>'RAID-adapter','-deleted'=>'no'));
- }
-
- public function hostcontrollers($lang = 'en')
- {
- $this->printXml($lang, array('type'=>'host-controller','-deleted'=>'no'));
- }
-}
diff --git a/h-source/Application/Controllers/EthernetcardsController.php b/h-source/Application/Controllers/EthernetcardsController.php
deleted file mode 100644
index 0425122..0000000
--- a/h-source/Application/Controllers/EthernetcardsController.php
+++ /dev/null
@@ -1,131 +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 EthernetcardsController extends GenericController
-{
-
- public function __construct($model, $controller, $queryString)
- {
-
- $worksOptions = Ethernetcards::$select;
- $worksField = 'ethernet_card_works';
- $interfaceOptions = Ethernetcards::$interface;
-
- parent::__construct($model, $controller, $queryString);
-
- //load the model
- $this->model('HardwareModel');
- $this->model('RevisionsModel');
- $this->model('EthernetcardsModel');
- $this->model('TalkModel');
-
- $this->mod = $this->m['EthernetcardsModel'];
-
- $this->m['HardwareModel']->id_user = $this->s['registered']->status['id_user'];
- $this->m['HardwareModel']->type = 'ethernet-card';
-
- $this->m['HardwareModel']->setConditions($worksOptions,$worksField,$interfaceOptions);
-
- $this->m['HardwareModel']->setFields('model,kernel,description,distribution,comm_year,ethernet_card_works,pci_id,interface,driver,other_names','sanitizeAll');
-
- $argKeys = array(
- 'page:forceNat' => 1,
- 'history_page:forceNat' => 1,
- 'vendor:sanitizeString' => 'undef',
- 'comm_year:sanitizeString' => 'undef',
- 'ethernet_card_works:sanitizeString' => 'undef',
- 'interface:sanitizeString' => 'undef',
- 'sort-by:sanitizeString' => 'ethernet-works',
- 'search_string:sanitizeString' => 'undef'
- );
-
- $this->setArgKeys($argKeys);
-
- $data['title'] = 'Ethernet cards';
-
- $data['intefaceOptions'] = $interfaceOptions;
- $data['worksOptions'] = $worksOptions;
- $data['worksField'] = $worksField;
-
- $data['notFoundString'] = "No ethernet devices found";
-
- $this->append($data);
- }
-
- public function catalogue($lang = 'en')
- {
- $this->shift(1);
-
- $whereArray = array(
- 'type' => $this->mod->type,
- 'vendor' => $this->viewArgs['vendor'],
- 'comm_year' => $this->viewArgs['comm_year'],
- 'ethernet_card_works' => $this->viewArgs['ethernet_card_works'],
- 'interface' => $this->viewArgs['interface'],
- );
-
- $this->mod->setWhereQueryClause($whereArray);
-
- parent::catalogue($lang);
- }
-
- public function view($lang = 'en', $id = 0, $name = null)
- {
- parent::view($lang, $id, $name);
- }
-
- public function history($lang = 'en', $id = 0)
- {
- parent::history($lang, $id);
- }
-
- public function revision($lang = 'en', $id_rev = 0)
- {
- parent::revision($lang, $id_rev);
- }
-
- public function insert($lang = 'en', $token = '')
- {
- parent::insert($lang, $token);
- }
-
- public function update($lang = 'en', $token = '')
- {
- parent::update($lang, $token);
- }
-
- public function differences($lang = 'en', $id_hard = 0, $id_rev = 0)
- {
- parent::differences($lang, $id_hard, $id_rev);
- }
-
- public function climb($lang = 'en', $id_rev = 0, $token = '')
- {
- parent::climb($lang, $id_rev, $token);
- }
-
- public function talk($lang = 'en', $id_hard = 0, $token = '')
- {
- parent::talk($lang, $id_hard, $token);
- }
-
-}
diff --git a/h-source/Application/Controllers/FaqController.php b/h-source/Application/Controllers/FaqController.php
deleted file mode 100644
index 45ebab2..0000000
--- a/h-source/Application/Controllers/FaqController.php
+++ /dev/null
@@ -1,41 +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 FaqController extends WikiController
-{
-
- public function __construct($model, $controller, $queryString)
- {
- $this->_topMenuClasses['faq'] = " class='currentitem'";
-
- parent::__construct($model, $controller, $queryString);
-
- $this->_topMenuClasses['wiki'] = null;
-
- $data['tm'] = $this->_topMenuClasses;
-
- $data['title'] = 'FAQ page - '.Website::$generalName;
-
- $this->append($data);
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Controllers/FingerprintreadersController.php b/h-source/Application/Controllers/FingerprintreadersController.php
deleted file mode 100644
index c3de0d7..0000000
--- a/h-source/Application/Controllers/FingerprintreadersController.php
+++ /dev/null
@@ -1,131 +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 FingerprintreadersController extends GenericController
-{
-
- public function __construct($model, $controller, $queryString)
- {
-
- $worksOptions = Fingerprintreaders::$select;
- $worksField = 'fingerprint_works';
- $interfaceOptions = Fingerprintreaders::$interface;
-
- parent::__construct($model, $controller, $queryString);
-
- //load the model
- $this->model('HardwareModel');
- $this->model('RevisionsModel');
- $this->model('FingerprintreadersModel');
- $this->model('TalkModel');
-
- $this->mod = $this->m['FingerprintreadersModel'];
-
- $this->m['HardwareModel']->id_user = $this->s['registered']->status['id_user'];
- $this->m['HardwareModel']->type = 'fingerprint-reader';
-
- $this->m['HardwareModel']->setConditions($worksOptions,$worksField,$interfaceOptions);
-
- $this->m['HardwareModel']->setFields('model,kernel,description,distribution,comm_year,fingerprint_works,pci_id,interface,driver,other_names','sanitizeAll');
-
- $argKeys = array(
- 'page:forceNat' => 1,
- 'history_page:forceNat' => 1,
- 'vendor:sanitizeString' => 'undef',
- 'comm_year:sanitizeString' => 'undef',
- 'fingerprint_works:sanitizeString' => 'undef',
- 'interface:sanitizeString' => 'undef',
- 'sort-by:sanitizeString' => 'fingerprint-works',
- 'search_string:sanitizeString' => 'undef'
- );
-
- $this->setArgKeys($argKeys);
-
- $data['title'] = 'Fingerprint reader';
-
- $data['intefaceOptions'] = $interfaceOptions;
- $data['worksOptions'] = $worksOptions;
- $data['worksField'] = $worksField;
-
- $data['notFoundString'] = "No fingerprint readers found";
-
- $this->append($data);
- }
-
- public function catalogue($lang = 'en')
- {
- $this->shift(1);
-
- $whereArray = array(
- 'type' => $this->mod->type,
- 'vendor' => $this->viewArgs['vendor'],
- 'comm_year' => $this->viewArgs['comm_year'],
- 'fingerprint_works' => $this->viewArgs['fingerprint_works'],
- 'interface' => $this->viewArgs['interface'],
- );
-
- $this->mod->setWhereQueryClause($whereArray);
-
- parent::catalogue($lang);
- }
-
- public function view($lang = 'en', $id = 0, $name = null)
- {
- parent::view($lang, $id, $name);
- }
-
- public function history($lang = 'en', $id = 0)
- {
- parent::history($lang, $id);
- }
-
- public function revision($lang = 'en', $id_rev = 0)
- {
- parent::revision($lang, $id_rev);
- }
-
- public function insert($lang = 'en', $token = '')
- {
- parent::insert($lang, $token);
- }
-
- public function update($lang = 'en', $token = '')
- {
- parent::update($lang, $token);
- }
-
- public function differences($lang = 'en', $id_hard = 0, $id_rev = 0)
- {
- parent::differences($lang, $id_hard, $id_rev);
- }
-
- public function climb($lang = 'en', $id_rev = 0, $token = '')
- {
- parent::climb($lang, $id_rev, $token);
- }
-
- public function talk($lang = 'en', $id_hard = 0, $token = '')
- {
- parent::talk($lang, $id_hard, $token);
- }
-
-}
diff --git a/h-source/Application/Controllers/GenericController.php b/h-source/Application/Controllers/GenericController.php
deleted file mode 100644
index 00848c3..0000000
--- a/h-source/Application/Controllers/GenericController.php
+++ /dev/null
@@ -1,1001 +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 GenericController extends BaseController
-{
-
- protected $_controllerName = null; //as in the URL
-
- public $orderPopup;
-
- public function __construct($model, $controller, $queryString) {
-
- $this->_topMenuClasses['hardware'] = " class='currentitem ui-btn-active'";
-
- parent::__construct($model, $controller, $queryString);
-
- $this->model('VendorsModel');
-
- $popup = new Popup();
- $popup->name = gtext('sort by');
-
- $popNames = array(gtext('last inserted'),gtext('alphabetically'),gtext('alphabetically desc'),gtext('compatibility'));
- $popValues = array('last-inserted','alphabetically','alphabetically-desc','compatibility');
-
- switch ($this->controller)
- {
- case 'printers':
- $popup->itemsName = $popNames;
- $popup->itemsValue = $popValues;
- break;
- case 'notebooks':
- $popup->itemsName = $popNames;
- $popup->itemsValue = $popValues;
- break;
- case 'scanners':
- $popup->itemsName = $popNames;
- $popup->itemsValue = $popValues;
- break;
- case 'wifi':
- $popNames = array(gtext('last inserted'),gtext('alphabetically'),gtext('alphabetically desc'),gtext('wifi works'));
- $popValues = array('last-inserted','alphabetically','alphabetically-desc','wifi-works');
- $popup->itemsName = $popNames;
- $popup->itemsValue = $popValues;
- break;
- case 'videocards':
- $popNames = array(gtext('last inserted'),gtext('alphabetically'),gtext('alphabetically desc'),gtext('video card works'));
- $popValues = array('last-inserted','alphabetically','alphabetically-desc','video-card-works');
- $popup->itemsName = $popNames;
- $popup->itemsValue = $popValues;
- break;
- case 'threegcards':
- $popNames = array(gtext('last inserted'),gtext('alphabetically'),gtext('alphabetically desc'),gtext('wifi works'));
- $popValues = array('last-inserted','alphabetically','alphabetically-desc','wifi-works');
- $popup->itemsName = $popNames;
- $popup->itemsValue = $popValues;
- break;
- case 'soundcards':
- $popNames = array(gtext('last inserted'),gtext('alphabetically'),gtext('alphabetically desc'),gtext('sound card works'));
- $popValues = array('last-inserted','alphabetically','alphabetically-desc','sound-card-works');
- $popup->itemsName = $popNames;
- $popup->itemsValue = $popValues;
- break;
- case 'webcams':
- $popNames = array(gtext('last inserted'),gtext('alphabetically'),gtext('alphabetically desc'),gtext('webcam works'));
- $popValues = array('last-inserted','alphabetically','alphabetically-desc','webcam-works');
- $popup->itemsName = $popNames;
- $popup->itemsValue = $popValues;
- break;
- case 'bluetooth':
- $popNames = array(gtext('last inserted'),gtext('alphabetically'),gtext('alphabetically desc'),gtext('bluetooth works'));
- $popValues = array('last-inserted','alphabetically','alphabetically-desc','bluetooth-works');
- $popup->itemsName = $popNames;
- $popup->itemsValue = $popValues;
- break;
- case 'acquisitioncards':
- $popNames = array(gtext('last inserted'),gtext('alphabetically'),gtext('alphabetically desc'),gtext('compatibility desc'));
- $popValues = array('last-inserted','alphabetically','alphabetically-desc','compatibility-desc');
- $popup->itemsName = $popNames;
- $popup->itemsValue = $popValues;
- break;
- case 'fingerprintreaders':
- $popNames = array(gtext('last inserted'),gtext('alphabetically'),gtext('alphabetically desc'),gtext('fingerprint works'));
- $popValues = array('last-inserted','alphabetically','alphabetically-desc','fingerprint-works');
- $popup->itemsName = $popNames;
- $popup->itemsValue = $popValues;
- break;
- case 'ethernetcards':
- $popNames = array(gtext('last inserted'),gtext('alphabetically'),gtext('alphabetically desc'),gtext('ethernet works'));
- $popValues = array('last-inserted','alphabetically','alphabetically-desc','ethernet-works');
- $popup->itemsName = $popNames;
- $popup->itemsValue = $popValues;
- break;
- case 'sdcardreaders':
- $popNames = array(gtext('last inserted'),gtext('alphabetically'),gtext('alphabetically desc'),gtext('sdcard works'));
- $popValues = array('last-inserted','alphabetically','alphabetically-desc','sdcard-works');
- $popup->itemsName = $popNames;
- $popup->itemsValue = $popValues;
- break;
- case 'modems':
- $popNames = array(gtext('last inserted'),gtext('alphabetically'),gtext('alphabetically desc'),gtext('compatibility desc'));
- $popValues = array('last-inserted','alphabetically','alphabetically-desc','compatibility-desc');
- $popup->itemsName = $popNames;
- $popup->itemsValue = $popValues;
- break;
- case 'raidadapters':
- $popNames = array(gtext('last inserted'),gtext('alphabetically'),gtext('alphabetically desc'),gtext('compatibility desc'));
- $popValues = array('last-inserted','alphabetically','alphabetically-desc','compatibility-desc');
- $popup->itemsName = $popNames;
- $popup->itemsValue = $popValues;
- break;
- case 'hostcontrollers':
- $popNames = array(gtext('last inserted'),gtext('alphabetically'),gtext('alphabetically desc'),gtext('compatibility desc'));
- $popValues = array('last-inserted','alphabetically','alphabetically-desc','compatibility-desc');
- $popup->itemsName = $popNames;
- $popup->itemsValue = $popValues;
- break;
- default:
- array_pop($popNames);
- array_pop($popValues);
- $popup->itemsName = $popNames;
- $popup->itemsValue = $popValues;
- break;
- }
-
- $this->orderPopup = $popup;
-
-// $data['howToCompileLabel'] = null;
- $data['isApproved'] = true;
-
- $data['tracksHelpLabel'] = $this->getModule(array('devices',$this->controller,'form','it_tracks_users'));
- $data['howToCompileLabel'] = $this->getModule(array('devices','all','form','how_to_compile'));
- $data['modelNameLabel'] = $this->getModule(array('devices','all','form','model_name_entry_help_label'));
- $data['vendoridProductidLabel'] = $this->getModule(array('devices','not_notebook','form','vendorid_productid_label'));
- $data['descriptionLabel'] = $this->getModule(array('devices','all','form','description_entry_help_label'));
- $data['preventWifiLabel'] = $this->getModule(array('devices','notebook','form','prevent_wifi_label'));
-
- $this->append($data);
- }
-
- protected function insert($lang = 'en', $token = '')
- {
- $this->shift(2);
-
- if ( strcmp($this->_updating,'no') !== 0 ) $this->redirect('users/login/'.$this->lang,0);
-
- $clean['token'] = sanitizeAlphanum($token);
-
- $data['descriptionPreview'] = null; //contains the HTML of the preview of the description entry
-
- $data['notice'] = null;
- $data['submission_response'] = 'error';
-
- $data['tree'] = $this->getSpecHardLink() . " &raquo; " . " <span class='last_tree_element'>".gtext("Insert")."</span>";
-
- $this->s['registered']->checkStatus();
-
- if ($this->s['registered']->status['status'] === 'logged' or Website::$allowAnonymousSubmission === "yes")
- {
-// if (!$this->s['registered']->checkCsrf($clean['token'])) $this->redirect($this->controller.'/catalogue/'.$this->lang,2,'wrong token..');
-
-// if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..');
-
- if (isset($_POST['insertAction']))
- {
- if ($this->checkDist())
- {
- $pci_id = $this->request->post('pci_id','','sanitizeAll');
- $interface = $this->request->post('interface','not-defined','sanitizeAll');
-
- if ($this->checkVendorId($interface))
- {
- if (strcmp($this->m['HardwareModel']->type,'notebook') !== 0)
- {
- $this->m['HardwareModel']->values['vendor'] = sanitizeAll($this->m['VendorsModel']->getName($pci_id,$interface));
-
- $this->m['HardwareModel']->databaseConditions['insert']['+checkUnique'] = 'pci_id|<i>VendorID:ProductID</i> is already present in the database. This means that the device you are trying to insert is already in the database. See here: '.$this->getAlreadyExixtsLink($pci_id);
- }
-
- //insert the new device
- $this->m['HardwareModel']->updateTable('insert');
-
- if ($this->m['HardwareModel']->queryResult)
- {
- if (strcmp($this->controller,'notebooks') === 0)
- {
- @session_start();
- $_SESSION['notebook_inserted'] = 'yes';
- }
-
- $data['submission_response'] = 'executed';
- }
-
- $this->viewRedirect($this->m['HardwareModel']->lastId);
-
- }
- }
- }
-
- $data['descriptionPreview'] = $this->getPreview();
-
- $data['notice'] = $this->m['HardwareModel']->notice;
-
- $data['submitName'] = "insertAction";
- $data['hiddenInput'] = null;
-
- $data['values'] = $this->m['HardwareModel']->getFormValues('insert','sanitizeHtml');
- $this->append($data);
-
- if (!isset($_POST['from_client']))
- {
- $this->load('top_left');
- $this->load('license_notice');
- $this->load('form');
- $this->load('bottom_left');
- $this->right();
- }
- else
- {
- header ("Content-Type:text/xml");
- $this->clean();
- $this->load('xml_response');
- }
- }
- else
- {
- $this->redirect("users/login/".$this->lang."?redirect=".$this->controller."/catalogue/".$this->lang,0);
- }
- }
-
- public function del($lang = 'en', $token = '')
- {
- header('Content-type: text/html; charset=UTF-8');
-
- $this->shift(2);
-
- $this->clean();
-
- $clean['token'] = sanitizeAlphanum($token);
-
- if ($this->s['registered']->status['status'] === 'logged')
- {
- if (!$this->s['registered']->checkCsrf($clean['token'])) die("wrong token");
-
- if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) die("your account has been blocked");
-
- $clean['id_user'] = (int)$this->s['registered']->status['id_user'];
- $clean['id_hard'] = $this->request->post('id_hard',0,'forceInt');
-
- $this->model("DeletionModel");
-
- $numb = $this->m['DeletionModel']->where(array("id_hard"=>$clean['id_hard'],"created_by"=>$clean['id_user']))->rowNumber();
-
- if ($numb === 0)
- {
- $id_dup = $this->request->post('id_duplicate',0,'forceInt');
- $object = $this->request->post('object','','sanitizeAll');
-
- if ($id_dup === 0 and strcmp($object,'duplication') === 0)
- {
- echo "you have no specified the device duplicated by this model";
- }
- else
- {
- $this->m['DeletionModel']->setFields('id_hard:forceInt,object,message,id_duplicate:forceInt','sanitizeAll');
- $this->m['DeletionModel']->values['created_by'] = $clean['id_user'];
-
- $this->m['DeletionModel']->updateTable('insert');
- if ($this->m['DeletionModel']->queryResult)
- {
- $hard = new HardwareModel();
- $c = $hard->where(array('id_hard'=>$clean['id_hard'],'ask_for_del'=>'yes'))->rowNumber();
- if ($c < 1)
- {
- $hard->db->update('hardware','ask_for_del',array('yes'),'id_hard='.$clean['id_hard']);
- }
- echo "operation executed";
- }
- else
- {
- echo "one error occurred, please try later";
- }
- }
- }
- else
- {
- echo "you have already asked for the deletion of this device";
- }
- }
- }
-
- protected function update($lang = 'en', $token = '')
- {
- $this->shift(2);
-
- $clean['token'] = sanitizeAlphanum($token);
-
- $data['descriptionPreview'] = null; //contains the HTML of the preview of the description entry
-
- $data['notice'] = null;
- $data['submission_response'] = 'error';
-
- $this->s['registered']->checkStatus();
-
- if (isset($_POST['id_hard']))
- {
- //get the id
- $clean['id_hard'] = isset($_POST['id_hard']) ? (int)$_POST['id_hard'] : 0;
-
- if ($this->s['registered']->status['status'] === 'logged')
- {
- if (!$this->s['registered']->checkCsrf($clean['token'])) $this->redirect($this->controller.'/catalogue/'.$this->lang,2,'wrong token..');
-
- if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..');
-
- if ($this->m['HardwareModel']->isCleared($clean['id_hard'])) $this->redirect('generic/cleared/'.$this->lang,0);
-
- $deleted = $this->m['HardwareModel']->select("hardware.deleted")->where(array("id_hard"=>$clean['id_hard']))->limit(1)->toList('deleted')->send();
-
- if (strcmp($deleted[0],'no') === 0)
- {
- $ne_name = $this->m['HardwareModel']->getTheModelName($clean['id_hard']);
- $name = encodeUrl($ne_name);
- $data['name'] = $name;
- $data['ne_name'] = $ne_name;
- $data['tree'] = $this->getSpecHardLink() . " &raquo; " . $this->getViewLink($clean['id_hard'],$ne_name) . " &raquo; <span class='last_tree_element'>".gtext("Edit")."</span>";
-
- if (isset($_POST['updateAction']))
- {
- if ($this->checkDist())
- {
- $pci_id = $this->request->post('pci_id','','sanitizeAll');
- $interface = $this->request->post('interface','not-defined','sanitizeAll');
-
- if ($this->checkVendorId($interface))
- {
- if (strcmp($this->m['HardwareModel']->type,'notebook') !== 0)
- {
- $this->m['HardwareModel']->values['vendor'] = sanitizeAll($this->m['VendorsModel']->getName($pci_id,$interface));
-
- $this->m['HardwareModel']->databaseConditions['update']['+checkUniqueCompl'] = 'pci_id|<i>VendorID:ProductID</i> is already present in the database. This means that the device you are trying to insert is already in the database. See here: '.$this->getAlreadyExixtsLink($pci_id);
- }
-
- //carry out the update database action
- $this->m['HardwareModel']->updateTable('update');
-
- if ($this->m['HardwareModel']->queryResult)
- {
- $data['submission_response'] = 'executed';
- }
- $this->viewRedirect($this->m['HardwareModel']->lastId);
- }
- }
- }
-
- $data['descriptionPreview'] = $this->getPreview();
-
- $data['notice'] = $this->m['HardwareModel']->notice;
-
- $data['id_hard'] = $clean['id_hard'];
- $data['submitName'] = "updateAction";
- // echo $this->m['HardwareModel']->fields;
- $data['values'] = $this->m['HardwareModel']->getFormValues('update','sanitizeHtml');
- $data['hiddenInput'] = "<input type='hidden' name='id_hard' value='".$clean['id_hard']."'>\n";
-
- $this->append($data);
-
- if (!isset($_POST['from_client']))
- {
- $this->load('top_left');
- $this->load('license_notice');
- $this->load('form');
- $this->load('bottom_left');
- $this->right();
- }
- else
- {
- header ("Content-Type:text/xml");
- $this->clean();
- $this->load('xml_response');
- }
- }
- else
- {
- $this->redirect($this->controller.'/catalogue/'.$this->lang,2,'deleted..');
- }
- }
- else
- {
- $this->redirect("users/login/".$this->lang."?redirect=".$this->controller."/view/".$this->lang."/".$clean['id_hard'],0);
- }
- }
- else
- {
- $this->redirect($this->controller.'/catalogue/'.$this->lang);
- }
- }
-
- //get the preview of the description entry
- protected function getPreview()
- {
- if (isset($_POST['previewAction']))
- {
- $this->m['HardwareModel']->result = false;
- return $this->request->post('description','','sanitizeHtml');
- }
- return null;
- }
-
- protected function checkVendorId($interface)
- {
- if (strcmp($this->m['HardwareModel']->type,'notebook') === 0) return true;
-
- if (array_key_exists('pci_id',$_POST))
- {
- if (strcmp($_POST['pci_id'],"") !== 0)
- {
- if (preg_match('/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/',$_POST['pci_id']))
- {
- if ($this->m['VendorsModel']->check($_POST['pci_id'],$interface))
- {
- return true;
- }
- else
- {
- $this->m['HardwareModel']->result = false;
- $this->m['HardwareModel']->notice = "<div class='alert'>Your vendor has not been found.<br /><br />Your vendorid code is not present in the list. If it is a USB device, please choose the right interface (USB), otherwise the system will check inside the PCI ID vendors' list. If it is not a USB device, and you are not sure about the right interface, choose not-defined, and it should work fine (the system will check inside the PCI ID vendors' list if you choose an interface other than USB). <br/><br />If your vendor has not been found yet, please open an issue <a href='".$this->baseUrl."/issues/viewall/".Lang::$current."'>here</a> in order to ask the insertion of your vendor.<br /><br />If your vendor has not been found you could also send your PCI ID or USB ID to the PCI ID repository (http://pciids.sourceforge.net/) or to the USB ID repository (http://www.linux-usb.org/usb-ids.html).</div>\n";
- return false;
- }
- }
- else
- {
- $this->m['HardwareModel']->result = false;
- $this->m['HardwareModel']->notice = "<div class='alert'><i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}</div>";
- }
- }
- else
- {
- $this->m['HardwareModel']->result = false;
- $this->m['HardwareModel']->notice = "<div class='alert'>Vendorid:Productid code not defined..</div>\n";
- return false;
- }
- }
- $this->m['HardwareModel']->result = false;
- return false;
- }
-
- protected function checkDist()
- {
- if (array_key_exists('distribution',$_POST))
- {
- if (strcmp($_POST['distribution'],"") !== 0)
- {
- if (Distributions::check($_POST['distribution']))
- {
- return true;
- }
- else
- {
- $this->m['HardwareModel']->result = false;
- $this->m['HardwareModel']->notice = "<div class='alert'>Distribution not allowed..</div>\n";
- return false;
- }
- }
- else
- {
- $this->m['HardwareModel']->result = false;
- $this->m['HardwareModel']->notice = "<div class='alert'>Distribution not defined..</div>\n";
- return false;
- }
- }
- $this->m['HardwareModel']->result = false;
- return false;
- }
-
- protected function viewRedirect($id)
- {
- $clean['id'] = (int)$id;
-
- if ($this->m['HardwareModel']->queryResult)
- {
- if (!isset($_POST['from_client']))
- {
- $name = encodeUrl($this->m['HardwareModel']->getTheModelName($clean['id']));
- $this->redirect($this->controller.'/view/'.$this->lang.'/'.$clean['id'].'/'.$name.$this->viewStatus);
- }
- }
- }
-
- //load the view files
- protected function loadViewAll($viewName = null)
- {
- $this->load('top_left');
- $viewArray = explode(',',$viewName);
- foreach ($viewArray as $viewFile)
- {
- $this->load($viewFile);
- }
- $this->load('bottom_left');
- $this->right();
- }
-
- protected function catalogue($lang = 'en')
- {
- $data['title'] = $this->controller.' - '.Website::$generalName;
-
- Params::$nullQueryValue = 'undef';
-
- $data['tree'] = plural($this->controller);
-
- //look for a string in the model name or in the other_names if the string is different from undef
- if (strcmp($this->viewArgs['search_string'],"undef") !== 0)
- {
- $nWhere = array(
- 'OR' => array(
- 'model' => "like '%".$this->viewArgs['search_string']."%'",
- 'other_names' => "like '%".$this->viewArgs['search_string']."%'",
- ),
- );
- $this->mod->aWhere($nWhere);
- }
-
- $this->mod->aWhere(array("deleted"=>"no","cleared"=>"no"));
-
- $this->mod->popupBuild();
- $popup = $this->mod->popupArray;
- $popup['sort-by'] = $this->orderPopup;
-
- $this->helper('Popup',$this->controller.'/catalogue/'.$this->lang,$popup,'inclusive','page');
-
- $this->h['Popup']->allString = gtext("All");
-
- //create the HTML of the popup
- $data['popup'] = $this->h['Popup']->render();
-
- if (strcmp($this->controller,'notebooks') === 0)
- {
- $this->mod->popupArray = array();
- $this->mod->morePopups();
- $this->mod->popupBuild();
- $this->h['Popup']->popupArray = $this->mod->popupArray;
- $data['popupMore'] = $this->h['Popup']->render();
- }
-
- $this->mod->orderBy = getOrderByClause($this->viewArgs['sort-by']);
- $recordNumber = $this->mod->rowNumber();
-
- $data['recordNumber'] = $recordNumber;
-
- //load the Pages helper
- $this->helper('Pages',$this->controller.'/catalogue/'.$this->lang,'page');
- $page = $this->viewArgs['page'];
- //set the limit clause
- $this->mod->limit = $this->h['Pages']->getLimit($page,$recordNumber,10);
-
- $data['table'] = $this->mod->getAll();
-// echo $this->mod->getQuery();
-
- $data['pageList'] = $this->h['Pages']->render($page-3,7);
- $data['numberOfPages'] = $this->h['Pages']->getNumbOfPages();
-
- $data['topNotice'] = $this->getModule(array('devices',$this->controller,'catalogue'));
-
- $data['popupLabel'] = $this->mod->getPopupLabel($this->viewArgs);
-
- $data["search_string_form_value"] = strcmp($this->viewArgs['search_string'],Params::$nullQueryValue) === 0 ? "" : $this->viewArgs['search_string'];
-
- //set search_string to undef to clean the model name filter
- $temp = $this->viewArgs;
- $temp['page'] = 1;
- $temp['search_string'] = "undef";
- $data['clearViewStatus'] = Url::createUrl($temp);
-
- $this->append($data);
-
- $this->loadViewAll('catalogue');
- }
-
- protected function passWhoAskedForDeletion($id_hard)
- {
- $clean['id_hard'] = (int)$id_hard;
-
- $deletion = new DeletionModel();
- $data['deletion'] = $deletion->select()->where(array('id_hard'=>$clean['id_hard']))->send();
- $data['deletionUsers'] = $deletion->getList($data['deletion'],'created_by');
-
- $this->append($data);
- }
-
- public function cleared($lang = 'en')
- {
- $data['title'] = 'page permanently deleted - '.Website::$generalName;
-
- $data['tree'] = "device page permanently deleted";
-
- $this->append($data);
-
- $this->loadViewAll('cleared');
- }
-
- protected function view($lang = 'en', $id_hard = 0, $name = null)
- {
- $this->shift(3);
-
- //set the history_page to 1 in the viewStatus
- $this->viewArgs['history_page'] = 1;
- $this->buildStatus();
-
- $clean['id_hard'] = (int)$id_hard;
- $data['id_hard'] = $clean['id_hard'];
- $data['ne_name'] = null;
- $data['name'] = null;
- $data['tree'] = null;
- $data['isDeleted'] = false;
-
- $data['md_javascript'] = "moderator_dialog(\"devicehide\",\"device\");moderator_dialog(\"deviceshow\",\"device\");moderator_dialog(\"deviceapprove\",\"device_app\");moderator_dialog(\"deviceclear\",\"device_cl\");";
-
- if ($this->m['HardwareModel']->isCleared($clean['id_hard'])) $this->redirect('generic/cleared/'.$this->lang,0);
-
- if ($this->mod->checkType($clean['id_hard']))
- {
- $this->mod->setWhereQueryClause(array("id_hard" => $clean['id_hard']));
- $data['table'] = $this->mod->getAll();
-
- if (count($data['table']) > 0)
- {
-
- $data['talk_number'] = $this->m['TalkModel']->select('count(*) as numb,id_hard')->where(array('id_hard'=>$clean['id_hard'],'deleted'=>'no'))->rowNumber();
-
- $data['ne_name'] = $data['table'][0]['hardware']['model'];
- $data['name'] = encodeUrl($data['ne_name']);
- $data['title'] = $data['ne_name'].' - '.Website::$generalName;
- $data['tree'] = $this->getSpecHardLink() . " &raquo; <span class='last_tree_element'>".$data['ne_name']."</span>";
- $data['isDeleted'] = $this->m['HardwareModel']->isDeleted($clean['id_hard']);
- $data['isApproved'] = strcmp($data['table'][0]['hardware']['approved'],'yes') === 0 ? true : false;
-
- $data['tracksHelpTop'] = $this->getModule(array('devices',$this->controller,'page','it_tracks_users'));
- $data['tracksHelpLabel'] = $this->getModule(array('devices',$this->controller,'form','it_tracks_users'));
-
- $this->passWhoAskedForDeletion($clean['id_hard']);
- }
-
- $this->append($data);
-
- @session_start();
- if ( isset($_SESSION['notebook_inserted']) and strcmp($this->controller,'notebooks') === 0 )
- {
- $viewFilesList = 'suggest_dialog,dialog,page,if_page_deleted,moderator_dialog';
- unset($_SESSION['notebook_inserted']);
- }
- else
- {
- $viewFilesList = 'dialog,page,if_page_deleted,moderator_dialog';
- }
-
- $this->loadViewAll($viewFilesList);
- }
- else
- {
-// $this->redirect($this->_controller.'/'.);
- }
- }
-
- protected function history($lang = 'en', $id = 0)
- {
- $this->shift(2);
- $clean['id'] = (int)$id;
- $data['id'] = $clean['id'];
- $data['ne_name'] = $this->m['HardwareModel']->getTheModelName($clean['id']);
- $data['name'] = encodeUrl($data['ne_name']);
- $data['tree'] = $this->getSpecHardLink() . " &raquo; " . $this->getViewLink($clean['id'],$data['ne_name'])." &raquo; <span class='last_tree_element'>".gtext("History")."</span>";
-
- $data['title'] = 'history - '.Website::$generalName;
-
- $data['isDeleted'] = $this->m['HardwareModel']->isDeleted($clean['id']);
-
- if ($this->m['HardwareModel']->isCleared($clean['id'])) $this->redirect('generic/cleared/'.$this->lang,0);
-
- //get the first revision
- $res = $this->m['RevisionsModel']->db->select('revisions','id_rev','id_hard='.$clean['id'],null,'id_rev',1);
- if (count($res) > 0)
- {
- $data['firstRev'] = $res[0]['revisions']['id_rev'];
- }
-
- $res1 = $this->m['HardwareModel']->db->select('hardware','update_date,updated_by','id_hard='.$clean['id']);
-
- $this->m['RevisionsModel']->setWhereQueryClause(array('id_hard' => $clean['id']));
-
- //load the Pages helper
- $this->helper('Pages',$this->controller.'/history/'.$this->lang.'/'.$clean['id'],'history_page');
- //get the number of records
- $recordNumber = $this->m['RevisionsModel']->rowNumber();
- $page = $this->viewArgs['history_page'];
- //set the limit clause
- $this->m['RevisionsModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,20);
- $res2 = $this->m['RevisionsModel']->getFields('update_date,updated_by,id_rev');
-
- $data['pageList'] = $this->h['Pages']->render($page-3,7);
-
-
- $data['rev1'] = $res1;
- $data['rev2'] = $res2;
-
- $this->passWhoAskedForDeletion($clean['id']);
-
- $this->append($data);
- $this->loadViewAll('history,if_page_deleted');
- }
-
- protected function revision($lang = 'en', $id_rev = 0)
- {
- $this->shift(2);
- $clean['id_rev'] = (int)$id_rev;
-
- $this->m['RevisionsModel']->setWhereQueryClause(array("id_rev" => $clean['id_rev']));
- $data['table'] = $this->m['RevisionsModel']->getAll();
-
- $data['id_hard'] = 0;
- $data['updated_by'] = null;
- $data['update_date'] = null;
- $data['name'] = null;
- $data['ne_name'] = null;
- $data['tree'] = null;
- $data['isDeleted'] = false;
- $data['title'] = 'revision - '.Website::$generalName;
-
- if (count($data['table']) > 0)
- {
- $data['id_hard'] = (int)$data['table'][0]['revisions']['id_hard'];
-
- if ($this->m['HardwareModel']->isCleared($data['id_hard'])) $this->redirect('generic/cleared/'.$this->lang,0);
-
- $data['ne_name'] = $this->m['HardwareModel']->getTheModelName($data['id_hard']);
- $data['name'] = encodeUrl($data['ne_name']);
- $data['tree'] = $this->getSpecHardLink() . " &raquo; " . $this->getViewLink($data['id_hard'],$data['ne_name'])." &raquo; " . $this->getHistoryLink($data['id_hard']) . " &raquo; <span class='last_tree_element'>".gtext("Revision")."</span>";
-
- $data['updated_by'] = $data['table'][0]['revisions']['updated_by'];
- $data['update_date'] = $data['table'][0]['revisions']['update_date'];
-
- $data['isDeleted'] = $this->m['HardwareModel']->isDeleted($data['id_hard']);
- }
-
- $this->append($data);
- $this->loadViewAll('page');
- }
-
- protected function differences($lang = 'en', $id_hard = 0, $id_rev = 0)
- {
- $this->shift(3);
-
- $data['title'] = 'differences - '.Website::$generalName;
-
- $clean['id_hard'] = (int)$id_hard;
- $clean['id_rev'] = (int)$id_rev;
-
- $data['id_hard'] = $clean['id_hard'];
- $ne_name = $this->m['HardwareModel']->getTheModelName((int)$data['id_hard']);
- $data['name'] = encodeUrl($ne_name);
- $data['tree'] = $this->getSpecHardLink() . " &raquo; " . $this->getViewLink($data['id_hard'],$ne_name)." &raquo; " . $this->getHistoryLink($clean['id_hard']) . " &raquo; <span class='last_tree_element'>".gtext("Differences")."</span>";
-
- $data['isDeleted'] = $this->m['HardwareModel']->isDeleted($clean['id_hard']);
- $data['showDiff'] = false;
-
- $diffArray = array();
-
- if ($this->m['HardwareModel']->isCleared($clean['id_hard'])) $this->redirect('generic/cleared/'.$this->lang,0);
-
- if (strcmp($clean['id_hard'],0) !== 0 and strcmp($clean['id_rev'],0) !== 0)
- {
- $this->m['RevisionsModel']->setWhereQueryClause(array('id_hard' => $clean['id_hard'],'id_rev' => '<='.$clean['id_rev']));
- $this->m['RevisionsModel']->limit = 2;
- $res = $this->m['RevisionsModel']->getAll();
- if (count($res) > 1)
- {
- $newArray = $res[0]['revisions'];
- $oldArray = $res[1]['revisions'];
-
- $data['update_new'] = $newArray['update_date'];
- $data['update_old'] = $oldArray['update_date'];
- $data['updated_by'] = $newArray['updated_by'];
-
- $diffArray = $this->mod->getDiffArray($oldArray, $newArray);
-
- $data['showDiff'] = true;
- }
- }
- else if (strcmp($clean['id_hard'],0) !== 0 and strcmp($clean['id_rev'],0) === 0)
- {
- $this->mod->setWhereQueryClause(array('id_hard' => $clean['id_hard']));
- $lastRes = $this->mod->getAll();
-
- if (count($lastRes) > 0)
- {
- $this->m['RevisionsModel']->setWhereQueryClause(array('id_hard' => $clean['id_hard']));
- $this->m['RevisionsModel']->limit = 1;
- $revRes = $this->m['RevisionsModel']->getAll();
-
- if (count($revRes) > 0)
- {
- $newArray = $lastRes[0]['hardware'];
- $oldArray = $revRes[0]['revisions'];
-
- $data['update_new'] = $newArray['update_date'];
- $data['update_old'] = $oldArray['update_date'];
- $data['updated_by'] = $newArray['updated_by'];
-
- $diffArray = $this->mod->getDiffArray($oldArray, $newArray);
-
- $data['showDiff'] = true;
- }
- }
-
- }
-
- $data['fieldsWithBreaks'] = $this->mod->fieldsWithBreaks;
- $data['diffArray'] = $diffArray;
-
- $this->append($data);
- $this->loadViewAll('differences');
- }
-
- protected function climb($lang = 'en', $id_rev = 0, $token = '')
- {
- $this->shift(3);
-
- $data['title'] = 'make current - '.Website::$generalName;
-
- $clean['token'] = sanitizeAlphanum($token);
-
- $clean['id_rev'] = (int)$id_rev;
- $clean['id_hard'] = (int)$this->m['RevisionsModel']->getIdHard($clean['id_rev']);
-
- if ($this->m['HardwareModel']->isCleared($clean['id_hard'])) $this->redirect('generic/cleared/'.$this->lang,0);
-
- if ($clean['id_hard'] !== 0)
- {
- $deleted = $this->m['HardwareModel']->select("hardware.deleted")->where(array("id_hard"=>$clean['id_hard']))->limit(1)->toList('deleted')->send();
-
- $data['isDeleted'] = $this->m['HardwareModel']->isDeleted($clean['id_hard']);
-
- $data['id_rev'] = $clean['id_rev'];
- $data['id_hard'] = $clean['id_hard'];
- $data['ne_name'] = $this->m['HardwareModel']->getTheModelName($clean['id_hard']);
- $data['name'] = encodeUrl($data['ne_name']);
- $data['tree'] = $this->getSpecHardLink() . " &raquo; " . $this->getViewLink($data['id_hard'],$data['ne_name'])." &raquo; " . $this->getHistoryLink($clean['id_hard']) . " &raquo; <span class='last_tree_element'>make current</span>";
-
- $data['notice'] = null;
- $this->s['registered']->checkStatus();
-
- if ($this->s['registered']->status['status'] === 'logged')
- {
- if (!$this->s['registered']->checkCsrf($clean['token'])) $this->redirect($this->controller.'/catalogue/'.$this->lang,2,'wrong token..');
-
- if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..');
-
- if ($this->m['HardwareModel']->isDeleted($clean['id_hard'])) $this->redirect($this->controller.'/catalogue/'.$this->lang,2,'this device page has been deleted..');
-
- if (isset($_POST['confirmAction']))
- {
- $this->m['HardwareModel']->makeCurrent($clean['id_rev']);
-
- $this->viewRedirect($this->m['HardwareModel']->lastId);
-
- $data['notice'] = $this->m['HardwareModel']->notice;
- }
-
- $this->append($data);
- $this->loadViewAll('climb');
- }
- else
- {
- $this->redirect("users/login/".$this->lang."?redirect=".$this->controller."/view/".$this->lang."/".$clean['id_hard'],0);
- }
- }
- }
-
- protected function talk($lang = 'en', $id_hard = 0, $token = 'token')
- {
- $this->shift(3);
-
- $this->m['TalkModel']->setFields('title,message','sanitizeAll');
-
- $data['title'] = 'talk - '.Website::$generalName;
-
- $clean['token'] = sanitizeAlphanum($token);
- $clean['id_hard'] = (int)$id_hard;
- $data['id_hard'] = $clean['id_hard'];
- $data['ne_name'] = $this->m['HardwareModel']->getTheModelName($clean['id_hard']);
- $data['name'] = encodeUrl($data['ne_name']);
- $data['tree'] = $this->getSpecHardLink() . " &raquo; " . $this->getViewLink($clean['id_hard'],$data['ne_name'])." &raquo; <span class='last_tree_element'>".gtext("Talk")."</span>";
-
- $data['isDeleted'] = $this->m['HardwareModel']->isDeleted($clean['id_hard']);
-
- if ($this->m['HardwareModel']->isCleared($clean['id_hard'])) $this->redirect('generic/cleared/'.$this->lang,0);
-
- if (isset($_POST['insertAction']))
- {
- if ($this->s['registered']->status['status'] === 'logged')
- {
- if (!$this->s['registered']->checkCsrf($clean['token'])) $this->redirect($this->controller.'/catalogue/'.$this->lang,2,'wrong token..');
-
- if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..');
-
- if ($this->m['HardwareModel']->isDeleted($clean['id_hard'])) $this->redirect($this->controller.'/catalogue/'.$this->lang,2,'this device page has been deleted..');
-
- $this->m['TalkModel']->values['created_by'] = $this->s['registered']->status['id_user'];
- $this->m['TalkModel']->values['id_hard'] = $clean['id_hard'];
-
- $this->m['TalkModel']->updateTable('insert');
- }
- }
-
- //if preview
- if (isset($_POST['previewAction']))
- {
- if ($this->s['registered']->status['status'] === 'logged')
- {
- if (!$this->s['registered']->checkCsrf($clean['token'])) $this->redirect($this->controller.'/catalogue/'.$this->lang,2,'wrong token..');
-
- $data['preview_message'] = $this->request->post('message','','sanitizeHtml');
- $this->m['TalkModel']->result = false;
- }
- }
-
- $data['table'] = $this->m['TalkModel']->select()->where(array('id_hard'=>$clean['id_hard']))->orderBy('id_talk')->send();
-
- $data['values'] = $this->m['TalkModel']->getFormValues('insert','sanitizeHtml');
- $data['notice'] = $this->m['TalkModel']->notice;
-
-// javascript for moderator
- $data['md_javascript'] = "moderator_dialog(\"hide\",\"talk\");moderator_dialog(\"show\",\"talk\");";
- $data['go_to'] = $this->currPage."/".$this->lang."/".$clean['id_hard'];
-
- $this->passWhoAskedForDeletion($clean['id_hard']);
-
- $this->append($data);
- $this->loadViewAll('talk,if_page_deleted,moderator_dialog');
- }
-
- //get the link to the device page from vendorid:productid code
- protected function getAlreadyExixtsLink($code)
- {
- $hw = new HardwareModel();
- $info = $hw->getModelByCode($code);
-
- if ($info)
- {
- return $this->getViewLink($info['id_hard'],$info['model'],Hardware::getControllerFromType($info['type']));
- }
- return '';
- }
-
- protected function getViewLink($id,$ne_name,$controller = null)
- {
- $contr = isset($controller) ? $controller : $this->controller;
-
- return "<a href='".$this->baseUrl.'/'.$contr.'/view/'.$this->lang.'/'.$id.'/'.encodeUrl($ne_name).$this->viewStatus."'>".$ne_name."</a>";
- }
-
- protected function getHistoryLink($id)
- {
- return "<a href='".$this->baseUrl.'/'.$this->controller.'/history/'.$this->lang.'/'.$id.'/'.$this->viewStatus."'>".gtext("History")."</a>";
- }
-
- protected function getSpecHardLink()
- {
- return "<a href='".$this->baseUrl.'/'.$this->controller.'/catalogue/'.$this->lang.$this->viewStatus."'>".plural($this->controller)."</a>";
- }
-
- protected function goToLoginForm()
- {
- if ($this->querySanitized)
- {
- $this->redirect("users/login/".$this->lang."?redirect=".$this->controller."/".$this->action.Url::createUrl($this->_queryString));
- }
- else
- {
- $this->redirect("users/login/".$this->lang."?redirect=home/index".Url::createUrl($this->_queryString));
- }
- }
-
-}
diff --git a/h-source/Application/Controllers/HardwareController.php b/h-source/Application/Controllers/HardwareController.php
deleted file mode 100644
index a75c4fe..0000000
--- a/h-source/Application/Controllers/HardwareController.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 HardwareController extends BaseController
-{
-
- public function __construct($model, $controller, $queryString)
- {
-
- $this->_topMenuClasses['hardware'] = " class='currentitem ui-btn-active'";
-
- parent::__construct($model, $controller, $queryString);
-
- $data['title'] = 'hardware - '.Website::$generalName;
- $this->append($data);
- }
-
- public function catalogue($lang = 'en')
- {
- $this->load('left');
- $this->right();
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Controllers/HelpController.php b/h-source/Application/Controllers/HelpController.php
deleted file mode 100644
index 658b547..0000000
--- a/h-source/Application/Controllers/HelpController.php
+++ /dev/null
@@ -1,41 +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 HelpController extends WikiController
-{
-
- public function __construct($model, $controller, $queryString)
- {
- $this->_topMenuClasses['help'] = " class='currentitem'";
-
- parent::__construct($model, $controller, $queryString);
-
- $this->_topMenuClasses['wiki'] = null;
-
- $data['tm'] = $this->_topMenuClasses;
-
- $data['title'] = 'help page - '.Website::$generalName;
-
- $this->append($data);
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Controllers/HistoryController.php b/h-source/Application/Controllers/HistoryController.php
deleted file mode 100644
index e50b7e1..0000000
--- a/h-source/Application/Controllers/HistoryController.php
+++ /dev/null
@@ -1,650 +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 HistoryController extends BaseController
-{
-
- public static $typeTable = array(
- 'message' => 'message',
- 'talk' => 'talk',
- 'user' => 'user',
- 'issue' => 'issue',
- 'wiki_talk' => 'wiki talk',
- 'page' => 'wiki page',
- 'page_del' => 'wiki page',
- 'device' => 'device page',
- 'device_app' => 'device page',
- 'device_cl' => 'device page',
- 'issue_del' => 'issue', //registered
- 'issue_ins' => 'issue', //registered
- 'message_ins' => 'message', //registered
- 'talk_ins' => 'talk', //registered
- 'wiki_talk_ins' => 'wiki talk',//registered
- 'hardware' => 'hardware', //registered
- 'wiki' => 'wiki', //registered
- );
-
- public static $actionTable = array(
- 'hide' => 'hide',
- 'show' => 'show',
- 'block' => 'block',
- 'unblock' => 'unblock',
- 'open' => 'open',
- 'close' => 'close',
- 'pageblock' => 'block',
- 'pageunblock' => 'unblock',
- 'pagehide' => 'hide',
- 'pageshow' => 'show',
- 'devicehide' => 'hide',
- 'deviceshow' => 'show',
- 'deviceapprove' => 'approve',
- 'deviceclear' => 'perm deleted',
- 'issuehide' => 'hide',
- 'issueshow' => 'show',
- 'insert' => 'insert', //registered
- 'update' => 'update', //registered
- );
-
- protected $strings = array(
-
- 'hide' => array(
-
- 'action' => 'hide',
- 'check_status' => 'no',
- 'to_status' => 'yes',
- 'exec_string' => 'The message has been hidden. Just reload the page',
- 'error_string' => 'Error: the message is already hidden',
-
- ),
-
- 'show' => array(
-
- 'action' => 'show',
- 'check_status' => 'yes',
- 'to_status' => 'no',
- 'exec_string' => 'The message is no more hidden. Just reload the page',
- 'error_string' => 'Error: the message is already visible',
-
- ),
-
- 'block' => array(
-
- 'action' => 'block',
- 'check_status' => 'no',
- 'to_status' => 'yes',
- 'exec_string' => 'The user has been blocked. Just reload the page',
- 'error_string' => 'Error: the user is already blocked',
-
- ),
-
- 'unblock' => array(
-
- 'action' => 'unblock',
- 'check_status' => 'yes',
- 'to_status' => 'no',
- 'exec_string' => 'The user is no more blocked. Just reload the page',
- 'error_string' => 'Error: the user is already un-blocked',
-
- ),
-
- 'open' => array(
-
- 'action' => 'open',
- 'check_status' => 'closed',
- 'to_status' => 'opened',
- 'exec_string' => 'The issue has been opened. Just reload the page',
- 'error_string' => 'Error: the issue is already opened',
-
- ),
-
- 'close' => array(
-
- 'action' => 'close',
- 'check_status' => 'opened',
- 'to_status' => 'closed',
- 'exec_string' => 'The issue has been closed. Just reload the page',
- 'error_string' => 'Error: the issue is already closed',
-
- ),
-
- 'pageblock' => array(
-
- 'action' => 'pageblock',
- 'check_status' => 'no',
- 'to_status' => 'yes',
- 'exec_string' => 'The wiki page has been blocked. Just reload the page',
- 'error_string' => 'Error: the wiki page is already blocked',
-
- ),
-
- 'pageunblock' => array(
-
- 'action' => 'pageunblock',
- 'check_status' => 'yes',
- 'to_status' => 'no',
- 'exec_string' => 'The wiki page is no more blocked. Just reload the page',
- 'error_string' => 'Error: the wiki page is already un-blocked',
-
- ),
-
- 'pagehide' => array(
-
- 'action' => 'pagehide',
- 'check_status' => 'no',
- 'to_status' => 'yes',
- 'exec_string' => 'The wiki page has been hidden. Just reload the page',
- 'error_string' => 'Error: the wiki page is already hidden',
-
- ),
-
- 'pageshow' => array(
-
- 'action' => 'pageshow',
- 'check_status' => 'yes',
- 'to_status' => 'no',
- 'exec_string' => 'The wiki page is no more hidden. Just reload the page',
- 'error_string' => 'Error: the wiki page is already visible',
-
- ),
-
- 'issuehide' => array(
-
- 'action' => 'issuehide',
- 'check_status' => 'no',
- 'to_status' => 'yes',
- 'exec_string' => 'The issue has been hidden. Just reload the page',
- 'error_string' => 'Error: the issue is already hidden',
-
- ),
-
- 'issueshow' => array(
-
- 'action' => 'issueshow',
- 'check_status' => 'yes',
- 'to_status' => 'no',
- 'exec_string' => 'The issue is no more hidden. Just reload the page',
- 'error_string' => 'Error: the issue is already visible',
-
- ),
-
- 'devicehide' => array(
-
- 'action' => 'devicehide',
- 'check_status' => 'no',
- 'to_status' => 'yes',
- 'exec_string' => 'The device page has been hidden. Just reload the page',
- 'error_string' => 'Error: the device page is already hidden',
- 'allowed_only_if' => array('cleared'=>'no'),
-
- ),
-
- 'deviceshow' => array(
-
- 'action' => 'deviceshow',
- 'check_status' => 'yes',
- 'to_status' => 'no',
- 'exec_string' => 'The device page is no more hidden. Just reload the page',
- 'error_string' => 'Error: the device page is already visible',
- 'allowed_only_if' => array('cleared'=>'no'),
-
- ),
-
- 'deviceapprove' => array(
-
- 'action' => 'deviceapprove',
- 'check_status' => 'no',
- 'to_status' => 'yes',
- 'exec_string' => 'The device page has been approved. Just reload the page',
- 'error_string' => 'Error: the device page is already approved',
- 'allowed_only_if' => array('cleared'=>'no'),
-
- ),
-
- 'deviceclear' => array(
-
- 'action' => 'deviceclear',
- 'check_status' => 'no',
- 'to_status' => 'yes',
- 'exec_string' => 'The device page has been permanently deleted. Just reload the page',
- 'error_string' => 'Error: the device page has already been permanently deleted',
- 'method' => 'permanentlyDelete',
-
- ),
- );
-
- protected $types = array(
-
- 'message' => array(
-
- 'clean_type' => 'message',
- 'model_name' => 'MessagesModel',
- 'id_name' => 'id_mes',
- 'field_name' => 'deleted',
- 'actions' => array('hide','show'),
- 'group' => 'moderator',
-
- ),
-
- 'talk' => array(
-
- 'clean_type' => 'talk',
- 'model_name' => 'TalkModel',
- 'id_name' => 'id_talk',
- 'field_name' => 'deleted',
- 'actions' => array('hide','show'),
- 'group' => 'moderator',
-
- ),
-
- 'user' => array(
-
- 'clean_type' => 'user',
- 'model_name' => 'UsersModel',
- 'id_name' => 'id_user',
- 'field_name' => 'blocked',
- 'actions' => array('block','unblock'),
- 'group' => 'admin',
-
- ),
-
- 'issue' => array(
-
- 'clean_type' => 'issue',
- 'model_name' => 'IssuesModel',
- 'id_name' => 'id_issue',
- 'field_name' => 'status',
- 'actions' => array('open','close'),
- 'group' => 'moderator',
- 'types_to_show' => 'issue,issue_del',
-
- ),
-
- 'wiki_talk' => array(
-
- 'clean_type' => 'wiki_talk',
- 'model_name' => 'WikitalkModel',
- 'id_name' => 'id_talk',
- 'field_name' => 'deleted',
- 'actions' => array('hide','show'),
- 'group' => 'moderator',
-
- ),
-
- //page blocked or not
- 'page' => array(
-
- 'clean_type' => 'page',
- 'model_name' => 'WikiModel',
- 'id_name' => 'id_wiki',
- 'field_name' => 'blocked',
- 'actions' => array('pageblock','pageunblock'),
- 'group' => 'admin',
- 'types_to_show' => 'page,page_del',
-
- ),
-
- //page hidden or not
- 'page_del' => array(
-
- 'clean_type' => 'page_del',
- 'model_name' => 'WikiModel',
- 'id_name' => 'id_wiki',
- 'field_name' => '-deleted',
- 'actions' => array('pagehide','pageshow'),
- 'group' => 'admin',
-
- ),
-
- //issue hidden or not
- 'issue_del' => array(
-
- 'clean_type' => 'issue_del',
- 'model_name' => 'IssuesModel',
- 'id_name' => 'id_issue',
- 'field_name' => 'deleted',
- 'actions' => array('issuehide','issueshow'),
- 'group' => 'moderator',
-
- ),
-
- //device page blocked or not
- 'device' => array(
-
- 'clean_type' => 'device',
- 'model_name' => 'HardwareModel',
- 'id_name' => 'id_hard',
- 'field_name' => '-deleted',
- 'actions' => array('devicehide','deviceshow'),
- 'group' => 'admin',
- 'types_to_show' => 'device_app,device,device_cl',
-
- ),
-
- //device page approved
- 'device_app' => array(
-
- 'clean_type' => 'device_app',
- 'model_name' => 'HardwareModel',
- 'id_name' => 'id_hard',
- 'field_name' => 'approved',
- 'actions' => array('deviceapprove'),
- 'group' => 'admin',
-
- ),
-
- //device page cleared
- 'device_cl' => array(
-
- 'clean_type' => 'device_cl',
- 'model_name' => 'HardwareModel',
- 'id_name' => 'id_hard',
- 'field_name' => 'cleared',
- 'actions' => array('deviceclear'),
- 'group' => 'admin',
-
- ),
- );
-
- public function __construct($model, $controller, $queryString)
- {
- parent::__construct($model, $controller, $queryString);
-
- $this->model('HistoryModel');
- $this->model('UsersModel');
-
- }
-
- public function hide($lang = 'en', $token = '')
- {
- $this->generic($lang, $token, 'hide');
- }
-
- public function show($lang = 'en', $token = '')
- {
- $this->generic($lang, $token, 'show');
- }
-
- public function block($lang = 'en', $token = '')
- {
- $this->generic($lang, $token, 'block');
- }
-
- public function unblock($lang = 'en', $token = '')
- {
- $this->generic($lang, $token, 'unblock');
- }
-
- public function open($lang = 'en', $token = '')
- {
- $this->generic($lang, $token, 'open');
- }
-
- public function close($lang = 'en', $token = '')
- {
- $this->generic($lang, $token, 'close');
- }
-
- public function pageblock($lang = 'en', $token = '')
- {
- $this->generic($lang, $token, 'pageblock');
- }
-
- public function pageunblock($lang = 'en', $token = '')
- {
- $this->generic($lang, $token, 'pageunblock');
- }
-
- public function pagehide($lang = 'en', $token = '')
- {
- $this->generic($lang, $token, 'pagehide');
- }
-
- public function pageshow($lang = 'en', $token = '')
- {
- $this->generic($lang, $token, 'pageshow');
- }
-
- public function devicehide($lang = 'en', $token = '')
- {
- $this->generic($lang, $token, 'devicehide');
- }
-
- public function deviceshow($lang = 'en', $token = '')
- {
- $this->generic($lang, $token, 'deviceshow');
- }
-
- public function deviceapprove($lang = 'en', $token = '')
- {
- $this->generic($lang, $token, 'deviceapprove');
- }
-
- public function deviceclear($lang = 'en', $token = '')
- {
- $this->generic($lang, $token, 'deviceclear');
- }
-
- public function issuehide($lang = 'en', $token = '')
- {
- $this->generic($lang, $token, 'issuehide');
- }
-
- public function issueshow($lang = 'en', $token = '')
- {
- $this->generic($lang, $token, 'issueshow');
- }
-
- protected function generic($lang = 'en', $token = '', $action = 'hide')
- {
- header('Content-type: text/html; charset=UTF-8');
-
- $this->shift(2);
-
- $this->clean();
-
- $clean['token'] = sanitizeAlphanum($token);
-
- if ($this->s['registered']->status['status'] === 'logged')
- {
- if (!$this->s['registered']->checkCsrf($clean['token'])) die("wrong token");
-
- if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) die("your account has been blocked");
-
- $clean['id_user'] = (int)$this->s['registered']->status['id_user'];
- $clean['id'] = $this->request->post('id',0,'forceInt');
- $type = $this->request->post('type','','sanitizeAll');
- $message = $this->request->post('message','');
-
- $modelName = 'error';
-
- if (array_key_exists($type,$this->types))
- {
- if (in_array($action,$this->types[$type]['actions']))
- {
- $clean['group'] = $this->types[$type]['group'];
- if (in_array($clean['group'],$this->s['registered']->status['groups']))
- {
- $modelName = $this->types[$type]['model_name'];
- $clean['type'] = $this->types[$type]['clean_type'];
- $clean['id_name'] = $this->types[$type]['id_name'];
- $clean['field_name'] = $this->types[$type]['field_name'];
-
- //load the right model
- $this->model($modelName);
- $model = $this->m[$modelName];
-
- $model->select()->where(array($clean['id_name'] => $clean['id'],$clean['field_name'] => $this->strings[$action]['check_status']));
-
- if (isset($this->strings[$action]['allowed_only_if']) and is_array($this->strings[$action]['allowed_only_if']))
- {
- $model->aWhere($this->strings[$action]['allowed_only_if']);
- }
-
- $count = $model->rowNumber();
-
- if ($count > 0)
- {
- if (eg_strlen($message) < 500)
- {
- //drop the - char if present
- $clean['field_name'] = str_replace('-',null,$clean['field_name']);
-
- //hide the message
- $model->values = array($clean['field_name'] => $this->strings[$action]['to_status']);
-
- if (isset($this->strings[$action]['method']))
- {
- call_user_func(array($model, $this->strings[$action]['method']),$clean['id']);
- }
- else
- {
- $model->pUpdate($clean['id']);
- }
-
- if ($model->queryResult)
- {
- $this->m['HistoryModel']->setFields('id:forceInt,type,message','sanitizeAll');
- $this->m['HistoryModel']->values['created_by'] = $clean['id_user'];
- $this->m['HistoryModel']->values['gr'] = $clean['group'];
- $this->m['HistoryModel']->values['action'] = $this->strings[$action]['action'];
- $this->m['HistoryModel']->updateTable('insert');
-
- echo $this->strings[$action]['exec_string'];
- }
- else
- {
- echo "error: one error occurred, please retry later";
- }
- }
- else
- {
- echo "error: the message has too many characters or wrong type";
- }
- }
- else
- {
- echo $this->strings[$action]['error_string'];
- }
- }
- }
- }
- }
- }
-
- public function viewall($lang = 'en', $type = 'message', $id = 0)
- {
- header('Content-type: text/html; charset=UTF-8');
-
- $this->shift(3);
-
- $this->clean();
-
- if ($this->s['registered']->status['status'] === 'logged')
- {
- if (!$this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user']))
- {
- $clean['id'] = (int)$id;
- if (array_key_exists($type,$this->types))
- {
- $clean['group'] = $this->types[$type]['group'];
- if (in_array($clean['group'],$this->s['registered']->status['groups']))
- {
- $clean['type'] = $this->types[$type]['clean_type'];
- $clean['typeInWhereClause'] = "'".$clean['type']."'";
-
- if (array_key_exists('types_to_show',$this->types[$type]))
- {
- $clean['typeInWhereClause'] = "'".implode("','",explode(',',$this->types[$type]['types_to_show']))."'";
- }
-
- switch ($clean['type'])
- {
- case 'user':
- $data['object'] = 'user';
- $data['box_class'] = 'details_of_actions_inner_user';
- break;
- case 'page':
- $data['object'] = 'wiki page';
- $data['box_class'] = 'details_of_actions_inner_user';
- break;
- case 'device':
- $data['object'] = 'device page';
- $data['box_class'] = 'details_of_actions_inner_user';
- break;
- case 'device_app':
- $data['object'] = 'device page';
- $data['box_class'] = 'details_of_actions_inner_user';
- break;
- case 'page_del':
- $data['object'] = 'wiki page';
- $data['box_class'] = 'details_of_actions_inner_user';
- break;
- case 'issue':
- $data['object'] = 'issue';
- $data['box_class'] = 'details_of_actions_inner_user';
- break;
- default:
- $data['object'] = 'message';
- $data['box_class'] = 'details_of_actions_inner';
- break;
- }
-
- $data['res'] = $this->m['HistoryModel']
- ->select()
- ->where(
- array
- (
- 'id'=>$clean['id'],
- 'type'=>"in(".$clean['typeInWhereClause'].")",
- 'gr'=>$clean['group'])
- )
- ->send();
-// echo $this->m['HistoryModel']->getQuery();
-
- $data['md_action'] = array(
- 'hide' => 'hidden',
- 'show' => 'restored',
- 'block' => 'blocked',
- 'unblock' => 'un-blocked',
- 'open' => 'opened again',
- 'close' => 'closed',
- 'pageblock' => 'blocked',
- 'pageunblock' => 'un-blocked',
- 'pagehide' => 'hidden',
- 'pageshow' => 'restored',
- 'devicehide' => 'hidden',
- 'deviceshow' => 'restored',
- 'deviceapprove' => 'approved',
- 'deviceclear' => 'permanently deleted',
- 'issuehide' => 'hidden',
- 'issueshow' => 'restored',
- );
-
- $this->append($data);
- $this->load('viewall');
- }
- }
- }
- }
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Controllers/HomeController.php b/h-source/Application/Controllers/HomeController.php
deleted file mode 100644
index 3c47547..0000000
--- a/h-source/Application/Controllers/HomeController.php
+++ /dev/null
@@ -1,47 +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 HomeController extends BaseController
-{
-
- public function __construct($model, $controller, $queryString)
- {
-
- $this->_topMenuClasses['home'] = " class='currentitem ui-btn-active'";
-
- parent::__construct($model, $controller, $queryString);
-
- $data['title'] = 'home - '.Website::$generalName;
- $this->append($data);
- }
-
- public function index($lang = 'en')
- {
-// get the news container
- $data['htmlNewsBox'] = $this->getModule(array('top_news'));
-
- $this->append($data);
- $this->cleverLoad('left');
- $this->right($lang);
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Controllers/HostcontrollersController.php b/h-source/Application/Controllers/HostcontrollersController.php
deleted file mode 100644
index 3655aa1..0000000
--- a/h-source/Application/Controllers/HostcontrollersController.php
+++ /dev/null
@@ -1,137 +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 HostcontrollersController extends GenericController
-{
-
- public function __construct($model, $controller, $queryString)
- {
-
- $worksOptions = Hostcontrollers::$select;
- $worksField = 'compatibility';
- $interfaceOptions = Hostcontrollers::$interface;
-
- parent::__construct($model, $controller, $queryString);
-
- //load the model
- $this->model('HardwareModel');
- $this->model('RevisionsModel');
- $this->model('HostcontrollersModel');
- $this->model('TalkModel');
-
- $this->mod = $this->m['HostcontrollersModel'];
-
- $this->m['HardwareModel']->id_user = $this->s['registered']->status['id_user'];
- $this->m['HardwareModel']->type = 'host-controller';
-
- $this->m['HardwareModel']->setConditions($worksOptions,$worksField,$interfaceOptions);
-
- $this->m['HardwareModel']->strongConditions['insert']["+++++checkIsStrings|".Hostcontrollers::subtypeList()] = "subtype";
-
- $this->m['HardwareModel']->strongConditions['update'] = $this->m['HardwareModel']->strongConditions['insert'];
-
- $this->m['HardwareModel']->setFields('model,kernel,description,distribution,comm_year,compatibility,pci_id,interface,driver,subtype,other_names','sanitizeAll');
-
- $argKeys = array(
- 'page:forceNat' => 1,
- 'history_page:forceNat' => 1,
- 'vendor:sanitizeString' => 'undef',
- 'comm_year:sanitizeString' => 'undef',
- 'compatibility:sanitizeString' => 'undef',
- 'subtype:sanitizeString' => 'undef',
- 'sort-by:sanitizeString' => 'compatibility-desc',
- 'search_string:sanitizeString' => 'undef'
- );
-
- $this->setArgKeys($argKeys);
-
- $data['title'] = 'Host controller';
-
- $data['intefaceOptions'] = $interfaceOptions;
- $data['worksOptions'] = $worksOptions;
- $data['worksField'] = $worksField;
-
- $data['notFoundString'] = "No Host Controller found";
-
- $data['subtypeHelpLabel'] = "PCMCIA, USB, Firewire, HECI";
-
- $this->append($data);
- }
-
- public function catalogue($lang = 'en')
- {
- $this->shift(1);
-
- $whereArray = array(
- 'type' => $this->mod->type,
- 'vendor' => $this->viewArgs['vendor'],
- 'comm_year' => $this->viewArgs['comm_year'],
- 'compatibility' => $this->viewArgs['compatibility'],
- 'subtype' => $this->viewArgs['subtype'],
- );
-
- $this->mod->setWhereQueryClause($whereArray);
-
- parent::catalogue($lang);
- }
-
- public function view($lang = 'en', $id = 0, $name = null)
- {
- parent::view($lang, $id, $name);
- }
-
- public function history($lang = 'en', $id = 0)
- {
- parent::history($lang, $id);
- }
-
- public function revision($lang = 'en', $id_rev = 0)
- {
- parent::revision($lang, $id_rev);
- }
-
- public function insert($lang = 'en', $token = '')
- {
- parent::insert($lang, $token);
- }
-
- public function update($lang = 'en', $token = '')
- {
- parent::update($lang, $token);
- }
-
- public function differences($lang = 'en', $id_hard = 0, $id_rev = 0)
- {
- parent::differences($lang, $id_hard, $id_rev);
- }
-
- public function climb($lang = 'en', $id_rev = 0, $token = '')
- {
- parent::climb($lang, $id_rev, $token);
- }
-
- public function talk($lang = 'en', $id_hard = 0, $token = '')
- {
- parent::talk($lang, $id_hard, $token);
- }
-
-}
diff --git a/h-source/Application/Controllers/ImageController.php b/h-source/Application/Controllers/ImageController.php
deleted file mode 100644
index 6774b4a..0000000
--- a/h-source/Application/Controllers/ImageController.php
+++ /dev/null
@@ -1,41 +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 ImageController extends Controller {
-
- public function captcha()
- {
- session_start();
-
- $params = array(
- 'fontPath' => ROOT.'/External/Fonts/FreeFont/FreeMono.ttf',
- 'boxHeight' => 100,
- 'boxWidth' => 200,
- 'undulation'=> true,
- 'align' => false
- );
-
- $captcha = new Image_Gd_Captcha($params);
- $captcha->render();
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Controllers/IssuesController.php b/h-source/Application/Controllers/IssuesController.php
deleted file mode 100644
index 6f7b74b..0000000
--- a/h-source/Application/Controllers/IssuesController.php
+++ /dev/null
@@ -1,203 +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 IssuesController extends BaseController
-{
-
- public function __construct($model, $controller, $queryString)
- {
-
- $this->_topMenuClasses['issues'] = " class='currentitem'";
-
- parent::__construct($model, $controller, $queryString);
-
- $this->model('IssuesModel');
- $this->model('MessagesModel');
- $this->model('UsersModel');
-
- $argKeys = array(
- 'page:forceNat' => 1,
- 'token:sanitizeAlphanum' => $this->token,
- );
-
- $this->setArgKeys($argKeys);
-
- $data['title'] = 'issues - '.Website::$generalName;
- $this->append($data);
- }
-
- public function viewall($lang = 'en')
- {
- $this->shift(1);
-
- $this->m['IssuesModel']->setFields('title,topic,priority,message','sanitizeAll');
-
- $data['preview_message'] = null;
-
- if (isset($_POST['insertAction']))
- {
- if ($this->s['registered']->status['status'] === 'logged')
- {
- if (!$this->s['registered']->checkCsrf($this->viewArgs['token'])) $this->redirect('home/index/'.$this->lang,2,'wrong token..');
-
- if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..');
-
- //set the page to 1 in the viewStatus
- $this->viewArgs['page'] = 1;
- $this->buildStatus();
-
- $clean['id_user'] = (int)$this->s['registered']->status['id_user'];
-
- $this->m['IssuesModel']->values['created_by'] = $clean['id_user'];
- $this->m['IssuesModel']->values['status'] = 'opened';
- $this->m['IssuesModel']->values['update_date'] = date('Y-m-d H:i:s');
- $this->m['IssuesModel']->updateTable('insert');
-
- }
- }
-
- //if preview
- if (isset($_POST['previewAction']))
- {
- if ($this->s['registered']->status['status'] === 'logged')
- {
- if (!$this->s['registered']->checkCsrf($this->viewArgs['token'])) $this->redirect('home/index/'.$this->lang,2,'wrong token..');
-
- $data['preview_message'] = $this->request->post('message','','sanitizeHtml');
- $this->m['IssuesModel']->result = false;
- }
- }
-
- $data['notice'] = $this->m['IssuesModel']->notice;
-
- $this->viewArgs['token'] = $this->token;
- $this->buildStatus();
-
- $this->m['IssuesModel']->setForm('issues/viewall/'.$this->lang.$this->viewStatus."#form",array('previewAction'=>'preview','insertAction'=>'submit'));
-
- $values = $this->m['IssuesModel']->getFormValues('insert','sanitizeHtml');
-
- $data['form'] = $this->m['IssuesModel']->form->render($values);
-
- //load the Pages helper
- $this->helper('Pages',$this->controller.'/viewall/'.$this->lang,'page');
- //get the number of records
- $this->m['IssuesModel']->from('issues')->left('messages')->using('id_issue')->groupBy('issues.id_issue')->orderBy('issues.update_date desc');
-
- if ($this->islogged === "no")
- {
- $this->m['IssuesModel']->where(array("n!issues.deleted"=>"no"));
- }
-
- $recordNumber = $this->m['IssuesModel']->rowNumber();
- $page = $this->viewArgs['page'];
- //set the limit clause
- $this->m['IssuesModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,30);
- $data['table'] = $this->m['IssuesModel']->select('issues.*,messages.message,count(*) as numb_mess')->send();
-
- $data['pageList'] = $this->h['Pages']->render($page-4,10);
-
- $this->append($data);
- $this->load('viewall');
- $this->right();
- }
-
- public function view($lang = 'en', $id_issue = 0)
- {
- $this->m['MessagesModel']->setFields('message','sanitizeAll');
-
- $this->shift(2);
-
- $clean['id_issue'] = (int)$id_issue;
- $data['id_issue'] = $clean['id_issue'];
- $data['preview_message'] = null;
-
- //if submit
- if (isset($_POST['insertAction']))
- {
- if ($this->s['registered']->status['status'] === 'logged')
- {
- if (!$this->s['registered']->checkCsrf($this->viewArgs['token'])) $this->redirect('home/index/'.$this->lang,2,'wrong token..');
-
- if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..');
-
- $clean['id_user'] = (int)$this->s['registered']->status['id_user'];
-
- $this->m['MessagesModel']->values['created_by'] = $clean['id_user'];
- $this->m['MessagesModel']->values['id_issue'] = $clean['id_issue'];
- $this->m['MessagesModel']->updateTable('insert');
-
- if ($this->m['MessagesModel']->queryResult)
- {
- $this->m['IssuesModel']->values = array('update_date' => date('Y-m-d H:i:s'));
- $this->m['IssuesModel']->update($clean['id_issue']);
-
- $domainName = rtrim(Url::getRoot(),"/");
- header('Refresh: 0;url='.$domainName.$_SERVER['REQUEST_URI']);
- exit;
- }
- }
- }
-
- //if preview
- if (isset($_POST['previewAction']))
- {
- if ($this->s['registered']->status['status'] === 'logged')
- {
- if (!$this->s['registered']->checkCsrf($this->viewArgs['token'])) $this->redirect('home/index/'.$this->lang,2,'wrong token..');
-
- $data['preview_message'] = $this->request->post('message','','sanitizeHtml');
- $this->m['MessagesModel']->result = false;
- }
- }
-
- $data['notice'] = $this->m['MessagesModel']->notice;
-
- $this->viewArgs['token'] = $this->token;
- $this->buildStatus();
-
- //create the form
- $this->m['MessagesModel']->setForm('issues/view/'.$this->lang."/".$clean['id_issue'].$this->viewStatus."#form",array('previewAction'=>'preview','insertAction'=>'submit'));
-
- $values = $this->m['MessagesModel']->getFormValues('insert','sanitizeHtml');
-
- $data['form'] = $this->m['MessagesModel']->form->render($values);
-
- //retrieve the values from the table
- $data['table'] = $this->m['IssuesModel']->select()->where(array('id_issue'=>$clean['id_issue']))->send();
-
-// javascript for moderator
- $data['md_javascript'] = "moderator_dialog(\"hide\",\"message\");moderator_dialog(\"show\",\"message\");moderator_dialog(\"open\",\"issue\");moderator_dialog(\"close\",\"issue\");moderator_dialog(\"issuehide\",\"issue_del\");moderator_dialog(\"issueshow\",\"issue_del\");";
- $data['go_to'] = $this->currPage."/".$this->lang."/".$clean['id_issue'];
-
- if (count($data['table']) > 0)
- {
- $data['messages'] = $this->m['MessagesModel']->select()->where(array('id_issue'=>$clean['id_issue']))->send();
-
- $this->append($data);
- $this->load('view');
- $this->load('moderator_dialog');
- $this->right();
- }
- }
-
-}
diff --git a/h-source/Application/Controllers/MeetController.php b/h-source/Application/Controllers/MeetController.php
deleted file mode 100644
index 808b951..0000000
--- a/h-source/Application/Controllers/MeetController.php
+++ /dev/null
@@ -1,338 +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 MeetController extends BaseController
-{
- private $whereArray = array(
- 'has_confirmed' => 0,
- 'deleted' => 'no',
- );
-
- public function __construct($model, $controller, $queryString)
- {
- parent::__construct($model, $controller, $queryString);
-
- $this->model('ProfileModel');
- $this->model('HardwareModel');
- $this->model('IssuesModel');
- $this->model('MessagesModel');
- $this->model('TalkModel');
- $this->model('WikiModel');
- $this->model('WikitalkModel');
-
- $argKeys = array(
- 'page:forceNat' => 1,
- );
-
- $this->setArgKeys($argKeys);
-
- $data['title'] = 'meet - '.Website::$generalName;
- $this->append($data);
- }
-
- //public page of the user
- public function user($lang = 'en', $user = '')
- {
- $clean['user'] = ctype_alnum($user) ? sanitizeAll($user) : '';
- $data['title'] = "meet ".$clean['user']." - ".Website::$generalName;
-
- $this->shift(2);
-
- if ($this->m['UsersModel']->userExists($clean['user']))
- {
- $clean['id_user'] = (int)$this->m['UsersModel']->getUserId($clean['user']);
- $data['meet_id_user'] = $clean['id_user'];
-
- $data['isBlocked'] = $this->m['UsersModel']->isBlocked($clean['id_user']);
-
- $this->whereArray['username'] = $clean['user'];
-
- $data['table'] = $this->m['ProfileModel']->select('regusers.e_mail,regusers.username,profile.*')->from('regusers inner join profile')->on('regusers.id_user = profile.created_by')->where($this->whereArray)->send();
-
- $data['meet_username'] = $clean['user'];
-
-// javascript for moderator
- $data['md_javascript'] = "moderator_dialog(\"block\",\"user\");moderator_dialog(\"unblock\",\"user\");";
-
- $this->append($data);
- $this->load('meet');
- $this->load('moderator_dialog');
- $this->right();
- }
-
- }
-
- //contributions menu
- public function contributions($lang = 'en', $user = '')
- {
- $clean['user'] = ctype_alnum($user) ? sanitizeAll($user) : '';
- $data['title'] = $clean['user']." contributions - ".Website::$generalName;
-
- $this->shift(2);
-
- if ($this->m['UsersModel']->userExists($clean['user']))
- {
- $clean['id_user'] = (int)$this->m['UsersModel']->getUserId($clean['user']);
-
- $this->whereArray['username'] = $clean['user'];
-
- $data['meet_username'] = $clean['user'];
-
- $hardNumb = $this->m['HardwareModel']->select()->where($this->whereArray)->rowNumber();
-
- $issuesNumb = $this->m['IssuesModel']->select('id_issue')->where(array('created_by'=>$clean['id_user'],'deleted'=>'no'))->rowNumber();
-
- $messNumb = $this->m['MessagesModel']->select('id_mes,messages.id_issue,messages.creation_date')->where(array('created_by'=>$clean['id_user'],'deleted'=>'no'))->rowNumber();
-
- $talkNumb = $this->m['TalkModel']->where(array('created_by'=>$clean['id_user'],'deleted'=>'no'))->rowNumber();
-
- $wikiNumb = $this->m['WikiModel']->where($this->whereArray)->rowNumber();
-
- $wikiTalkNumb = $this->m['WikitalkModel']->where(array('created_by'=>$clean['id_user'],'deleted'=>'no'))->rowNumber();
-
- $data['hasHardware'] = $hardNumb > 0 ? true : false;
- $data['hasIssues'] = $issuesNumb > 0 ? true : false;
- $data['hasMessages'] = $messNumb > 0 ? true : false;
- $data['hasTalk'] = $talkNumb > 0 ? true : false;
- $data['hasWiki'] = $wikiNumb > 0 ? true : false;
- $data['hasWikiTalk'] = $wikiTalkNumb > 0 ? true : false;
-
- $this->append($data);
- $this->load('contributions');
- $this->right();
- }
-
- }
-
- //hardware contributions
- public function hardware($lang = 'en', $user = '')
- {
- $clean['user'] = ctype_alnum($user) ? sanitizeAll($user) : '';
- $data['title'] = "hardware contributions - ".Website::$generalName;
-
- $this->shift(2);
-
- if ($this->m['UsersModel']->userExists($clean['user']))
- {
- $this->whereArray['username'] = $clean['user'];
-
- $data['table'] = $this->m['HardwareModel']->select('hardware.*,regusers.username')->where($this->whereArray)->send();
-
- $data['meet_username'] = $clean['user'];
-
- $data['tree_last_string'] = "hardware contributions";
- $data['page_explanation_title'] = "hardware contributions of";
-
- $this->append($data);
- $this->load('list_template');
- $this->right();
- }
-
- }
-
- //issues opened
- public function issues($lang = 'en', $user = '')
- {
- $clean['user'] = ctype_alnum($user) ? sanitizeAll($user) : '';
- $data['title'] = "issues submitted - ".Website::$generalName;
-
- $this->shift(2);
-
- if ($this->m['UsersModel']->userExists($clean['user']))
- {
- //load the Pages helper
- $this->helper('Pages','meet/issues/'.$this->lang.'/'.$clean['user'],'page');
-
- $clean['id_user'] = (int)$this->m['UsersModel']->getUserId($clean['user']);
-
- $this->m['IssuesModel']->select('id_issue')->where(array('created_by'=>$clean['id_user'],'deleted'=>'no'))->orderBy('id_issue desc');
-
- $recordNumber = $this->m['IssuesModel']->rowNumber();
- $page = $this->viewArgs['page'];
-
- $this->m['IssuesModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,20);
-
- $data['table'] = $this->m['IssuesModel']->select('id_issue,creation_date,title')->send();
-
- $data['pageList'] = $this->h['Pages']->render($page-3,7);
-
- $data['meet_username'] = $clean['user'];
-
- $data['tree_last_string'] = "issues opened";
- $data['page_explanation_title'] = "issues opened by";
-
- $this->append($data);
- $this->load('list_template');
- $this->right();
- }
-
- }
-
- //messages submitted
- public function messages($lang = 'en', $user = '')
- {
- $clean['user'] = ctype_alnum($user) ? sanitizeAll($user) : '';
- $data['title'] = "messages submitted - ".Website::$generalName;
-
- $this->shift(2);
-
- if ($this->m['UsersModel']->userExists($clean['user']))
- {
- //load the Pages helper
- $this->helper('Pages','meet/messages/'.$this->lang.'/'.$clean['user'],'page');
-
- $clean['id_user'] = (int)$this->m['UsersModel']->getUserId($clean['user']);
-
- $this->m['MessagesModel']->from('messages inner join issues')->on('messages.id_issue=issues.id_issue')->select('id_mes,messages.id_issue,messages.creation_date,title')->where(array('created_by'=>$clean['id_user'],'deleted'=>'no'))->orderBy('id_mes desc');
-
- $recordNumber = $this->m['MessagesModel']->rowNumber();
- $page = $this->viewArgs['page'];
-
- $this->m['MessagesModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,20);
-
- $data['table'] = $this->m['MessagesModel']->send();
-
- $data['meet_username'] = $clean['user'];
-
- $data['tree_last_string'] = "messages submitted";
- $data['page_explanation_title'] = "messages submitted by";
-
- $data['pageList'] = $this->h['Pages']->render($page-3,7);
-
- $this->append($data);
- $this->load('list_template');
- $this->right();
- }
- }
-
- //messages in the talk page of the devices
- public function talk($lang = 'en', $user = '')
- {
- $clean['user'] = ctype_alnum($user) ? sanitizeAll($user) : '';
- $data['title'] = "talk messages submitted - ".Website::$generalName;
-
- $this->shift(2);
-
- if ($this->m['UsersModel']->userExists($clean['user']))
- {
- //load the Pages helper
- $this->helper('Pages','meet/talk/'.$this->lang.'/'.$clean['user'],'page');
-
- $clean['id_user'] = (int)$this->m['UsersModel']->getUserId($clean['user']);
-
- $this->m['TalkModel']->inner('hardware')->using('id_hard')->select('talk.*,hardware.*')->where(array('created_by'=>$clean['id_user'],'deleted'=>'no'))->orderBy('id_talk desc');
-
- $recordNumber = $this->m['TalkModel']->rowNumber();
- $page = $this->viewArgs['page'];
-
- $this->m['TalkModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,20);
-
- $data['table'] = $this->m['TalkModel']->send();
-
- $data['meet_username'] = $clean['user'];
-
- $data['tree_last_string'] = "talk messages (hardware pages)";
- $data['page_explanation_title'] = "talk messages (hardware pages) submitted by";
-
- $data['pageList'] = $this->h['Pages']->render($page-3,7);
-
- $this->append($data);
- $this->load('list_template');
- $this->right();
- }
- }
-
- //hardware contributions
- public function wiki($lang = 'en', $user = '')
- {
- $clean['user'] = ctype_alnum($user) ? sanitizeAll($user) : '';
- $data['title'] = "wiki contributions - ".Website::$generalName;
-
- $this->shift(2);
-
- if ($this->m['UsersModel']->userExists($clean['user']))
- {
- //load the Pages helper
- $this->helper('Pages','meet/wiki/'.$this->lang.'/'.$clean['user'],'page');
-
- $this->whereArray['username'] = $clean['user'];
-
- $data['table'] = $this->m['WikiModel']->select('wiki.*,regusers.username')->where($this->whereArray)->orderBy('wiki.id_wiki desc');
-
- $recordNumber = $this->m['WikiModel']->rowNumber();
- $page = $this->viewArgs['page'];
-
- $this->m['WikiModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,30);
-
- $data['table'] = $this->m['WikiModel']->send();
-
- $data['meet_username'] = $clean['user'];
-
- $data['tree_last_string'] = "wiki contributions";
- $data['page_explanation_title'] = "wiki contributions of";
-
- $data['pageList'] = $this->h['Pages']->render($page-5,11);
-
- $this->append($data);
- $this->load('list_template');
- $this->right();
- }
-
- }
-
- //messages in the talk page of the wiki pages
- public function wikitalk($lang = 'en', $user = '')
- {
- $clean['user'] = ctype_alnum($user) ? sanitizeAll($user) : '';
- $data['title'] = "talk messages submitted - ".Website::$generalName;
-
- $this->shift(2);
-
- if ($this->m['UsersModel']->userExists($clean['user']))
- {
- //load the Pages helper
- $this->helper('Pages','meet/wikitalk/'.$this->lang.'/'.$clean['user'],'page');
-
- $clean['id_user'] = (int)$this->m['UsersModel']->getUserId($clean['user']);
-
- $this->m['WikitalkModel']->where(array('created_by'=>$clean['id_user'],'deleted'=>'no'))->orderBy('id_talk desc');
-
- $recordNumber = $this->m['WikitalkModel']->rowNumber();
- $page = $this->viewArgs['page'];
-
- $this->m['WikitalkModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,20);
-
- $data['table'] = $this->m['WikitalkModel']->send();
-
- $data['meet_username'] = $clean['user'];
-
- $data['tree_last_string'] = "talk messages (wiki pages)";
- $data['page_explanation_title'] = "talk messages (wiki pages) submitted by";
-
- $data['pageList'] = $this->h['Pages']->render($page-3,7);
-
- $this->append($data);
- $this->load('list_template');
- $this->right();
- }
- }
-} \ No newline at end of file
diff --git a/h-source/Application/Controllers/ModemsController.php b/h-source/Application/Controllers/ModemsController.php
deleted file mode 100644
index 2b308b6..0000000
--- a/h-source/Application/Controllers/ModemsController.php
+++ /dev/null
@@ -1,131 +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 ModemsController extends GenericController
-{
-
- public function __construct($model, $controller, $queryString)
- {
-
- $worksOptions = Modems::$select;
- $worksField = 'compatibility';
- $interfaceOptions = Modems::$interface;
-
- parent::__construct($model, $controller, $queryString);
-
- //load the model
- $this->model('HardwareModel');
- $this->model('RevisionsModel');
- $this->model('ModemsModel');
- $this->model('TalkModel');
-
- $this->mod = $this->m['ModemsModel'];
-
- $this->m['HardwareModel']->id_user = $this->s['registered']->status['id_user'];
- $this->m['HardwareModel']->type = 'modem';
-
- $this->m['HardwareModel']->setConditions($worksOptions,$worksField,$interfaceOptions);
-
- $this->m['HardwareModel']->setFields('model,kernel,description,distribution,comm_year,compatibility,pci_id,interface,driver,other_names','sanitizeAll');
-
- $argKeys = array(
- 'page:forceNat' => 1,
- 'history_page:forceNat' => 1,
- 'vendor:sanitizeString' => 'undef',
- 'comm_year:sanitizeString' => 'undef',
- 'compatibility:sanitizeString' => 'undef',
- 'interface:sanitizeString' => 'undef',
- 'sort-by:sanitizeString' => 'compatibility-desc',
- 'search_string:sanitizeString' => 'undef'
- );
-
- $this->setArgKeys($argKeys);
-
- $data['title'] = 'Modems';
-
- $data['intefaceOptions'] = $interfaceOptions;
- $data['worksOptions'] = $worksOptions;
- $data['worksField'] = $worksField;
-
- $data['notFoundString'] = "No modems found";
-
- $this->append($data);
- }
-
- public function catalogue($lang = 'en')
- {
- $this->shift(1);
-
- $whereArray = array(
- 'type' => $this->mod->type,
- 'vendor' => $this->viewArgs['vendor'],
- 'comm_year' => $this->viewArgs['comm_year'],
- 'compatibility' => $this->viewArgs['compatibility'],
- 'interface' => $this->viewArgs['interface'],
- );
-
- $this->mod->setWhereQueryClause($whereArray);
-
- parent::catalogue($lang);
- }
-
- public function view($lang = 'en', $id = 0, $name = null)
- {
- parent::view($lang, $id, $name);
- }
-
- public function history($lang = 'en', $id = 0)
- {
- parent::history($lang, $id);
- }
-
- public function revision($lang = 'en', $id_rev = 0)
- {
- parent::revision($lang, $id_rev);
- }
-
- public function insert($lang = 'en', $token = '')
- {
- parent::insert($lang, $token);
- }
-
- public function update($lang = 'en', $token = '')
- {
- parent::update($lang, $token);
- }
-
- public function differences($lang = 'en', $id_hard = 0, $id_rev = 0)
- {
- parent::differences($lang, $id_hard, $id_rev);
- }
-
- public function climb($lang = 'en', $id_rev = 0, $token = '')
- {
- parent::climb($lang, $id_rev, $token);
- }
-
- public function talk($lang = 'en', $id_hard = 0, $token = '')
- {
- parent::talk($lang, $id_hard, $token);
- }
-
-}
diff --git a/h-source/Application/Controllers/MyController.php b/h-source/Application/Controllers/MyController.php
deleted file mode 100644
index 69b8da7..0000000
--- a/h-source/Application/Controllers/MyController.php
+++ /dev/null
@@ -1,214 +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 MyController extends BaseController
-{
-
- public function __construct($model, $controller, $queryString) {
- parent::__construct($model, $controller, $queryString);
-
- $this->model('UsersModel');
- $this->model('ProfileModel');
-
- $argKeys = array(
- 'token:sanitizeAlphanum' => 'token'
- );
-
- $this->setArgKeys($argKeys);
-
- $data['title'] = 'my panel';
- $this->append($data);
- }
-
- public function home($lang = 'en')
- {
- $this->shift(1);
-
- $data['title'] = 'my panel - '.Website::$generalName;
-
- $this->s['registered']->check();
-
- $clean['id_user'] = (int)$this->s['registered']->status['id_user'];
- $data['username'] = $this->m['UsersModel']->getUser($clean['id_user']);
-
- $data['userBlocked'] = $this->m['UsersModel']->isBlocked($clean['id_user']);
-
- $this->append($data);
- $this->load('panel');
- $this->right($this->lang);
- }
-
- public function password($lang = 'en')
- {
- $this->shift(1);
-
- $data['title'] = 'password - '.Website::$generalName;
-
- $this->s['registered']->check();
-
- if (!$this->s['registered']->checkCsrf($this->viewArgs['token'])) $this->redirect($this->controller.'/home/'.$this->lang,2,'wrong token..');
-
- $this->m['UsersModel']->setFields('password:sha1','none');
-
- $this->m['UsersModel']->strongConditions['update'] = array('checkEqual'=>'password,confirmation');
-
- $data['notice'] = null;
-
- $clean['id_user'] = (int)$this->s['registered']->status['id_user'];
-
- if (isset($_POST['updateAction'])) {
- $pass = $this->s['registered']->getPassword();
- if (sha1($_POST['old']) === $pass)
- {
- $this->m['UsersModel']->updateTable('update',$clean['id_user']);
- $data['notice'] = $this->m['UsersModel']->notice;
- if ($this->m['UsersModel']->queryResult)
- {
- $this->s['registered']->logout();
- $this->redirect('home/index/'.$this->lang,2,'logout');
- }
- }
- else
- {
- $data['notice'] = "<div class='alert'>The old password is wrong</div>\n";
- }
- }
-
- $values = $this->m['UsersModel']->selectId($clean['id_user']);
- $values['old'] = '';
- $values['confirmation'] = '';
-
- $action = array('updateAction'=>'save');
- $form = new Form_Form('my/password/'.$this->lang.$this->viewStatus,$action);
- $form->setEntry('old','Password');
- $form->entry['old']->labelString = 'old password:';
- $form->setEntry('password','Password');
- $form->setEntry('confirmation','Password');
- $data['form'] = $form->render($values,'old,password,confirmation');
-
- $this->append($data);
-
- $this->load('password');
- $this->right();
- }
-
- public function email($lang = 'en')
- {
- $this->shift(1);
-
- $data['title'] = 'email - '.Website::$generalName;
-
- $this->s['registered']->check();
-
- if (!$this->s['registered']->checkCsrf($this->viewArgs['token'])) $this->redirect($this->controller.'/home/'.$this->lang,2,'wrong token..');
-
- $this->m['UsersModel']->setFields('e_mail','sanitizeAll');
-
- $this->m['UsersModel']->strongConditions['update'] = array('checkMail'=>'e_mail');
-
- $this->m['UsersModel']->databaseConditions['update'] = array('checkUniqueCompl'=>'e_mail');
-
- $data['notice'] = null;
-
- $clean['id_user'] = (int)$this->s['registered']->status['id_user'];
-
- $this->m['UsersModel']->updateTable('update',$clean['id_user']);
- $data['notice'] = $this->m['UsersModel']->notice;
-
- $values = $this->m['UsersModel']->selectId($clean['id_user']);
-
- $action = array('updateAction'=>'save');
- $form = new Form_Form('my/email/'.$this->lang.$this->viewStatus,$action);
- $form->setEntry('e_mail','InputText');
- $form->entry['e_mail']->labelString = 'your e-mail address:';
- $data['form'] = $form->render($values,'e_mail');
-
- $this->append($data);
-
- $this->load('email');
- $this->right();
- }
-
- public function profile($lang = 'en')
- {
- $this->shift(1);
-
- $data['title'] = 'profile - '.Website::$generalName;
-
- $this->s['registered']->check();
-
- if (!$this->s['registered']->checkCsrf($this->viewArgs['token'])) $this->redirect($this->controller.'/home/'.$this->lang,2,'wrong token..');
-
- $this->m['ProfileModel']->setFields('real_name,website,where_you_are,birth_date,fav_distro,projects,publish_mail,send_notification,description','sanitizeAll');
-
- $clean['id_user'] = (int)$this->s['registered']->status['id_user'];
-
- $res = $this->m['ProfileModel']->db->select('profile','id_prof','created_by='.$clean['id_user']);
- $clean['id_prof'] = (int)$res[0]['profile']['id_prof'];
-
- $this->m['ProfileModel']->values['update_date'] = date('Y-m-d H:i:s');
- $this->m['ProfileModel']->updateTable('update',$clean['id_prof']);
- $data['notice'] = $this->m['ProfileModel']->notice;
-
- $values = $this->m['ProfileModel']->getFormValues('update','sanitizeHtml',$clean['id_prof']);
-
- $this->m['ProfileModel']->setForm('my/profile/'.$this->lang.$this->viewStatus,array('updateAction'=>'save'),'POST');
- $data['form'] = $this->m['ProfileModel']->form->render($values);
-
- $this->append($data);
-
- $this->load('profile');
- $this->right();
- }
-
- public function goodbye($lang = 'en')
- {
- $data['title'] = 'delete - '.Website::$generalName;
-
- session_start();
-
- $this->shift(1);
-
- $this->s['registered']->check();
-
- if (!$this->s['registered']->checkCsrf($this->viewArgs['token'])) $this->redirect($this->controller.'/home/'.$this->lang,2,'wrong token..');
-
- $clean['id_user'] = (int)$this->s['registered']->status['id_user'];
-
- if (isset($_POST['closeAction']))
- {
- $this->s['registered']->logout();
- $this->m['UsersModel']->close($clean['id_user']);
-
- if ($this->m['UsersModel']->queryResult)
- {
- $this->redirect('users/notice/'.$this->lang);
- }
-
- }
-
- $this->append($data);
- $this->load('goodbye');
- $this->right();
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Controllers/NewsController.php b/h-source/Application/Controllers/NewsController.php
deleted file mode 100644
index 1d500c9..0000000
--- a/h-source/Application/Controllers/NewsController.php
+++ /dev/null
@@ -1,67 +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 NewsController extends BaseController
-{
-
- public function __construct($model, $controller, $queryString)
- {
-
- $this->_topMenuClasses['news'] = " class='currentitem'";
-
- parent::__construct($model, $controller, $queryString);
-
- $this->model('NewsModel');
-
- $data['title'] = 'news - '.Website::$generalName;
- $this->append($data);
- }
-
- public function index($lang = 'en')
- {
- $argKeys = array(
- 'page:forceNat' => 1,
- );
-
- $this->setArgKeys($argKeys);
-
- $this->shift(1);
-
- $this->helper('Pages',$this->controller.'/index/'.$this->lang,'page');
- $this->h['Pages']->nextString = 'older news';
- $this->h['Pages']->previousString = 'latest news';
- $page = $this->viewArgs['page'];
- $recordNumber = $this->m['NewsModel']->rowNumber();
- $data['recordNumber'] = $recordNumber;
-
- //set the limit clause
- $limit = $this->h['Pages']->getLimit($page,$recordNumber,10);
-
- $data['table'] = $this->m['NewsModel']->select()->limit($limit)->send();
- $data['pageList'] = $this->h['Pages']->render($page,0);
-
- $this->append($data);
- $this->load('index');
- $this->right($lang);
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Controllers/NotebooksController.php b/h-source/Application/Controllers/NotebooksController.php
deleted file mode 100644
index 1daf894..0000000
--- a/h-source/Application/Controllers/NotebooksController.php
+++ /dev/null
@@ -1,159 +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 NotebooksController extends GenericController
-{
-
- public function __construct($model, $controller, $queryString)
- {
-
- parent::__construct($model, $controller, $queryString);
-
- //load the model
- $this->model('HardwareModel');
- $this->model('RevisionsModel');
- $this->model('NotebooksModel');
- $this->model('TalkModel');
-
- $this->mod = $this->m['NotebooksModel'];
-
- $this->m['HardwareModel']->id_user = $this->s['registered']->status['id_user'];
- $this->m['HardwareModel']->type = 'notebook';
-
- //hardware conditions
- $this->m['HardwareModel']->strongConditions['update'] = array(
- "checkIsStrings|".Notebooks::vendorsList() => "vendor",
- "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",
- "+checkIsStrings|".Notebooks::compatibilityList() => "compatibility",
- "checkLength|190" => "model",
- "+checkLength|299" => "distribution",
- "++checkIsStrings|".Hardware::getCommYears() => "comm_year",
- "+++checkIsStrings|".Notebooks::$subtypeSelect => "subtype",
- "++++checkIsStrings|".Notebooks::wifiList() => "wifi_works",
- "+++++checkIsStrings|".Notebooks::videoList() => "video_card_works",
- "++++++checkIsStrings|".Notebooks::biosList() => "bios",
- "+++++++checkIsStrings|".Notebooks::webcamList() => "webcam_works",
- "++++++++checkIsStrings|".Notebooks::architectureList() => "architecture",
- "+++++++++checkIsStrings|".Notebooks::installableList() => "can_free_systems_be_installed",
- "++++++++++checkIsStrings|".Notebooks::preventWifiList() => "prevent_wifi",
- );
-
- $this->m['HardwareModel']->strongConditions['insert'] = $this->m['HardwareModel']->strongConditions['update'];
-
- $this->m['HardwareModel']->softConditions['update'] = array(
- "checkMatch|".Hardware::$regExpressions['kernel'] => "kernel|characters not allowed in the <i>kernel</i> entry",
- "checkLength|40000" => "description",
- "++checkLength|99" => "video_card_type,wifi_type",
- "+++checkLength|99" => "kernel",
- "+checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\/\,\:\;\(\)\[\]]+$/" => "video_card_type|only the following characters are allowed for the <i>videocard</i> entry: a-z A-Z 0-9 - _ . + / , : ; ( ) [ ]",
- "++checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\/\,\:\;\(\)\[\]]+$/" => "wifi_type|only the following characters are allowed for the <i>wifi</i> entry: a-z A-Z 0-9 - _ . + / , : ; ( ) [ ]",
- "+++checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\/\,\:\;\(\)\[\]]+$/" => "webcam_type|only the following characters are allowed for the <i>webcam</i> entry: a-z A-Z 0-9 - _ . + / , : ; ( ) [ ]",
- );
-
- $this->m['HardwareModel']->softConditions['insert'] = $this->m['HardwareModel']->softConditions['update'];
-
- $this->m['HardwareModel']->setFields('vendor,model,compatibility,kernel,description,distribution,video_card_type,video_card_works,wifi_type,wifi_works,comm_year,subtype,bios,can_free_systems_be_installed,webcam_type,webcam_works,architecture,prevent_wifi','sanitizeAll');
-
- $argKeys = array(
- 'page:forceNat' => 1,
- 'history_page:forceNat' => 1,
- 'vendor:sanitizeString' => 'undef',
- 'compatibility:sanitizeString' => 'undef',
- 'comm_year:sanitizeString' => 'undef',
- 'subtype:sanitizeString' => 'undef',
- 'sort-by:sanitizeString' => 'compatibility',
- 'bios:sanitizeString' => 'undef',
- 'architecture:sanitizeString' => 'undef',
- 'search_string:sanitizeString' => 'undef'
- );
-
- $this->setArgKeys($argKeys);
-
- $data['worksField'] = 'compatibility';
-
- $data['notFoundString'] = "No notebooks found";
-
- $data['title'] = 'Notebooks';
- $this->append($data);
- }
-
- public function catalogue($lang = 'en')
- {
- $this->shift(1);
-
- $whereArray = array(
- 'type' => $this->mod->type,
- 'vendor' => $this->viewArgs['vendor'],
- 'comm_year' => $this->viewArgs['comm_year'],
- 'subtype' => $this->viewArgs['subtype'],
- 'compatibility' => $this->viewArgs['compatibility'],
- 'bios' => $this->viewArgs['bios'],
- 'architecture' => $this->viewArgs['architecture'],
- );
-
- $this->mod->setWhereQueryClause($whereArray);
-
- parent::catalogue($lang);
- }
-
- public function view($lang = 'en', $id = 0, $name = null)
- {
- parent::view($lang, $id, $name);
- }
-
- public function history($lang = 'en', $id = 0)
- {
- parent::history($lang, $id);
- }
-
- public function revision($lang = 'en', $id_rev = 0)
- {
- parent::revision($lang, $id_rev);
- }
-
- public function insert($lang = 'en', $token = '')
- {
- parent::insert($lang, $token);
- }
-
- public function update($lang = 'en', $token = '')
- {
- parent::update($lang, $token);
- }
-
- public function differences($lang = 'en', $id_hard = 0, $id_rev = 0)
- {
- parent::differences($lang, $id_hard, $id_rev);
- }
-
- public function climb($lang = 'en', $id_rev = 0, $token = '')
- {
- parent::climb($lang, $id_rev, $token);
- }
-
- public function talk($lang = 'en', $id_hard = 0, $token = '')
- {
- parent::talk($lang, $id_hard, $token);
- }
-
-}
diff --git a/h-source/Application/Controllers/PrintersController.php b/h-source/Application/Controllers/PrintersController.php
deleted file mode 100644
index 8610314..0000000
--- a/h-source/Application/Controllers/PrintersController.php
+++ /dev/null
@@ -1,154 +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 PrintersController extends GenericController
-{
-
- public function __construct($model, $controller, $queryString)
- {
-
- parent::__construct($model, $controller, $queryString);
-
- //load the model
- $this->model('HardwareModel');
- $this->model('RevisionsModel');
- $this->model('PrintersModel');
- $this->model('TalkModel');
-
- $this->mod = $this->m['PrintersModel'];
-
- $this->m['HardwareModel']->id_user = $this->s['registered']->status['id_user'];
- $this->m['HardwareModel']->type = 'printer';
-
- //hardware conditions
- $this->m['HardwareModel']->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|".Printer::compatibilityList() => "compatibility",
- "++checkIsStrings|".Hardware::getCommYears() => "comm_year",
- "+++checkIsStrings|".Printer::$interface => "interface",
- "++++checkIsStrings|".Printer::$subtype => "subtype",
- "+++++checkIsStrings|".Printer::$trackSelect => "it_tracks_users",
- );
-
- $this->m['HardwareModel']->strongConditions['insert'] = $this->m['HardwareModel']->strongConditions['update'];
-
- $this->m['HardwareModel']->softConditions['update'] = array(
- "checkMatch|".Hardware::$regExpressions['kernel'] => "kernel|characters not allowed in the <i>kernel</i> entry",
- "checkLength|40000" => "description",
- "+checkLength|49" => "driver",
- "++checkLength|99" => "kernel",
- "++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->m['HardwareModel']->softConditions['insert'] = $this->m['HardwareModel']->softConditions['update'];
-
- $this->m['HardwareModel']->setFields('model,kernel,description,compatibility,distribution,comm_year,pci_id,driver,interface,subtype,other_names,it_tracks_users','sanitizeAll');
-
- $argKeys = array(
- 'page:forceNat' => 1,
- 'history_page:forceNat' => 1,
- 'vendor:sanitizeString' => 'undef',
- 'compatibility:sanitizeString' => 'undef',
- 'comm_year:sanitizeString' => 'undef',
- 'interface:sanitizeString' => 'undef',
- 'sort-by:sanitizeString' => 'compatibility',
- 'search_string:sanitizeString' => 'undef'
- );
-
- $this->setArgKeys($argKeys);
-
- $data['title'] = 'printers';
-
- $data['intefaceOptions'] = Printer::$interface;
- $data['worksOptions'] = Printer::$compatibility;
- $data['worksField'] = 'compatibility';
-
- $data['notFoundString'] = "No printers found";
-
- $data['subtypeHelpLabel'] = "laser, inkjet, ..";
-
- $this->append($data);
- }
-
- public function catalogue($lang = 'en')
- {
- $this->shift(1);
-
- $whereArray = array(
- 'type' => $this->mod->type,
- 'vendor' => $this->viewArgs['vendor'],
- 'compatibility' => $this->viewArgs['compatibility'],
- 'comm_year' => $this->viewArgs['comm_year'],
- 'interface' => $this->viewArgs['interface'],
- );
-
- $this->mod->setWhereQueryClause($whereArray);
-
- parent::catalogue($lang);
- }
-
- public function view($lang = 'en', $id = 0, $name = null)
- {
- parent::view($lang, $id, $name);
- }
-
- public function history($lang = 'en', $id = 0)
- {
- parent::history($lang, $id);
- }
-
- public function revision($lang = 'en', $id_rev = 0)
- {
- parent::revision($lang, $id_rev);
- }
-
- public function insert($lang = 'en', $token = '')
- {
- parent::insert($lang, $token);
- }
-
- public function update($lang = 'en', $token = '')
- {
- parent::update($lang, $token);
- }
-
- public function differences($lang = 'en', $id_hard = 0, $id_rev = 0)
- {
- parent::differences($lang, $id_hard, $id_rev);
- }
-
- public function climb($lang = 'en', $id_rev = 0, $token = '')
- {
- parent::climb($lang, $id_rev, $token);
- }
-
- public function talk($lang = 'en', $id_hard = 0, $token = '')
- {
- parent::talk($lang, $id_hard, $token);
- }
-
-}
diff --git a/h-source/Application/Controllers/ProjectController.php b/h-source/Application/Controllers/ProjectController.php
deleted file mode 100644
index 234fb59..0000000
--- a/h-source/Application/Controllers/ProjectController.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 ProjectController extends BaseController
-{
-
- public function __construct($model, $controller, $queryString)
- {
- $this->_topMenuClasses['project'] = " class='currentitem ui-btn-active'";
-
- parent::__construct($model, $controller, $queryString);
-
- $data['title'] = 'project - '.Website::$generalName;
- $this->append($data);
- }
-
- public function index($lang = 'en')
- {
- $this->cleverLoad('index');
- $this->right();
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Controllers/RaidadaptersController.php b/h-source/Application/Controllers/RaidadaptersController.php
deleted file mode 100644
index be248b4..0000000
--- a/h-source/Application/Controllers/RaidadaptersController.php
+++ /dev/null
@@ -1,131 +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 RaidadaptersController extends GenericController
-{
-
- public function __construct($model, $controller, $queryString)
- {
-
- $worksOptions = Raidadapters::$select;
- $worksField = 'compatibility';
- $interfaceOptions = Raidadapters::$interface;
-
- parent::__construct($model, $controller, $queryString);
-
- //load the model
- $this->model('HardwareModel');
- $this->model('RevisionsModel');
- $this->model('RaidadaptersModel');
- $this->model('TalkModel');
-
- $this->mod = $this->m['RaidadaptersModel'];
-
- $this->m['HardwareModel']->id_user = $this->s['registered']->status['id_user'];
- $this->m['HardwareModel']->type = 'RAID-adapter';
-
- $this->m['HardwareModel']->setConditions($worksOptions,$worksField,$interfaceOptions);
-
- $this->m['HardwareModel']->setFields('model,kernel,description,distribution,comm_year,compatibility,pci_id,interface,driver,other_names','sanitizeAll');
-
- $argKeys = array(
- 'page:forceNat' => 1,
- 'history_page:forceNat' => 1,
- 'vendor:sanitizeString' => 'undef',
- 'comm_year:sanitizeString' => 'undef',
- 'compatibility:sanitizeString' => 'undef',
- 'interface:sanitizeString' => 'undef',
- 'sort-by:sanitizeString' => 'compatibility-desc',
- 'search_string:sanitizeString' => 'undef'
- );
-
- $this->setArgKeys($argKeys);
-
- $data['title'] = 'Acquisition cards';
-
- $data['intefaceOptions'] = $interfaceOptions;
- $data['worksOptions'] = $worksOptions;
- $data['worksField'] = $worksField;
-
- $data['notFoundString'] = "No RAID adapter found";
-
- $this->append($data);
- }
-
- public function catalogue($lang = 'en')
- {
- $this->shift(1);
-
- $whereArray = array(
- 'type' => $this->mod->type,
- 'vendor' => $this->viewArgs['vendor'],
- 'comm_year' => $this->viewArgs['comm_year'],
- 'compatibility' => $this->viewArgs['compatibility'],
- 'interface' => $this->viewArgs['interface'],
- );
-
- $this->mod->setWhereQueryClause($whereArray);
-
- parent::catalogue($lang);
- }
-
- public function view($lang = 'en', $id = 0, $name = null)
- {
- parent::view($lang, $id, $name);
- }
-
- public function history($lang = 'en', $id = 0)
- {
- parent::history($lang, $id);
- }
-
- public function revision($lang = 'en', $id_rev = 0)
- {
- parent::revision($lang, $id_rev);
- }
-
- public function insert($lang = 'en', $token = '')
- {
- parent::insert($lang, $token);
- }
-
- public function update($lang = 'en', $token = '')
- {
- parent::update($lang, $token);
- }
-
- public function differences($lang = 'en', $id_hard = 0, $id_rev = 0)
- {
- parent::differences($lang, $id_hard, $id_rev);
- }
-
- public function climb($lang = 'en', $id_rev = 0, $token = '')
- {
- parent::climb($lang, $id_rev, $token);
- }
-
- public function talk($lang = 'en', $id_hard = 0, $token = '')
- {
- parent::talk($lang, $id_hard, $token);
- }
-
-}
diff --git a/h-source/Application/Controllers/RssController.php b/h-source/Application/Controllers/RssController.php
deleted file mode 100644
index 0a74695..0000000
--- a/h-source/Application/Controllers/RssController.php
+++ /dev/null
@@ -1,64 +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 RssController extends SpecialController
-{
-
- public function __construct($model, $controller, $queryString)
- {
- parent::__construct($model, $controller, $queryString);
-
- $data['title'] = 'RSS - '.Website::$generalName;
- $this->append($data);
- }
-
- public function modifications($lang = 'en')
- {
- header ("Content-Type:application/rss+xml");
- parent::modifications($lang);
-
- $data['statusnetText'] = null;
- $this->append($data);
-
- $this->clean();
- $this->load('modifications');
- }
-
- //RSS feeds for identi.ca or StatusNet
- public function statusnet($lang = 'en')
- {
- $this->modifications($lang);
-
- $data['statusnetText'] = Website::$statusnetGroupText;
- $this->append($data);
- }
-
- public function notapproved($lang = 'en')
- {
- $this->shift(1);
-
- $this->pagelist($lang,'notapproved');
- $this->clean();
- $this->load('notapproved');
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Controllers/ScannersController.php b/h-source/Application/Controllers/ScannersController.php
deleted file mode 100644
index 80dc229..0000000
--- a/h-source/Application/Controllers/ScannersController.php
+++ /dev/null
@@ -1,127 +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 ScannersController extends GenericController
-{
-
- public function __construct($model, $controller, $queryString)
- {
-
- parent::__construct($model, $controller, $queryString);
-
- //load the model
- $this->model('HardwareModel');
- $this->model('RevisionsModel');
- $this->model('ScannersModel');
- $this->model('TalkModel');
-
- $this->mod = $this->m['ScannersModel'];
-
- $this->m['HardwareModel']->id_user = $this->s['registered']->status['id_user'];
- $this->m['HardwareModel']->type = 'scanner';
-
- $this->m['HardwareModel']->setConditions(Printer::compatibilityList(),'compatibility',Printer::$interface);
-
- $this->m['HardwareModel']->setFields('model,kernel,description,compatibility,distribution,comm_year,pci_id,driver,interface,other_names','sanitizeAll');
-
- $argKeys = array(
- 'page:forceNat' => 1,
- 'history_page:forceNat' => 1,
- 'vendor:sanitizeString' => 'undef',
- 'compatibility:sanitizeString' => 'undef',
- 'comm_year:sanitizeString' => 'undef',
- 'interface:sanitizeString' => 'undef',
- 'sort-by:sanitizeString' => 'compatibility',
- 'search_string:sanitizeString' => 'undef'
- );
-
- $this->setArgKeys($argKeys);
-
- $data['title'] = 'scanners';
-
- $data['intefaceOptions'] = Printer::$interface;
- $data['worksOptions'] = Printer::$compatibility;
- $data['worksField'] = 'compatibility';
-
- $data['notFoundString'] = "No scanners found";
-
- $this->append($data);
- }
-
- public function catalogue($lang = 'en')
- {
- $this->shift(1);
-
- $whereArray = array(
- 'type' => $this->mod->type,
- 'vendor' => $this->viewArgs['vendor'],
- 'compatibility' => $this->viewArgs['compatibility'],
- 'comm_year' => $this->viewArgs['comm_year'],
- 'interface' => $this->viewArgs['interface'],
- );
-
- $this->mod->setWhereQueryClause($whereArray);
-
- parent::catalogue($lang);
- }
-
- public function view($lang = 'en', $id = 0, $name = null)
- {
- parent::view($lang, $id, $name);
- }
-
- public function history($lang = 'en', $id = 0)
- {
- parent::history($lang, $id);
- }
-
- public function revision($lang = 'en', $id_rev = 0)
- {
- parent::revision($lang, $id_rev);
- }
-
- public function insert($lang = 'en', $token = '')
- {
- parent::insert($lang, $token);
- }
-
- public function update($lang = 'en', $token = '')
- {
- parent::update($lang, $token);
- }
-
- public function differences($lang = 'en', $id_hard = 0, $id_rev = 0)
- {
- parent::differences($lang, $id_hard, $id_rev);
- }
-
- public function climb($lang = 'en', $id_rev = 0, $token = '')
- {
- parent::climb($lang, $id_rev, $token);
- }
-
- public function talk($lang = 'en', $id_hard = 0, $token = '')
- {
- parent::talk($lang, $id_hard, $token);
- }
-
-}
diff --git a/h-source/Application/Controllers/SdcardreadersController.php b/h-source/Application/Controllers/SdcardreadersController.php
deleted file mode 100644
index 9d156cf..0000000
--- a/h-source/Application/Controllers/SdcardreadersController.php
+++ /dev/null
@@ -1,131 +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 SdcardreadersController extends GenericController
-{
-
- public function __construct($model, $controller, $queryString)
- {
-
- $worksOptions = Sdcardreaders::$select;
- $worksField = 'sd_card_works';
- $interfaceOptions = Sdcardreaders::$interface;
-
- parent::__construct($model, $controller, $queryString);
-
- //load the model
- $this->model('HardwareModel');
- $this->model('RevisionsModel');
- $this->model('SdcardreadersModel');
- $this->model('TalkModel');
-
- $this->mod = $this->m['SdcardreadersModel'];
-
- $this->m['HardwareModel']->id_user = $this->s['registered']->status['id_user'];
- $this->m['HardwareModel']->type = 'sd-card-reader';
-
- $this->m['HardwareModel']->setConditions($worksOptions,$worksField,$interfaceOptions);
-
- $this->m['HardwareModel']->setFields('model,kernel,description,distribution,comm_year,sd_card_works,pci_id,interface,driver,other_names','sanitizeAll');
-
- $argKeys = array(
- 'page:forceNat' => 1,
- 'history_page:forceNat' => 1,
- 'vendor:sanitizeString' => 'undef',
- 'comm_year:sanitizeString' => 'undef',
- 'sd_card_works:sanitizeString' => 'undef',
- 'interface:sanitizeString' => 'undef',
- 'sort-by:sanitizeString' => 'sdcard-works',
- 'search_string:sanitizeString' => 'undef'
- );
-
- $this->setArgKeys($argKeys);
-
- $data['title'] = 'SD card readers';
-
- $data['intefaceOptions'] = $interfaceOptions;
- $data['worksOptions'] = $worksOptions;
- $data['worksField'] = $worksField;
-
- $data['notFoundString'] = "No SD card readers found";
-
- $this->append($data);
- }
-
- public function catalogue($lang = 'en')
- {
- $this->shift(1);
-
- $whereArray = array(
- 'type' => $this->mod->type,
- 'vendor' => $this->viewArgs['vendor'],
- 'comm_year' => $this->viewArgs['comm_year'],
- 'sd_card_works' => $this->viewArgs['sd_card_works'],
- 'interface' => $this->viewArgs['interface'],
- );
-
- $this->mod->setWhereQueryClause($whereArray);
-
- parent::catalogue($lang);
- }
-
- public function view($lang = 'en', $id = 0, $name = null)
- {
- parent::view($lang, $id, $name);
- }
-
- public function history($lang = 'en', $id = 0)
- {
- parent::history($lang, $id);
- }
-
- public function revision($lang = 'en', $id_rev = 0)
- {
- parent::revision($lang, $id_rev);
- }
-
- public function insert($lang = 'en', $token = '')
- {
- parent::insert($lang, $token);
- }
-
- public function update($lang = 'en', $token = '')
- {
- parent::update($lang, $token);
- }
-
- public function differences($lang = 'en', $id_hard = 0, $id_rev = 0)
- {
- parent::differences($lang, $id_hard, $id_rev);
- }
-
- public function climb($lang = 'en', $id_rev = 0, $token = '')
- {
- parent::climb($lang, $id_rev, $token);
- }
-
- public function talk($lang = 'en', $id_hard = 0, $token = '')
- {
- parent::talk($lang, $id_hard, $token);
- }
-
-}
diff --git a/h-source/Application/Controllers/SearchController.php b/h-source/Application/Controllers/SearchController.php
deleted file mode 100644
index 1892f70..0000000
--- a/h-source/Application/Controllers/SearchController.php
+++ /dev/null
@@ -1,267 +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 SearchController extends BaseController
-{
-
- public function __construct($model, $controller, $queryString)
- {
-
- $this->_topMenuClasses['search'] = " class='currentitem'";
-
- parent::__construct($model, $controller, $queryString);
-
- $this->model('HardwareModel');
-
- $data['title'] = 'search - '.Website::$generalName;
- $this->append($data);
- }
-
- public function form($lang = 'en')
- {
- $this->cleverLoad('form');
- $this->right();
- }
-
- public function results($lang = 'en')
- {
- Params::$nullQueryValue = 'undef';
-
- $argKeys = array(
- 'page:forceNat' => 1,
- 'action:sanitizeAlphanum' => 'search',
- 'type:sanitizeString' => 'notebook',
- 'model:sanitizeString' => 'undef',
- );
-
- $this->setArgKeys($argKeys);
-
- $this->shift(1);
-
- if (strcmp($this->viewArgs['action'],'search') === 0)
- {
- Params::$whereClauseSymbolArray = array('like');
-
- $this->m['HardwareModel']->logicalOperators = array('AND','OR');
-
- $whereClause = array(
- 'type' => $this->viewArgs['type'],
- 'level1' => array(
- 'model' => "like '%".$this->viewArgs['model']."%'",
- 'other_names' => "like '%".$this->viewArgs['model']."%'",
- ),
-// 'model' => "like '%".$this->viewArgs['model']."%'",
-// 'other_names' => "like '%".$this->viewArgs['model']."%'",
- '-deleted' => "no",
- 'cleared' => "no",
- );
-
- $recordNumber = $this->m['HardwareModel']->clear()->where($whereClause)->orderBy("id_hard desc")->rowNumber();
-
- $data['recordNumber'] = $recordNumber;
-
- //load the Pages helper
- $this->helper('Pages',$this->controller.'/results/'.$this->lang,'page');
- $page = $this->viewArgs['page'];
- //set the limit clause
- $limit = $this->h['Pages']->getLimit($page,$recordNumber,10);
-
- $data['table'] = $this->m['HardwareModel']->clear()->select('id_hard,model,type,comm_year,other_names')->where($whereClause)->limit($limit)->orderBy("id_hard desc")->send();
-// echo $this->m['HardwareModel']->getQuery();
-
- $data['pageList'] = $this->h['Pages']->render($page-3,7);
-
- $this->append($data);
- $this->cleverLoad('results');
- $this->right();
- }
-
- }
-
- public function pciid($lang = 'en')
- {
- if (isset($_POST['pciid']))
- {
- $clean['pciid'] = $this->request->post('pciid','','sanitizePciid');
- $data['table'] = $this->m['HardwareModel']->clear()->select()->where(array('pci_id'=>$clean['pciid']))->send();
- $data['recordNumber'] = 0;
-
- $this->append($data);
- $this->cleverLoad('results');
- $this->right();
- }
- }
-
- public function lspci($lang = 'en')
- {
- if (isset($_POST['lspci']))
- {
- $data['notice'] = null;
-
- $lspci = $this->request->post('lspci','','sanitizeHtml');
- $lspciResult = array();
- $flag = true;
-
- if (strlen($lspci)<50000)
- {
- $lspci = nl2br($lspci);
- $lspciArray = explode('<br />',$lspci);
- reset($lspciArray);
- while(current($lspciArray) !== false)
- {
- $item = current($lspciArray);
- if( preg_match( '/Slot\:(.*)([0-9a-zA-Z]{2}\:[0-9a-zA-Z]{2}\.[0-9a-zA-Z]{1})/i', $item ) )
-// if (stristr($item,'Slot'))
- {
- $temp = array();
-// class
- if (next($lspciArray) !== false)
- {
- $item = trim(current($lspciArray));
- if( preg_match( '/Class\:(.*)\[(.*)\]/i', $item, $matches ) )
- {
- $temp['className'] = sanitizeAll($matches[1]);
- $temp['classId'] = sanitizeAll($matches[2]);
- }
- else
- {
- $temp['className'] = "unknown";
- $temp['classId'] = "unknown";
- }
- }
- else
- {
- $flag = false;
- break;
- }
-
-// vendor
- if (next($lspciArray) !== false)
- {
- $item = trim(current($lspciArray));
- if( preg_match( '/Vendor\:(.*)\[(.*)\]/i', $item, $matches ) )
- {
- $temp['vendorName'] = sanitizeAll($matches[1]);
- $temp['vendorId'] = sanitizeAll($matches[2]);
- }
- else
- {
- $temp['vendorName'] = "unknown";
- $temp['vendorId'] = "unknown";
- }
- }
- else
- {
- $flag = false;
- break;
- }
-
-// device
- if (next($lspciArray) !== false)
- {
- $item = trim(current($lspciArray));
- if( preg_match( '/Device\:(.*)\[(.*)\]/i', $item, $matches ) )
- {
- $temp['deviceName'] = sanitizeAll($matches[1]);
- $temp['deviceId'] = sanitizeAll($matches[2]);
- }
- else
- {
- $temp['deviceName'] = "unknown";
- $temp['deviceId'] = "unknown";
- }
- }
- else
- {
- $flag = false;
- break;
- }
-
- $lspciResult[] = $temp;
- }
- next($lspciArray);
- }
- if (count($lspciResult) === 0 or $flag === false)
- {
- $data['notice'] = "<div class='alert'>".gtext('the text submitted by you does not seem to be the lspci -vmmnn output. Please check the text and try again')."</div>\n";
- $flag = false;
- }
- }
- else
- {
- $data['notice'] = "<div class='alert'>the lspci output is too long</div>\n";
- $flag = false;
- }
-
- $data['flag'] = $flag;
-
- $data['table'] = array();
- $data['notFoundDevices'] = array();
-
- if ($flag)
- {
- $lspciFiltered = array();
- $vendorIDProductIDArray = array();
- foreach ($lspciResult as $device)
- {
- if (array_key_exists($device['classId'],Hardware::$deviceClasses))
- {
- $vendorIDProductIDArray[] = sanitizePciid($device['vendorId'].":".$device['deviceId']);
- $lspciFiltered[] = $device;
- }
- }
- if (count($vendorIDProductIDArray) > 0)
- {
- $whereString = "'".implode("','",$vendorIDProductIDArray)."'";
- $data['table'] = $this->m['HardwareModel']->select()->where(array('pci_id'=>"in($whereString)"))->send();
-
- $foundPciidArray = $this->m['HardwareModel']
- ->select('pci_id')
- ->where(array('pci_id'=>"in($whereString)"))
- ->toList('pci_id')
- ->send();
-
- $notFoundDevices = array(); //list of devices not found inside the database
- $notFoundPciIdList = array(); //to check that it does not take the same device twice
-
- foreach ($lspciFiltered as $device)
- {
- if (!in_array($device['vendorId'].":".$device['deviceId'],$foundPciidArray))
- {
- if (!in_array($device['vendorId'].":".$device['deviceId'],$notFoundPciIdList))
- {
- $notFoundDevices[] = $device;
- $notFoundPciIdList[] = $device['vendorId'].":".$device['deviceId'];
- }
- }
- }
-
- $data['notFoundDevices'] = $notFoundDevices;
- }
-
- }
- $this->append($data);
- $this->cleverLoad('lspci_results');
- $this->right();
- }
- }
-} \ No newline at end of file
diff --git a/h-source/Application/Controllers/SoundcardsController.php b/h-source/Application/Controllers/SoundcardsController.php
deleted file mode 100644
index fff5e77..0000000
--- a/h-source/Application/Controllers/SoundcardsController.php
+++ /dev/null
@@ -1,127 +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 SoundcardsController extends GenericController
-{
-
- public function __construct($model, $controller, $queryString)
- {
-
- parent::__construct($model, $controller, $queryString);
-
- //load the model
- $this->model('HardwareModel');
- $this->model('RevisionsModel');
- $this->model('SoundcardsModel');
- $this->model('TalkModel');
-
- $this->mod = $this->m['SoundcardsModel'];
-
- $this->m['HardwareModel']->id_user = $this->s['registered']->status['id_user'];
- $this->m['HardwareModel']->type = 'soundcard';
-
- $this->m['HardwareModel']->setConditions(Soundcards::$audioSelect,'sound_card_works',Soundcards::$interface);
-
- $this->m['HardwareModel']->setFields('model,kernel,description,distribution,comm_year,sound_card_works,pci_id,interface,driver,other_names','sanitizeAll');
-
- $argKeys = array(
- 'page:forceNat' => 1,
- 'history_page:forceNat' => 1,
- 'vendor:sanitizeString' => 'undef',
- 'comm_year:sanitizeString' => 'undef',
- 'sound_card_works:sanitizeString' => 'undef',
- 'interface:sanitizeString' => 'undef',
- 'sort-by:sanitizeString' => 'sound-card-works',
- 'search_string:sanitizeString' => 'undef'
- );
-
- $this->setArgKeys($argKeys);
-
- $data['title'] = 'Soundcard';
-
- $data['intefaceOptions'] = Soundcards::$interface;
- $data['worksOptions'] = Soundcards::$audioSelect;
- $data['worksField'] = 'sound_card_works';
-
- $data['notFoundString'] = "No sound cards found";
-
- $this->append($data);
- }
-
- public function catalogue($lang = 'en')
- {
- $this->shift(1);
-
- $whereArray = array(
- 'type' => $this->mod->type,
- 'vendor' => $this->viewArgs['vendor'],
- 'comm_year' => $this->viewArgs['comm_year'],
- 'sound_card_works' => $this->viewArgs['sound_card_works'],
- 'interface' => $this->viewArgs['interface'],
- );
-
- $this->mod->setWhereQueryClause($whereArray);
-
- parent::catalogue($lang);
- }
-
- public function view($lang = 'en', $id = 0, $name = null)
- {
- parent::view($lang, $id, $name);
- }
-
- public function history($lang = 'en', $id = 0)
- {
- parent::history($lang, $id);
- }
-
- public function revision($lang = 'en', $id_rev = 0)
- {
- parent::revision($lang, $id_rev);
- }
-
- public function insert($lang = 'en', $token = '')
- {
- parent::insert($lang, $token);
- }
-
- public function update($lang = 'en', $token = '')
- {
- parent::update($lang, $token);
- }
-
- public function differences($lang = 'en', $id_hard = 0, $id_rev = 0)
- {
- parent::differences($lang, $id_hard, $id_rev);
- }
-
- public function climb($lang = 'en', $id_rev = 0, $token = '')
- {
- parent::climb($lang, $id_rev, $token);
- }
-
- public function talk($lang = 'en', $id_hard = 0, $token = '')
- {
- parent::talk($lang, $id_hard, $token);
- }
-
-}
diff --git a/h-source/Application/Controllers/SpecialController.php b/h-source/Application/Controllers/SpecialController.php
deleted file mode 100644
index 4acbb5e..0000000
--- a/h-source/Application/Controllers/SpecialController.php
+++ /dev/null
@@ -1,216 +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 SpecialController extends BaseController
-{
-
- public function __construct($model, $controller, $queryString)
- {
- parent::__construct($model, $controller, $queryString);
-
- $this->model('HistoryModel');
- $this->model('HardwareModel');
-
- $data['title'] = gtext('last modifications').' - '.Website::$generalName;
- $this->append($data);
-
- Params::$nullQueryValue = 'undef';
-
- $this->setArgKeys(array('page:forceNat'=>1,'username:sanitizeAll'=>'undef'));
- }
-
- protected function last($lang = 'en',$action = 'modifications')
- {
- switch ($action)
- {
- case 'modactions':
- $data['title'] = 'last moderations - '.Website::$generalName;
- $data['viewTitle'] = 'List of actions carried out by moderators';
- $data['user_status'] = 'MODERATOR';
-
- $whereClauseArray = array(
- 'gr' => 'moderator',
- );
-
- $viewFile = 'modactions';
-
- break;
- case 'adminactions':
- $data['title'] = 'last admin actions - '.Website::$generalName;
- $data['viewTitle'] = 'List of actions carried out by administrators';
- $data['user_status'] = 'ADMINISTRATOR';
-
- $whereClauseArray = array(
- 'gr' => 'admin',
- );
-
- $viewFile = 'modactions';
-
- break;
-
- case 'usersactions':
- $data['title'] = 'last registered users actions - '.Website::$generalName;
- $data['viewTitle'] = 'List of actions carried out by registered users';
- $data['user_status'] = 'USER';
-
- $whereClauseArray = array(
- 'gr' => 'registered',
- );
-
- $viewFile = 'modactions';
-
- break;
- }
- $whereClauseArray['username'] = $this->viewArgs['username'];
-
- $this->helper('Pages','special/'.$this->action.'/'.$this->lang,'page');
-
- $this->m['HistoryModel']->clear()->left('regusers')->on('history.created_by=regusers.id_user')->select("history.*,regusers.username")->where($whereClauseArray)->orderBy('id_history desc');
-
- $recordNumber = $this->m['HistoryModel']->rowNumber();
- $page = $this->viewArgs['page'];
-
- $this->m['HistoryModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,30);
-
- $data['table'] = $this->m['HistoryModel']->send();
-
-// echo $this->m['HistoryModel']->getQuery();
-
- $data['pageList'] = $this->h['Pages']->render($page-5,11);
-
- //the value of the filter
- $data['filterValue'] = strcmp($this->viewArgs['username'],'undef') === 0 ? null : $this->viewArgs['username'];
-
- $this->append($data);
- $this->load($viewFile);
- $this->right();
- }
-
- public function modifications($lang = 'en')
- {
- $this->shift(1);
-
- $data['title'] = 'last modifications - '.Website::$generalName;
-
- $whereClauseArray = array(
- 'gr' => 'registered',
- 'type' => 'hardware',
- 'deleted' => 'no',
- 'cleared' => 'no',
- );
-
- $this->helper('Pages','special/'.$this->action.'/'.$this->lang,'page');
-
- $this->m['HistoryModel']->clear()->select('history.*,hardware.*')->inner('hardware')->on('hardware.id_hard=history.id')->where($whereClauseArray)->orderBy('id_history desc');
-
- $recordNumber = $this->m['HistoryModel']->rowNumber();
- $page = $this->viewArgs['page'];
-
- $this->m['HistoryModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,30);
-
- $data['table'] = $this->m['HistoryModel']->send();
-
- $data['pageList'] = $this->h['Pages']->render($page-5,11);
-
- $this->append($data);
- $this->load('modifications');
- $this->right();
- }
-
- public function modactions($lang = 'en')
- {
- $this->shift(1);
-
- $this->s['registered']->check('moderator');
-
- $this->last($lang = 'en','modactions');
- }
-
- public function adminactions($lang = 'en')
- {
- $this->shift(1);
-
- $this->s['registered']->check('admin');
-
- $this->last($lang = 'en','adminactions');
- }
-
- public function usersactions($lang = 'en')
- {
- $this->shift(1);
-
- $this->s['registered']->check('moderator');
-
- $this->last($lang = 'en','usersactions');
- }
-
- protected function pagelist($lang = 'en', $type)
- {
- switch ($type)
- {
- case 'deleted':
- $whereArray = array('-deleted'=>'yes','approved'=>'yes');
- $data['titleString'] = 'hidden device pages';
- break;
- case 'notapproved':
- $whereArray = array('approved'=>'no');
- $data['titleString'] = 'Device pages that have to be approved';
- break;
- }
-
- $this->helper('Pages','special/'.$this->action.'/'.$this->lang,'page');
-
- $this->m['HardwareModel']->clear()->select()->where($whereArray)->orderBy('id_hard desc');
-
- $recordNumber = $this->m['HardwareModel']->rowNumber();
- $page = $this->viewArgs['page'];
-
- $this->m['HardwareModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,30);
-
- $data['table'] = $this->m['HardwareModel']->send();
-
- $data['pageList'] = $this->h['Pages']->render($page-5,11);
-
- $this->append($data);
- $this->load('pages_deleted');
- $this->right();
- }
-
- public function deleted($lang = 'en')
- {
- $this->shift(1);
-
- $this->s['registered']->check('admin');
-
- $this->pagelist($lang,'deleted');
- }
-
- public function notapproved($lang = 'en')
- {
- $this->shift(1);
-
- $this->s['registered']->check('admin');
-
- $this->pagelist($lang,'notapproved');
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Controllers/ThreegcardsController.php b/h-source/Application/Controllers/ThreegcardsController.php
deleted file mode 100644
index 3824fe0..0000000
--- a/h-source/Application/Controllers/ThreegcardsController.php
+++ /dev/null
@@ -1,127 +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 ThreegcardsController extends GenericController
-{
-
- public function __construct($model, $controller, $queryString)
- {
-
- parent::__construct($model, $controller, $queryString);
-
- //load the model
- $this->model('HardwareModel');
- $this->model('RevisionsModel');
- $this->model('ThreegcardsModel');
- $this->model('TalkModel');
-
- $this->mod = $this->m['ThreegcardsModel'];
-
- $this->m['HardwareModel']->id_user = $this->s['registered']->status['id_user'];
- $this->m['HardwareModel']->type = '3G-card';
-
- $this->m['HardwareModel']->setConditions(Wifi::$wifiSelect,'wifi_works',ThreeGcards::interfaceList());
-
- $this->m['HardwareModel']->setFields('model,kernel,description,distribution,comm_year,wifi_works,pci_id,interface,driver,other_names','sanitizeAll');
-
- $argKeys = array(
- 'page:forceNat' => 1,
- 'history_page:forceNat' => 1,
- 'vendor:sanitizeString' => 'undef',
- 'comm_year:sanitizeString' => 'undef',
- 'wifi_works:sanitizeString' => 'undef',
- 'interface:sanitizeString' => 'undef',
- 'sort-by:sanitizeString' => 'wifi-works',
- 'search_string:sanitizeString' => 'undef'
- );
-
- $this->setArgKeys($argKeys);
-
- $data['title'] = '3G card';
-
- $data['intefaceOptions'] = Wifi::$interface;
- $data['worksOptions'] = Wifi::$wifiSelect;
- $data['worksField'] = 'wifi_works';
-
- $data['notFoundString'] = "No 3G cards found";
-
- $this->append($data);
- }
-
- public function catalogue($lang = 'en')
- {
- $this->shift(1);
-
- $whereArray = array(
- 'type' => $this->mod->type,
- 'vendor' => $this->viewArgs['vendor'],
- 'comm_year' => $this->viewArgs['comm_year'],
- 'wifi_works' => $this->viewArgs['wifi_works'],
- 'interface' => $this->viewArgs['interface'],
- );
-
- $this->mod->setWhereQueryClause($whereArray);
-
- parent::catalogue($lang);
- }
-
- public function view($lang = 'en', $id = 0, $name = null)
- {
- parent::view($lang, $id, $name);
- }
-
- public function history($lang = 'en', $id = 0)
- {
- parent::history($lang, $id);
- }
-
- public function revision($lang = 'en', $id_rev = 0)
- {
- parent::revision($lang, $id_rev);
- }
-
- public function insert($lang = 'en', $token = '')
- {
- parent::insert($lang, $token);
- }
-
- public function update($lang = 'en', $token = '')
- {
- parent::update($lang, $token);
- }
-
- public function differences($lang = 'en', $id_hard = 0, $id_rev = 0)
- {
- parent::differences($lang, $id_hard, $id_rev);
- }
-
- public function climb($lang = 'en', $id_rev = 0, $token = '')
- {
- parent::climb($lang, $id_rev, $token);
- }
-
- public function talk($lang = 'en', $id_hard = 0, $token = '')
- {
- parent::talk($lang, $id_hard, $token);
- }
-
-}
diff --git a/h-source/Application/Controllers/UsersController.php b/h-source/Application/Controllers/UsersController.php
deleted file mode 100644
index 741eaf4..0000000
--- a/h-source/Application/Controllers/UsersController.php
+++ /dev/null
@@ -1,352 +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 UsersController extends BaseController
-{
-
- public function __construct($model, $controller, $queryString)
- {
- parent::__construct($model, $controller, $queryString);
-
- $this->model('UsersModel');
- $this->model('ProfileModel');
- $this->model('HardwareModel');
-
- $data['title'] = 'Login';
- $this->append($data);
- }
-
- public function login($lang = 'en')
- {
- $data = array();
-
- if ( strcmp($this->_updating,'no') === 0 )
- {
- $data['flag'] = isset($type) ? 'setted' : null;
-
- $data['title'] = 'Login - '.Website::$generalName;
-
- $redirect = $this->request->get('redirect','','sanitizeAll');
-
- $data['action'] = Url::getRoot("users/login/".$this->lang."?redirect=$redirect");
-
- $data['notice'] = null;
-
- $this->s['registered']->checkStatus();
-
- if ($this->s['registered']->status['status']=='logged') { //check if already logged
- $this->redirect('home/index/'.Lang::$current,3,'You are already logged...');
- die();
- }
- if (isset($_POST['username']) and isset($_POST['password']))
- {
- $username = ctype_alnum($_POST['username']) ? sanitizeAll($_POST['username']) : '';
- $choice = $this->s['registered']->login($username,$_POST['password']);
-
- switch($choice) {
- case 'logged':
- $this->redirect('home/index/'.Lang::$current,3,'You are already logged...');
- break;
- case 'accepted':
- if (strcmp($redirect,'') !== 0)
- {
- $redirect = html_entity_decode($redirect,ENT_QUOTES,DEFAULT_CHARSET);
- $domainName = rtrim(Url::getRoot(),"/");
- header('Location:'.$domainName."/".$redirect);
- }
- else
- {
- $this->redirect('home/index/'.Lang::$current,0);
- }
- break;
- case 'login-error':
- $data['notice'] = '<div class="alert">Wrong username or password</div>';
- break;
- case 'wait':
- $data['notice'] = '<div class="alert">You have to wait 5 seconds before you can try to login another time</div>';
- break;
- }
- }
- }
-
- $this->append($data);
- $this->load('login');
- }
-
- public function logout($lang = 'en')
- {
- $res = $this->s['registered']->logout();
-
- if ($res === 'not-logged')
- {
- $data['notice'] = "<div class='alert'>You can't logout because you are not logged...</div>\n";
- }
- else if ($res === 'was-logged')
- {
- $this->redirect('home/index/'.Lang::$current,0);
- }
- else if ($res === 'error')
- {
-
- }
-
- $this->append($data);
- $this->load('logout');
- }
-
- public function add($lang = 'en')
- {
- $data['title'] = 'create account - '.Website::$generalName;
-
- if ( strcmp($this->_updating,'no') === 0 )
- {
- //start session for captcha
- session_start();
-
- if ( isset($_SESSION['status']) ) unset($_SESSION['status']);
-
- $this->shift(1);
-
- $this->m['UsersModel']->strongConditions['insert'] = array(
- "checkAlphanum" => "username",
- "checkLength|35" => "username",
- "checkMail" => "e_mail",
- "+checkLength|60" => "e_mail",
- "checkEqual" => "password,confirmation",
- "checkMatch|/^[a-zA-Z0-9\_\-\!]+$/" => "password,confirmation|characters allowed for the password: a-z A-Z 0-9 - _ !"
- );
-
- $this->m['UsersModel']->databaseConditions['insert'] = array(
- "checkUnique" => "username",
- "+checkUnique" => "e_mail"
- );
-
- if ($this->s['registered']->status['status'] === 'logged')
- {
- $this->redirect('home/index/'.$this->lang,2,'you are already logged..');
- }
- else
- {
- $data['notice'] = null;
-
- $this->m['UsersModel']->setFields('username:sanitizeAll,e_mail:sanitizeAll,password:sha1','none');
-
- $this->m['UsersModel']->updateTable('insert');
-
- $data['notice'] = $this->m['UsersModel']->notice;
-
- $values = $this->m['UsersModel']->getFormValues('insert','sanitizeHtml');
- $values['confirmation'] = '';
-
- $data['values'] = $values;
-
- $this->append($data);
-
- $this->load('add');
- $this->right();
- }
- }
- else
- {
- $this->redirect('users/login/'.$this->lang,0);
- }
- }
-
- public function confirm($lang = 'en', $id_user = 0, $confirmation_token = '')
- {
- $data['title'] = 'confirm account - '.Website::$generalName;
-
- if ( strcmp($this->_updating,'no') === 0 )
- {
- if ($this->s['registered']->status['status'] === 'logged')
- {
- $this->redirect('home/index/'.$this->lang,2,'you are already logged..');
- }
- else
- {
- $clean['id_user'] = (int)$id_user;
- $clean['confirmation_token'] = sanitizeAlphanum($confirmation_token);
-
- $data['status_confirm'] = false;
-
- $res = $this->m['UsersModel']->select('id_user,creation_time')->where(array("id_user"=>$clean['id_user'],"confirmation_token"=>$clean['confirmation_token'],"has_confirmed"=>1,"deleted"=>"no"))->send();
-
- // echo $this->m['UsersModel']->getQuery();
-
- if (count($res) > 0)
- {
- $now = time();
- $checkTime = $res[0]['regusers']['creation_time'] + Account::$confirmTime;
- if ($checkTime > $now)
- {
- $this->m['UsersModel']->values = array('has_confirmed' => 0, 'creation_time' => 0);
- if ($this->m['UsersModel']->update($clean['id_user']))
- {
- $data['status_confirm'] = true;
-
- //ad a record in the profile table
- $this->m['ProfileModel']->values = array('created_by' => $clean['id_user']);
- $this->m['ProfileModel']->insert();
-
- }
- }
- }
-
- // var_dump($data['status_confirm']);
-
- $this->append($data);
- $this->load('confirmation');
- $this->right();
- }
- }
- else
- {
- $this->redirect('users/login/'.$this->lang,0);
- }
- }
-
- public function change($lang = 'en', $id_user = 0, $forgot_token = '')
- {
- session_start();
-
- $data['title'] = 'change password - '.Website::$generalName;
-
- if ( strcmp($this->_updating,'no') === 0 )
- {
- if ($this->s['registered']->status['status'] === 'logged')
- {
- $this->redirect('home/index/'.$this->lang,2,'you are already logged..');
- }
- else
- {
- $clean['id_user'] = (int)$id_user;
- $clean['forgot_token'] = sanitizeAlphanum($forgot_token);
-
- $res = $this->m['UsersModel']->select('username,id_user,forgot_time,e_mail')->where(array("id_user"=>$clean['id_user'],"forgot_token"=>$clean['forgot_token'],"has_confirmed"=>0,"deleted"=>"no"))->send();
-
- if (count($res) > 0)
- {
- $now = time();
- $checkTime = $res[0]['regusers']['forgot_time'] + Account::$confirmTime;
- if ($checkTime > $now)
- {
- $username = $res[0]['regusers']['username'];
- $email = $res[0]['regusers']['e_mail'];
-
- $newPassword = generateString(10);
- $this->m['UsersModel']->values = array('password' => sha1($newPassword), 'forgot_time' => 0);
- if ($this->m['UsersModel']->update($clean['id_user']))
- {
- $result = Account::sendpassword($username,$email,$newPassword);
-
- if ($result)
- {
- $_SESSION['status'] = 'sent_new_password';
- }
- else
- {
- $_SESSION['status'] = 'sent_new_password_error';
- }
-
- $hed = new HeaderObj(DOMAIN_NAME);
- $hed->redirect('users/notice/'.Lang::$current,1);
-
- }
- }
- }
-
- $this->append($data);
- $this->load('change');
- $this->right();
- }
- }
- else
- {
- $this->redirect('users/login/'.$this->lang,0);
- }
- }
-
- public function forgot($lang = 'en')
- {
- $data['title'] = 'request password - '.Website::$generalName;
-
- if ( strcmp($this->_updating,'no') === 0 )
- {
- session_start();
-
- if ( isset($_SESSION['status']) ) unset($_SESSION['status']);
-
- $this->shift(1);
-
- if ($this->s['registered']->status['status'] === 'logged')
- {
- $this->redirect('home/index/'.$this->lang,2,'you are already logged..');
- }
- else
- {
- $data['notice'] = null;
-
- if (isset($_POST['forgotAction']))
- {
- if (isset($_POST['username']))
- {
- $this->m['UsersModel']->forgot($_POST['username']);
- $data['notice'] = $this->m['UsersModel']->notice;
- }
- }
-
- $this->append($data);
-
- $this->load('forgot');
- $this->right();
- }
- }
- else
- {
- $this->redirect('users/login/'.$this->lang,0);
- }
- }
-
- public function notice($lang = 'en')
- {
- $data['title'] = 'notice - '.Website::$generalName;
-
- if ( strcmp($this->_updating,'no') === 0 )
- {
- session_start();
- if ($this->s['registered']->status['status'] === 'logged')
- {
- $this->redirect('home/index/'.$this->lang,2,'you are already logged..');
- }
- else
- {
- $this->load('notice');
- $this->right();
- }
- }
- else
- {
- $this->redirect('users/login/'.$this->lang,0);
- }
- }
-
-} \ No newline at end of file
diff --git a/h-source/Application/Controllers/VideocardsController.php b/h-source/Application/Controllers/VideocardsController.php
deleted file mode 100644
index a27e723..0000000
--- a/h-source/Application/Controllers/VideocardsController.php
+++ /dev/null
@@ -1,127 +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 VideocardsController extends GenericController
-{
-
- public function __construct($model, $controller, $queryString)
- {
-
- parent::__construct($model, $controller, $queryString);
-
- //load the model
- $this->model('HardwareModel');
- $this->model('RevisionsModel');
- $this->model('VideocardsModel');
- $this->model('TalkModel');
-
- $this->mod = $this->m['VideocardsModel'];
-
- $this->m['HardwareModel']->id_user = $this->s['registered']->status['id_user'];
- $this->m['HardwareModel']->type = 'videocard';
-
- $this->m['HardwareModel']->setConditions(Videocard::videoList(),'video_card_works',Videocard::$interface);
-
- $this->m['HardwareModel']->setFields('model,kernel,description,distribution,video_card_works,comm_year,pci_id,interface,driver,other_names','sanitizeAll');
-
- $argKeys = array(
- 'page:forceNat' => 1,
- 'history_page:forceNat' => 1,
- 'vendor:sanitizeString' => 'undef',
- 'comm_year:sanitizeString' => 'undef',
- 'video_card_works:sanitizeString' => 'undef',
- 'interface:sanitizeString' => 'undef',
- 'sort-by:sanitizeString' => 'video-card-works',
- 'search_string:sanitizeString' => 'undef'
- );
-
- $this->setArgKeys($argKeys);
-
- $data['title'] = 'Videocards';
-
- $data['intefaceOptions'] = Videocard::$interface;
- $data['worksOptions'] = Videocard::$videoSelect;
- $data['worksField'] = 'video_card_works';
-
- $data['notFoundString'] = "No video cards found";
-
- $this->append($data);
- }
-
- public function catalogue($lang = 'en')
- {
- $this->shift(1);
-
- $whereArray = array(
- 'type' => $this->mod->type,
- 'vendor' => $this->viewArgs['vendor'],
- 'comm_year' => $this->viewArgs['comm_year'],
- 'video_card_works' => $this->viewArgs['video_card_works'],
- 'interface' => $this->viewArgs['interface'],
- );
-
- $this->mod->setWhereQueryClause($whereArray);
-
- parent::catalogue($lang);
- }
-
- public function view($lang = 'en', $id = 0, $name = null)
- {
- parent::view($lang, $id, $name);
- }
-
- public function history($lang = 'en', $id = 0)
- {
- parent::history($lang, $id);
- }
-
- public function revision($lang = 'en', $id_rev = 0)
- {
- parent::revision($lang, $id_rev);
- }
-
- public function insert($lang = 'en', $token = '')
- {
- parent::insert($lang, $token);
- }
-
- public function update($lang = 'en', $token = '')
- {
- parent::update($lang, $token);
- }
-
- public function differences($lang = 'en', $id_hard = 0, $id_rev = 0)
- {
- parent::differences($lang, $id_hard, $id_rev);
- }
-
- public function climb($lang = 'en', $id_rev = 0, $token = '')
- {
- parent::climb($lang, $id_rev, $token);
- }
-
- public function talk($lang = 'en', $id_hard = 0, $token = '')
- {
- parent::talk($lang, $id_hard, $token);
- }
-
-}
diff --git a/h-source/Application/Controllers/WebcamsController.php b/h-source/Application/Controllers/WebcamsController.php
deleted file mode 100644
index 41807ed..0000000
--- a/h-source/Application/Controllers/WebcamsController.php
+++ /dev/null
@@ -1,127 +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 WebcamsController extends GenericController
-{
-
- public function __construct($model, $controller, $queryString)
- {
-
- parent::__construct($model, $controller, $queryString);
-
- //load the model
- $this->model('HardwareModel');
- $this->model('RevisionsModel');
- $this->model('WebcamsModel');
- $this->model('TalkModel');
-
- $this->mod = $this->m['WebcamsModel'];
-
- $this->m['HardwareModel']->id_user = $this->s['registered']->status['id_user'];
- $this->m['HardwareModel']->type = 'webcam';
-
- $this->m['HardwareModel']->setConditions(Webcams::$select,'webcam_works',Webcams::$interface);
-
- $this->m['HardwareModel']->setFields('model,kernel,description,distribution,comm_year,webcam_works,pci_id,interface,driver,other_names','sanitizeAll');
-
- $argKeys = array(
- 'page:forceNat' => 1,
- 'history_page:forceNat' => 1,
- 'vendor:sanitizeString' => 'undef',
- 'comm_year:sanitizeString' => 'undef',
- 'webcam_works:sanitizeString' => 'undef',
- 'interface:sanitizeString' => 'undef',
- 'sort-by:sanitizeString' => 'webcam-works',
- 'search_string:sanitizeString' => 'undef'
- );
-
- $this->setArgKeys($argKeys);
-
- $data['title'] = 'Webcam';
-
- $data['intefaceOptions'] = Webcams::$interface;
- $data['worksOptions'] = Webcams::$select;
- $data['worksField'] = 'webcam_works';
-
- $data['notFoundString'] = "No webcams found";
-
- $this->append($data);
- }
-
- public function catalogue($lang = 'en')
- {
- $this->shift(1);
-
- $whereArray = array(
- 'type' => $this->mod->type,
- 'vendor' => $this->viewArgs['vendor'],
- 'comm_year' => $this->viewArgs['comm_year'],
- 'webcam_works' => $this->viewArgs['webcam_works'],
- 'interface' => $this->viewArgs['interface'],
- );
-
- $this->mod->setWhereQueryClause($whereArray);
-
- parent::catalogue($lang);
- }
-
- public function view($lang = 'en', $id = 0, $name = null)
- {
- parent::view($lang, $id, $name);
- }
-
- public function history($lang = 'en', $id = 0)
- {
- parent::history($lang, $id);
- }
-
- public function revision($lang = 'en', $id_rev = 0)
- {
- parent::revision($lang, $id_rev);
- }
-
- public function insert($lang = 'en', $token = '')
- {
- parent::insert($lang, $token);
- }
-
- public function update($lang = 'en', $token = '')
- {
- parent::update($lang, $token);
- }
-
- public function differences($lang = 'en', $id_hard = 0, $id_rev = 0)
- {
- parent::differences($lang, $id_hard, $id_rev);
- }
-
- public function climb($lang = 'en', $id_rev = 0, $token = '')
- {
- parent::climb($lang, $id_rev, $token);
- }
-
- public function talk($lang = 'en', $id_hard = 0, $token = '')
- {
- parent::talk($lang, $id_hard, $token);
- }
-
-}
diff --git a/h-source/Application/Controllers/WifiController.php b/h-source/Application/Controllers/WifiController.php
deleted file mode 100644
index 8bf4c72..0000000
--- a/h-source/Application/Controllers/WifiController.php
+++ /dev/null
@@ -1,127 +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 WifiController extends GenericController
-{
-
- public function __construct($model, $controller, $queryString)
- {
-
- parent::__construct($model, $controller, $queryString);
-
- //load the model
- $this->model('HardwareModel');
- $this->model('RevisionsModel');
- $this->model('WifiModel');
- $this->model('TalkModel');
-
- $this->mod = $this->m['WifiModel'];
-
- $this->m['HardwareModel']->id_user = $this->s['registered']->status['id_user'];
- $this->m['HardwareModel']->type = 'wifi';
-
- $this->m['HardwareModel']->setConditions(Wifi::$wifiSelect,'wifi_works',ThreeGcards::interfaceList());
-
- $this->m['HardwareModel']->setFields('model,kernel,description,distribution,comm_year,wifi_works,pci_id,interface,driver,other_names','sanitizeAll');
-
- $argKeys = array(
- 'page:forceNat' => 1,
- 'history_page:forceNat' => 1,
- 'vendor:sanitizeString' => 'undef',
- 'comm_year:sanitizeString' => 'undef',
- 'wifi_works:sanitizeString' => 'undef',
- 'interface:sanitizeString' => 'undef',
- 'sort-by:sanitizeString' => 'wifi-works',
- 'search_string:sanitizeString' => 'undef'
- );
-
- $this->setArgKeys($argKeys);
-
- $data['title'] = 'Wifi';
-
- $data['intefaceOptions'] = Wifi::$interface;
- $data['worksOptions'] = Wifi::$wifiSelect;
- $data['worksField'] = 'wifi_works';
-
- $data['notFoundString'] = "No wifi cards found";
-
- $this->append($data);
- }
-
- public function catalogue($lang = 'en')
- {
- $this->shift(1);
-
- $whereArray = array(
- 'type' => $this->mod->type,
- 'vendor' => $this->viewArgs['vendor'],
- 'comm_year' => $this->viewArgs['comm_year'],
- 'wifi_works' => $this->viewArgs['wifi_works'],
- 'interface' => $this->viewArgs['interface'],
- );
-
- $this->mod->setWhereQueryClause($whereArray);
-
- parent::catalogue($lang);
- }
-
- public function view($lang = 'en', $id = 0, $name = null)
- {
- parent::view($lang, $id, $name);
- }
-
- public function history($lang = 'en', $id = 0)
- {
- parent::history($lang, $id);
- }
-
- public function revision($lang = 'en', $id_rev = 0)
- {
- parent::revision($lang, $id_rev);
- }
-
- public function insert($lang = 'en', $token = '')
- {
- parent::insert($lang, $token);
- }
-
- public function update($lang = 'en', $token = '')
- {
- parent::update($lang, $token);
- }
-
- public function differences($lang = 'en', $id_hard = 0, $id_rev = 0)
- {
- parent::differences($lang, $id_hard, $id_rev);
- }
-
- public function climb($lang = 'en', $id_rev = 0, $token = '')
- {
- parent::climb($lang, $id_rev, $token);
- }
-
- public function talk($lang = 'en', $id_hard = 0, $token = '')
- {
- parent::talk($lang, $id_hard, $token);
- }
-
-}
diff --git a/h-source/Application/Controllers/WikiController.php b/h-source/Application/Controllers/WikiController.php
deleted file mode 100644
index f3da19f..0000000
--- a/h-source/Application/Controllers/WikiController.php
+++ /dev/null
@@ -1,644 +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 WikiController extends BaseController
-{
-
- public function __construct($model, $controller, $queryString) {
-
- $this->_topMenuClasses['wiki'] = " class='currentitem'";
-
- parent::__construct($model, $controller, $queryString);
-
- $this->model('UsersModel');
- $this->model('WikiModel');
- $this->model('WikirevisionsModel');
- $this->model('WikitalkModel');
-
- $this->m['WikiModel']->id_user = (int)$this->s['registered']->status['id_user'];
- }
-
- public function insert($lang = 'en')
- {
- $this->shift(1);
-
- $data['pagePreview'] = null;
-
- $data['title'] = 'insert a wiki page - '.Website::$generalName;
-
- $this->m['WikiModel']->setFields('title,page','sanitizeAll');
-
- $data['notice'] = null;
-
- $this->s['registered']->checkStatus();
-
- if ($this->s['registered']->status['status'] === 'logged')
- {
- if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..');
-
- if (isset($_POST['insertAction']))
- {
- //insert the new wiki page
- $this->m['WikiModel']->updateTable('insert');
-
- if ($this->m['WikiModel']->queryResult)
- {
- $domainName = rtrim(Url::getRoot(),"/");
- header('Location: '.$domainName.'/wiki/page/'.$this->lang.'/'.$this->m['WikiModel']->lastTitleClean);
- die();
- }
- }
-
- $data['pagePreview'] = $this->getPreview();
-
- $data['notice'] = $this->m['WikiModel']->notice;
-
- $data['submitName'] = "insertAction";
- $data['hiddenInput'] = null;
-
- $data['values'] = $this->m['WikiModel']->getFormValues('insert','sanitizeHtml');
- $this->append($data);
-
- $this->load('form');
- $this->load('bottom_left');
- $this->right();
- }
- else
- {
- $this->redirect("users/login/".$this->lang."?redirect=".$this->controller."/insert/".$this->lang,0);
- }
- }
-
- public function update($lang = 'en')
- {
- $this->shift(1);
-
- $data['pagePreview'] = null;
-
- $data['title'] = 'update a wiki page - '.Website::$generalName;
-
- $this->m['WikiModel']->setFields('title,page','sanitizeAll');
-
- $data['notice'] = null;
- $this->s['registered']->checkStatus();
-
- if (isset($_POST['id_wiki']))
- {
- //get the id
- $clean['id_wiki'] = (int)$_POST['id_wiki'];
- $title = $this->m['WikiModel']->getTheModelName($clean['id_wiki']);
-
- if ($this->s['registered']->status['status'] === 'logged')
- {
-
- if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..');
-
- if ($this->m['WikiModel']->isBlocked($clean['id_wiki'])) $this->redirect('wiki/page/'.$this->lang,2,'this page has been blocked..');
-
- if ($this->m['WikiModel']->isDeleted($clean['id_wiki'])) $this->redirect('wiki/page/'.$this->lang,2,'this page has been deleted..');
-
- $deleted = $this->m['WikiModel']->select("wiki.deleted")->where(array("id_wiki"=>$clean['id_wiki']))->limit(1)->toList('wiki.deleted')->send();
-
- $data['tree_name'] = $title;
-
- if (isset($_POST['updateAction']))
- {
- //carry out the update database action
- $this->m['WikiModel']->updateTable('update');
-
- if ($this->m['WikiModel']->queryResult)
- {
- $domainName = rtrim(Url::getRoot(),"/");
- header('Location: '.$domainName.'/wiki/page/'.$this->lang.'/'.$this->m['WikiModel']->lastTitleClean);
- die();
- }
- }
-
- $data['pagePreview'] = $this->getPreview();
-
- $data['notice'] = $this->m['WikiModel']->notice;
-
- $data['id_wiki'] = $clean['id_wiki'];
- $data['submitName'] = "updateAction";
-
- $data['values'] = $this->m['WikiModel']->getFormValues('update','sanitizeHtml');
- $data['hiddenInput'] = "<input type='hidden' name='id_wiki' value='".$clean['id_wiki']."'>\n";
-
- $this->append($data);
-
- $this->load('form');
- $this->load('bottom_left');
- $this->right();
- }
- else
- {
- $domainName = rtrim(Url::getRoot(),"/");
- header('Location: '.$domainName."/users/login/".$this->lang."?redirect=".$this->controller."/page/".$this->lang."/".titleForRedirect($title));
- die();
- }
- }
- else
- {
- $this->redirect($this->controller.'/page/'.$this->lang);
- }
- }
-
- //get the preview of the description entry
- protected function getPreview()
- {
- if (isset($_POST['previewAction']))
- {
- $this->m['WikiModel']->result = false;
- return $this->request->post('page','','sanitizeHtml');
- }
- return null;
- }
-
- public function page($lang = 'en', $title_clean = null)
- {
- $this->shift(2);
-
- $data['title'] = 'main page - '.Website::$generalName;
- $clean['title_clean'] = sanitizeAll($title_clean);
-
- $data['isDeleted'] = false;
- $data['isBlocked'] = false;
-
- if (isset($title_clean))
- {
- $res = $this->m['WikiModel']->select()->where(array('title_clean'=>$clean['title_clean']))->orderBy('id_wiki desc')->limit(1)->send();
-
- if ( count($res) > 0 )
- {
- $data['table'] = $res;
- $data['tree_name'] = $res[0]['wiki']['title'];
- $data['title'] = $res[0]['wiki']['title'] . ' - ' . Website::$generalName;
- $data['isDeleted'] = $this->m['WikiModel']->isDeleted($res[0]['wiki']['id_wiki']);
- $data['isBlocked'] = $this->m['WikiModel']->isBlocked($res[0]['wiki']['id_wiki']);
-
- if ( count($res) < 2 )
- {
- $data['talk_number'] = $this->m['WikitalkModel']->select('count(*) as numb,id_wiki')->where(array('id_wiki'=>$res[0]['wiki']['id_wiki'],'deleted'=>'no'))->rowNumber();
-
- $viewFile = 'wiki_page';
- $data['id_wiki'] = $res[0]['wiki']['id_wiki'];
- }
- else
- {
- $viewFile = 'select';
- }
- }
- else
- {
- $rev = new WikirevisionsModel();
- $res_rev = $rev->select()->where(array('title_clean'=>$clean['title_clean']))->orderBy('id_rev desc')->limit(1)->send();
- if ( count($res_rev) > 0 )
- {
- $clean['idWiki'] = $rev->getIdPage($res_rev[0]['wiki_revisions']['id_rev']);
- $newTitle = $this->m['WikiModel']->getTheModelName($clean['idWiki']);
- $n = titleForRedirect($newTitle);
- $domainName = rtrim(Url::getRoot(),"/");
- header('Location: '.$domainName.'/wiki/page/'.$this->lang.'/'.$n);
- die();
- }
- else
- {
- $viewFile = 'not_found';
- }
- }
- }
- else
- {
- $this->redirect('wiki/page/'.$this->lang.'/Main-Page');
- }
-
- $data['md_javascript'] = "moderator_dialog(\"pageblock\",\"page\");moderator_dialog(\"pageunblock\",\"page\");moderator_dialog(\"pagehide\",\"page_del\");moderator_dialog(\"pageshow\",\"page_del\");";
-
- $this->append($data);
-
- $this->load($viewFile);
- $this->load('bottom_left');
- $this->load('moderator_dialog');
- $this->right();
- }
-
- public function history($lang = 'en', $id = 0)
- {
- $argKeys = array(
- 'page:forceNat' => 1,
- );
-
- $this->setArgKeys($argKeys);
- $this->shift(2);
-
- $clean['id'] = (int)$id;
- $data['id'] = $clean['id'];
- $data['tree_name'] = $this->m['WikiModel']->getTheModelName($clean['id']);
- $data['isBlocked'] = $this->m['WikiModel']->isBlocked($clean['id']);
- $data['isDeleted'] = $this->m['WikiModel']->isDeleted($clean['id']);
-
- $data['title'] = 'history - '.Website::$generalName;
-
- //get the first revision
- $res = $this->m['WikirevisionsModel']->db->select('revisions','id_rev','id_wiki='.$clean['id'],null,'id_rev',1);
- if (count($res) > 0)
- {
- $data['firstRev'] = $res[0]['wiki_revisions']['id_rev'];
- }
-
- $res1 = $this->m['WikiModel']->db->select('wiki','update_date,created_by','id_wiki='.$clean['id']);
-
- $this->m['WikirevisionsModel']->setWhereQueryClause(array('id_wiki' => $clean['id']));
-
- //load the Pages helper
- $this->helper('Pages',$this->controller.'/history/'.$this->lang.'/'.$clean['id'],'page');
- //get the number of records
- $recordNumber = $this->m['WikirevisionsModel']->rowNumber();
- $page = $this->viewArgs['page'];
- //set the limit clause
- $this->m['WikirevisionsModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,20);
- $res2 = $this->m['WikirevisionsModel']->getFields('update_date,created_by,id_rev');
-
- $data['pageList'] = $this->h['Pages']->render($page-3,7);
-
- $data['rev1'] = $res1;
- $data['rev2'] = $res2;
-
- $this->append($data);
- $this->load('history');
- $this->load('bottom_left');
- $this->right();
- }
-
- public function revision($lang = 'en', $id_rev = 0)
- {
- $argKeys = array(
- 'page:forceNat' => 1,
- );
-
- $this->setArgKeys($argKeys);
- $this->shift(2);
-
- $clean['id_rev'] = (int)$id_rev;
-
- $this->m['WikirevisionsModel']->setWhereQueryClause(array("id_rev" => $clean['id_rev']));
- $data['table'] = $this->m['WikirevisionsModel']->getAll();
-
- $data['id_wiki'] = 0;
- $data['created_by'] = null;
- $data['update_date'] = null;
- $data['tree_name'] = null;
- $data['tree'] = null;
- $data['tree'] = null;
- $data['title'] = 'revision - '.Website::$generalName;
- $data['isDeleted'] = false;
-
- if (count($data['table']) > 0)
- {
- $data['id_wiki'] = (int)$data['table'][0]['wiki_revisions']['id_wiki'];
- $data['isDeleted'] = $this->m['WikiModel']->isDeleted($data['id_wiki']);
- $data['tree_name'] = $this->m['WikiModel']->getTheModelName($data['id_wiki']);
- $data['tree'] = $this->getSpecPageLink() . " &raquo; " . "<a href='".$this->m['WikiModel']->toWikiPage($data['id_wiki'])."'>".$data['tree_name']."</a>"." &raquo; " . $this->getHistoryLink($data['id_wiki']) . " &raquo; ".gtext('Revision');
-
- $data['created_by'] = $data['table'][0]['wiki_revisions']['created_by'];
- $data['update_date'] = $data['table'][0]['wiki_revisions']['update_date'];
- }
-
- $this->append($data);
- $this->load('wiki_page');
- $this->load('bottom_left');
- $this->right();
- }
-
- public function differences($lang = 'en', $id_wiki = 0, $id_rev = 0)
- {
- $this->shift(3);
-
- $data['title'] = 'differences - '.Website::$generalName;
-
- $clean['id_wiki'] = (int)$id_wiki;
- $clean['id_rev'] = (int)$id_rev;
-
- $data['id_wiki'] = $clean['id_wiki'];
- $tree_name = $this->m['WikiModel']->getTheModelName((int)$clean['id_wiki']);
- $data['tree_name'] = $tree_name;
- $data['tree'] = $this->getSpecPageLink() . " &raquo; " . "<a href='".$this->m['WikiModel']->toWikiPage($clean['id_wiki'])."'>".$data['tree_name']."</a>" ." &raquo; " . $this->getHistoryLink($data['id_wiki']) . " &raquo; ".gtext('Differences');
-
- $data['isDeleted'] = $this->m['WikiModel']->isDeleted($clean['id_wiki']);
- $data['showDiff'] = false;
-
- $diffArray = array();
-
- if (strcmp($clean['id_wiki'],0) !== 0 and strcmp($clean['id_rev'],0) !== 0)
- {
- $this->m['WikirevisionsModel']->where(array('id_wiki' => $clean['id_wiki'],'id_rev' => '<='.$clean['id_rev']));
- $this->m['WikirevisionsModel']->limit = 2;
- $res = $this->m['WikirevisionsModel']->getAll();
- if (count($res) > 1)
- {
- $newArray = $res[0]['wiki_revisions'];
- $oldArray = $res[1]['wiki_revisions'];
-
- $data['update_new'] = $newArray['update_date'];
- $data['update_old'] = $oldArray['update_date'];
- $data['created_by'] = $newArray['created_by'];
-
- $diffArray = $this->m['WikiModel']->getDiffArray($oldArray, $newArray);
-
- $data['showDiff'] = true;
- }
- }
- else if (strcmp($clean['id_wiki'],0) !== 0 and strcmp($clean['id_rev'],0) === 0)
- {
- $this->m['WikiModel']->where(array('id_wiki' => $clean['id_wiki']));
- $lastRes = $this->m['WikiModel']->getAll();
-
- if (count($lastRes) > 0)
- {
- $this->m['WikirevisionsModel']->setWhereQueryClause(array('id_wiki' => $clean['id_wiki']));
- $this->m['WikirevisionsModel']->limit = 1;
- $revRes = $this->m['WikirevisionsModel']->getAll();
-
- if (count($revRes) > 0)
- {
- $newArray = $lastRes[0]['wiki'];
- $oldArray = $revRes[0]['wiki_revisions'];
-
- $data['update_new'] = $newArray['update_date'];
- $data['update_old'] = $oldArray['update_date'];
- $data['created_by'] = $newArray['created_by'];
-
- $diffArray = $this->m['WikiModel']->getDiffArray($oldArray, $newArray);
-
- $data['showDiff'] = true;
- }
- }
-
- }
-
- $data['fieldsWithBreaks'] = $this->m['WikiModel']->fieldsWithBreaks;
- $data['diffArray'] = $diffArray;
-
- $this->append($data);
- $this->load('differences');
- $this->load('bottom_left');
- $this->right();
- }
-
- public function climb($lang = 'en', $id_rev = 0)
- {
- $this->shift(2);
-
- $this->m['WikiModel']->setFields('title,page','sanitizeAll');
-
- $data['title'] = 'make current - '.Website::$generalName;
-
- $clean['id_rev'] = (int)$id_rev;
- $clean['id_wiki'] = (int)$this->m['WikirevisionsModel']->getIdPage($clean['id_rev']);
-
- if ($clean['id_wiki'] !== 0)
- {
-
- $data['isDeleted'] = $this->m['WikiModel']->isDeleted($clean['id_wiki']);
-
- $data['id_rev'] = $clean['id_rev'];
- $data['id_wiki'] = $clean['id_wiki'];
- $data['tree_name'] = $this->m['WikiModel']->getTheModelName($clean['id_wiki']);
- $data['name'] = $data['tree_name'];
- $data['tree'] = $this->getSpecPageLink() . " &raquo; " . "<a href='".$this->m['WikiModel']->toWikiPage($clean['id_wiki'])."'>".$data['tree_name']."</a>"." &raquo; " . $this->getHistoryLink($clean['id_wiki']) . " &raquo; " . gtext('Make current');
-
- $data['notice'] = null;
- $this->s['registered']->checkStatus();
-
- if ($this->s['registered']->status['status'] === 'logged')
- {
- if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..');
-
- if ($this->m['WikiModel']->isBlocked($clean['id_wiki'])) $this->redirect('wiki/page/'.$this->lang,2,'this page has been blocked..');
-
- if ($this->m['WikiModel']->isDeleted($clean['id_wiki'])) $this->redirect('wiki/page/'.$this->lang,2,'this page has been deleted..');
-
- if (isset($_POST['confirmAction']))
- {
- $this->m['WikiModel']->makeCurrent($clean['id_rev']);
-
- if ($this->m['WikiModel']->queryResult)
- {
- $domainName = rtrim(Url::getRoot(),"/");
- header('Location: '.$domainName.'/wiki/page/'.$this->lang.'/'.$this->m['WikiModel']->lastTitleClean);
- die();
- }
-
- $data['notice'] = $this->m['WikiModel']->notice;
- }
-
- $this->append($data);
- $this->load('climb');
- $this->load('bottom_left');
- $this->right();
- }
- else
- {
- $this->redirect("users/login/".$this->lang."?redirect=".$this->controller."/page/".$this->lang."/".encodeUrl($data['tree_name']),0);
- }
- }
- }
-
- public function talk($lang = 'en', $id_wiki = 0)
- {
- $this->shift(2);
-
- $this->m['WikitalkModel']->setFields('title,message','sanitizeAll');
-
- $data['title'] = 'talk - '.Website::$generalName;
-
- $clean['id_wiki'] = (int)$id_wiki;
- $data['id_wiki'] = $clean['id_wiki'];
- $data['tree_name'] = $this->m['WikiModel']->getTheModelName($clean['id_wiki']);
- $data['isBlocked'] = $this->m['WikiModel']->isBlocked($clean['id_wiki']);
- $data['isDeleted'] = $this->m['WikiModel']->isDeleted($clean['id_wiki']);
-
- $data['tree'] = $this->getSpecPageLink() . " &raquo; " . "<a href='".$this->m['WikiModel']->toWikiPage($clean['id_wiki'])."'>".$data['tree_name']."</a>"." &raquo; ".gtext('Talk');
-
- if (isset($_POST['insertAction']))
- {
- if ($this->s['registered']->status['status'] === 'logged')
- {
- if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..');
-
- if ($this->m['WikiModel']->isBlocked($clean['id_wiki'])) $this->redirect('wiki/page/'.$this->lang,2,'this page has been blocked..');
-
- if ($this->m['WikiModel']->isDeleted($clean['id_wiki'])) $this->redirect('wiki/page/'.$this->lang,2,'this page has been deleted..');
-
- $this->m['WikitalkModel']->values['created_by'] = $this->s['registered']->status['id_user'];
- $this->m['WikitalkModel']->values['id_wiki'] = $clean['id_wiki'];
-
- $this->m['WikitalkModel']->updateTable('insert');
-
-// if ($this->m['WikitalkModel']->queryResult)
-// {
-// header('Refresh: 0;url='.$_SERVER['REQUEST_URI']);
-// die();
-// }
- }
- }
-
- $data['table'] = $this->m['WikitalkModel']->select()->where(array('id_wiki'=>$clean['id_wiki']))->orderBy('id_talk')->send();
-
- $data['values'] = $this->m['WikitalkModel']->getFormValues('insert','sanitizeHtml');
- $data['notice'] = $this->m['WikitalkModel']->notice;
-
-// javascript for moderator
- $data['md_javascript'] = "moderator_dialog(\"hide\",\"wiki_talk\");moderator_dialog(\"show\",\"wiki_talk\");";
- $data['go_to'] = $this->currPage."/".$this->lang."/".$clean['id_wiki'];
-
- $this->append($data);
- $this->load('talk');
- $this->load('moderator_dialog');
- $this->right();
- }
-
- public function pages($lang = 'en')
- {
- $data['topString'] = 'list of pages';
- $data['title'] = gtext('list of pages').' - '.Website::$generalName;
-
- $this->setArgKeys(array('page:forceNat'=>1));
-
- $this->shift(1);
-
- $this->helper('Pages','wiki/pages/'.$this->lang,'page');
-
- $this->m['WikiModel']->clear()->select()->where(array('-deleted'=>'no'))->orderBy('id_wiki desc');
-
- $recordNumber = $this->m['WikiModel']->rowNumber();
- $page = $this->viewArgs['page'];
-
- $this->m['WikiModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,30);
-
- $data['table'] = $this->m['WikiModel']->send();
-
- $data['pageList'] = $this->h['Pages']->render($page-7,15);
-
- $this->append($data);
- $this->load('pages');
- $this->right();
- }
-
- protected function see($lang = 'en', $status = 'blocked')
- {
- $this->s['registered']->check('admin');
-
- switch ($status)
- {
- case 'deleted':
- $data['topString'] = 'list of deleted pages';
- $data['title'] = gtext('list of deleted pages').' - '.Website::$generalName;
- $whereClause = '-deleted';
- break;
- case 'blocked':
- $data['topString'] = 'list of blocked pages';
- $data['title'] = gtext('list of blocked pages').' - '.Website::$generalName;
- $whereClause = 'blocked';
- break;
- }
-
- $this->setArgKeys(array('page:forceNat'=>1));
-
- $this->shift(1);
-
- $this->helper('Pages','wiki/'.$status.'/'.$this->lang,'page');
-
- $this->m['WikiModel']->clear()->select()->where(array($whereClause=>'yes'))->orderBy('id_wiki desc');
-
- $recordNumber = $this->m['WikiModel']->rowNumber();
- $page = $this->viewArgs['page'];
-
- $this->m['WikiModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,30);
-
- $data['table'] = $this->m['WikiModel']->send();
-
- $data['pageList'] = $this->h['Pages']->render($page-7,15);
-
- $this->append($data);
- $this->load('pages');
- $this->right();
- }
-
- public function deleted($lang = 'en')
- {
- $this->see($lang,'deleted');
- }
-
- public function blocked($lang = 'en')
- {
- $this->see($lang,'blocked');
- }
-
- //print all the modifications to the wiki
- public function modifications($lang = 'en')
- {
- $data['title'] = gtext('last modifications').' - '.Website::$generalName;
-
- $this->setArgKeys(array('page:forceNat'=>1));
-
- $this->shift(1);
-
- $whereClauseArray = array(
- 'gr' => 'registered',
- 'type' => 'wiki',
- );
-
- $this->helper('Pages','wiki/modifications/'.$this->lang,'page');
-
- $this->m['HistoryModel']->clear()->select()->where($whereClauseArray)->orderBy('id_history desc');
-
- $recordNumber = $this->m['HistoryModel']->rowNumber();
- $page = $this->viewArgs['page'];
-
- $this->m['HistoryModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,30);
-
- $data['table'] = $this->m['HistoryModel']->send();
-
- $data['pageList'] = $this->h['Pages']->render($page-7,15);
-
- $this->append($data);
- $this->load('modifications');
- $this->right();
- }
-
- protected function getViewLink($ne_name)
- {
- return "<a href='".$this->baseUrl.'/'.$this->controller.'/page/'.$this->lang.'/'.encodeUrl($ne_name)."'>".$ne_name."</a>";
- }
-
- protected function getHistoryLink($id)
- {
- return "<a href='".$this->baseUrl.'/'.$this->controller.'/history/'.$this->lang.'/'.$id."'>".gtext('History')."</a>";
- }
-
- protected function getSpecPageLink()
- {
- return "<a href='".$this->baseUrl.'/'.$this->controller.'/page/'.$this->lang."/Main-Page'>".ucfirst($this->controller)."</a>";
- }
-
-} \ No newline at end of file