From 3ff03dc4f0a72432b34c00da620272cf011e4ddd Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 29 Jul 2021 14:17:20 +1000 Subject: Publishing h-node.org code. - this is the h-node.org code, except - removed a js file (3x copies at three different locations) without license / copyright headers - /Js/linkToForm.js - /Public/Js/linkToForm.js - /admin/Public/Js/linkToForm.js - removed config files containing credentials - /Application/Include/params.php - /Config/Config.php - /admin/Application/Include/params.php - /admin/Config/Config.php - added license and copyright header to one php file - /admin/Library/ErrorReporting.php (almost identical to /Library/ErrorReporting.php which has the headers) --- .../Application/Controllers/BaseController.php | 34 +++++----- .../Application/Controllers/ManagerController.php | 72 ---------------------- .../Application/Controllers/UsersController.php | 4 +- .../Application/Controllers/WikiController.php | 3 +- 4 files changed, 19 insertions(+), 94 deletions(-) delete mode 100644 h-source/Application/Controllers/ManagerController.php (limited to 'h-source/Application/Controllers') diff --git a/h-source/Application/Controllers/BaseController.php b/h-source/Application/Controllers/BaseController.php index 5c5a197..ac2be1f 100644 --- a/h-source/Application/Controllers/BaseController.php +++ b/h-source/Application/Controllers/BaseController.php @@ -119,7 +119,7 @@ class BaseController extends Controller //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) { @@ -128,30 +128,28 @@ class BaseController extends Controller } //get the configuration xml - if (Website::$useXmlConfigFile) + $xmlRes = $this->m['ParamsModel']->select('boxes_xml')->where(array('id_par'=>1))->toList('boxes_xml')->send(); + if (count($xmlRes)>0) { - $xmlConfigFile = rtrim(Website::$xmlConfigFileFolder,'/') . '/config.xml'; - - if (@simplexml_load_file($xmlConfigFile)) + $configXml = htmlspecialchars_decode($xmlRes[0],ENT_QUOTES); + + if (Website::$useXmlConfigFile) { - $this->_configXml = simplexml_load_file($xmlConfigFile); + $xmlConfigFile = rtrim(Website::$xmlConfigFileFolder,'/') . '/config.xml'; + if (@simplexml_load_file($xmlConfigFile)) + { + $this->_configXml = simplexml_load_file($xmlConfigFile); + } } - } - else - { - $xmlRes = $this->m['ParamsModel']->select('boxes_xml')->where(array('id_par'=>1))->toList('boxes_xml')->send(); - - if (count($xmlRes)>0) + else { - $configXml = htmlspecialchars_decode($xmlRes[0],ENT_QUOTES); - 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"))); @@ -162,9 +160,9 @@ class BaseController extends Controller //link to the "discover your hardware" wiki page $data['discoverYourHardwareLink'] = $this->getModule(array('right_column','discover_your_hardware')); - + Distributions::setAllowedList(); - + $this->append($data); } @@ -302,4 +300,4 @@ class BaseController extends Controller } } -} \ No newline at end of file +} diff --git a/h-source/Application/Controllers/ManagerController.php b/h-source/Application/Controllers/ManagerController.php deleted file mode 100644 index b178ea6..0000000 --- a/h-source/Application/Controllers/ManagerController.php +++ /dev/null @@ -1,72 +0,0 @@ -. - -if (!defined('EG')) die('Direct access not allowed!'); - -//this controller is used to carry out the actions of the superadmin -class ManagerController extends BaseController -{ - - public function __construct($model, $controller, $queryString) - { - parent::__construct($model, $controller, $queryString); - - $this->model('DistrosModel'); - $this->modelName = 'DistrosModel'; - - $data['title'] = 'Manager - '.Website::$generalName; - $this->append($data); - - $this->setArgKeys(array('page:forceInt'=>1)); - - $this->s['registered']->check('manager'); - } - - public function distros($lang = 'en') { //view all the users - - $this->shift(1); - - $this->loadScaffold('main',array('popup'=>true,'popupType'=>'inclusive','recordPerPage'=>30, 'mainAction'=>'distros/'.$this->lang, "mainMenu" => "add")); - - $this->scaffold->loadMain('distros.full_name,distros.clean_name','distros.id_distro','moveup,movedown,ledit,del'); - $this->scaffold->setHead(gtext('TITLE').','.gtext('DISTRO-CODE')); - - $this->scaffold->mainMenu->links['add']['url'] = 'form/insert/0'; - $this->scaffold->mainMenu->links['add']['title'] = gtext('Insert a new distro'); - - $this->scaffold->update('del'); - - $this->scaffold->model->clear(); - - $this->scaffold->model->orderBy("id_order"); - - $this->scaffold->update('moveup,movedown'); - - $data['scaffold'] = $this->scaffold->render(); -// echo $this->scaffold->model->getQuery(); - - $data['notice'] = $this->scaffold->model->notice; - - $this->append($data); - $this->cleverLoad('distros'); - $this->right($this->lang); - } - -} \ No newline at end of file diff --git a/h-source/Application/Controllers/UsersController.php b/h-source/Application/Controllers/UsersController.php index c324804..741eaf4 100644 --- a/h-source/Application/Controllers/UsersController.php +++ b/h-source/Application/Controllers/UsersController.php @@ -136,8 +136,8 @@ class UsersController extends BaseController ); $this->m['UsersModel']->databaseConditions['insert'] = array( - "checkUnique" => "username|the username is already present", - "+checkUnique" => "e_mail|the e-mail address is already present" + "checkUnique" => "username", + "+checkUnique" => "e_mail" ); if ($this->s['registered']->status['status'] === 'logged') diff --git a/h-source/Application/Controllers/WikiController.php b/h-source/Application/Controllers/WikiController.php index 6304d77..5dc05b8 100644 --- a/h-source/Application/Controllers/WikiController.php +++ b/h-source/Application/Controllers/WikiController.php @@ -259,8 +259,7 @@ class WikiController extends BaseController $data['title'] = 'history - '.Website::$generalName; //get the first revision - $res = $this->m['WikirevisionsModel']->db->select('wiki_revisions','id_rev','id_wiki='.$clean['id'],null,'id_rev',1); -// echo $this->m['WikirevisionsModel']->getQuery(); + $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']; -- cgit v1.2.3