diff options
Diffstat (limited to 'admin/Application')
76 files changed, 4617 insertions, 0 deletions
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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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'] = "<div class='alert'>Vecchia password sbagliata</div>\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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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'] = '<div class="alert">Wrong username or password</div>'; + break; + case 'wait': + $data['notice'] = '<div class="alert">You have to wait 5 seconds before you can try to login another time</div>'; + break; + } + } + $this->set($data); + $this->load('login'); + } + + public function logout() + { + $res = $this->s['admin']->logout(); + if ($res == 'not-logged') { + $data['notice'] = "<div class='alert'>You can't logout because you are not logged..</div>\n"; + + } else if ($res == 'was-logged') { + $data['notice'] = "<div class='executed'>Logout executed successfully!</div>\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'] = "<div class='executed'>User has been forced out..</div>\n"; + } + else + { + $data['notice'] = "<div class='alert'>Error..</div>\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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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 @@ +<?php + +// All EasyGiant code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +// See COPYRIGHT.txt and LICENSE.txt. + +if (!defined('EG')) die('Direct access not allowed!'); + +//in this file you can write the PHP code that will be executed just after the controller initialization, after super global array have been sanitizied + +//you can access the whole set of classes of EasyGiant
\ No newline at end of file diff --git a/admin/Application/Hooks/BeforeChecks.php b/admin/Application/Hooks/BeforeChecks.php new file mode 100644 index 0000000..03ee247 --- /dev/null +++ b/admin/Application/Hooks/BeforeChecks.php @@ -0,0 +1,16 @@ +<?php + +// All EasyGiant code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +// See COPYRIGHT.txt and LICENSE.txt. + +if (!defined('EG')) die('Direct access not allowed!'); + +//in this file you can write the PHP code that will be executed at the beginning of the EasyGiant execution, before super global array have been sanitizied + +//this is the preferred place to create and fill log files + +//you can access the whole set of classes and functions of EasyGiant + +Params::$htmlentititiesCharset = "UTF-8"; + +Params::$allowedSanitizeFunc .= ",sanitizeString,sanitizeAlphanum";
\ No newline at end of file diff --git a/admin/Application/Hooks/BeforeInitialization.php b/admin/Application/Hooks/BeforeInitialization.php new file mode 100644 index 0000000..6d1851b --- /dev/null +++ b/admin/Application/Hooks/BeforeInitialization.php @@ -0,0 +1,10 @@ +<?php + +// All EasyGiant code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +// See COPYRIGHT.txt and LICENSE.txt. + +if (!defined('EG')) die('Direct access not allowed!'); + +//in this file you can write the PHP code that will be executed just before the controller initialization, after super global array have been sanitizied + +//you can access the whole set of classes of EasyGiant
\ No newline at end of file diff --git a/admin/Application/Hooks/index.html b/admin/Application/Hooks/index.html new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/admin/Application/Hooks/index.html @@ -0,0 +1 @@ + diff --git a/admin/Application/Include/distributions.php b/admin/Application/Include/distributions.php new file mode 100644 index 0000000..294eac6 --- /dev/null +++ b/admin/Application/Include/distributions.php @@ -0,0 +1,88 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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(" <br /> ",$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 = "<div class='dist_checkboxes_hidden_box'>"; + $str .= "<div class='dist_checkboxes_hidden_box_inner'>"; + foreach (self::$allowed as $value => $label) + { + $str .= "<div class=\"hidden_box_item\"><input class=\"hidden_box_input $value\" type=\"checkbox\" name=\"$value\" value=\"$value\"/> $label</div>"; + } + $str .= "</div>"; + $str .= "<input class=\"hidden_box_distribution_submit\" type=\"submit\" value=\"apply\">"; + $str .= "<input class=\"hidden_box_distribution_cancel\" type=\"submit\" value=\"cancel\">"; + $str .= "</div>"; + + 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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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'])?"<del>".implode(' ',$k['d'])."</del> ":''). + (!empty($k['i'])?"<ins>".implode(' ',$k['i'])."</ins> ":''); + 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 "<a href='/users/meet/".Lang::$current."/$user'>$user</a>"; + } +} + + + +//decode the text of the wiki +function decodeWikiText($string) +{ + + $string = preg_replace('/(\[hr\])/', '<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', '<b>${2}</b>',$string); + + $string = preg_replace('/(\[u\])(.*?)(\[\/u\])/s', '<u>${2}</u>',$string); + + $string = preg_replace('/(\[i\])(.*?)(\[\/i\])/s', '<i>${2}</i>',$string); + + $string = preg_replace('/(\[del\])(.*?)(\[\/del\])/s', '<del>${2}</del>',$string); + + $string = preg_replace('/(\[\*\])(.*?)(\[\/\*\])/s', '<li>${2}</li>',$string); + + $string = preg_replace('/(\[list\])(.*?)(\[\/list\])/s', '<ul>${2}</ul>',$string); + + $string = preg_replace('/(\[enum\])(.*?)(\[\/enum\])/s', '<ol>${2}</ol>',$string); + + $string = preg_replace('/(\[code\])(.*?)(\[\/code\])/s', '<pre class="code_pre">${2}</pre>',$string); + + $string = preg_replace('/(\[p\])(.*?)(\[\/p\])/s', '<p>${2}</p>',$string); + + $string = preg_replace('/(\[h1\])(.*?)(\[\/h1\])/s', '<div class="div_h1">${2}</div>',$string); + + $string = preg_replace('/(\[h2\])(.*?)(\[\/h2\])/s', '<div class="div_h2">${2}</div>',$string); + + $string = preg_replace('/(\[h3\])(.*?)(\[\/h3\])/s', '<div class="div_h3">${2}</div>',$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 "<a title = '".$string."' href='".$string."'>".$string."</a>"; + } + return $string; +} + +function linkTo($match) +{ + if (checkUrl($match[2])) + { + return "<a title = '".$match[2]."' href='".$match[2]."'>".$match[2]."</a>"; + } + else + { + return $match[0]; + } +} + +function linkToWithText($match) +{ + if (checkUrl($match[2])) + { + + return "<a title = '".$match[2]."' href='".$match[2]."'>".$match[3]."</a>"; + } + 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) ? "<a title = 'link to notebook $name: $href' href='$href'>".$name."</a>" : $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) ? "<a title = 'link to wifi card $name: $href' href='$href'>".$name."</a>" : $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) ? "<a title = 'link to video card $name: $href' href='$href'>".$name."</a>" : $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 "<b>duplication</b> of the model having id <b><a href='/".$controller."/view/".Lang::$current."/".$clean['id_hard']."/".$name."'>".$clean['id_hard']."</a></b>"; + } + else + { + return "<b>".$row['deletion']['object']."</b>"; + } +} 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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +if (!defined('EG')) die('Direct access not allowed!'); + +class BoxesModel extends Model_Tree { + + public function __construct() { + $this->_tables = 'boxes'; + $this->_idFields = 'id_box'; + + parent::__construct(); + } + + public $formStruct = array( + 'entries' => array( + 'title' => array(), + 'message' => array('type'=>'Textarea'), + 'id_box' => array( + 'type' => 'Hidden' + ) + ), + ); + +}
\ No newline at end of file diff --git a/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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +if (!defined('EG')) die('Direct access not allowed!'); + +class DeletionModel extends Model_Tree +{ + + public function __construct() + { + $this->_tables = 'deletion'; + $this->_idFields = 'id_del'; + +// $this->_where=array( +// 'id_hard' => 'talk' +// ); +// + $this->_popupItemNames = array( + 'object' => 'object', + ); + + $this->_popupLabels = array( + 'object' => 'OBJECT', + ); +// + $this->orderBy = 'deletion.id_del desc'; + + $this->strongConditions['insert'] = array( + "checkIsStrings|duplication,other" => 'object', + "+checkLength|500" => 'message' + ); + + parent::__construct(); + } + +}
\ No newline at end of file diff --git a/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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +if (!defined('EG')) die('Direct access not allowed!'); + +class HardwareModel extends Model_Map { + + public $id_user = 0; + public $type = ''; //device type + public $lastId = 0; //the id of the last record inserted + + public $formStruct = array( + 'entries' => array( + 'deleted'=> array('type'=>'Select','options'=>'no,yes'), + 'id_hard' => array( + 'type' => 'Hidden' + ) + ), + ); + + public function __construct() { + $this->_tables='hardware,regusers,hardware_users'; + $this->_idFields='id_hard,id_user'; + $this->_where=array( + 'type' => 'hardware', + 'username' => 'regusers', + '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 = "<div class='alert'>Wrong type..</div>\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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +if (!defined('EG')) die('Direct access not allowed!'); + +class HistoryModel extends Model_Tree { + + public function __construct() { + $this->_tables = 'history'; + $this->_idFields = 'id_history'; + + $this->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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +if (!defined('EG')) die('Direct access not allowed!'); + +class NewsModel extends Model_Tree { + + public function __construct() { + $this->_tables = 'news'; + $this->_idFields = 'id_news'; + + $this->orderBy = 'news.id_news desc'; + + parent::__construct(); + } + + public $formStruct = array( + 'entries' => array( + 'title' => array(), + 'message' => array('type'=>'Textarea','idName'=>'bb_code'), + 'id_news' => array( + 'type' => 'Hidden' + ) + ), + ); + +}
\ No newline at end of file diff --git a/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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +if (!defined('EG')) die('Direct access not allowed!'); + +class ParamsModel extends Model_Tree { + + public function __construct() { + $this->_tables = 'params'; + $this->_idFields = 'id_par'; + + parent::__construct(); + } + + public $formStruct = array( + 'entries' => array( + 'updating' => array( + 'type'=>'Select', + 'options'=>'no,yes', + ), + '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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +if (!defined('EG')) die('Direct access not allowed!'); + +class ProfileModel extends Model_Tree { + + public function __construct() { + $this->_tables = 'profile'; + $this->_idFields = 'id_prof'; + + $this->_where=array( + 'username' => 'regusers', + 'has_confirmed' => 'regusers', + 'deleted' => 'regusers' + ); + + $this->softConditions['update'] = array( + "checkLength|90" => "real_name,where_you_are,fav_distro,birth_date,website|the fields 'real name', 'where_you_are', 'favorite distro', 'website' and 'birthdate' don't have to have more than 90 characters", + "checkLength|1000" => "projects,description|the fields 'projects' and 'description' don't have to have more than 1000 characters", + "checkIsStrings|no,yes" => "publish_mail" + ); + + 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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +if (!defined('EG')) die('Direct access not allowed!'); + +class RevisionsModel extends Model_Tree { + + public $id_user = 0; + public $type = ''; //device type + + public function __construct() { + $this->_tables='revisions'; + $this->_idFields='id_rev'; + + $this->_where=array( + 'id_hard'=>'revisions' + ); + + $this->orderBy = 'id_rev desc'; + + parent::__construct(); + } + + public function getIdHard($id_rev = 0) + { + $clean['id_rev'] = (int)$id_rev; + + $res = $this->db->select('revisions','id_hard','id_rev='.$clean['id_rev']); + + return (count($res) > 0) ? $res[0]['revisions']['id_hard'] : 0; + } + +}
\ No newline at end of file diff --git a/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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +if (!defined('EG')) die('Direct access not allowed!'); + +class UsersModel extends Model_Map +{ + + public static $usersList = array(); + + public function __construct() + { + $this->_tables='regusers,reggroups,regusers_groups'; + $this->_idFields='id_user,id_group'; + + $this->_where=array( + 'id_group' => 'reggroups', + 'id_user' => 'regusers', + 'name' => 'reggroups', + 'confirmation_token'=> 'regusers', + 'has_confirmed' => 'regusers', + 'deleted' => 'regusers', + 'forgot_token' => 'regusers' + ); + + $this->_popupItemNames = array( + 'has_confirmed'=>'has_confirmed', + 'deleted'=>'deleted', + 'id_group'=>'name', + ); + + $this->_popupLabels = array( + 'has_confirmed'=>'HAS CONFIRMED?', + 'deleted'=>'DELETED?', + 'id_group'=>'GROUP' + ); + + $this->orderBy = 'regusers.id_user desc'; + + parent::__construct(); + + $this->deleteNotRegistered(); + } + + public function 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 = "<div class='alert'>Wrong captcha code...</div>\n"; + } + } + } + + public function close($id_user) + { + $clean['id_user'] = (int)$id_user; + + $this->values = array( + 'has_confirmed' => 1, + 'deleted' => 'yes', + 'e_mail' => '' + ); + + if ($this->update($clean['id_user'])) + { + $_SESSION['status'] = 'deleted'; + + $profile = new ProfileModel(); + $res = $profile->db->select('profile','id_prof','created_by='.$clean['id_user']); + + if (count($res) > 0) + { + $clean['id_prof'] = (int)$res[0]['profile']['id_prof']; + $profile->values = array( + 'real_name' => '', + 'where_you_are' => '', + 'birth_date' => '', + 'fav_distro' => '', + 'projects' => '', + 'description' => '' + ); + $profile->update($clean['id_prof']); + } + } + + } + + public function forgot($username) + { + $clean['username'] = ctype_alnum($username) ? sanitizeAll($username) : ''; + + if (isset($_POST['captcha'])) + { + if ( strcmp($_SESSION['captchaString'],$_POST['captcha']) === 0 ) + { + $res = $this->db->select('regusers','e_mail,id_user','username="'.$clean['username'].'" and has_confirmed = 0 and deleted = "no"'); + if (count($res) > 0) + { + $e_mail = $res[0]['regusers']['e_mail']; + $id_user = (int)$res[0]['regusers']['id_user']; + $forgot_token = md5(randString(20)); + $forgot_time = time(); + $updateArray = array($forgot_token, $forgot_time); + $this->db->update('regusers','forgot_token,forgot_time',$updateArray,'username="'.$clean['username'].'"'); + + $result = Account::sendnew($clean['username'],$e_mail,$id_user,$forgot_token); + + if ($result) + { + $_SESSION['status'] = 'sent_new'; + } + else + { + $_SESSION['status'] = 'sent_new_error'; + } + + $hed = new HeaderObj(DOMAIN_NAME); + $hed->redirect('users/notice/'.Lang::$current,1); + + } + else + { + $this->notice = "<div class='alert'>the user does not exist</div>\n"; + } + } + else + { + $this->result = false; + $this->queryResult = false; + $this->notice = "<div class='alert'>Wrong captcha code...</div>\n"; + } + } + } + +}
\ No newline at end of file diff --git a/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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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 @@ +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +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 @@ +<?php + +// All EasyGiant code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +// See COPYRIGHT.txt and LICENSE.txt. + +if (!defined('EG')) die('Direct access not allowed!'); + +//module to print an HTML link +//extends the ModAbstract class inside the Library folder +class ModBase extends ModAbstract { + + public function render() + { + return null; + } + + public function getHtmlClass() + { + if (isset($this->simpleXmlObj->classname)) + { + return " class='".$this->simpleXmlObj->classname[0]."' "; + } + return null; + } + + //wrap the html with a <div> + //look for the <div> tag in the xml in order to set the class of the div + public function wrapDiv($string) + { + $divOpen = "<div class='box_module'>"; + $divClose = "</div>"; + + if (isset($this->simpleXmlObj->div)) + { + $divOpen = "<div class='".$this->simpleXmlObj->div."'>"; + } + + 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 @@ +<?php + +// All EasyGiant code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +// See COPYRIGHT.txt and LICENSE.txt. + +if (!defined('EG')) die('Direct access not allowed!'); + +//module to print an HTML image +//extends the ModBase class +class ModImage extends ModBase { + + public function widthPropertyString() + { + if (isset($this->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 = "<img ".$this->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 @@ +<?php + +// All EasyGiant code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +// See COPYRIGHT.txt and LICENSE.txt. + +if (!defined('EG')) die('Direct access not allowed!'); + +//module to print an HTML link +//extends the ModBase class +class ModLink extends ModBase { + + public function render() + { + $link = "<a ".$this->getHtmlClass()." href='".$this->simpleXmlObj->href[0]."'>".$this->simpleXmlObj->text[0]."</a>"; + 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 @@ +<?php + +// All EasyGiant code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +// See COPYRIGHT.txt and LICENSE.txt. + +if (!defined('EG')) die('Direct access not allowed!'); + +//module to print an HTML image linking to something +//extends the ModBase class +class ModLinkimage extends ModImage { + + public function render() + { + $link = "<a ".$this->getHtmlClass()." href='".$this->simpleXmlObj->href[0]."'><img ".$this->widthPropertyString().$this->heightPropertyString().$this->titlePropertyString()." src='".$this->simpleXmlObj->src[0]."'></a>"; + 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 @@ +<?php + +// All EasyGiant code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +// See COPYRIGHT.txt and LICENSE.txt. + +if (!defined('EG')) die('Direct access not allowed!'); + +//module to print some raw HTML +//extends the ModBase class +class ModRaw extends ModBase { + + public function render() + { + $link = $this->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 @@ +<?php + +// All EasyGiant code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +// See COPYRIGHT.txt and LICENSE.txt. + +if (!defined('EG')) die('Direct access not allowed!'); + +//error strings in the case database conditions are not satisfied +class Lang_It_DbCondStrings extends Lang_Eng_DbCondStrings { + + //get the error string in the case that the value of the field $field is already present in the table $table + public function getNotUniqueString($field) + { + return "<div class='alert'>Il valore del campo <i>". $field ."</i> è già presente. Per favore scegline un altro.</div>\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 @@ +<?php + +// All EasyGiant code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +// See COPYRIGHT.txt and LICENSE.txt. + +if (!defined('EG')) die('Direct access not allowed!'); + +class Lang_It_ModelStrings extends Lang_ResultStrings { + + public $string = array( + "error" => "<div class='alert'>Errore nella query: contatta l'amministratore!</div>\n", + "executed" => "<div class='executed'>operazione eseguita!</div>\n", + "associate" => "<div class='alert'>Problema di integrità referenziale: il record è associato ad un record di una tabella figlia. Devi prima rompere l'associazione.</div>\n", + "no-id" => "<div class='alert'>Non è definito alcun id della query</div>\n", + "not-linked" => "<div class='alert'>Il record non è associato, non puoi dissociarlo</div>", + "linked" => "<div class='alert'>Il record è già associato, non puoi associarlo un'altra volta</div>" + ); + +} 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 @@ +<?php + +// All EasyGiant code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +// See COPYRIGHT.txt and LICENSE.txt. + +if (!defined('EG')) die('Direct access not allowed!'); + +class Lang_It_UploadStrings extends Lang_ResultStrings { + + public $string = array( + "error" => "<div class='alert'>Errore: verificare i permessi del file/directory</div>\n", + "executed" => "<div class='executed'>Operazione eseguita!</div>\n", + "not-child" => "<div class='alert'>La cartella selezionata non è una sotto directory della directory base</div>\n", + "not-dir" => "<div class='alert'>La cartella selezionata non è una directory</div>\n", + "not-empty" => "<div class='alert'>La cartella selezionata non è vuota</div>\n", + "no-folder-specified" => "<div class='alert'>Non è stata specificata alcuna cartella</div>\n", + "not-writable" => "<div class='alert'>La cartella non è scrivibile</div>\n", + "not-writable-file" => "<div class='alert'>Il file non è scrivibile</div>\n", + "dir-exists" => "<div class='alert'>Esiste già una directory con lo stesso nome</div>\n", + "no-upload-file" => "<div class='alert'>Non c'è alcun file di cui fare l'upload</div>\n", + "size-over" => "<div class='alert'>La dimensione del file è troppo grande</div>\n", + "not-allowed-ext" => "<div class='alert'>L'estensione del file che vuoi caricare non è consentita</div>\n", + "file-exists" => "<div class='alert'>Esiste già un file con lo stesso nome</div>\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 @@ +<?php + +// All EasyGiant code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +// See COPYRIGHT.txt and LICENSE.txt. + +if (!defined('EG')) die('Direct access not allowed!'); + +class Lang_It_ValCondStrings extends Lang_Eng_ValCondStrings { + + //if the element is not defined + public function getNotDefinedResultString($element) + { + return "<div class='alert'>". $element ." non è stato definito</div>\n"; + } + + //if the elements are not equal + public function getNotEqualResultString($element) + { + return "<div class='alert'>Differenti valori: $element</div>\n"; + } + + //if the element is not alphabetic + public function getNotAlphabeticResultString($element) + { + return "<div class='alert'>".$element." deve essere una stringa di soli caratteri alfabetici</div>\n"; + } + + //if the element is not alphanumeric + public function getNotAlphanumericResultString($element) + { + return "<div class='alert'>".$element." deve essere una stringa di soli caratteri alfanumerici</div>\n"; + } + + //if the element is not a decimal digit + public function getNotDecimalDigitResultString($element) + { + return "<div class='alert'>".$element." deve essere una stringa di soli numeri decimali</div>\n"; + } + + //if the element has the mail format + public function getNotMailFormatResultString($element) + { + return "<div class='alert'>".$element." non sembra un indirizzo e-mail</div>\n"; + } + + //if the element is numeric + public function getNotNumericResultString($element) + { + return "<div class='alert'>".$element." deve essere un numero</div>\n"; + } + + //if the element (string) length exceeds the value of characters (defined by $maxLength) + public function getLengthExceedsResultString($element,$maxLength) + { + return "<div class='alert'>".$element." non deve essere composto da più di $maxLength caratteri</div>\n"; + } + + //if the element is one of the strings indicated by $stringList (a comma-separated list of strings) + public function getIsForbiddenStringResultString($element,$stringList) + { + return "<div class='alert'>".$element." non può assumere uno dei seguenti valori: $stringList</div>\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 "<div class='alert'>".$element." deve assumere uno dei seguenti valori: $stringList</div>\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 @@ +<?php if (!defined('EG')) die('Direct access not allowed!'); ?> + +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +?> + +<?php echo $scaffold;?>
\ 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 @@ +<?php if (!defined('EG')) die('Direct access not allowed!'); ?> + +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +?> + +<?php echo $scaffold;?>
\ 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 @@ +<?php if (!defined('EG')) die('Direct access not allowed!'); ?> + +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +?> + +<div class='mainMenu'> + <?php echo $menu;?> +</div> + +<div class="ask_for_deletion_external"> + + <?php foreach ($table as $row) { ?> + <div class="ask_for_deletion_internal"> + <div class="ask_for_deletion_item"> + <b>id hardware to delete</b>: <?php echo $row['deletion']['id_hard'];?> + </div> + <div class="ask_for_deletion_item"> + <b>requested by</b>: <?php echo getUserName($row['deletion']['created_by']);?> + </div> + <div class="ask_for_deletion_item"> + <b>at</b>: <?php echo smartDate($row['deletion']['creation_date']);?> + </div> + <div class="ask_for_deletion_item"> + <b>why</b>: <?php echo $row['deletion']['object'];?> + </div> + <div class="ask_for_deletion_item"> + <b>hardware duplicated</b>: <?php echo $row['deletion']['id_duplicate'];?> + </div> + <div class="ask_for_deletion_item"> + <b>message</b>: <?php echo $row['deletion']['message'];?> + </div> + </div> + <?php } ?> +</div>
\ 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 @@ +<?php if (!defined('EG')) die('Direct access not allowed!'); ?> + +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +?> + +<?php echo $scaffold;?>
\ 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 @@ +<?php if (!defined('EG')) die('Direct access not allowed!'); ?> + +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +?> + +<?php echo $scaffold;?>
\ 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 @@ +<?php if (!defined('EG')) die('Direct access not allowed!'); ?> + +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +?> + + <script> + + $(document).ready(function() { + + $("#bb_code").markItUp(mySettings); + $("#bb_code_notice").markItUp(mySettings); + + }); + + </script> + +<?php echo $scaffold;?>
\ 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 @@ +<?php if (!defined('EG')) die('Direct access not allowed!'); ?> + +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +?> + + <script> + + $(document).ready(function() { + + $("#bb_code").markItUp(mySettings); + + }); + + </script> + +<?php echo $scaffold;?>
\ 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 @@ +<?php if (!defined('EG')) die('Direct access not allowed!'); ?> + +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +?> + +<script> + + $(document).ready(function() { + + $("#bb_code").markItUp(mySettings); + + }); + +</script> + +<?php echo $scaffold;?>
\ 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 @@ +<?php if (!defined('EG')) die('Direct access not allowed!'); ?> + +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +?> + +<?php echo $scaffold;?>
\ 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 @@ +<?php if (!defined('EG')) die('Direct access not allowed!'); ?> + +<div class='mainMenu'> + <?php echo $menĂ¹;?> +</div> + +<?php echo $notice;?> + +<?php echo $form;?>
\ 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 @@ +<?php if (!defined('EG')) die('Direct access not allowed!'); ?> + +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +?> + +<div class='mainMenu'> + <?php echo $menu;?> +</div> + +<?php echo $notice;?> + +<div class='groupsList'> + Associate the user <b><?php echo $user;?></b> to some groups:<br /><br /> + <form action = '<?php echo $action;?>' method = 'POST'> + + <select name='boxIdentifier'> + <?php foreach ($groups as $name => $value) {?> + <option value='<?php echo $value;?>'><?php echo $name;?></option> + <?php } ?> + </select> + <input type='submit' name='associateAction' value='associate'> + <input type='submit' name='dissociateAction' value='dissociate'> + <input type='hidden' name='id_user' value='<?php echo (int)$_POST['id_user'];?>'> + </form> +</div> + +<br /><hr> +<div class='groupsList'> + The user <b><?php echo $user;?></b> is inserted inside the following Groups: + <ul> + <?php foreach ($groupsUser as $g) {?> + <li><?php echo $g['reggroups']['name'];?></li> + <?php } ?> + </ul> +</div>
\ 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 @@ +<?php if (!defined('EG')) die('Direct access not allowed!'); ?> + +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +?> + +<?php echo $scaffold;?>
\ 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 @@ +<?php if (!defined('EG')) die('Direct access not allowed!'); ?> + +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +?> + +<?php echo $scaffold;?>
\ 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 @@ +<?php if (!defined('EG')) die('Direct access not allowed!'); ?> + +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +?> + +<div class='mainMenu'> + <?php echo $menu;?> +</div> + +<?php echo $notice;?> + +<div class='groupsList'> + Associate the user <b><?php echo $user;?></b> to some groups:<br /><br /> + <form action = '<?php echo $action;?>' method = 'POST'> + + <select name='boxIdentifier'> + <?php foreach ($groups as $name => $value) {?> + <option value='<?php echo $value;?>'><?php echo $name;?></option> + <?php } ?> + </select> + <input type='submit' name='associateAction' value='associate'> + <input type='submit' name='dissociateAction' value='dissociate'> + <input type='hidden' name='id_user' value='<?php echo (int)$_POST['id_user'];?>'> + </form> +</div> + +<br /><hr> +<div class='groupsList'> + The user <b><?php echo $user;?></b> is inserted inside the following Groups: + <ul> + <?php foreach ($groupsUser as $g) {?> + <li><?php echo $g['admingroups']['name'];?></li> + <?php } ?> + </ul> +</div>
\ 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 @@ +<?php if (!defined('EG')) die('Direct access not allowed!'); ?> + +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +?> + +<div class='mainMenu'> + <?php echo $menĂ¹;?> +</div> + +<?php echo $notice;?> 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 @@ +<?php if (!defined('EG')) die('Direct access not allowed!'); ?> + +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +?> + +<?php echo $notice; ?> + +<div class="login_box"> + <form action = '<?php echo $action;?>' method = 'POST'> + + <table> + <tr> + <td>Username</td> + <td><input type='text' name='username'></td> + </tr> + <tr> + <td>Password</td> + <td><input type='password' name='password'></td> + </tr> + <tr> + <td><input type = 'submit' value = 'login'></td> + </tr> + </table> + + </form> +</div> 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 @@ +<?php if (!defined('EG')) die('Direct access not allowed!'); ?> + +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +?> + +<div class="logout_box"> + <div><?php echo $notice;?></div> + + <div><a href="<?php echo $login;?>">login</a></div> +</div>
\ 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 @@ +<?php if (!defined('EG')) die('Direct access not allowed!'); ?> + +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +?> + +<?php echo $scaffold;?>
\ 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 @@ +<?php if (!defined('EG')) die('Direct access not allowed!'); ?> + +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +?> + +</div> <!--container--> +</body> +</html> 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 @@ +<?php if (!defined('EG')) die('Direct access not allowed!'); ?> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +?> +<head> + + <title>Admin</title> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> + <link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrlSrc.'/Public/Css/scaffold.css';?>"></style> + <link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrlSrc.'/Public/Css/mainmenu.css';?>"></style> + <link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrlSrc.'/Public/Css/popupmenu.css';?>"></style> + <link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrlSrc.'/Public/Css/form.css';?>"></style> + <link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrlSrc.'/Public/Css/pagelist.css';?>"></style> + <link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrlSrc.'/Public/Css/files.css';?>"></style> + <link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrlSrc.'/Public/Css/login.css';?>"></style> + + <link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrlSrc.'/Public/Css/panel.css';?>"></style> + + <!--[if IE]> + <link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl?>/Public/Css/explorer.css"> + <![endif] --> + + <script type="text/javascript" src="<?php echo $this->baseUrl;?>/Public/Js/jquery/jquery-1.4.2.min.js"></script> + + <!--markitup--> + <script type="text/javascript" src="<?php echo $this->baseUrl;?>/Public/Js/markitup/jquery.markitup.js"></script> + <script type="text/javascript" src="<?php echo $this->baseUrl;?>/Public/Js/markitup/sets/bbcode/set.js"></script> + + <!-- markItUp! skin --> + <link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl;?>/Public/Js/markitup/skins/simple/style.css" /> + <!-- markItUp! toolbar skin --> + <link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl;?>/Public/Js/markitup/sets/bbcode/style.css" /> + + <style type='text/css'> + + div#container{ + text-align: left; + margin:0px; + } + + .ask_for_deletion_internal + { + margin:10px; + background:#B0E0E6; + padding:10px; + } + .ask_for_deletion_item + { + font:normal 15px/1.3 sans-serif,arial,Verdana; + margin:5px; + } + </style> + + <script> + + $(document).ready(function(){ + + $(".delForm form").click(function () { + if (window.confirm("do you really want to delete this record?")) { + return true; + } + return false; + }); + + }); + + </script> + +</head> + +<body> + +<div id="container"> + 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 @@ +<?php if (!defined('EG')) die('Direct access not allowed!'); ?> + +<?php + +// h-admin, a web software to build a community of people that want to share their hardware information. +// Copyright (C) 2010 Antonio Gallo (h-admin-copyright.txt) +// +// This file is part of h-admin +// +// h-admin is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// h-admin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with h-admin. If not, see <http://www.gnu.org/licenses/>. + +?> + +<div class="mainPanel"> + + <div class='mainMenu'> + <div class='logoutButton'> + <a href ="<?php echo Url::getRoot('adminusers/logout');?>">LOGOUT</a> + </div> + </div> + + <div class='usersLoggedList'> + Users logged: + <?php foreach ($logged as $user) {?> + <b><?php echo $user.' ';?></b> + <?php } ?> + </div> + + <ul class='panelApplicationList'> + <li><a href="<?php echo Url::getRoot('adminusers/main/1/undef/'.$token);?>">Admin users</a></li> + <li><a href="<?php echo Url::getRoot('adminpassword/form/'.$token);?>">Password</a></li> + <li><a href="<?php echo Url::getRoot('adminhardware/main/1/undef/undef/undef/'.$token);?>">Hardware</a></li> + <li><a href="<?php echo Url::getRoot('admindeletion/main/1/undef/'.$token);?>">Ask for deletion</a></li> + <li><a href="<?php echo Url::getRoot('adminissues/main/1/undef/undef/undef/undef/'.$token);?>">Issues</a></li> + <li><a href="<?php echo Url::getRoot('adminmessages/main/1/undef/no/'.$token);?>">Messages to Issues</a></li> + <li><a href="<?php echo Url::getRoot('admintalk/main/1/'.$token);?>">Talk</a></li> + <li><a href="<?php echo Url::getRoot('adminregusers/main/1/undef/undef/undef/'.$token);?>">Registered users</a></li> + <li><a href="<?php echo Url::getRoot('adminparams/form/'.$token);?>">Parameters</a></li> + <li><a href="<?php echo Url::getRoot('adminnews/main/1/'.$token);?>">News</a></li> + <li><a href="<?php echo Url::getRoot('adminboxes/main/1/'.$token);?>">Boxes</a></li> + <li><a href="<?php echo Url::getRoot('adminhistory/main/1/undef/undef/undef/'.$token);?>">Moderators' actions history</a></li> + </ul> + +</div>
\ 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 @@ + |