aboutsummaryrefslogtreecommitdiff
path: root/h-source/Application/Controllers
diff options
context:
space:
mode:
authorYuchen Pei <me@ypei.me>2021-07-29 14:17:20 +1000
committerYuchen Pei <me@ypei.me>2021-07-29 14:17:20 +1000
commit3ff03dc4f0a72432b34c00da620272cf011e4ddd (patch)
tree5746711ba17a91aed56c6529ea8cceb06c3ad16a /h-source/Application/Controllers
parentcd4534aa10ba3b122963992741721289fa50d0ab (diff)
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)
Diffstat (limited to 'h-source/Application/Controllers')
-rw-r--r--h-source/Application/Controllers/BaseController.php34
-rw-r--r--h-source/Application/Controllers/ManagerController.php72
-rw-r--r--h-source/Application/Controllers/UsersController.php4
-rw-r--r--h-source/Application/Controllers/WikiController.php3
4 files changed, 19 insertions, 94 deletions
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 @@
-<?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!');
-
-//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'];