From 07f5140771388c9e0c8a99b0dd2e5d950bdb173b Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 14 Oct 2021 15:16:42 +1100 Subject: moving h-source subdir out. --- .../Controllers/AdminboxesController.php | 78 +++++ .../Controllers/AdmindeletionController.php | 66 +++++ .../Controllers/AdminhardwareController.php | 121 ++++++++ .../Controllers/AdminhistoryController.php | 68 +++++ .../Controllers/AdminissuesController.php | 88 ++++++ .../Controllers/AdminmessagesController.php | 86 ++++++ .../Controllers/AdminnewsController.php | 78 +++++ .../Controllers/AdminparamsController.php | 68 +++++ .../Controllers/AdminpasswordController.php | 88 ++++++ .../Controllers/AdminregusersController.php | 101 +++++++ .../Controllers/AdmintalkController.php | 59 ++++ .../Controllers/AdminusersController.php | 200 +++++++++++++ admin/Application/Controllers/PanelController.php | 43 +++ admin/Application/Hooks/AfterInitialization.php | 10 + admin/Application/Hooks/BeforeChecks.php | 16 ++ admin/Application/Hooks/BeforeInitialization.php | 10 + admin/Application/Hooks/index.html | 1 + admin/Application/Include/distributions.php | 88 ++++++ admin/Application/Include/hardware.php | 216 ++++++++++++++ admin/Application/Include/languages.php | 192 +++++++++++++ admin/Application/Include/myFunctions.php | 318 +++++++++++++++++++++ admin/Application/Include/params.php | 145 ++++++++++ admin/Application/Models/AdminusersModel.php | 37 +++ admin/Application/Models/BaseModel.php | 68 +++++ admin/Application/Models/BoxesModel.php | 42 +++ admin/Application/Models/DeletionModel.php | 53 ++++ admin/Application/Models/HardwareModel.php | 200 +++++++++++++ admin/Application/Models/HistoryModel.php | 55 ++++ admin/Application/Models/IssuesModel.php | 96 +++++++ admin/Application/Models/MessagesModel.php | 58 ++++ admin/Application/Models/NewsModel.php | 44 +++ admin/Application/Models/NotebooksModel.php | 71 +++++ admin/Application/Models/ParamsModel.php | 48 ++++ admin/Application/Models/PrintersModel.php | 70 +++++ admin/Application/Models/ProfileModel.php | 72 +++++ admin/Application/Models/RevisionsModel.php | 50 ++++ admin/Application/Models/ScannersModel.php | 70 +++++ admin/Application/Models/TalkModel.php | 54 ++++ admin/Application/Models/UsersModel.php | 223 +++++++++++++++ admin/Application/Models/VideocardsModel.php | 66 +++++ admin/Application/Models/WifiModel.php | 69 +++++ admin/Application/Modules/ModBase.php | 41 +++ admin/Application/Modules/ModImage.php | 45 +++ admin/Application/Modules/ModLink.php | 18 ++ admin/Application/Modules/ModLinkimage.php | 18 ++ admin/Application/Modules/ModRaw.php | 18 ++ admin/Application/Modules/index.html | 1 + .../Application/Strings/Lang/It/DbCondStrings.php | 17 ++ admin/Application/Strings/Lang/It/ModelStrings.php | 19 ++ .../Application/Strings/Lang/It/UploadStrings.php | 26 ++ .../Application/Strings/Lang/It/ValCondStrings.php | 69 +++++ admin/Application/Strings/Lang/It/index.html | 1 + admin/Application/Strings/Lang/index.html | 1 + admin/Application/Strings/index.html | 1 + admin/Application/Views/Adminboxes/main.php | 25 ++ admin/Application/Views/Admindeletion/main.php | 25 ++ admin/Application/Views/Adminhardware/ask.php | 53 ++++ admin/Application/Views/Adminhardware/main.php | 25 ++ admin/Application/Views/Adminhistory/main.php | 25 ++ admin/Application/Views/Adminissues/main.php | 36 +++ admin/Application/Views/Adminmessages/main.php | 35 +++ admin/Application/Views/Adminnews/main.php | 35 +++ admin/Application/Views/Adminparams/form.php | 25 ++ admin/Application/Views/Adminpassword/form.php | 9 + .../Application/Views/Adminregusers/associate.php | 54 ++++ admin/Application/Views/Adminregusers/main.php | 25 ++ admin/Application/Views/Admintalk/main.php | 25 ++ admin/Application/Views/Adminusers/associate.php | 54 ++++ admin/Application/Views/Adminusers/forceout.php | 29 ++ admin/Application/Views/Adminusers/login.php | 45 +++ admin/Application/Views/Adminusers/logout.php | 29 ++ admin/Application/Views/Adminusers/main.php | 25 ++ admin/Application/Views/footer_back.php | 27 ++ admin/Application/Views/header_back.php | 94 ++++++ admin/Application/Views/panel.php | 55 ++++ admin/Application/index.html | 1 + 76 files changed, 4617 insertions(+) create mode 100644 admin/Application/Controllers/AdminboxesController.php create mode 100644 admin/Application/Controllers/AdmindeletionController.php create mode 100644 admin/Application/Controllers/AdminhardwareController.php create mode 100644 admin/Application/Controllers/AdminhistoryController.php create mode 100644 admin/Application/Controllers/AdminissuesController.php create mode 100644 admin/Application/Controllers/AdminmessagesController.php create mode 100644 admin/Application/Controllers/AdminnewsController.php create mode 100644 admin/Application/Controllers/AdminparamsController.php create mode 100644 admin/Application/Controllers/AdminpasswordController.php create mode 100644 admin/Application/Controllers/AdminregusersController.php create mode 100644 admin/Application/Controllers/AdmintalkController.php create mode 100644 admin/Application/Controllers/AdminusersController.php create mode 100755 admin/Application/Controllers/PanelController.php create mode 100644 admin/Application/Hooks/AfterInitialization.php create mode 100644 admin/Application/Hooks/BeforeChecks.php create mode 100644 admin/Application/Hooks/BeforeInitialization.php create mode 100644 admin/Application/Hooks/index.html create mode 100644 admin/Application/Include/distributions.php create mode 100644 admin/Application/Include/hardware.php create mode 100644 admin/Application/Include/languages.php create mode 100644 admin/Application/Include/myFunctions.php create mode 100644 admin/Application/Include/params.php create mode 100755 admin/Application/Models/AdminusersModel.php create mode 100644 admin/Application/Models/BaseModel.php create mode 100644 admin/Application/Models/BoxesModel.php create mode 100644 admin/Application/Models/DeletionModel.php create mode 100644 admin/Application/Models/HardwareModel.php create mode 100644 admin/Application/Models/HistoryModel.php create mode 100644 admin/Application/Models/IssuesModel.php create mode 100644 admin/Application/Models/MessagesModel.php create mode 100644 admin/Application/Models/NewsModel.php create mode 100644 admin/Application/Models/NotebooksModel.php create mode 100644 admin/Application/Models/ParamsModel.php create mode 100644 admin/Application/Models/PrintersModel.php create mode 100644 admin/Application/Models/ProfileModel.php create mode 100644 admin/Application/Models/RevisionsModel.php create mode 100644 admin/Application/Models/ScannersModel.php create mode 100644 admin/Application/Models/TalkModel.php create mode 100755 admin/Application/Models/UsersModel.php create mode 100644 admin/Application/Models/VideocardsModel.php create mode 100644 admin/Application/Models/WifiModel.php create mode 100644 admin/Application/Modules/ModBase.php create mode 100644 admin/Application/Modules/ModImage.php create mode 100644 admin/Application/Modules/ModLink.php create mode 100644 admin/Application/Modules/ModLinkimage.php create mode 100644 admin/Application/Modules/ModRaw.php create mode 100644 admin/Application/Modules/index.html create mode 100644 admin/Application/Strings/Lang/It/DbCondStrings.php create mode 100644 admin/Application/Strings/Lang/It/ModelStrings.php create mode 100644 admin/Application/Strings/Lang/It/UploadStrings.php create mode 100644 admin/Application/Strings/Lang/It/ValCondStrings.php create mode 100644 admin/Application/Strings/Lang/It/index.html create mode 100644 admin/Application/Strings/Lang/index.html create mode 100644 admin/Application/Strings/index.html create mode 100644 admin/Application/Views/Adminboxes/main.php create mode 100644 admin/Application/Views/Admindeletion/main.php create mode 100644 admin/Application/Views/Adminhardware/ask.php create mode 100644 admin/Application/Views/Adminhardware/main.php create mode 100644 admin/Application/Views/Adminhistory/main.php create mode 100644 admin/Application/Views/Adminissues/main.php create mode 100644 admin/Application/Views/Adminmessages/main.php create mode 100644 admin/Application/Views/Adminnews/main.php create mode 100755 admin/Application/Views/Adminparams/form.php create mode 100755 admin/Application/Views/Adminpassword/form.php create mode 100644 admin/Application/Views/Adminregusers/associate.php create mode 100644 admin/Application/Views/Adminregusers/main.php create mode 100644 admin/Application/Views/Admintalk/main.php create mode 100644 admin/Application/Views/Adminusers/associate.php create mode 100755 admin/Application/Views/Adminusers/forceout.php create mode 100755 admin/Application/Views/Adminusers/login.php create mode 100755 admin/Application/Views/Adminusers/logout.php create mode 100644 admin/Application/Views/Adminusers/main.php create mode 100755 admin/Application/Views/footer_back.php create mode 100755 admin/Application/Views/header_back.php create mode 100755 admin/Application/Views/panel.php create mode 100644 admin/Application/index.html (limited to 'admin/Application') diff --git a/admin/Application/Controllers/AdminboxesController.php b/admin/Application/Controllers/AdminboxesController.php new file mode 100644 index 0000000..65ba18c --- /dev/null +++ b/admin/Application/Controllers/AdminboxesController.php @@ -0,0 +1,78 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class AdminboxesController extends Controller { + + function __construct($model, $controller, $queryString) { + parent::__construct($model, $controller, $queryString); + + $this->load('header_back'); + $this->load('footer_back','last'); + + $this->session('admin'); + $this->model('BoxesModel'); + + $this->modelName = 'BoxesModel'; + + $this->m['BoxesModel']->setFields('title,message','sanitizeAll'); + + $this->setArgKeys(array('page:forceNat'=>1,'token:sanitizeAll'=>'token')); + } + + public function main() + { + $this->shift(); + + $this->s['admin']->check(); + + if (!$this->s['admin']->checkCsrf($this->viewArgs['token'])) $this->redirect('panel/main/',2,'wrong token..'); + + $this->loadScaffold('main'); + + $this->scaffold->loadMain('boxes:id_box,boxes:title,smartDate|boxes:creation_date','boxes:id_box','edit,del'); + $this->scaffold->setHead('NEWS ID,TITLE,DATE'); + $this->scaffold->update('del'); + $data['scaffold'] = $this->scaffold->render(); + $this->append($data); + $this->load('main'); + } + + public function form($queryType = 'insert') + { + $this->shift(1); + + $this->s['admin']->check(); + + if (!$this->s['admin']->checkCsrf($this->viewArgs['token'])) $this->redirect('panel/main/',2,'wrong token..'); + + $this->m['BoxesModel']->updateTable('insert,update'); + + $this->loadScaffold('form'); + $this->scaffold->loadForm($queryType,"adminboxes/form/$queryType"); + $this->scaffold->getFormValues('sanitizeHtml'); + $data['scaffold'] = $this->scaffold->render(); + + $this->append($data); + $this->load('main'); + } + +} \ No newline at end of file diff --git a/admin/Application/Controllers/AdmindeletionController.php b/admin/Application/Controllers/AdmindeletionController.php new file mode 100644 index 0000000..d5ee6fc --- /dev/null +++ b/admin/Application/Controllers/AdmindeletionController.php @@ -0,0 +1,66 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class AdmindeletionController extends Controller { + + function __construct($model, $controller, $queryString) { + parent::__construct($model, $controller, $queryString); + + $this->load('header_back'); + $this->load('footer_back','last'); + + $this->session('admin'); + $this->model('DeletionModel'); + + $this->modelName = 'DeletionModel'; + +// $this->m['DeletionModel']->setFields('object,topic,status,priority,message,notice','sanitizeAll'); + + $this->setArgKeys(array('page:forceNat'=>1,'object:sanitizeAll'=>'undef','token:sanitizeAll'=>'token')); + } + + public function main() + { + $this->shift(); + + Params::$nullQueryValue = 'undef'; + + $this->s['admin']->check(); + + if (!$this->s['admin']->checkCsrf($this->viewArgs['token'])) $this->redirect('panel/main/',2,'wrong token..'); + + $this->loadScaffold('main',array('popup'=>true,'popupType'=>'inclusive','mainMenu'=>'panel','recordPerPage'=>30)); + + $whereClauseArray = array( + 'object' => $this->viewArgs['object'], + ); + $this->scaffold->setWhereQueryClause($whereClauseArray); + + $this->scaffold->loadMain('deletion:id_del,deletion:object,deletion:id_duplicate,deletion:id_hard,getUserName|deletion:created_by,smartDate|deletion:creation_date','deletion:id_del',''); + $this->scaffold->setHead('DEL ID,OBJECT,DUPLICATED,HARDWARE ID,CREATED BY,DATE'); + $this->scaffold->update('del'); + $data['scaffold'] = $this->scaffold->render(); + $this->append($data); + $this->load('main'); + } + +} \ No newline at end of file diff --git a/admin/Application/Controllers/AdminhardwareController.php b/admin/Application/Controllers/AdminhardwareController.php new file mode 100644 index 0000000..c02a4c2 --- /dev/null +++ b/admin/Application/Controllers/AdminhardwareController.php @@ -0,0 +1,121 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class AdminhardwareController extends Controller +{ + + function __construct($model, $controller, $queryString) + { + parent::__construct($model, $controller, $queryString); + + $this->load('header_back'); + $this->load('footer_back','last'); + + $this->session('admin'); + $this->model('HardwareModel'); + $this->model('DeletionModel'); + + $this->modelName = 'HardwareModel'; + + $this->m['HardwareModel']->setFields('deleted','sanitizeAll'); + + $this->setArgKeys(array('page:forceNat'=>1,'type:sanitizeAll'=>'undef','ask_for_del:sanitizeAll'=>'undef','-deleted:sanitizeAll'=>'undef','token:sanitizeAll'=>'token')); + } + + public function main() + { + $this->shift(); + + Params::$nullQueryValue = 'undef'; + + $this->s['admin']->check(); + + if (!$this->s['admin']->checkCsrf($this->viewArgs['token'])) $this->redirect('panel/main/',2,'wrong token..'); + + $this->loadScaffold('main',array('popup'=>true,'popupType'=>'inclusive','mainMenu'=>'panel','recordPerPage'=>30)); + + $whereClauseArray = array( + 'type' => $this->viewArgs['type'], + 'ask_for_del' => $this->viewArgs['ask_for_del'], + '-deleted' => $this->viewArgs['-deleted'], + ); + $this->scaffold->setWhereQueryClause($whereClauseArray); + + $this->scaffold->loadMain('hardware:id_hard,hardware:model,hardware:type,getUserName|hardware:created_by,getUserName|hardware:updated_by,smartDate|hardware:creation_date,smartDate|hardware:update_date,hardware:ask_for_del,hardware:deleted','hardware:id_hard','edit'); + + $this->scaffold->addItem('simpleLink','adminhardware/ask/;hardware:id_hard;',null,'who asked for deletion'); + $this->scaffold->setHead('HARD ID,MODEL,TYPE,CREATED BY,UPDATED BY,CREATION DATE,UPDATE DATE,ASK FOR DEL?,DELETED?,EDIT,VIEW'); + $data['scaffold'] = $this->scaffold->render(); + $this->append($data); + $this->load('main'); + } + + public function ask($id_hard = 0) + { + $this->shift(1); + + $this->s['admin']->check(); + + if (!$this->s['admin']->checkCsrf($this->viewArgs['token'])) $this->redirect('panel/main/',2,'wrong token..'); + + $clean['id_hard'] = (int)$id_hard; + + $this->helper('Menu','adminhardware','panel'); + $this->h['Menu']->links['back']['text'] = 'Back'; + $this->h['Menu']->links['back']['url'] = 'main'; + + $data["table"] = $this->m['DeletionModel']->select()->where(array("id_hard"=>$clean['id_hard']))->orderBy("id_del desc")->send(); + + $data['menu'] = $this->h['Menu']->render('panel,back'); + + $this->append($data); + $this->load('ask'); + + } + + public function form($queryType = 'update') + { + $this->shift(1); + + $this->s['admin']->check(); + + if (!$this->s['admin']->checkCsrf($this->viewArgs['token'])) $this->redirect('panel/main/',2,'wrong token..'); + + if (isset($_POST['updateAction'])) + { + $clean['id_hard'] = $this->request->post('id_hard',0,'forceInt'); + $clean['deleted'] = $this->request->post('deleted',0,'sanitizeAll'); + + $this->m['HardwareModel']->db->update('hardware','deleted',array($clean['deleted']),'id_hard='.$clean['id_hard']); + + } + + $this->loadScaffold('form'); + $this->scaffold->loadForm($queryType,"adminhardware/form/$queryType"); + $this->scaffold->getFormValues('sanitizeHtml'); + $data['scaffold'] = $this->scaffold->render(); + + $this->append($data); + $this->load('main'); + } + +} \ No newline at end of file diff --git a/admin/Application/Controllers/AdminhistoryController.php b/admin/Application/Controllers/AdminhistoryController.php new file mode 100644 index 0000000..849e432 --- /dev/null +++ b/admin/Application/Controllers/AdminhistoryController.php @@ -0,0 +1,68 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class AdminhistoryController extends Controller +{ + + function __construct($model, $controller, $queryString) + { + parent::__construct($model, $controller, $queryString); + + $this->load('header_back'); + $this->load('footer_back','last'); + + $this->session('admin'); + $this->model('HistoryModel'); + + $this->modelName = 'HistoryModel'; + + $this->setArgKeys(array('page:forceNat'=>1,'type:sanitizeAll'=>'undef','action:sanitizeAll'=>'undef','created_by:sanitizeAll'=>'undef','token:sanitizeAll'=>'token')); + } + + public function main() + { + $this->shift(); + + Params::$nullQueryValue = 'undef'; + + $this->s['admin']->check(); + + if (!$this->s['admin']->checkCsrf($this->viewArgs['token'])) $this->redirect('panel/main/',2,'wrong token..'); + + $this->loadScaffold('main',array('popup'=>true,'popupType'=>'inclusive','mainMenu'=>'panel','recordPerPage'=>30)); + + $whereClauseArray = array( + 'type' => $this->viewArgs['type'], + 'action' => $this->viewArgs['action'], + 'created_by'=> $this->viewArgs['created_by'], + 'gr' => '!="registered"', + ); + $this->scaffold->setWhereQueryClause($whereClauseArray); + $this->scaffold->model->orderBy('id_history desc'); + $this->scaffold->loadMain('history:id_history,history:type,history:action,getUserName|history:created_by,history:id,smartDate|history:creation_date,history:gr,history:message','history:id_history',''); + $this->scaffold->setHead('HISTORY ID,TYPE,ACTION,CREATED BY,OBJECT ID,CREATION DATE,GROUP,MESSAGE'); + $data['scaffold'] = $this->scaffold->render(); + $this->append($data); + $this->load('main'); + } + +} \ No newline at end of file diff --git a/admin/Application/Controllers/AdminissuesController.php b/admin/Application/Controllers/AdminissuesController.php new file mode 100644 index 0000000..476b69c --- /dev/null +++ b/admin/Application/Controllers/AdminissuesController.php @@ -0,0 +1,88 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class AdminissuesController extends Controller { + + function __construct($model, $controller, $queryString) { + parent::__construct($model, $controller, $queryString); + + $this->load('header_back'); + $this->load('footer_back','last'); + + $this->session('admin'); + $this->model('IssuesModel'); + + $this->modelName = 'IssuesModel'; + + $this->m['IssuesModel']->setFields('deleted,status','sanitizeAll'); + + $this->setArgKeys(array('page:forceNat'=>1,'priority:sanitizeAll'=>'undef','status:sanitizeAll'=>'undef','topic:sanitizeAll'=>'undef','deleted:sanitizeAll'=>'undef','token:sanitizeAll'=>'token')); + } + + public function main() + { + $this->shift(); + + Params::$nullQueryValue = 'undef'; + + $this->s['admin']->check(); + + if (!$this->s['admin']->checkCsrf($this->viewArgs['token'])) $this->redirect('panel/main/',2,'wrong token..'); + + $this->loadScaffold('main',array('popup'=>true,'popupType'=>'inclusive')); + + $whereClauseArray = array( + 'priority' => $this->viewArgs['priority'], + 'status' => $this->viewArgs['status'], + 'topic' => $this->viewArgs['topic'], + 'deleted' => $this->viewArgs['deleted'], + ); + $this->scaffold->setWhereQueryClause($whereClauseArray); + + $this->scaffold->loadMain('issues:id_issue,issues:title,issues:topic,getUserName|issues:created_by,issues:priority,issues:status,smartDate|issues:creation_date,issues:deleted','issues:id_issue','edit,del'); + $this->scaffold->setHead('ISSUE ID,TITLE,TOPIC,CREATED BY,PRIORITY,STATUS,DATE'); + $this->scaffold->update('del'); + $data['scaffold'] = $this->scaffold->render(); + $this->append($data); + $this->load('main'); + } + + public function form($queryType = 'insert') + { + $this->shift(1); + + $this->s['admin']->check(); + + if (!$this->s['admin']->checkCsrf($this->viewArgs['token'])) $this->redirect('panel/main/',2,'wrong token..'); + + $this->m['IssuesModel']->updateTable('insert,update'); + + $this->loadScaffold('form'); + $this->scaffold->loadForm($queryType,"adminissues/form/$queryType"); + $this->scaffold->getFormValues('sanitizeHtml'); + $data['scaffold'] = $this->scaffold->render(); + + $this->append($data); + $this->load('main'); + } + +} \ No newline at end of file diff --git a/admin/Application/Controllers/AdminmessagesController.php b/admin/Application/Controllers/AdminmessagesController.php new file mode 100644 index 0000000..5a979c4 --- /dev/null +++ b/admin/Application/Controllers/AdminmessagesController.php @@ -0,0 +1,86 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class AdminmessagesController extends Controller { + + function __construct($model, $controller, $queryString) { + parent::__construct($model, $controller, $queryString); + + $this->load('header_back'); + $this->load('footer_back','last'); + + $this->session('admin'); + $this->model('MessagesModel'); + + $this->modelName = 'MessagesModel'; + + $this->m['MessagesModel']->setFields('deleted,has_read','sanitizeAll'); + + $this->setArgKeys(array('page:forceNat'=>1,'deleted:sanitizeAll'=>'undef','has_read:sanitizeAll'=>'undef','token:sanitizeAll'=>'token')); + } + + public function main() + { + $this->shift(); + + Params::$nullQueryValue = 'undef'; + + $this->s['admin']->check(); + + if (!$this->s['admin']->checkCsrf($this->viewArgs['token'])) $this->redirect('panel/main/',2,'wrong token..'); + + $this->loadScaffold('main',array('popup'=>true,'popupType'=>'inclusive','recordPerPage'=>20)); + + $whereClauseArray = array( + 'deleted' => $this->viewArgs['deleted'], + 'has_read' => $this->viewArgs['has_read'], + ); + $this->scaffold->setWhereQueryClause($whereClauseArray); + $this->scaffold->model->orderBy = "id_mes desc"; + + $this->scaffold->loadMain('messages:id_mes,messages:id_issue,getUserName|messages:created_by,smartDate|messages:creation_date,messages:deleted,messages:has_read','messages:id_mes','edit'); + $this->scaffold->setHead('MESSAGE ID,ISSUE ID,CREATED BY,DATE,DELETED?,ALREADY READ?'); + $data['scaffold'] = $this->scaffold->render(); + $this->append($data); + $this->load('main'); + } + + public function form($queryType = 'insert') + { + $this->shift(1); + + $this->s['admin']->check(); + + if (!$this->s['admin']->checkCsrf($this->viewArgs['token'])) $this->redirect('panel/main/',2,'wrong token..'); + + $this->m['MessagesModel']->updateTable('insert,update'); + + $this->loadScaffold('form'); + $this->scaffold->loadForm($queryType,"adminmessages/form/$queryType"); + $this->scaffold->getFormValues('sanitizeHtml'); + $data['scaffold'] = $this->scaffold->render(); + + $this->append($data); + $this->load('main'); + } + +} \ No newline at end of file diff --git a/admin/Application/Controllers/AdminnewsController.php b/admin/Application/Controllers/AdminnewsController.php new file mode 100644 index 0000000..d722ffe --- /dev/null +++ b/admin/Application/Controllers/AdminnewsController.php @@ -0,0 +1,78 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class AdminnewsController extends Controller { + + function __construct($model, $controller, $queryString) { + parent::__construct($model, $controller, $queryString); + + $this->load('header_back'); + $this->load('footer_back','last'); + + $this->session('admin'); + $this->model('NewsModel'); + + $this->modelName = 'NewsModel'; + + $this->m['NewsModel']->setFields('title,message','sanitizeAll'); + + $this->setArgKeys(array('page:forceNat'=>1,'token:sanitizeAll'=>'token')); + } + + public function main() + { + $this->shift(); + + $this->s['admin']->check(); + + if (!$this->s['admin']->checkCsrf($this->viewArgs['token'])) $this->redirect('panel/main/',2,'wrong token..'); + + $this->loadScaffold('main'); + + $this->scaffold->loadMain('news:id_news,news:title,smartDate|news:creation_date','news:id_news','edit,del'); + $this->scaffold->setHead('NEWS ID,TITLE,DATE'); + $this->scaffold->update('del'); + $data['scaffold'] = $this->scaffold->render(); + $this->append($data); + $this->load('main'); + } + + public function form($queryType = 'insert') + { + $this->shift(1); + + $this->s['admin']->check(); + + if (!$this->s['admin']->checkCsrf($this->viewArgs['token'])) $this->redirect('panel/main/',2,'wrong token..'); + + $this->m['NewsModel']->updateTable('insert,update'); + + $this->loadScaffold('form'); + $this->scaffold->loadForm($queryType,"adminnews/form/$queryType"); + $this->scaffold->getFormValues('sanitizeHtml'); + $data['scaffold'] = $this->scaffold->render(); + + $this->append($data); + $this->load('main'); + } + +} \ No newline at end of file diff --git a/admin/Application/Controllers/AdminparamsController.php b/admin/Application/Controllers/AdminparamsController.php new file mode 100644 index 0000000..62e58b6 --- /dev/null +++ b/admin/Application/Controllers/AdminparamsController.php @@ -0,0 +1,68 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class AdminparamsController extends Controller { + + function __construct($model, $controller, $queryString) { + parent::__construct($model, $controller, $queryString); + + $this->load('header_back'); + $this->load('footer_back','last'); + + $this->session('admin'); + $this->model('ParamsModel'); + + $this->modelName = 'ParamsModel'; + + $this->m['ParamsModel']->setFields('updating,boxes_xml','sanitizeAll'); + + $this->setArgKeys(array('token:sanitizeAll'=>'token')); + } + + public function form() + { + $this->shift(); + + $this->s['admin']->check(); + + if (!$this->s['admin']->checkCsrf($this->viewArgs['token'])) $this->redirect('panel/main/',2,'wrong token..'); + + $this->m['ParamsModel']->updateTable('update',1); + if ($this->m['ParamsModel']->queryResult) + { + if (strcmp($this->m['ParamsModel']->values['updating'],'yes') === 0) + { + $this->m['ParamsModel']->query("delete from regsessions;"); + } + } +// echo $this->m['ParamsModel']->getQuery(); + + $this->loadScaffold('form',array('formMenu'=>'panel')); + $this->scaffold->loadForm('update',"adminparams/form"); + $this->scaffold->getFormValues('sanitizeHtml',1); + $data['scaffold'] = $this->scaffold->render(); + + $this->append($data); + $this->load('form'); + } + +} \ No newline at end of file diff --git a/admin/Application/Controllers/AdminpasswordController.php b/admin/Application/Controllers/AdminpasswordController.php new file mode 100644 index 0000000..bcaca95 --- /dev/null +++ b/admin/Application/Controllers/AdminpasswordController.php @@ -0,0 +1,88 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class AdminpasswordController extends Controller +{ + + function __construct($model, $controller, $queryString) + { + parent::__construct($model, $controller, $queryString); + + $this->load('header_back'); + $this->load('footer_back','last'); + + $this->helper('Menu','users','panel/main'); + $this->helper('Array'); + + $this->session('admin'); + $this->model('AdminusersModel'); + + $this->m['AdminusersModel']->setFields('password:sha1','none'); + + $this->m['AdminusersModel']->strongConditions['update'] = array('checkEqual'=>'password,confirmation'); + $this->m['AdminusersModel']->strongConditions['insert'] = array('checkEqual'=>'password,confirmation'); + + $this->m['AdminusersModel']->identifierName = 'id_user'; + + $this->setArgKeys(array('token:sanitizeAll'=>'token')); + } + + public function form() + { + $this->shift(0); + + $this->s['admin']->check(); + + if (!$this->s['admin']->checkCsrf($this->viewArgs['token'])) $this->redirect('panel/main/',2,'wrong token..'); + + $data['notice'] = null; + + $id = (int)$this->s['admin']->status['id_user']; + if (isset($_POST['updateAction'])) { + $pass = $this->s['admin']->getPassword(); + if (sha1($_POST['old']) === $pass) + { + $this->m['AdminusersModel']->updateTable('update',$id); + $data['notice'] = $this->m['AdminusersModel']->notice; + } + else + { + $data['notice'] = "
Vecchia password sbagliata
\n"; + } + } + $data['menù'] = $this->h['Menu']->render('panel'); + + $values = $this->m['AdminusersModel']->selectId($id); + + $action = array('updateAction'=>'save'); + $form = new Form_Form('adminpassword/form'.$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('form'); + } + +} \ No newline at end of file diff --git a/admin/Application/Controllers/AdminregusersController.php b/admin/Application/Controllers/AdminregusersController.php new file mode 100644 index 0000000..b4ed6ed --- /dev/null +++ b/admin/Application/Controllers/AdminregusersController.php @@ -0,0 +1,101 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class AdminregusersController extends Controller { + + function __construct($model, $controller, $queryString) { + parent::__construct($model, $controller, $queryString); + + $this->load('header_back'); + $this->load('footer_back','last'); + + $this->session('admin'); + $this->model('UsersModel'); + + $this->modelName = 'UsersModel'; + + $this->helper('Menu','adminregusers','panel/main'); + +// $this->m['UsersModel']->setFields('username,e_mail,has_confirmed,deleted,creation_date','sanitizeAll'); + + $this->setArgKeys(array('page:forceNat'=>1,'has_confirmed:sanitizeAll'=>'undef','deleted:sanitizeAll'=>'undef','id_group:sanitizeAll'=>'undef','token:sanitizeAll'=>'token')); + } + + public function main() + { + $this->shift(); + + Params::$nullQueryValue = 'undef'; + + $this->s['admin']->check(); + + if (!$this->s['admin']->checkCsrf($this->viewArgs['token'])) $this->redirect('panel/main/',2,'wrong token..'); + + $this->loadScaffold('main',array('popup'=>true,'popupType'=>'inclusive','mainMenu'=>'panel','recordPerPage'=>30)); + + $whereClauseArray = array( + 'has_confirmed' => $this->viewArgs['has_confirmed'], + 'deleted' => $this->viewArgs['deleted'], + 'id_group' => $this->viewArgs['id_group'], + ); + $this->scaffold->setWhereQueryClause($whereClauseArray); + + $this->scaffold->loadMain('regusers:id_user,regusers:username,regusers:e_mail,regusers:has_confirmed,regusers:deleted,smartDate|regusers:creation_date','regusers:id_user','link'); + $this->scaffold->setHead('USER ID,USERNAME,E-MAIL,HAS CONFIRMED?,DELETED?,DATE'); + $data['scaffold'] = $this->scaffold->render(); + $this->append($data); + $this->load('main'); + } + + public function associate() + { + $this->shift(0); + + $this->s['admin']->check(); + + if (!$this->s['admin']->checkCsrf($this->viewArgs['token'])) $this->redirect('panel/main/',2,'wrong token..'); + + $this->m['UsersModel']->printAssError = 'yes'; + $this->m['UsersModel']->updateTable('associate,dissociate'); + + $data['notice'] = $this->m['UsersModel']->notice; + + $data['menu'] = $this->h['Menu']->render('back'); + + $data['action'] = $this->baseUrl.'/adminregusers/associate'.$this->viewStatus; + + $data['groups'] = $this->m['UsersModel']->getFieldArray('reggroups:id_group','reggroups:name'); + + //get the name of the user whose id is $_POST['id_user'] + $users = $this->m['UsersModel']->db->select('regusers','username','id_user='.(int)$_POST['id_user']); + $data['user'] = $users[0]['regusers']['username']; + + //get the groups inside which the user is inserted + $this->m['UsersModel']->setWhereQueryClause(array('id_user'=>(int)$_POST['id_user'])); + $this->m['UsersModel']->orderBy = 'reggroups.id_group desc'; + $data['groupsUser'] = $this->m['UsersModel']->getAll('Boxes'); +// echo $this->m['UsersModel']->getQuery(); + + $this->set($data); + $this->load('associate'); + } +} \ No newline at end of file diff --git a/admin/Application/Controllers/AdmintalkController.php b/admin/Application/Controllers/AdmintalkController.php new file mode 100644 index 0000000..b91912a --- /dev/null +++ b/admin/Application/Controllers/AdmintalkController.php @@ -0,0 +1,59 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class AdmintalkController extends Controller { + + function __construct($model, $controller, $queryString) { + parent::__construct($model, $controller, $queryString); + + $this->load('header_back'); + $this->load('footer_back','last'); + + $this->session('admin'); + $this->model('TalkModel'); + + $this->modelName = 'TalkModel'; + + $this->m['TalkModel']->setFields('title,message','sanitizeAll'); + + $this->setArgKeys(array('page:forceNat'=>1,'token:sanitizeAll'=>'token')); + } + + public function main() + { + $this->shift(); + + $this->s['admin']->check(); + + if (!$this->s['admin']->checkCsrf($this->viewArgs['token'])) $this->redirect('panel/main/',2,'wrong token..'); + + $this->loadScaffold('main',array('mainMenu'=>'panel')); + + $this->scaffold->loadMain('talk:id_talk,talk:id_hard,talk:title,getUserName|talk:created_by,smartDate|talk:creation_date','talk:id_talk','del'); + $this->scaffold->setHead('TALK ID,HARDWARE ID,TITLE,CREATED BY,DATE'); + $this->scaffold->update('del'); + $data['scaffold'] = $this->scaffold->render(); + $this->append($data); + $this->load('main'); + } + +} \ No newline at end of file diff --git a/admin/Application/Controllers/AdminusersController.php b/admin/Application/Controllers/AdminusersController.php new file mode 100644 index 0000000..0154c0c --- /dev/null +++ b/admin/Application/Controllers/AdminusersController.php @@ -0,0 +1,200 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class AdminusersController extends Controller +{ + + function __construct($model, $controller, $queryString) + { + parent::__construct($model, $controller, $queryString); + + $this->load('header_back'); + $this->load('footer_back','last'); + + $this->helper('Menu','adminusers','panel/main'); + $this->helper('Array'); + + $this->session('admin'); + $this->model(); + + $this->m['AdminusersModel']->setFields('username:sanitizeAll,password:sha1','none'); + + $this->m['AdminusersModel']->strongConditions['update'] = array('checkAlphaNum'=>'username','checkEqual'=>'password,confirmation'); + $this->m['AdminusersModel']->strongConditions['insert'] = array('checkAlphaNum'=>'username','checkEqual'=>'password,confirmation'); + + $this->m['AdminusersModel']->databaseConditions['insert'] = array('checkUnique'=>'username'); + $this->m['AdminusersModel']->databaseConditions['update'] = array('checkUniqueCompl'=>'username'); + + $this->setArgKeys(array('page:forceNat'=>1,'id_group:forceInt'=>'0','token:sanitizeAll'=>'token')); + Params::$nullQueryValue = '0'; + } + + public function login() + { + $data['action'] = Url::getRoot('adminusers/login'); + $data['notice'] = null; + + $this->s['admin']->checkStatus(); + if ($this->s['admin']->status['status']=='logged') + { + $this->s['admin']->redirect('logged'); + } + if (isset($_POST['username']) and isset($_POST['password'])) + { + $username = ctype_alnum($_POST['username']) ? sanitizeAll($_POST['username']) : ''; + $choice = $this->s['admin']->login($username,$_POST['password']); + + switch($choice) + { + case 'logged': + $this->redirect('panel/main',3,'You are already logged...'); + break; + case 'accepted': + $this->redirect('panel/main',3,'Hi '.$this->s['admin']->status['user'].'...'); + break; + case 'login-error': + $data['notice'] = '
Wrong username or password
'; + break; + case 'wait': + $data['notice'] = '
You have to wait 5 seconds before you can try to login another time
'; + break; + } + } + $this->set($data); + $this->load('login'); + } + + public function logout() + { + $res = $this->s['admin']->logout(); + if ($res == 'not-logged') { + $data['notice'] = "
You can't logout because you are not logged..
\n"; + + } else if ($res == 'was-logged') { + $data['notice'] = "
Logout executed successfully!
\n"; + + } else if ($res == 'error') { + + } + + $data['login'] = Url::getRoot('adminusers/login'); + $this->set($data); + $this->load('logout'); + } + + public function forceout($id) + { + $this->shift(1); + + $this->s['admin']->check(); + $data['menù'] = $this->h['Menu']->render('back'); + $data['notice'] = null; + $id = (int)$id; + if (strcmp($this->s['admin']->status['id_user'],$id) !== 0) + { + if ($this->s['admin']->forceOut($id)) + { + $data['notice'] = "
User has been forced out..
\n"; + } + else + { + $data['notice'] = "
Error..
\n"; + } + } + + $this->set($data); + $this->load('forceout'); + } + + public function main() + { + $this->shift(); + + $this->s['admin']->check(); + + if (!$this->s['admin']->checkCsrf($this->viewArgs['token'])) $this->redirect('panel/main/',2,'wrong token..'); + + $this->loadScaffold('main',array('popup'=>false)); + $this->scaffold->setWhereQueryClause(array('id_group'=>$this->viewArgs['id_group'])); + $this->scaffold->loadMain('adminusers:id_user,adminusers:username','adminusers:id_user','edit,del'); + $this->scaffold->addItem('simpleLink','adminusers/forceout/;adminusers:id_user;',null,'ForceOut'); + $this->scaffold->update('del'); + $data['scaffold'] = $this->scaffold->render(); + $this->set($data); + $this->load('main'); + } + + public function form($queryType = 'insert') + { + $this->shift(1); + + $this->s['admin']->check(); + + if (!$this->s['admin']->checkCsrf($this->viewArgs['token'])) $this->redirect('panel/main/',2,'wrong token..'); + + $this->m['AdminusersModel']->updateTable('insert,update'); + + $this->loadScaffold('form'); + $this->scaffold->loadForm($queryType,"adminusers/form/$queryType"); + $this->scaffold->getFormValues('sanitizeHtml'); + $this->scaffold->setFormEntries('model',array('password'=>'Password')); + $this->scaffold->form->setEntry('confirmation','Password'); + $data['scaffold'] = $this->scaffold->render(null,'username,password,confirmation,id_user'); + + $this->set($data); + $this->load('main'); + } + +// public function associate() +// { +// $this->shift(0); +// +// $this->s['admin']->check(); +// +// if (!$this->s['admin']->checkCsrf($this->viewArgs['token'])) $this->redirect('panel/main/',2,'wrong token..'); +// +// $this->m['AdminusersModel']->printAssError = 'yes'; +// $this->m['AdminusersModel']->updateTable('associate,dissociate'); +// +// $data['notice'] = $this->m['AdminusersModel']->notice; +// +// $data['menu'] = $this->h['Menu']->render('back'); +// +// $data['action'] = $this->baseUrl.'/adminusers/associate'.$this->viewStatus; +// +// $data['groups'] = $this->m['AdminusersModel']->getFieldArray('admingroups:id_group','admingroups:name'); +// +// //get the name of the user whose id is $_POST['id_user'] +// $users = $this->m['AdminusersModel']->db->select('adminusers','username','id_user='.(int)$_POST['id_user']); +// $data['user'] = $users[0]['adminusers']['username']; +// +// //get the groups inside which the user is inserted +// $this->m['AdminusersModel']->setWhereQueryClause(array('id_user'=>(int)$_POST['id_user'])); +// $this->m['AdminusersModel']->orderBy = 'admingroups.id_group desc'; +// $data['groupsUser'] = $this->m['AdminusersModel']->getAll('Boxes'); +// // echo $this->m['AdminusersModel']->getQuery(); +// +// $this->set($data); +// $this->load('associate'); +// } + +} \ No newline at end of file diff --git a/admin/Application/Controllers/PanelController.php b/admin/Application/Controllers/PanelController.php new file mode 100755 index 0000000..27eeacf --- /dev/null +++ b/admin/Application/Controllers/PanelController.php @@ -0,0 +1,43 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class PanelController extends Controller { + + public function __construct($model, $controller, $queryString) { + parent::__construct($model, $controller, $queryString); + $this->session('admin'); + $this->load('header_back'); + $this->load('footer_back','last'); + } + + public function main() + { + $this->s['admin']->check(); + $data['logged'] = $this->s['admin']->getUsersLogged(); + + $data['token'] = $this->s['admin']->status['token']; + + $this->set($data); + $this->load('panel'); + } + +} \ No newline at end of file diff --git a/admin/Application/Hooks/AfterInitialization.php b/admin/Application/Hooks/AfterInitialization.php new file mode 100644 index 0000000..a369309 --- /dev/null +++ b/admin/Application/Hooks/AfterInitialization.php @@ -0,0 +1,10 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class Distributions +{ + + public static $allowed = array( + 'blag_90001' => 'BLAG 90001', + 'blag_120000' => 'BLAG 120000', + 'dragora_1_1' => 'Dragora 1.1', + 'dynebolic_2_5_2' => 'Dynebolic 2.5.2 DHORUBA', + 'gnewsense_2_3' => 'gNewSense 2.3 Deltah', + 'gnewsense_3_0' => 'gNewSense 3.0 Metad', + 'musix_2_0' => 'Musix GNU+Linux 2.0 R0', + 'trisquel_3_5' => 'Trisquel 3.5 Awen', + 'trisquel_4_0' => 'Trisquel 4.0 Taranis', + 'ututo_xs_2009' => 'UTUTO XS 2009', + 'ututo_xs_2010' => 'UTUTO XS 2010', + 'venenux_0_8' => 'VENENUX 0.8', + ); + + public static function getName($distList = '') + { + $returnString = null; + $returnArray = array(); + $distArray = explode(',',$distList); + foreach ($distArray as $dist) + { + $dist = trim($dist); + if (array_key_exists($dist,self::$allowed)) + { + $returnArray[] = self::$allowed[$dist]; + } + } + return implode("
",$returnArray); + } + + public static function check($distString) + { + $distArray = explode(',',$distString); + + $allowedArray = array_keys(self::$allowed); + + foreach ($distArray as $dist) + { + $dist = trim($dist); + if (!in_array($dist,$allowedArray)) return false; + } + + return true; + } + + public static function getFormHtml() + { + $str = "
"; + $str .= "
"; + foreach (self::$allowed as $value => $label) + { + $str .= "
$label
"; + } + $str .= "
"; + $str .= ""; + $str .= ""; + $str .= "
"; + + return $str; + } + +} \ No newline at end of file diff --git a/admin/Application/Include/hardware.php b/admin/Application/Include/hardware.php new file mode 100644 index 0000000..62dfa37 --- /dev/null +++ b/admin/Application/Include/hardware.php @@ -0,0 +1,216 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + + +class Hardware +{ + + public static $controllers = array('notebooks','wifi','videocards','printers','scanners'); //used by UsersController::login() + + public static $commYear = 'not-specified,2010,2009,2008,2007,2006,2005,2004,2003,2002,2001,2000,1999,1998,1997,1996,1995,1994,1993,1992'; + +} + +class Printer extends hardware +{ + public static $vendors = array( + "brother" => "brother", + "Canon" => "Canon", + "EPSON" => "EPSON", + "Lexmark" => "Lexmark", + "KONICA-MINOLTA" => "KONICA-MINOLTA", + "Hewlett-Packard" => "Hewlett-Packard", + "Panasonic" => "Panasonic", + "RICOH" => "RICOH", + "SAMSUNG" => "SAMSUNG", + "SHARP" => "SHARP", + "TOSHIBA" => "TOSHIBA", + "XEROX" => "XEROX", + ); + + public static $compatibility = array( + "A Full" => "A-Full", + "B Partial" => "B-Partial", + "C None" => "C-None", + ); + + public static $interface = "not-specified,USB,Serial,Parallel,Firewire,SCSI,Ethernet"; + + public static function vendorsList() + { + return implode(',',array_values(self::$vendors)); + } + + public static function compatibilityList() + { + return implode(',',array_values(self::$compatibility)); + } + +} + +class Wifi extends hardware +{ + public static $vendors = array( + "A-LINK" => "A-LINK", + "Airlink101" => "Airlink101", + "Belkin" => "Belkin", + "Broadcom" => "Broadcom", + "CANYON" => "CANYON", + "D-Link" => "D-Link", + "Hawking" => "Hawking", + "LevelOne" => "LevelOne", + "Linksys" => "Linksys", + "NEC" => "NEC", + "Netgear" => "Netgear", + "Ralink" => "Ralink", + "TOSHIBA" => "TOSHIBA", + "TP-LINK" => "TP-LINK", + ); + + public static $interface = "not-specified,USB,PCI,PCI-E,mini-PCI,mini-PCI-E,ExpressCard,PC-Card"; + + public static $wifiSelect = 'yes,no'; + + public static function vendorsList() + { + return implode(',',array_values(self::$vendors)); + } +} + +class Videocard extends hardware +{ + public static $vendors = array( + "ATI" => "ATI", + "NVIDIA" => "NVIDIA", + "Intel" => "Intel", + ); + + public static $videoSelect = array( + "works with 3D acceleration" => "works_with_3D", + "works, but without 3D acceleration" => "works_without_3D", + ); + + public static $videoReverse = array( + "works_with_3D" => "works with 3D acceleration", + "works_without_3D" => "works, but without 3D acceleration", + ); + + public static $interface = "not-specified,PCI,AGP,PCI-E,ISA"; + + public static function vendorsList() + { + return implode(',',array_values(self::$vendors)); + } + + public static function videoList() + { + return implode(',',array_values(self::$videoSelect)); + } +} + + +class Notebooks extends Hardware +{ + + public static $vendors = array( + "Acer" => "Acer", + "Apple" => "Apple", + "Asus" => "Asus", + "Compal Electronics" => "Compal-Electronics", + "COMPAQ" => "COMPAQ", + "Dell" => "Dell", + "emachines" => "emachines", + "FUJITSU" => "FUJITSU", + "Gateway" => "Gateway", + "Hewlett Packard" => "Hewlett-Packard", + "IBM" => "IBM", + "Lenovo" => "Lenovo", + "LG" => "LG", + "Philips" => "Philips", + "Panasonic" => "Panasonic", + "Sony" => "Sony", + "SAMSUNG" => "SAMSUNG", + "Thomson" => "Thomson", + "TOSHIBA" => "TOSHIBA", + ); + + public static $compatibility = array( + "A Platinum" => "A-platinum", + "B Gold" => "B-gold", + "C Silver" => "C-silver", + "D Bronze" => "D-bronze", + "E Garbage" => "E-garbage" + ); + + public static $subtypeSelect = 'notebook,netbook,not-specified'; + + public static $videoSelect = array( + "not specified" => 'not-specified', + "yes, with 3D acceleration" => "yes_with_3D", + "yes, but without 3D acceleration" => "yes_without_3D", + "it does not work" => "no", + ); + + public static $videoReverse = array( + "yes_with_3D" => "works with 3D acceleration", + "yes_without_3D" => "works but without 3D acceleration", + "no" => "it does not work", + 'not-specified' => "not specified how it works", + "" => "" + ); + + public static $wifiSelect = array( + "not specified" => 'not-specified', + 'yes' => 'yes', + 'no' => 'no', + 'there is no wifi card' => 'no-wifi-card', + ); + + public static $wifiReverse = array( + "yes" => "it works", + "no" => "it does not work", + 'not-specified' => "not specified how it works", + 'no-wifi-card' => 'there is no wifi card', + "" => "" + ); + + public static function videoList() + { + return implode(',',array_values(self::$videoSelect)); + } + + public static function wifiList() + { + return implode(',',array_values(self::$wifiSelect)); + } + + public static function vendorsList() + { + return implode(',',array_values(self::$vendors)); + } + + public static function compatibilityList() + { + return implode(',',array_values(self::$compatibility)); + } + +} \ No newline at end of file diff --git a/admin/Application/Include/languages.php b/admin/Application/Include/languages.php new file mode 100644 index 0000000..6262c3e --- /dev/null +++ b/admin/Application/Include/languages.php @@ -0,0 +1,192 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class Lang +{ + public static $allowed = array('en','es','it'); + public static $current = 'en'; + + public static $complete = array( + 'en' => 'gb.png,English', + 'es' => 'es.png,Spanish', + 'it' => 'it.png,Italian', + ); + + public static function sanitize($lang = 'en') + { + return (in_array($lang,self::$allowed)) ? sanitizeAll($lang) : 'en'; + } +} + +class MyStrings +{ + + public static $view = array( + + 'en' => array( + + 'notebooks' => array( + + 'element' => 'notebook' + + ), + + 'wifi' => array( + + 'element' => 'wifi card' + + ), + + 'videocards'=> array( + + 'element' => 'video card' + + ), + + 'printers'=> array( + + 'element' => 'printer' + + ), + + 'scanners'=> array( + + 'element' => 'scanner' + + ), + ), + + 'fr' => array( + + 'notebooks' => array( + + 'element' => 'notebook' + + ), + + 'wifi' => array( + + 'element' => 'wifi card' + + ), + + 'videocards'=> array( + + 'element' => 'video card' + + ), + + 'printers'=> array( + + 'element' => 'printer' + + ), + + 'scanners'=> array( + + 'element' => 'scanner' + + ), + ), + + 'it' => array( + + 'notebooks' => array( + + 'element' => 'notebook' + + ), + + 'wifi' => array( + + 'element' => 'wifi card' + + ), + + 'videocards'=> array( + + 'element' => 'video card' + + ), + + 'printers'=> array( + + 'element' => 'printer' + + ), + + 'scanners'=> array( + + 'element' => 'scanner' + + ), + ), + + 'es' => array( + + 'notebooks' => array( + + 'element' => 'notebook' + + ), + + 'wifi' => array( + + 'element' => 'wifi card' + + ), + + 'videocards'=> array( + + 'element' => 'video card' + + ), + + 'printers'=> array( + + 'element' => 'printer' + + ), + + 'scanners'=> array( + + 'element' => 'scanner' + + ), + ), + ); + + //type => controller + public static $reverse = array( + 'notebook' => 'notebooks', + 'wifi' => 'wifi', + 'videocard' => 'videocards', + 'printer' => 'printers', + 'scanner' => 'scanners', + ); + + public static function getTypes() + { + return implode(',',array_keys(self::$reverse)); + } + +} \ No newline at end of file diff --git a/admin/Application/Include/myFunctions.php b/admin/Application/Include/myFunctions.php new file mode 100644 index 0000000..355c181 --- /dev/null +++ b/admin/Application/Include/myFunctions.php @@ -0,0 +1,318 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +function encodeUrl($url) +{ + $url = str_replace(' ','-',$url); + $url = urlencode($url); +// $url = html_entity_decode($url, ENT_QUOTES); +// $url = xml_encode($url); + return $url; +} + + +function smartDate($uglyDate = null, $lang = 'en') +{ + switch ($lang) + { + case 'en': + $smDate = date('H:i, d F Y',strtotime($uglyDate)); + break; + default: + $smDate = date('H:i, d F Y',strtotime($uglyDate)); + } + return $smDate; +} + +function sanitizeString($string) +{ + $string = preg_match('/^[a-zA-Z0-9\-\_\.\+\s]+$/',$string) ? sanitizeAll($string) : 'undef'; + return $string; +} + +function sanitizeAlphanum($string) +{ + $string = ctype_alnum($string) ? sanitizeAll($string) : 'undef'; + return $string; +} + + +function getOrderByClause($string) +{ + switch ($string) + { + case 'last-inserted': + $orderBy = 'hardware.id_hard desc'; + break; + case 'alphabetically': + $orderBy = 'model'; + break; + case 'alphabetically-desc': + $orderBy = 'model desc'; + break; + case 'compatibility': + $orderBy = 'compatibility'; + break; + case 'undef': + $orderBy = 'hardware.id_hard desc'; + break; + default: + $orderBy = 'hardware.id_hard desc'; + } + + return $orderBy; +} + + +// function isEqual($str1, $str2) +// { +// // $str1 = str_replace("\n",'',$str1); +// // $str1 = str_replace("\r",null,$str1); +// // $str2 = str_replace("\n",'',$str1); +// // $str2 = str_replace("\r",null,$str1); +// +// return (strcmp($str1,$str2) === 0) ? true : false; +// } +// +// function getNewKeys($array,$ovalue) +// { +// $res = array(); +// for ($i = 0; $i < count($array); $i++) +// { +// if (isEqual($array[$i],$ovalue)) $res[] = $i; +// // if (strcmp($keys[$i],$ovalue) === 0) $res[] = $i; +// } +// return $res; +// } + +function diff($old, $new){ + $maxlen = 0; + foreach($old as $oindex => $ovalue){ +// $nkeys = getNewKeys($new,$ovalue); + $nkeys = array_keys($new, $ovalue); + foreach($nkeys as $nindex){ + $matrix[$oindex][$nindex] = isset($matrix[$oindex - 1][$nindex - 1]) ? + $matrix[$oindex - 1][$nindex - 1] + 1 : 1; + if($matrix[$oindex][$nindex] > $maxlen){ + $maxlen = $matrix[$oindex][$nindex]; + $omax = $oindex + 1 - $maxlen; + $nmax = $nindex + 1 - $maxlen; + } + } + } + if($maxlen == 0) return array(array('d'=>$old, 'i'=>$new)); + return array_merge( + diff(array_slice($old, 0, $omax), array_slice($new, 0, $nmax)), + array_slice($new, $nmax, $maxlen), + diff(array_slice($old, $omax + $maxlen), array_slice($new, $nmax + $maxlen))); +} + +function htmlDiff($old, $new){ + $old = str_replace("\r\n"," \r\n ",$old); + $new = str_replace("\r\n"," \r\n ",$new); + + $ret = null; + $diff = diff(explode(' ', $old), explode(' ', $new)); + foreach($diff as $k){ + if(is_array($k)) + $ret .= (!empty($k['d'])?"".implode(' ',$k['d'])." ":''). + (!empty($k['i'])?"".implode(' ',$k['i'])." ":''); + else $ret .= $k . ' '; + } + return $ret; +} + + +//a cosa serve? +function applyBreaks($values,$fields) +{ + $fieldsArray = explode(',',$fields); + + foreach ($fieldsArray as $field) + { + if (array_key_exists($field,$values)) + { + $values[$field] = nl2br($values[$field]); + } + } + return $values; +} + + +function getLinkToUser($user) +{ + if (strstr($user,'__')) + { + return str_replace('__',null,$user); + } + else + { + return "$user"; + } +} + + + +//decode the text of the wiki +function decodeWikiText($string) +{ + + $string = preg_replace('/(\[hr\])/', '
',$string); + + $string = preg_replace_callback('/(\[a\])(.*?)(\[\/a\])/', 'linkTo',$string); + + $string = preg_replace_callback('/(\[a\])(.*?)\|(.*?)(\[\/a\])/', 'linkToWithText',$string); + + $string = preg_replace_callback('/(\[notebook\])([0-9]*?)(\[\/notebook\])/s', 'linkToNotebook',$string); + + $string = preg_replace_callback('/(\[wifi\])([0-9]*?)(\[\/wifi\])/s', 'linkToWifi',$string); + + $string = preg_replace_callback('/(\[videocard\])([0-9]*?)(\[\/videocard\])/s', 'linkToVideocard',$string); + + $string = preg_replace('/(\[b\])(.*?)(\[\/b\])/s', '${2}',$string); + + $string = preg_replace('/(\[u\])(.*?)(\[\/u\])/s', '${2}',$string); + + $string = preg_replace('/(\[i\])(.*?)(\[\/i\])/s', '${2}',$string); + + $string = preg_replace('/(\[del\])(.*?)(\[\/del\])/s', '${2}',$string); + + $string = preg_replace('/(\[\*\])(.*?)(\[\/\*\])/s', '
  • ${2}
  • ',$string); + + $string = preg_replace('/(\[list\])(.*?)(\[\/list\])/s', '',$string); + + $string = preg_replace('/(\[enum\])(.*?)(\[\/enum\])/s', '
      ${2}
    ',$string); + + $string = preg_replace('/(\[code\])(.*?)(\[\/code\])/s', '
    ${2}
    ',$string); + + $string = preg_replace('/(\[p\])(.*?)(\[\/p\])/s', '

    ${2}

    ',$string); + + $string = preg_replace('/(\[h1\])(.*?)(\[\/h1\])/s', '
    ${2}
    ',$string); + + $string = preg_replace('/(\[h2\])(.*?)(\[\/h2\])/s', '
    ${2}
    ',$string); + + $string = preg_replace('/(\[h3\])(.*?)(\[\/h3\])/s', '
    ${2}
    ',$string); + + return $string; +} + +function checkUrl($url) +{ +// $match = '/^http\:\/\/(www\.)?[a-zA-Z0-9\-\_]+(\.[a-zA-Z0-9\-\_]+)?\.(com|net|it|info|org|eu|uk)((\/[a-zA-Z0-9\_\-\+]+)+[\/]?)?(\?([a-zA-Z0-9\_\-\+\s]+\=[a-zA-Z0-9\_\-\s\+\&]+)+)?(#[a-zA-Z0-9\_\-\+\s]+)?([\s]*)?$/'; + + $match = '/^http\:\/\/(www\.)?[a-zA-Z0-9\-\_]+(\.[a-zA-Z0-9\-\_]+)?\.(com|net|it|info|org|eu|uk|ca)((\/[a-zA-Z0-9\_\-\+]+)*(\/([a-zA-Z0-9\_\-\.\+]+\.(php|html|htm|asp|aspx|jsp|cgi))?)?)?(\?([a-zA-Z0-9\_\-\+\s]+\=[a-zA-Z0-9\_\-\s\+\&]+)+)?(#[a-zA-Z0-9\_\-\+\s]+)?([\s]*)?$/'; + + if (preg_match($match,$url)) + { + return true; + } + else + { + return false; + } +} + +function vitalizeUrl($string) +{ + if (checkUrl($string)) + { + return "".$string.""; + } + return $string; +} + +function linkTo($match) +{ + if (checkUrl($match[2])) + { + return "".$match[2].""; + } + else + { + return $match[0]; + } +} + +function linkToWithText($match) +{ + if (checkUrl($match[2])) + { + + return "".$match[3].""; + } + else + { + return $match[0]; + } +} + +//create the link to the wiki page of the notebook +function linkToNotebook($match) +{ + $hardware = new HardwareModel(); + $clean['id_hard'] = (int)$match[2]; + $name = encodeUrl($hardware->getTheModelName($clean['id_hard'])); + $href = "/notebooks/view/".Lang::$current."/".$clean['id_hard']."/$name"; + return (strcmp($name,'') !== 0) ? "".$name."" : $match[0]; +} + +//create the link to the wiki page of the wifi +function linkToWifi($match) +{ + $hardware = new HardwareModel(); + $clean['id_hard'] = (int)$match[2]; + $name = encodeUrl($hardware->getTheModelName($clean['id_hard'])); + $href = "/wifi/view/".Lang::$current."/".$clean['id_hard']."/$name"; + return (strcmp($name,'') !== 0) ? "".$name."" : $match[0]; +} + +//create the link to the wiki page of the videocard +function linkToVideocard($match) +{ + $hardware = new HardwareModel(); + $clean['id_hard'] = (int)$match[2]; + $name = encodeUrl($hardware->getTheModelName($clean['id_hard'])); + $href = "/videocards/view/".Lang::$current."/".$clean['id_hard']."/$name"; + return (strcmp($name,'') !== 0) ? "".$name."" : $match[0]; +} + +function getUserName($id_user = 0) +{ + $clean['id_user'] = (int)$id_user; + $u = new UsersModel(); + return $u->getUser($clean['id_user']); +} + +function getMotivation($row,$controller) +{ + if (strcmp($row['deletion']['object'],'duplication') === 0) + { + $clean['id_hard'] = (int)$row['deletion']['id_duplicate']; + $hardware = new HardwareModel(); + $name = encodeUrl($hardware->getTheModelName($clean['id_hard'])); + return "duplication of the model having id ".$clean['id_hard'].""; + } + else + { + return "".$row['deletion']['object'].""; + } +} diff --git a/admin/Application/Include/params.php b/admin/Application/Include/params.php new file mode 100644 index 0000000..43181bf --- /dev/null +++ b/admin/Application/Include/params.php @@ -0,0 +1,145 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class Website +{ + static public $generalMail = ""; + + static public $generalName = "h-admin"; + + static public $projectName = "h-admin"; + + static public $mailServer = ""; + + static public $mailPassword = ""; +} + +class Account +{ + + static public $confirmTime = 3600; + + static public function confirm($username,$e_mail,$id_user,$token) + { + require_once (ROOT.'/External/swiftmailer/lib/swift_required.php'); + + $clean['username'] = sanitizeAll($username); + $clean['id_user'] = (int)$id_user; + $clean['token'] = sanitizeAll($token); + + $siteName = Website::$generalName; + $siteMail = Website::$generalMail; + + $mess = "Hello,\n\nyou have registered an account to $siteName with the following data:\nusername: ".$clean['username']."\n\nin order to confirm the registration of the new account follow the link below\nhttp://".DOMAIN_NAME."/users/confirm/".Lang::$current."/".$clean['id_user']."/".$clean['token']."\n\nIf you don't want to confirm the account registration\nthen wait one hour and your username and e-mail will be deleted from the database\n\nIf you received this e-mail for error, please simply disregard this message"; + + $message = Swift_Message::newInstance()->setSubject('account registration to '.$siteName)->setFrom(array($siteMail => $siteName))->setTo(array($e_mail))->setBody($mess); + + //Create the Transport + $transport = Swift_SmtpTransport::newInstance(Website::$mailServer, 25)->setUsername(Website::$generalMail)->setPassword(Website::$mailPassword); + + //Create the Mailer using your created Transport + $mailer = Swift_Mailer::newInstance($transport); + + //Send the message + $result = $mailer->send($message); + + if ($result) + { + return true; + } + else + { + return false; + } + + } + + static public function sendnew($username,$e_mail,$id_user,$token) + { + require_once (ROOT.'/External/swiftmailer/lib/swift_required.php'); + + $clean['username'] = sanitizeAll($username); + $clean['id_user'] = (int)$id_user; + $clean['token'] = sanitizeAll($token); + + $siteName = Website::$generalName; + $siteMail = Website::$generalMail; + + $mess = "Hello,\n\nyou have requested a new password for your account at $siteName.\nYour username is:\n".$clean['username']."\n\nin order to obtain a new password for your account follow the link below\nhttp://".DOMAIN_NAME."/users/change/".Lang::$current."/".$clean['id_user']."/".$clean['token']."\n\nIf you don't want to change the password then disregard this mail\n"; + + $message = Swift_Message::newInstance()->setSubject('request a new password at '.$siteName)->setFrom(array($siteMail => $siteName))->setTo(array($e_mail))->setBody($mess); + + //Create the Transport + $transport = Swift_SmtpTransport::newInstance(Website::$mailServer, 25)->setUsername(Website::$generalMail)->setPassword(Website::$mailPassword); + + //Create the Mailer using your created Transport + $mailer = Swift_Mailer::newInstance($transport); + + //Send the message + $result = $mailer->send($message); + + if ($result) + { + return true; + } + else + { + return false; + } + + } + + static public function sendpassword($username,$e_mail,$password) + { + require_once (ROOT.'/External/swiftmailer/lib/swift_required.php'); + + $clean['username'] = sanitizeAll($username); + $clean['password'] = sanitizeAll($password); + + $siteName = Website::$generalName; + $siteMail = Website::$generalMail; + + $mess = "Hello,\n\nyou have requested a new password for your account to $siteName.\nYour username is:\n".$clean['username']."\n\nYour new password is:\n".$clean['password']."\n"; + + $message = Swift_Message::newInstance()->setSubject('get your new h-node.com account password ')->setFrom(array($siteMail => $siteName))->setTo(array($e_mail))->setBody($mess); + + //Create the Transport + $transport = Swift_SmtpTransport::newInstance(Website::$mailServer, 25)->setUsername(Website::$generalMail)->setPassword(Website::$mailPassword); + + //Create the Mailer using your created Transport + $mailer = Swift_Mailer::newInstance($transport); + + //Send the message + $result = $mailer->send($message); + + if ($result) + { + return true; + } + else + { + return false; + } + + } + +} \ No newline at end of file diff --git a/admin/Application/Models/AdminusersModel.php b/admin/Application/Models/AdminusersModel.php new file mode 100755 index 0000000..498a1a7 --- /dev/null +++ b/admin/Application/Models/AdminusersModel.php @@ -0,0 +1,37 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class AdminusersModel extends Model_Map { + + public function __construct() { + $this->_tables='adminusers,admingroups,adminusers_groups'; + $this->_idFields='id_user,id_group'; + $this->_where=array('id_group'=>'admingroups','id_user'=>'adminusers','name'=>'admingroups'); + $this->_popupItemNames = array('id_group'=>'name'); + $this->orderBy = 'adminusers.id_user desc'; + +// $this->on = "adminusers.id_user=adminusers_groups.id_user and admingroups.id_group=adminusers_groups.id_group"; + + parent::__construct(); + } + +} \ No newline at end of file diff --git a/admin/Application/Models/BaseModel.php b/admin/Application/Models/BaseModel.php new file mode 100644 index 0000000..374be72 --- /dev/null +++ b/admin/Application/Models/BaseModel.php @@ -0,0 +1,68 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class BaseModel extends Model_Tree { + + public $type = ''; //device type + public $diffFields = array(); + + public function __construct() { + $this->_tables = 'hardware'; + $this->_idFields = 'id_hard'; + + $this->_where=array( + 'type' => 'hardware', + 'vendor' => 'hardware', + 'compatibility' => 'hardware', + 'comm_year' => 'hardware', + ); + + $this->orderBy = 'hardware.id_hard desc'; + parent::__construct(); + } + + public function checkType($id_hard = 0) + { + $clean['id_hard'] = (int)$id_hard; + $res = $this->db->select('hardware','type','id_hard='.$clean['id_hard']); + if (count($res) > 0) + { + return (strcmp($this->type,$res[0]['hardware']['type']) === 0 ) ? true : false; + } + return false; + } + + public function getDiffArray($oldArray, $newArray) + { + $diffArray = array(); + foreach ($this->diffFields as $field => $label) + { + if (array_key_exists($field,$oldArray) and array_key_exists($field,$newArray)) + { +// echo htmlDiff($oldArray[$field], $newArray[$field]); +// echo $oldArray[$field].$newArray[$field]; + $diffArray[$label] = htmlDiff($oldArray[$field], $newArray[$field]); + } + } + return $diffArray; + } +} \ No newline at end of file diff --git a/admin/Application/Models/BoxesModel.php b/admin/Application/Models/BoxesModel.php new file mode 100644 index 0000000..1f1a51a --- /dev/null +++ b/admin/Application/Models/BoxesModel.php @@ -0,0 +1,42 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class BoxesModel extends Model_Tree { + + public function __construct() { + $this->_tables = 'boxes'; + $this->_idFields = 'id_box'; + + parent::__construct(); + } + + public $formStruct = array( + 'entries' => array( + 'title' => array(), + 'message' => array('type'=>'Textarea'), + 'id_box' => array( + 'type' => 'Hidden' + ) + ), + ); + +} \ No newline at end of file diff --git a/admin/Application/Models/DeletionModel.php b/admin/Application/Models/DeletionModel.php new file mode 100644 index 0000000..0e67904 --- /dev/null +++ b/admin/Application/Models/DeletionModel.php @@ -0,0 +1,53 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class DeletionModel extends Model_Tree +{ + + public function __construct() + { + $this->_tables = 'deletion'; + $this->_idFields = 'id_del'; + +// $this->_where=array( +// 'id_hard' => 'talk' +// ); +// + $this->_popupItemNames = array( + 'object' => 'object', + ); + + $this->_popupLabels = array( + 'object' => 'OBJECT', + ); +// + $this->orderBy = 'deletion.id_del desc'; + + $this->strongConditions['insert'] = array( + "checkIsStrings|duplication,other" => 'object', + "+checkLength|500" => 'message' + ); + + parent::__construct(); + } + +} \ No newline at end of file diff --git a/admin/Application/Models/HardwareModel.php b/admin/Application/Models/HardwareModel.php new file mode 100644 index 0000000..48cab7e --- /dev/null +++ b/admin/Application/Models/HardwareModel.php @@ -0,0 +1,200 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class HardwareModel extends Model_Map { + + public $id_user = 0; + public $type = ''; //device type + public $lastId = 0; //the id of the last record inserted + + public $formStruct = array( + 'entries' => array( + 'deleted'=> array('type'=>'Select','options'=>'no,yes'), + 'id_hard' => array( + 'type' => 'Hidden' + ) + ), + ); + + public function __construct() { + $this->_tables='hardware,regusers,hardware_users'; + $this->_idFields='id_hard,id_user'; + $this->_where=array( + 'type' => 'hardware', + 'username' => 'regusers', + 'has_confirmed' => 'regusers', + 'deleted' => 'regusers', + '-deleted' => 'hardware' + ); + $this->orderBy = 'hardware.id_hard desc'; + $this->printAssError = "no"; + + $this->_popupItemNames = array( + 'type'=>'type', + 'ask_for_del'=>'ask_for_del', + '-deleted'=>'deleted', + ); + + $this->_popupLabels = array( + 'type'=>'TYPE', + 'ask_for_del'=>'ASK FOR DEL?', + '-deleted'=>'DELETED?', + ); + + $this->databaseConditions['insert'] = array( + 'checkUnique' => 'model', + ); + + $this->databaseConditions['update'] = array( + 'checkUniqueCompl' => 'model', + ); + + parent::__construct(); + } + + public function insert() + { + $this->values['created_by'] = (int)$this->id_user; + $this->values['updated_by'] = (int)$this->id_user; + $this->values['update_date'] = date('Y-m-d H:i:s'); + + //random ID + $randomId = md5(uniqid(mt_rand(),true)); + $this->values["type"] = $randomId; + + parent::insert(); + + //associate the user to the record + if ($this->queryResult) + { + $resId = $this->db->select("hardware","id_hard","type='$randomId'"); + $clean['id'] = $resId[0]['hardware']['id_hard']; + $this->lastId = $clean['id']; + $this->db->update('hardware','type',array($this->type),'id_hard='.$clean['id']); + + $this->associate($clean['id']); + } + + } + + public function update($id) + { + $clean['id'] = (int)$id; + + $this->values['updated_by'] = (int)$this->id_user; + $this->values['update_date'] = date('Y-m-d H:i:s'); + + //save the old fields in the revisions table + $this->setWhereQueryClause(array('id_hard' => $clean['id'])); + $oldStruct = $this->getFields($this->fields.',created_by,updated_by,update_date,type,id_hard'); + + if (count($oldStruct > 0)) + { + if (strcmp($oldStruct[0]['hardware']['type'],$this->type) === 0) + { + $oldValues = $oldStruct[0]['hardware']; + + $revisions = new RevisionsModel(); + $revisions->values = $oldValues; + if ($revisions->insert()) + { + parent::update($clean['id']); + if ($this->queryResult) + { + $this->lastId = $clean['id']; + if (!$this->checkAssociation($clean['id'],(int)$this->id_user)) + { + $this->associate($clean['id']); + } + } + } + } + } + } + + public function makeCurrent($id_rev) + { + $clean['id_rev'] = (int)$id_rev; + + $revisions = new RevisionsModel(); + + $clean['id_hard'] = (int)$revisions->getIdHard($clean['id_rev']); + + //save the old fields in the revisions table + $this->setWhereQueryClause(array('id_hard'=>$clean['id_hard'])); + $oldStruct = $this->getFields($this->fields.',created_by,updated_by,update_date,type,id_hard'); + + if (count($oldStruct > 0)) + { + if (strcmp($oldStruct[0]['hardware']['type'],$this->type) === 0) + { + //get the values of the revision + $revisions->setWhereQueryClause(array('id_rev'=>$clean['id_rev'])); + $newStruct = $revisions->getFields($this->fields.',created_by,updated_by,update_date,type,id_hard'); + + if (count($newStruct > 0)) + { + $revisions->values = $oldStruct[0]['hardware']; + + $this->values = $newStruct[0]['revisions']; + $this->values['updated_by'] = (int)$this->id_user; + $this->values['update_date'] = date('Y-m-d H:i:s'); + + if ($revisions->insert()) + { + if (parent::update($clean['id_hard'])) + { + $this->lastId = $clean['id_hard']; + if (!$this->checkAssociation($clean['id_hard'],(int)$this->id_user)) + { + $this->associate($clean['id_hard']); + } + } + } + } + } + else + { + $this->notice = "
    Wrong type..
    \n"; + } + } + + } + + public function associate($id_record) + { + return parent::associate((int)$id_record,(int)$this->id_user); + } + + //get the model name + public function getTheModelName($id) + { + $clean['id'] = (int)$id; + $this->setWhereQueryClause(array('id_hard' => $clean['id'])); + $res = $this->getFields('model'); + $name = count($res) > 0 ? $res[0]['hardware']['model'] : ''; + return $name; + } + + + +} \ No newline at end of file diff --git a/admin/Application/Models/HistoryModel.php b/admin/Application/Models/HistoryModel.php new file mode 100644 index 0000000..5f35d6b --- /dev/null +++ b/admin/Application/Models/HistoryModel.php @@ -0,0 +1,55 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class HistoryModel extends Model_Tree { + + public function __construct() { + $this->_tables = 'history'; + $this->_idFields = 'id_history'; + + $this->orderBy = 'history.id_history'; + + $this->_popupFunctions = array( + 'created_by'=> 'getUserName', + ); + + $this->_popupItemNames = array( + 'type' => 'type', + 'action' => 'action', + 'created_by'=> 'created_by', + ); + + $this->_popupLabels = array( + 'type' => 'TYPE', + 'action' => 'ACTION', + 'created_by'=> 'MODERATOR', + ); + + $this->_popupWhere = array( + 'created_by' => 'gr != "registered"', + ); + + + parent::__construct(); + } + +} \ No newline at end of file diff --git a/admin/Application/Models/IssuesModel.php b/admin/Application/Models/IssuesModel.php new file mode 100644 index 0000000..3ad3a5c --- /dev/null +++ b/admin/Application/Models/IssuesModel.php @@ -0,0 +1,96 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class IssuesModel extends Model_Tree { + + public function __construct() { + $this->_tables = 'issues'; + $this->_idFields = 'id_issue'; + + $this->_onDelete = 'nocheck'; + + $this->_where = array( + 'priority' => 'issues', + 'status' => 'issues', + 'topic' => 'issues', + ); + + $this->_popupItemNames = array( + 'priority' => 'priority', + 'status' => 'status', + 'topic' => 'topic', + 'deleted' => 'deleted', + ); + + $this->_popupLabels = array( + 'priority' => 'PRIORITY', + 'status' => 'STATUS', + 'topic' => 'TOPIC', + 'deleted' => 'DELETED?', + ); + + $this->orderBy = 'issues.id_issue desc'; + + $this->strongConditions['insert'] = array( + "checkLength|99" => 'title', + "+checkLength|34" => 'topic', + "++checkLength|15" => 'priority', + "+++checkLength|5000" => 'message', + "checkisStrings|low,medium,high" => 'priority', + "+checkisStrings|maybe-a-bug,new-categories-of-hardware,add-a-vendor-name,other" => 'topic', + ); + + parent::__construct(); + } + + public $formStruct = array( + 'entries' => array( + 'title' => array(), + 'topic' => array( + 'type'=>'Select', + 'options'=>array( + 'Add a vendor name' => 'add-a-vendor-name', + 'Maybe a bug' => 'maybe-a-bug', + 'Add new categories of hardware' => 'new-categories-of-hardware', + 'Other' => 'other' + ), + ), + 'deleted'=> array( + 'type' => 'Select', + 'options' => 'no,yes', + ), + 'priority' => array('type'=>'Select','options'=>'low,medium,high'), + 'message' => array('type'=>'Textarea','idName'=>'bb_code'), + 'status' => array( + 'type' => 'Select', + 'options' => 'opened,closed' + ), + 'notice' => array( + 'type' => 'Textarea', + 'idName' => 'bb_code_notice', + ), + 'id_issue' => array( + 'type' => 'Hidden' + ) + ), + ); +} \ No newline at end of file diff --git a/admin/Application/Models/MessagesModel.php b/admin/Application/Models/MessagesModel.php new file mode 100644 index 0000000..2022b4a --- /dev/null +++ b/admin/Application/Models/MessagesModel.php @@ -0,0 +1,58 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class MessagesModel extends Model_Tree { + + public function __construct() { + $this->_tables = 'messages'; + $this->_idFields = 'id_mes'; + + $this->orderBy = 'messages.id_mes'; + + $this->_popupItemNames = array( + 'deleted' => 'deleted', + 'has_read' => 'has_read', + ); + + $this->_popupLabels = array( + 'deleted' => 'DELETED?', + 'has_read' => 'ALREADY READ?', + ); + + $this->strongConditions['insert'] = array( + "checkLength|5000" => 'message', + ); + + parent::__construct(); + } + + public $formStruct = array( + 'entries' => array( + 'deleted' => array('type'=>'Select','options'=>'no,yes'), + 'has_read' => array('type'=>'Select','options'=>'no,yes'), + 'message' => array('type'=>'Textarea','idName'=>'bb_code'), + 'id_mes' => array( + 'type' => 'Hidden' + ) + ), + ); +} \ No newline at end of file diff --git a/admin/Application/Models/NewsModel.php b/admin/Application/Models/NewsModel.php new file mode 100644 index 0000000..2f47800 --- /dev/null +++ b/admin/Application/Models/NewsModel.php @@ -0,0 +1,44 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class NewsModel extends Model_Tree { + + public function __construct() { + $this->_tables = 'news'; + $this->_idFields = 'id_news'; + + $this->orderBy = 'news.id_news desc'; + + parent::__construct(); + } + + public $formStruct = array( + 'entries' => array( + 'title' => array(), + 'message' => array('type'=>'Textarea','idName'=>'bb_code'), + 'id_news' => array( + 'type' => 'Hidden' + ) + ), + ); + +} \ No newline at end of file diff --git a/admin/Application/Models/NotebooksModel.php b/admin/Application/Models/NotebooksModel.php new file mode 100644 index 0000000..fda2c42 --- /dev/null +++ b/admin/Application/Models/NotebooksModel.php @@ -0,0 +1,71 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class NotebooksModel extends BaseModel { + + public $type = 'notebook'; //device type + + public $diffFields = array( + 'vendor' => 'vendor', + 'model' => 'model name', + 'subtype' => 'subtype (notebook or netbook) ?', + 'comm_year' => 'year of commercialization', + 'distribution' => 'distribution used', + 'compatibility' => 'compatibility level', + 'kernel' => 'kernel libre version', + 'video_card_type' => 'video card model', + 'video_card_works' => 'does the video card work?', + 'wifi_type' => 'wifi model', + 'wifi_works' => 'does the wifi card works?', + 'description' => 'model description', + ); + + public $fieldsWithBreaks = array('model description'); + + public function __construct() + { + + $this->_popupItemNames = array( + 'vendor' => 'vendor', + 'compatibility' => 'compatibility', + 'comm_year' => 'comm_year', + 'subtype' => 'subtype', + ); + + $this->_popupLabels = array( + 'vendor' => 'vendor', + 'compatibility' => 'compatibility', + 'comm_year' => 'year', + 'subtype' => 'subtype', + ); + + $this->_popupWhere = array( + 'vendor' => 'type="notebook" and deleted="no"', + 'compatibility' => 'type="notebook" and deleted="no"', + 'comm_year' => 'type="notebook" and deleted="no"', + 'subtype' => 'type="notebook" and deleted="no"', + ); + + parent::__construct(); + } + +} \ No newline at end of file diff --git a/admin/Application/Models/ParamsModel.php b/admin/Application/Models/ParamsModel.php new file mode 100644 index 0000000..f30bca1 --- /dev/null +++ b/admin/Application/Models/ParamsModel.php @@ -0,0 +1,48 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class ParamsModel extends Model_Tree { + + public function __construct() { + $this->_tables = 'params'; + $this->_idFields = 'id_par'; + + parent::__construct(); + } + + public $formStruct = array( + 'entries' => array( + 'updating' => array( + 'type'=>'Select', + 'options'=>'no,yes', + ), + 'boxes_xml' => array( + 'type'=>'Textarea', + 'labelString'=> 'Configuration xml', + ), + 'id_par' => array( + 'type' => 'Hidden' + ) + ), + ); + +} \ No newline at end of file diff --git a/admin/Application/Models/PrintersModel.php b/admin/Application/Models/PrintersModel.php new file mode 100644 index 0000000..104e214 --- /dev/null +++ b/admin/Application/Models/PrintersModel.php @@ -0,0 +1,70 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class PrintersModel extends BaseModel +{ + + public $type = 'printer'; //device type + + public $diffFields = array( + 'vendor' => 'vendor', + 'model' => 'model name', + 'pci_id' => 'VendorID:ProductID', + 'comm_year' => 'year of commercialization', + 'interface' => 'interface', + 'distribution' => 'distribution used', + 'compatibility' => 'compatibility', + 'kernel' => 'kernel libre version', + 'driver' => 'driver used', + 'description' => 'model description', + ); + + public $fieldsWithBreaks = array('model description'); + + public function __construct() + { + + $this->_popupItemNames = array( + 'vendor' => 'vendor', + 'compatibility' => 'compatibility', + 'comm_year' => 'comm_year', + 'interface' => 'interface', + ); + + $this->_popupLabels = array( + 'vendor' => 'vendor', + 'compatibility' => 'compatibility', + 'comm_year' => 'year', + 'interface' => 'interface', + ); + + $this->_popupWhere = array( + 'vendor' => 'type="printer" and deleted="no"', + 'compatibility' => 'type="printer" and deleted="no"', + 'comm_year' => 'type="printer" and deleted="no"', + 'interface' => 'type="printer" and deleted="no"', + ); + + parent::__construct(); + } + +} \ No newline at end of file diff --git a/admin/Application/Models/ProfileModel.php b/admin/Application/Models/ProfileModel.php new file mode 100644 index 0000000..626e652 --- /dev/null +++ b/admin/Application/Models/ProfileModel.php @@ -0,0 +1,72 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class ProfileModel extends Model_Tree { + + public function __construct() { + $this->_tables = 'profile'; + $this->_idFields = 'id_prof'; + + $this->_where=array( + 'username' => 'regusers', + 'has_confirmed' => 'regusers', + 'deleted' => 'regusers' + ); + + $this->softConditions['update'] = array( + "checkLength|90" => "real_name,where_you_are,fav_distro,birth_date,website|the fields 'real name', 'where_you_are', 'favorite distro', 'website' and 'birthdate' don't have to have more than 90 characters", + "checkLength|1000" => "projects,description|the fields 'projects' and 'description' don't have to have more than 1000 characters", + "checkIsStrings|no,yes" => "publish_mail" + ); + + parent::__construct(); + } + + public $formStruct = array( + + 'entries' => array( + 'real_name' => array('labelString'=>'Your real name'), + 'website' => array('labelString'=>'Your website address (add http://)'), + 'where_you_are' => array('labelString'=>'I\'m from...'), + 'birth_date' => array('labelString'=>'My birthdate'), + 'fav_distro' => array('labelString'=>'My favourite distribution'), + 'projects' => array( + 'type' => 'Textarea', + 'labelString'=>'Free software projects I\'m working on' + ), + 'publish_mail' => array( + 'type' => 'Select', + 'options' => 'no,yes', + 'labelString'=> 'Would you like to publish your e-mail address?' + ), + 'description' => array( + 'type' => 'Textarea', + 'labelString'=> 'Your description' + ), + 'id_prof' => array( + 'type' => 'Hidden' + ) + ), + + ); + +} \ No newline at end of file diff --git a/admin/Application/Models/RevisionsModel.php b/admin/Application/Models/RevisionsModel.php new file mode 100644 index 0000000..bbfa939 --- /dev/null +++ b/admin/Application/Models/RevisionsModel.php @@ -0,0 +1,50 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class RevisionsModel extends Model_Tree { + + public $id_user = 0; + public $type = ''; //device type + + public function __construct() { + $this->_tables='revisions'; + $this->_idFields='id_rev'; + + $this->_where=array( + 'id_hard'=>'revisions' + ); + + $this->orderBy = 'id_rev desc'; + + parent::__construct(); + } + + public function getIdHard($id_rev = 0) + { + $clean['id_rev'] = (int)$id_rev; + + $res = $this->db->select('revisions','id_hard','id_rev='.$clean['id_rev']); + + return (count($res) > 0) ? $res[0]['revisions']['id_hard'] : 0; + } + +} \ No newline at end of file diff --git a/admin/Application/Models/ScannersModel.php b/admin/Application/Models/ScannersModel.php new file mode 100644 index 0000000..978a26b --- /dev/null +++ b/admin/Application/Models/ScannersModel.php @@ -0,0 +1,70 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class ScannersModel extends BaseModel +{ + + public $type = 'scanner'; //device type + + public $diffFields = array( + 'vendor' => 'vendor', + 'model' => 'model name', + 'pci_id' => 'VendorID:ProductID', + 'comm_year' => 'year of commercialization', + 'interface' => 'interface', + 'distribution' => 'distribution used', + 'compatibility' => 'compatibility', + 'kernel' => 'kernel libre version', + 'driver' => 'driver used', + 'description' => 'model description', + ); + + public $fieldsWithBreaks = array('model description'); + + public function __construct() + { + + $this->_popupItemNames = array( + 'vendor' => 'vendor', + 'compatibility' => 'compatibility', + 'comm_year' => 'comm_year', + 'interface' => 'interface', + ); + + $this->_popupLabels = array( + 'vendor' => 'vendor', + 'compatibility' => 'compatibility', + 'comm_year' => 'year', + 'interface' => 'interface', + ); + + $this->_popupWhere = array( + 'vendor' => 'type="scanner" and deleted="no"', + 'compatibility' => 'type="scanner" and deleted="no"', + 'comm_year' => 'type="scanner" and deleted="no"', + 'interface' => 'type="scanner" and deleted="no"', + ); + + parent::__construct(); + } + +} \ No newline at end of file diff --git a/admin/Application/Models/TalkModel.php b/admin/Application/Models/TalkModel.php new file mode 100644 index 0000000..cdf2fc6 --- /dev/null +++ b/admin/Application/Models/TalkModel.php @@ -0,0 +1,54 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class TalkModel extends Model_Tree { + + public function __construct() { + $this->_tables = 'talk'; + $this->_idFields = 'id_talk'; + + $this->_where=array( + 'id_hard' => 'talk' + ); + + $this->orderBy = 'talk.id_talk desc'; + + $this->strongConditions['insert'] = array( + "checkLength|99" => 'title', + "+checkNotEmpty" => 'message', + "++checkLength|5000" => 'message', + ); + + parent::__construct(); + } + + public $formStruct = array( + 'entries' => array( + 'title' => array(), + 'message' => array('type'=>'Textarea'), + 'id_talk' => array( + 'type' => 'Hidden' + ) + ), + ); + +} \ No newline at end of file diff --git a/admin/Application/Models/UsersModel.php b/admin/Application/Models/UsersModel.php new file mode 100755 index 0000000..3f55cfe --- /dev/null +++ b/admin/Application/Models/UsersModel.php @@ -0,0 +1,223 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class UsersModel extends Model_Map +{ + + public static $usersList = array(); + + public function __construct() + { + $this->_tables='regusers,reggroups,regusers_groups'; + $this->_idFields='id_user,id_group'; + + $this->_where=array( + 'id_group' => 'reggroups', + 'id_user' => 'regusers', + 'name' => 'reggroups', + 'confirmation_token'=> 'regusers', + 'has_confirmed' => 'regusers', + 'deleted' => 'regusers', + 'forgot_token' => 'regusers' + ); + + $this->_popupItemNames = array( + 'has_confirmed'=>'has_confirmed', + 'deleted'=>'deleted', + 'id_group'=>'name', + ); + + $this->_popupLabels = array( + 'has_confirmed'=>'HAS CONFIRMED?', + 'deleted'=>'DELETED?', + 'id_group'=>'GROUP' + ); + + $this->orderBy = 'regusers.id_user desc'; + + parent::__construct(); + + $this->deleteNotRegistered(); + } + + public function deleteNotRegistered() + { + $limit = time() - Account::$confirmTime; + $this->db->del('regusers','has_confirmed = 1 and deleted = "no" and creation_time < '.$limit); + } + + public function getUser($id_user = 0) + { + $clean['id_user'] = (int)$id_user; + if (array_key_exists($clean['id_user'],self::$usersList)) + { + return self::$usersList[$clean['id_user']]; + } + else + { + $user = $this->db->select('regusers','username,has_confirmed','id_user='.$clean['id_user']); + if (count($user) > 0) + { + $fuser = (strcmp($user[0]['regusers']['has_confirmed'],0) === 0) ? $user[0]['regusers']['username'] : "__".$user[0]['regusers']['username']; + self::$usersList[$clean['id_user']] = $fuser; + return $fuser; + } + else + { + return "__"; + } + } + } + + public function insert() + { + //create the token + $confirmation_token = md5(randString(20)); + $this->values['confirmation_token'] = $confirmation_token; + //has_confirmed flag + $this->values['has_confirmed'] = 1; + $this->values['creation_time'] = time(); + + //random ID + $randomId = md5(randString(5).uniqid(mt_rand(),true)); + $this->values["temp_field"] = $randomId; + + if (isset($_POST['captcha'])) + { + if ( strcmp($_SESSION['captchaString'],$_POST['captcha']) === 0 ) + { + + parent::insert(); + + if ($this->queryResult) + { + $resId = $this->db->select("regusers","id_user","temp_field='$randomId'"); + $clean['id_user'] = $resId[0]['regusers']['id_user']; + $this->db->update("regusers",'temp_field',array(''),'id_user='.$clean['id_user']); + + $result = Account::confirm($this->values['username'],$this->values['e_mail'],$clean['id_user'],$confirmation_token); + + if ($result) + { + $_SESSION['status'] = 'sent'; + } + else + { + $_SESSION['status'] = 'regerror'; + } + + $hed = new HeaderObj(DOMAIN_NAME); + $hed->redirect('users/notice/'.Lang::$current); + } + + } + else + { + $this->result = false; + $this->queryResult = false; + $this->notice = "
    Wrong captcha code...
    \n"; + } + } + } + + public function close($id_user) + { + $clean['id_user'] = (int)$id_user; + + $this->values = array( + 'has_confirmed' => 1, + 'deleted' => 'yes', + 'e_mail' => '' + ); + + if ($this->update($clean['id_user'])) + { + $_SESSION['status'] = 'deleted'; + + $profile = new ProfileModel(); + $res = $profile->db->select('profile','id_prof','created_by='.$clean['id_user']); + + if (count($res) > 0) + { + $clean['id_prof'] = (int)$res[0]['profile']['id_prof']; + $profile->values = array( + 'real_name' => '', + 'where_you_are' => '', + 'birth_date' => '', + 'fav_distro' => '', + 'projects' => '', + 'description' => '' + ); + $profile->update($clean['id_prof']); + } + } + + } + + public function forgot($username) + { + $clean['username'] = ctype_alnum($username) ? sanitizeAll($username) : ''; + + if (isset($_POST['captcha'])) + { + if ( strcmp($_SESSION['captchaString'],$_POST['captcha']) === 0 ) + { + $res = $this->db->select('regusers','e_mail,id_user','username="'.$clean['username'].'" and has_confirmed = 0 and deleted = "no"'); + if (count($res) > 0) + { + $e_mail = $res[0]['regusers']['e_mail']; + $id_user = (int)$res[0]['regusers']['id_user']; + $forgot_token = md5(randString(20)); + $forgot_time = time(); + $updateArray = array($forgot_token, $forgot_time); + $this->db->update('regusers','forgot_token,forgot_time',$updateArray,'username="'.$clean['username'].'"'); + + $result = Account::sendnew($clean['username'],$e_mail,$id_user,$forgot_token); + + if ($result) + { + $_SESSION['status'] = 'sent_new'; + } + else + { + $_SESSION['status'] = 'sent_new_error'; + } + + $hed = new HeaderObj(DOMAIN_NAME); + $hed->redirect('users/notice/'.Lang::$current,1); + + } + else + { + $this->notice = "
    the user does not exist
    \n"; + } + } + else + { + $this->result = false; + $this->queryResult = false; + $this->notice = "
    Wrong captcha code...
    \n"; + } + } + } + +} \ No newline at end of file diff --git a/admin/Application/Models/VideocardsModel.php b/admin/Application/Models/VideocardsModel.php new file mode 100644 index 0000000..3b96091 --- /dev/null +++ b/admin/Application/Models/VideocardsModel.php @@ -0,0 +1,66 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class VideocardsModel extends BaseModel +{ + + public $type = 'videocard'; //device type + + public $diffFields = array( + 'vendor' => 'vendor', + 'model' => 'model name', + 'pci_id' => 'VendorID:ProductID', + 'comm_year' => 'year of commercialization', + 'interface' => 'interface', + 'distribution' => 'distribution used', + 'kernel' => 'kernel libre version', + 'video_card_works' => 'how does it work with free software?', + 'description' => 'model description', + ); + + public $fieldsWithBreaks = array('model description'); + + public function __construct() + { + + $this->_popupItemNames = array( + 'vendor' => 'vendor', + 'comm_year' => 'comm_year', + 'interface' => 'interface', + ); + + $this->_popupLabels = array( + 'vendor' => 'vendor', + 'comm_year' => 'year', + 'interface' => 'interface', + ); + + $this->_popupWhere = array( + 'vendor' => 'type="videocard" and deleted="no"', + 'comm_year' => 'type="videocard" and deleted="no"', + 'interface' => 'type="videocard" and deleted="no"', + ); + + parent::__construct(); + } + +} \ No newline at end of file diff --git a/admin/Application/Models/WifiModel.php b/admin/Application/Models/WifiModel.php new file mode 100644 index 0000000..d8c84aa --- /dev/null +++ b/admin/Application/Models/WifiModel.php @@ -0,0 +1,69 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class WifiModel extends BaseModel +{ + + public $type = 'wifi'; //device type + + public $diffFields = array( + 'vendor' => 'vendor', + 'model' => 'model name', + 'pci_id' => 'VendorID:ProductID', + 'comm_year' => 'year of commercialization', + 'interface' => 'interface', + 'distribution' => 'distribution used', + 'kernel' => 'kernel libre version', + 'wifi_works' => 'does it work with free software?', + 'description' => 'model description', + ); + + public $fieldsWithBreaks = array('model description'); + + public function __construct() + { + + $this->_popupItemNames = array( + 'vendor' => 'vendor', + 'comm_year' => 'comm_year', + 'wifi_works' => 'wifi_works', + 'interface' => 'interface', + ); + + $this->_popupLabels = array( + 'vendor' => 'vendor', + 'comm_year' => 'year', + 'wifi_works' => 'does it work?', + 'interface' => 'interface', + ); + + $this->_popupWhere = array( + 'vendor' => 'type="wifi" and deleted="no"', + 'comm_year' => 'type="wifi" and deleted="no"', + 'wifi_works' => 'type="wifi" and deleted="no"', + 'interface' => 'type="wifi" and deleted="no"', + ); + + parent::__construct(); + } + +} \ No newline at end of file diff --git a/admin/Application/Modules/ModBase.php b/admin/Application/Modules/ModBase.php new file mode 100644 index 0000000..44d25a2 --- /dev/null +++ b/admin/Application/Modules/ModBase.php @@ -0,0 +1,41 @@ +simpleXmlObj->classname)) + { + return " class='".$this->simpleXmlObj->classname[0]."' "; + } + return null; + } + + //wrap the html with a
    + //look for the
    tag in the xml in order to set the class of the div + public function wrapDiv($string) + { + $divOpen = "
    "; + $divClose = "
    "; + + if (isset($this->simpleXmlObj->div)) + { + $divOpen = "
    "; + } + + return $divOpen . $string . $divClose; + } + +} \ No newline at end of file diff --git a/admin/Application/Modules/ModImage.php b/admin/Application/Modules/ModImage.php new file mode 100644 index 0000000..5a116b1 --- /dev/null +++ b/admin/Application/Modules/ModImage.php @@ -0,0 +1,45 @@ +simpleXmlObj->width)) + { + return " width = '" . $this->simpleXmlObj->width ."' "; + } + return null; + } + + public function heightPropertyString() + { + if (isset($this->simpleXmlObj->height)) + { + return " height = '" . $this->simpleXmlObj->height ."' "; + } + return null; + } + + public function titlePropertyString() + { + if (isset($this->simpleXmlObj->title)) + { + return " title = '" . $this->simpleXmlObj->title ."' "; + } + return null; + } + + public function render() + { + $link = "getHtmlClass().$this->widthPropertyString().$this->heightPropertyString().$this->titlePropertyString()." src='".$this->simpleXmlObj->src[0]."'>"; + return $this->wrapDiv($link)."\n"; + } + +} \ No newline at end of file diff --git a/admin/Application/Modules/ModLink.php b/admin/Application/Modules/ModLink.php new file mode 100644 index 0000000..011bc78 --- /dev/null +++ b/admin/Application/Modules/ModLink.php @@ -0,0 +1,18 @@ +getHtmlClass()." href='".$this->simpleXmlObj->href[0]."'>".$this->simpleXmlObj->text[0].""; + return $this->wrapDiv($link)."\n"; + } + +} \ No newline at end of file diff --git a/admin/Application/Modules/ModLinkimage.php b/admin/Application/Modules/ModLinkimage.php new file mode 100644 index 0000000..8e49bbf --- /dev/null +++ b/admin/Application/Modules/ModLinkimage.php @@ -0,0 +1,18 @@ +getHtmlClass()." href='".$this->simpleXmlObj->href[0]."'>widthPropertyString().$this->heightPropertyString().$this->titlePropertyString()." src='".$this->simpleXmlObj->src[0]."'>"; + return $this->wrapDiv($link)."\n"; + } + +} \ No newline at end of file diff --git a/admin/Application/Modules/ModRaw.php b/admin/Application/Modules/ModRaw.php new file mode 100644 index 0000000..4ed3226 --- /dev/null +++ b/admin/Application/Modules/ModRaw.php @@ -0,0 +1,18 @@ +simpleXmlObj->text[0]; + return $this->wrapDiv($link)."\n"; + } + +} \ No newline at end of file diff --git a/admin/Application/Modules/index.html b/admin/Application/Modules/index.html new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/admin/Application/Modules/index.html @@ -0,0 +1 @@ + diff --git a/admin/Application/Strings/Lang/It/DbCondStrings.php b/admin/Application/Strings/Lang/It/DbCondStrings.php new file mode 100644 index 0000000..4c985cd --- /dev/null +++ b/admin/Application/Strings/Lang/It/DbCondStrings.php @@ -0,0 +1,17 @@ +Il valore del campo ". $field ." è già presente. Per favore scegline un altro.
    \n"; + } + +} diff --git a/admin/Application/Strings/Lang/It/ModelStrings.php b/admin/Application/Strings/Lang/It/ModelStrings.php new file mode 100644 index 0000000..e02013b --- /dev/null +++ b/admin/Application/Strings/Lang/It/ModelStrings.php @@ -0,0 +1,19 @@ + "
    Errore nella query: contatta l'amministratore!
    \n", + "executed" => "
    operazione eseguita!
    \n", + "associate" => "
    Problema di integrità referenziale: il record è associato ad un record di una tabella figlia. Devi prima rompere l'associazione.
    \n", + "no-id" => "
    Non è definito alcun id della query
    \n", + "not-linked" => "
    Il record non è associato, non puoi dissociarlo
    ", + "linked" => "
    Il record è già associato, non puoi associarlo un'altra volta
    " + ); + +} diff --git a/admin/Application/Strings/Lang/It/UploadStrings.php b/admin/Application/Strings/Lang/It/UploadStrings.php new file mode 100644 index 0000000..57bcda6 --- /dev/null +++ b/admin/Application/Strings/Lang/It/UploadStrings.php @@ -0,0 +1,26 @@ + "
    Errore: verificare i permessi del file/directory
    \n", + "executed" => "
    Operazione eseguita!
    \n", + "not-child" => "
    La cartella selezionata non è una sotto directory della directory base
    \n", + "not-dir" => "
    La cartella selezionata non è una directory
    \n", + "not-empty" => "
    La cartella selezionata non è vuota
    \n", + "no-folder-specified" => "
    Non è stata specificata alcuna cartella
    \n", + "not-writable" => "
    La cartella non è scrivibile
    \n", + "not-writable-file" => "
    Il file non è scrivibile
    \n", + "dir-exists" => "
    Esiste già una directory con lo stesso nome
    \n", + "no-upload-file" => "
    Non c'è alcun file di cui fare l'upload
    \n", + "size-over" => "
    La dimensione del file è troppo grande
    \n", + "not-allowed-ext" => "
    L'estensione del file che vuoi caricare non è consentita
    \n", + "file-exists" => "
    Esiste già un file con lo stesso nome
    \n", + ); + +} diff --git a/admin/Application/Strings/Lang/It/ValCondStrings.php b/admin/Application/Strings/Lang/It/ValCondStrings.php new file mode 100644 index 0000000..a54c650 --- /dev/null +++ b/admin/Application/Strings/Lang/It/ValCondStrings.php @@ -0,0 +1,69 @@ +". $element ." non è stato definito
    \n"; + } + + //if the elements are not equal + public function getNotEqualResultString($element) + { + return "
    Differenti valori: $element
    \n"; + } + + //if the element is not alphabetic + public function getNotAlphabeticResultString($element) + { + return "
    ".$element." deve essere una stringa di soli caratteri alfabetici
    \n"; + } + + //if the element is not alphanumeric + public function getNotAlphanumericResultString($element) + { + return "
    ".$element." deve essere una stringa di soli caratteri alfanumerici
    \n"; + } + + //if the element is not a decimal digit + public function getNotDecimalDigitResultString($element) + { + return "
    ".$element." deve essere una stringa di soli numeri decimali
    \n"; + } + + //if the element has the mail format + public function getNotMailFormatResultString($element) + { + return "
    ".$element." non sembra un indirizzo e-mail
    \n"; + } + + //if the element is numeric + public function getNotNumericResultString($element) + { + return "
    ".$element." deve essere un numero
    \n"; + } + + //if the element (string) length exceeds the value of characters (defined by $maxLength) + public function getLengthExceedsResultString($element,$maxLength) + { + return "
    ".$element." non deve essere composto da più di $maxLength caratteri
    \n"; + } + + //if the element is one of the strings indicated by $stringList (a comma-separated list of strings) + public function getIsForbiddenStringResultString($element,$stringList) + { + return "
    ".$element." non può assumere uno dei seguenti valori: $stringList
    \n"; + } + + //if the element is not one of the strings indicated by $stringList (a comma-separated list of strings) + public function getIsNotStringResultString($element,$stringList) + { + return "
    ".$element." deve assumere uno dei seguenti valori: $stringList
    \n"; + } +} diff --git a/admin/Application/Strings/Lang/It/index.html b/admin/Application/Strings/Lang/It/index.html new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/admin/Application/Strings/Lang/It/index.html @@ -0,0 +1 @@ + diff --git a/admin/Application/Strings/Lang/index.html b/admin/Application/Strings/Lang/index.html new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/admin/Application/Strings/Lang/index.html @@ -0,0 +1 @@ + diff --git a/admin/Application/Strings/index.html b/admin/Application/Strings/index.html new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/admin/Application/Strings/index.html @@ -0,0 +1 @@ + diff --git a/admin/Application/Views/Adminboxes/main.php b/admin/Application/Views/Adminboxes/main.php new file mode 100644 index 0000000..7d71709 --- /dev/null +++ b/admin/Application/Views/Adminboxes/main.php @@ -0,0 +1,25 @@ + + +. + +?> + + \ No newline at end of file diff --git a/admin/Application/Views/Admindeletion/main.php b/admin/Application/Views/Admindeletion/main.php new file mode 100644 index 0000000..7d71709 --- /dev/null +++ b/admin/Application/Views/Admindeletion/main.php @@ -0,0 +1,25 @@ + + +. + +?> + + \ No newline at end of file diff --git a/admin/Application/Views/Adminhardware/ask.php b/admin/Application/Views/Adminhardware/ask.php new file mode 100644 index 0000000..1368dca --- /dev/null +++ b/admin/Application/Views/Adminhardware/ask.php @@ -0,0 +1,53 @@ + + +. + +?> + + + +
    + + +
    +
    + id hardware to delete: +
    +
    + requested by: +
    +
    + at: +
    +
    + why: +
    +
    + hardware duplicated: +
    +
    + message: +
    +
    + +
    \ No newline at end of file diff --git a/admin/Application/Views/Adminhardware/main.php b/admin/Application/Views/Adminhardware/main.php new file mode 100644 index 0000000..7d71709 --- /dev/null +++ b/admin/Application/Views/Adminhardware/main.php @@ -0,0 +1,25 @@ + + +. + +?> + + \ No newline at end of file diff --git a/admin/Application/Views/Adminhistory/main.php b/admin/Application/Views/Adminhistory/main.php new file mode 100644 index 0000000..7d71709 --- /dev/null +++ b/admin/Application/Views/Adminhistory/main.php @@ -0,0 +1,25 @@ + + +. + +?> + + \ No newline at end of file diff --git a/admin/Application/Views/Adminissues/main.php b/admin/Application/Views/Adminissues/main.php new file mode 100644 index 0000000..1df2110 --- /dev/null +++ b/admin/Application/Views/Adminissues/main.php @@ -0,0 +1,36 @@ + + +. + +?> + + + + \ No newline at end of file diff --git a/admin/Application/Views/Adminmessages/main.php b/admin/Application/Views/Adminmessages/main.php new file mode 100644 index 0000000..0ce6983 --- /dev/null +++ b/admin/Application/Views/Adminmessages/main.php @@ -0,0 +1,35 @@ + + +. + +?> + + + + \ No newline at end of file diff --git a/admin/Application/Views/Adminnews/main.php b/admin/Application/Views/Adminnews/main.php new file mode 100644 index 0000000..5b603f2 --- /dev/null +++ b/admin/Application/Views/Adminnews/main.php @@ -0,0 +1,35 @@ + + +. + +?> + + + + \ No newline at end of file diff --git a/admin/Application/Views/Adminparams/form.php b/admin/Application/Views/Adminparams/form.php new file mode 100755 index 0000000..7d71709 --- /dev/null +++ b/admin/Application/Views/Adminparams/form.php @@ -0,0 +1,25 @@ + + +. + +?> + + \ No newline at end of file diff --git a/admin/Application/Views/Adminpassword/form.php b/admin/Application/Views/Adminpassword/form.php new file mode 100755 index 0000000..640b6e5 --- /dev/null +++ b/admin/Application/Views/Adminpassword/form.php @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/admin/Application/Views/Adminregusers/associate.php b/admin/Application/Views/Adminregusers/associate.php new file mode 100644 index 0000000..9350d3a --- /dev/null +++ b/admin/Application/Views/Adminregusers/associate.php @@ -0,0 +1,54 @@ + + +. + +?> + + + + + +
    + Associate the user to some groups:

    +
    + + + + + '> +
    +
    + +

    +
    + The user is inserted inside the following Groups: +
      + +
    • + +
    +
    \ No newline at end of file diff --git a/admin/Application/Views/Adminregusers/main.php b/admin/Application/Views/Adminregusers/main.php new file mode 100644 index 0000000..7d71709 --- /dev/null +++ b/admin/Application/Views/Adminregusers/main.php @@ -0,0 +1,25 @@ + + +. + +?> + + \ No newline at end of file diff --git a/admin/Application/Views/Admintalk/main.php b/admin/Application/Views/Admintalk/main.php new file mode 100644 index 0000000..7d71709 --- /dev/null +++ b/admin/Application/Views/Admintalk/main.php @@ -0,0 +1,25 @@ + + +. + +?> + + \ No newline at end of file diff --git a/admin/Application/Views/Adminusers/associate.php b/admin/Application/Views/Adminusers/associate.php new file mode 100644 index 0000000..b0f6672 --- /dev/null +++ b/admin/Application/Views/Adminusers/associate.php @@ -0,0 +1,54 @@ + + +. + +?> + + + + + +
    + Associate the user to some groups:

    +
    + + + + + '> +
    +
    + +

    +
    + The user is inserted inside the following Groups: +
      + +
    • + +
    +
    \ No newline at end of file diff --git a/admin/Application/Views/Adminusers/forceout.php b/admin/Application/Views/Adminusers/forceout.php new file mode 100755 index 0000000..f4b901d --- /dev/null +++ b/admin/Application/Views/Adminusers/forceout.php @@ -0,0 +1,29 @@ + + +. + +?> + + + + diff --git a/admin/Application/Views/Adminusers/login.php b/admin/Application/Views/Adminusers/login.php new file mode 100755 index 0000000..c005f35 --- /dev/null +++ b/admin/Application/Views/Adminusers/login.php @@ -0,0 +1,45 @@ + + +. + +?> + + + + diff --git a/admin/Application/Views/Adminusers/logout.php b/admin/Application/Views/Adminusers/logout.php new file mode 100755 index 0000000..81ec4db --- /dev/null +++ b/admin/Application/Views/Adminusers/logout.php @@ -0,0 +1,29 @@ + + +. + +?> + +
    +
    + +
    login
    +
    \ No newline at end of file diff --git a/admin/Application/Views/Adminusers/main.php b/admin/Application/Views/Adminusers/main.php new file mode 100644 index 0000000..7d71709 --- /dev/null +++ b/admin/Application/Views/Adminusers/main.php @@ -0,0 +1,25 @@ + + +. + +?> + + \ No newline at end of file diff --git a/admin/Application/Views/footer_back.php b/admin/Application/Views/footer_back.php new file mode 100755 index 0000000..fa9269c --- /dev/null +++ b/admin/Application/Views/footer_back.php @@ -0,0 +1,27 @@ + + +. + +?> + +
    + + diff --git a/admin/Application/Views/header_back.php b/admin/Application/Views/header_back.php new file mode 100755 index 0000000..862847d --- /dev/null +++ b/admin/Application/Views/header_back.php @@ -0,0 +1,94 @@ + + + +. + +?> + + + Admin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + diff --git a/admin/Application/Views/panel.php b/admin/Application/Views/panel.php new file mode 100755 index 0000000..1fff0b6 --- /dev/null +++ b/admin/Application/Views/panel.php @@ -0,0 +1,55 @@ + + +. + +?> + + \ No newline at end of file diff --git a/admin/Application/index.html b/admin/Application/index.html new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/admin/Application/index.html @@ -0,0 +1 @@ + -- cgit v1.2.3