diff options
Diffstat (limited to 'applications/modules')
| -rw-r--r-- | applications/modules/admin/controllers/GroupeController.php | 266 | ||||
| -rw-r--r-- | applications/modules/admin/controllers/IndexController.php | 63 | ||||
| -rw-r--r-- | applications/modules/admin/controllers/ModuleController.php | 108 | ||||
| -rw-r--r-- | applications/modules/admin/controllers/UtilisateurController.php | 380 | ||||
| -rwxr-xr-x | applications/modules/admin/descriptor.ini | 38 | ||||
| -rw-r--r-- | applications/modules/admin/models/GroupRightForm.php | 89 | ||||
| -rw-r--r-- | applications/modules/login/controllers/IndexController.php | 142 | ||||
| -rw-r--r-- | applications/modules/login/controllers/RegisterController.php | 158 | ||||
| -rwxr-xr-x | applications/modules/login/descriptor.ini | 36 | ||||
| -rw-r--r-- | applications/modules/pub/controllers/AdminController.php | 43 | ||||
| -rw-r--r-- | applications/modules/pub/controllers/IndexController.php | 47 | ||||
| -rwxr-xr-x | applications/modules/pub/descriptor.ini | 36 | ||||
| -rw-r--r-- | applications/modules/setup/controllers/IndexController.php | 53 | ||||
| -rwxr-xr-x | applications/modules/setup/descriptor.ini | 35 |
14 files changed, 1494 insertions, 0 deletions
diff --git a/applications/modules/admin/controllers/GroupeController.php b/applications/modules/admin/controllers/GroupeController.php new file mode 100644 index 0000000..8e0f18e --- /dev/null +++ b/applications/modules/admin/controllers/GroupeController.php @@ -0,0 +1,266 @@ +<?php +/** + * +----------------------------------------------------------------------+ + * | This file is part of TABARNAK - PHP Version 5 | + * +----------------------------------------------------------------------+ + * | Copyright (C) 2008-2009 Libricks | + * +----------------------------------------------------------------------+ + * | Ce programme est un logiciel libre distribue sous licence GNU/GPL. | + * | Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. | + * | | + * | This program 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 2 | + * | of the License, or (at your option) any later version. | + * | | + * | This program 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 this program; if not, write to | + * | the Free Software Foundation, Inc., | + * | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | + * | | + * +----------------------------------------------------------------------+ + * | Authors: * Marc-Henri PAMISEUX <[email protected]> | + * | * Jean-Baptiste BLANC <[email protected]> | + * +----------------------------------------------------------------------+ + */ +/** + * Contrôleur principal de l'application + * + * @package application + * @subpackage controllers + */ + +class Admin_GroupeController extends Zend_Controller_Action +{ + + private $groupform = null; + + /** + * Affichage de la page d'accueil + */ + public function indexAction() + { + $this->_forward('groupe','groupe','admin'); + } + + private function getStringForRights($current,$add){ + return ($current == "" || is_null($current)) ? $add : "$current,$add"; + } + + public function droitAction(){ + $myform = $this->getGroupeDroitsForm(); + $this->view->form = $myform; + $this->view->subs = $myform->getSubForms(); + $this->view->compte_array = getRolesArray(); + $this->view->nbCompte = count(getRolesArray())+1; + + if($this->getRequest()->isPost()){ + $config = new Zend_Config_Ini(CONFIG_PATH.'tabarnak_acl.ini', null, + array('skipExtends' => true, + 'allowModifications' => true)); + + //Vide tous les droits dans le fichier + foreach(getRolesArray() as $r){ + $config->$r->__unset('deny'); + $config->$r->__unset('allow'); + } + + //Créer un tableau contenant la totalité des descripteurs de modules + //Cela permet de créer ensuite les deny. + $deny = array(); + $aListMod = getModulesNames(MOD_PATH); + foreach($aListMod as $module=>$modChemin){ + $liste = new Zend_Config_Ini($modChemin.DIRECTORY_SEPARATOR.'descriptor.ini','general'); + foreach($liste->toArray() as $control=>$act){ + $deny[$module][$control] = array_flip(getArrayFromIniString($act)); + } + } + + $allDeny = array(); + foreach(getRolesArray() as $r){ + $allDeny[$r] = $deny; + } + + //Traite les données envoyés par le formulaire (seulement des allow) + foreach($_POST as $module=>$array){ + if(is_array($array)){ + foreach($array as $controller=>$actions){ + $ressource = $module."_".$controller; + foreach($actions as $action=>$auth){ + foreach($auth as $bla=>$role){ + $a = explode("_",$role); + $perm = $a[0]; + $rol = $a[1]; + $current = $config->$rol->__get("$perm.$ressource"); + $str = $this->getStringForRights($current,$action); + + //Retire de l'array deny l'action ajoutée aux allow + unset($allDeny[$rol][$module][$controller][$action]); + if(count($allDeny[$rol][$module][$controller])<=0) + unset($allDeny[$rol][$module][$controller]); + + $config->$rol->__set("$perm.$ressource",$str); + } + } + } + } + } + + //Ecrit les deny pour chaque roles et modules + foreach($allDeny as $role=>$array){ + foreach($array as $module=>$den){ + foreach($den as $controller=>$v){ + foreach($v as $action=>$l){ + $ressource = $module."_".$controller; + $current = $config->$role->__get("deny.$ressource"); + $str = $this->getStringForRights($current,$action); + $config->$role->__set("deny.$ressource",$str); + } + } + } + } + + try{ + $writer = new Zend_Config_Writer_Ini(array('config' => $config, + 'filename' => CONFIG_PATH.'tabarnak_acl.ini')); + $writer->write(); + }catch(Exception $e){ + $this->view->erreur = $e->getTraceAsString(); + } + + $acl_ini = new Tbk_Acl_Ini(CONFIG_PATH.'tabarnak_acl.ini'); + $sessionNS = new Zend_Session_Namespace('Droits'); + $sessionNS->__set('acl',$acl_ini); + + $this->_forward('index','groupe','admin'); + } + } + + public function groupeAction(){ + $this->view->addGroupeForm = $this->getGroupeAjouterForm(); + $this->view->removeGroupeForm = $this->getGroupeSupprimerForm(); + $this->view->lienDroits = '/admin/groupe/droit'; + } + + public function addgroupeAction(){ + $config = new Zend_Config_Ini(CONFIG_PATH.'tabarnak_acl.ini', null, + array('skipExtends' => true, + 'allowModifications' => true)); + $config->roles->$_POST['nom_groupe'] = ""; + $dt_tmp = $config->$_POST['parent']; + $config->$_POST['nom_groupe'] = $dt_tmp; + + try{ + $writer = new Zend_Config_Writer_Ini(array('config' => $config, + 'filename' => CONFIG_PATH.'tabarnak_acl.ini')); + $writer->write(); + }catch(Exception $e){ + $this->view->erreur = $e->getTraceAsString(); + } + + $acl_ini = new Tbk_Acl_Ini(CONFIG_PATH.'tabarnak_acl.ini'); + $sessionNS = new Zend_Session_Namespace('Droits'); + $sessionNS->__set('acl',$acl_ini); + $this->_forward('groupe','groupe','admin'); + } + + public function removegroupeAction(){ + $config = new Zend_Config_Ini(CONFIG_PATH.'tabarnak_acl.ini', null, + array('skipExtends' => true, + 'allowModifications' => true)); + + $config->__unset($_POST['nom_groupe']); + $config->roles->__unset($_POST['nom_groupe']); + + try{ + $writer = new Zend_Config_Writer_Ini(array('config' => $config, + 'filename' => CONFIG_PATH.'tabarnak_acl.ini')); + $writer->write(); + }catch(Exception $e){ + $this->view->erreur = $e->getTraceAsString(); + } + + $acl_ini = new Tbk_Acl_Ini(CONFIG_PATH.'tabarnak_acl.ini'); + $sessionNS = new Zend_Session_Namespace('Droits'); + $sessionNS->__set('acl',$acl_ini); + $this->_forward('groupe','groupe','admin'); + } + + + /** + * @desc Cette fonction permet de générer le formulaire pour ajouter un groupe. + * @return Zend_Form + */ + private function getGroupeAjouterForm(){ + $form = new Zend_Form(); + $form->setAction('/admin/groupe/addgroupe'); + $form->setMethod('post'); + $form->setDecorators(formDecorator()); + + $parent = new Zend_Form_Element_Select('parent'); + $parent->setRequired(true); + $parent->setLabel("Role de base"); + $parent->addMultiOptions(getRolesArray()); + $parent->setDecorators(stdDecorator()); + + $user = new Zend_Form_Element_Text('nom_groupe'); + $user->addValidator('alnum'); + $user->setRequired(true); + $user->addFilter('StringToLower'); + $user->setLabel("Nom du groupe"); + $user->setDecorators(stdDecorator()); + + $submit = new Zend_Form_Element_Submit('ajouter'); + $submit->setLabel('Ajouter'); + $submit->setDecorators(buttonDecorator()); + + $form->addElement($parent,'parent'); + $form->addElement($user,'nom_groupe'); + $form->addElement($submit,'submit'); + return $form; + } + + /** + * @desc Cette fonction permet de générer le formulaire pour ajouter un groupe. + * @return Zend_Form + */ + private function getGroupeSupprimerForm(){ + $form = new Zend_Form(); + $form->setAction('/admin/groupe/removegroupe'); + $form->setMethod('post'); + $form->setDecorators(formDecorator()); + + $parent = new Zend_Form_Element_Select('nom_groupe'); + $parent->setRequired(true); + $parent->setLabel("Groupe à supprimer"); + $parent->addMultiOptions(getRolesArray()); + $parent->setDecorators(stdDecorator()); + + $submit = new Zend_Form_Element_Submit('supprimer'); + $submit->setLabel('Supprimer'); + $submit->setDecorators(buttonDecorator()); + + $form->addElement($parent,'nom_groupe'); + $form->addElement($submit,'submit'); + + return $form; + } + + /** + * + * @desc Cette fonction permet de générer le formulaire pour gérer les droits des groupes. + * @return Zend_Form + */ + private function getGroupeDroitsForm(){ + if(is_null($this->groupform)) + $this->groupform = new GroupRightForm(); + + return $this->groupform; + } +} +?>
\ No newline at end of file diff --git a/applications/modules/admin/controllers/IndexController.php b/applications/modules/admin/controllers/IndexController.php new file mode 100644 index 0000000..54cfe1e --- /dev/null +++ b/applications/modules/admin/controllers/IndexController.php @@ -0,0 +1,63 @@ +<?php +/** + * +----------------------------------------------------------------------+ + * | This file is part of TABARNAK - PHP Version 5 | + * +----------------------------------------------------------------------+ + * | Copyright (C) 2008-2009 Libricks | + * +----------------------------------------------------------------------+ + * | Ce programme est un logiciel libre distribue sous licence GNU/GPL. | + * | Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. | + * | | + * | This program 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 2 | + * | of the License, or (at your option) any later version. | + * | | + * | This program 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 this program; if not, write to | + * | the Free Software Foundation, Inc., | + * | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | + * | | + * +----------------------------------------------------------------------+ + * | Authors: * Marc-Henri PAMISEUX <[email protected]> | + * | * Jean-Baptiste BLANC <[email protected]> | + * +----------------------------------------------------------------------+ + */ +/** + * Contrôleur principal de l'application + * + * @package application + * @subpackage controllers + */ + +class Admin_IndexController extends Zend_Controller_Action +{ + /** + * Affichage de la page d'accueil + */ + public function indexAction() + { + if(!Zend_Auth::getInstance()->hasIdentity()){ + $this->_forward('index','index','login'); + return ; + } + + $link = array('Modules' => 'admin/module/index', + 'Serveur' => 'admin/index/phpinfo', + 'Groupes' => 'admin/groupe/index', + 'Utilisateurs' => 'admin/utilisateur/index', ); + + $this->view->liens = $link; + } + + public function phpinfoAction(){ + + } + +} +?>
\ No newline at end of file diff --git a/applications/modules/admin/controllers/ModuleController.php b/applications/modules/admin/controllers/ModuleController.php new file mode 100644 index 0000000..07a0292 --- /dev/null +++ b/applications/modules/admin/controllers/ModuleController.php @@ -0,0 +1,108 @@ +<?php +/** + * +----------------------------------------------------------------------+ + * | This file is part of TABARNAK - PHP Version 5 | + * +----------------------------------------------------------------------+ + * | Copyright (C) 2008-2009 Libricks | + * +----------------------------------------------------------------------+ + * | Ce programme est un logiciel libre distribue sous licence GNU/GPL. | + * | Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. | + * | | + * | This program 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 2 | + * | of the License, or (at your option) any later version. | + * | | + * | This program 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 this program; if not, write to | + * | the Free Software Foundation, Inc., | + * | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | + * | | + * +----------------------------------------------------------------------+ + * | Authors: * Marc-Henri PAMISEUX <[email protected]> | + * | * Jean-Baptiste BLANC <[email protected]> | + * +----------------------------------------------------------------------+ + */ +class Admin_ModuleController extends Zend_Controller_Action +{ + /** + * Affichage de la page d'accueil + */ + public function indexAction() + { + if(!Zend_Auth::getInstance()->hasIdentity()){ + $this->_forward('index','index','login'); + return ; + } + $link = array(); + $modList = getModulesNames(MOD_PATH); + foreach($modList as $v){ + if(is_file($v.'/controllers/AdminController.php')){ + $decoupe = explode(DIRECTORY_SEPARATOR,$v); + $modName = $decoupe[count($decoupe)-1]; + $link[$modName] = '/'.$modName.'/admin/index'; + } + } + + $this->view->form = $this->getActiveForm(); + $this->view->liens = $link; + } + + public function activationAction(){ + if($this->getRequest()->isPost()){ + $form = $this->getActiveForm(); + foreach($_POST as $module=>$perm){ + if(preg_match("#active_#",$module)){ + $mod = explode('_',$module,2); + $file = MOD_PATH.DIRECTORY_SEPARATOR.$mod[1].DIRECTORY_SEPARATOR.'descriptor.ini'; + $config = new Zend_Config_Ini($file, null, + array('skipExtends'=> true, + 'allowModifications'=> true)); + $config->activation->active = $perm; + + try{ + $writer = new Zend_Config_Writer_Ini(array('config' => $config, + 'filename' => $file)); + $writer->write(); + }catch(Exception $e){ + $this->view->erreur = $e->getTraceAsString(); + } + } + } + } + } + + //Permet de récupérer le formulaire d'activation des modules. + private function getActiveForm(){ + $form = new Zend_Form(); + $form->setAction('/admin/module/activation'); + $form->setMethod('post'); + $form->setDecorators(formDecorator()); + + $liste_module = getModulesNames(MOD_PATH); + foreach($liste_module as $module=>$module_path){ + $parent = new Zend_Form_Element_Checkbox("active_$module"); + $parent->setLabel("Activer $module"); + $parent->setDecorators(stdDecorator()); + if(is_module_active($module)) + $parent->setChecked(true); + + $form->addElement($parent,"active_$module"); + } + + + $submit = new Zend_Form_Element_Submit('ajouter'); + $submit->setLabel('Enregistrer'); + $submit->setDecorators(buttonDecorator()); + + $form->addElement($submit,'submit'); + return $form; + } + +} +?> diff --git a/applications/modules/admin/controllers/UtilisateurController.php b/applications/modules/admin/controllers/UtilisateurController.php new file mode 100644 index 0000000..0fea962 --- /dev/null +++ b/applications/modules/admin/controllers/UtilisateurController.php @@ -0,0 +1,380 @@ +<?php +/** + * +----------------------------------------------------------------------+ + * | This file is part of TABARNAK - PHP Version 5 | + * +----------------------------------------------------------------------+ + * | Copyright (C) 2008-2009 Libricks | + * +----------------------------------------------------------------------+ + * | Ce programme est un logiciel libre distribue sous licence GNU/GPL. | + * | Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. | + * | | + * | This program 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 2 | + * | of the License, or (at your option) any later version. | + * | | + * | This program 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 this program; if not, write to | + * | the Free Software Foundation, Inc., | + * | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | + * | | + * +----------------------------------------------------------------------+ + * | Authors: * Marc-Henri PAMISEUX <[email protected]> | + * | * Jean-Baptiste BLANC <[email protected]> | + * +----------------------------------------------------------------------+ + */ +class Admin_UtilisateurController extends Zend_Controller_Action +{ + /** + * Affichage de la page d'accueil + */ + public function indexAction(){ + $page = $this->_getParam('page'); + if(empty($page) || is_null($page)) + $page = 1; + else + $page = intval($page); + + $indexForm = $this->getIndexForm($page); + $elements = $indexForm[1]->getElements(); + + $infos = array(); + foreach($elements as $k=>$v){ + if(preg_match("#infos_#",$k)) + $infos[$k] = $v; + } + + $this->view->ajout = $this->getFormAjout(); + $paginator = $indexForm[0]; + $paginator->setView($this->view); + $this->view->pages = $paginator->getPages(); + $this->view->liste = $indexForm[1]; + $this->view->elements = $elements; + $this->view->infos = $infos; + + } + + private function getIndexForm($page = 1){ + $conf = new Zend_Config_Ini(CONFIG_PATH.'persistance.ini'); + + $config = $conf->general; + $base_auth = $conf->toArray(); + $auth = $base_auth["auth"]["db"]; + + $db = Zend_Db::factory($config->db); + Zend_Db_Table::setDefaultAdapter($db); + + + $select = $db->select(); + $select->from($auth["table"],'*'); + $select->where($auth["champ"]["role"]."!=?",'admin'); + + $users = $db->fetchAll($select); + + $paginator = Zend_Paginator::factory($users); + $paginator->setCurrentPageNumber($page); + $paginator->setItemCountPerPage(10); + $paginator->setPageRange(3); + + $form = new Zend_Form(); + $form->setAction('/admin/utilisateur/suppression'); + $form->setMethod('post'); + $form->setAttrib('class', 'formulaire'); + + foreach($paginator as $infos){ + $login = $infos[$auth["champ"]["login"]]; + $id = $infos[$auth["champ"]["id"]]; + $mail = $infos[$auth["champ"]["mail"]]; + $role = $infos[$auth["champ"]["role"]]; + + $hidden = new Zend_Form_Element_Hidden("infos_$id"); + $hidden->setValue("$id;$login;$mail;$role"); + $checkbox = new Zend_Form_Element_Checkbox("del_$id"); + $checkbox->setLabel("$login"); + $checkbox->setDecorators(array('ViewHelper','Errors')); + + $form->addElement($hidden,"infos_$id"); + $form->addElement($checkbox,"del_$id"); + } + + $submit = new Zend_Form_Element_Submit('supprimer'); + $submit->setLabel('Supprimer'); + $submit->setDecorators(array('ViewHelper', + array(array('row' => 'HtmlTag'), array('tag' => 'p')))); + + $form->addElement($submit,'supprimer'); + return array($paginator,$form); + } + + + /* + * PARTIE SUR LA SUPPRESSION + */ + + public function suppressionAction(){ + if($this->getRequest()->isPost()){ + $to_del = array(); + foreach($_POST as $k=>$v){ + if(preg_match("#del_#",$k) && intval($v) == 1){ + $expl = explode("_",$k,2); + array_push($to_del,intval($expl[1])); + } + } + if(count($to_del)>0){ + $conf = new Zend_Config_Ini(CONFIG_PATH.'persistance.ini'); + + $config = $conf->general; + $base_auth = $conf->toArray(); + $auth = $base_auth["auth"]["db"]; + + $db = Zend_Db::factory($config->db); + Zend_Db_Table::setDefaultAdapter($db); + + foreach($to_del as $id){ + $where = $db->quoteInto($auth["champ"]["id"].' = ?', $id); + $affected = $db->delete($auth["table"],$where); + } + } + } + $this->_forward('index','utilisateur','admin'); + } + + /* + * PARTIE SUR LA MODIFICATION + */ + + public function modificationAction(){ + $var = $this->_getParam('user'); + if(!$this->getRequest()->isPost() && (empty($var) || is_null($var))){ + $this->_forward('index','utilisateur','admin'); + } + else{ + if(!isset($_POST['user_id'])) + $form = $this->getFormModification($this->_getParam('user')); + else{ + $form = $this->getFormModification($_POST['user_id']); + + if (!$form->isValid($_POST)) { + $this->view->form = $form; + } + else{ + $conf = new Zend_Config_Ini(CONFIG_PATH.'persistance.ini'); + + $config = $conf->general; + $base_auth = $conf->toArray(); + $auth = $base_auth["auth"]["db"]; + + $db = Zend_Db::factory($config->db); + Zend_Db_Table::setDefaultAdapter($db); + + $values = array( + $auth["champ"]["login"] => $_POST['user'], + $auth["champ"]["role"] => $_POST['role'], + $auth["champ"]["mail"] => $_POST['mail'] + ); + if(!empty($_POST['pass'])) + $values[$auth["champ"]["mdp"]] = md5($_POST['pass']); + + + + $where = $db->quoteInto($auth["champ"]["id"].' = ?', $_POST['user_id']); + $affected = $db->update($auth["table"],$values,$where); + + if($affected>0) + $this->_forward('index','utilisateur','admin'); + } + } + $this->view->form = $form; + } + } + + private function getFormModification($user_id = null){ + $conf = new Zend_Config_Ini(CONFIG_PATH.'persistance.ini'); + + $config = $conf->general; + $base_auth = $conf->toArray(); + $auth = $base_auth["auth"]["db"]; + + $db = Zend_Db::factory($config->db); + Zend_Db_Table::setDefaultAdapter($db); + + + $select = $db->select(); + $select->from($auth["table"],"*"); + $select->where($auth["champ"]["id"]."=?",$user_id); + + $result = $db->fetchAll($select); + + $info_user = array(); + + if(count($result)>0){ + $info_user['login'] = $result[0][$auth["champ"]["login"]]; + $info_user['role'] = $result[0][$auth["champ"]["role"]]; + $info_user['mail'] = $result[0][$auth["champ"]["mail"]]; + } + + $form = new Zend_Form(); + $form->setAction('/admin/utilisateur/modification'); + $form->setMethod('post'); + $form->setAttrib('class', 'formulaire'); + $form->setDecorators(formDecorator()); + + $user = new Zend_Form_Element_Text('user'); + $user->addValidator('alnum'); + $user->setRequired(true); + $user->addFilter('StringToLower'); + $user->setLabel("Identifiant"); + $user->setValue($info_user['login']); + $user->setDecorators(stdDecorator()); + + $pass = new Zend_Form_Element_Password('pass'); + $pass->addValidator('StringLength', false, array(6)); + $pass->setRequired(false); + $pass->setLabel("Mot de passe"); + $pass->setDecorators(stdDecorator()); + + $mail = new Zend_Form_Element_Text('mail'); + $mail->addValidator('EmailAddress'); + $mail->setRequired(true); + $mail->setLabel("Email"); + $mail->setValue($info_user['mail']); + $mail->setDecorators(stdDecorator()); + + $listeRole = new Zend_Form_Element_Select('role'); + $listeRole->setRequired(true); + $listeRole->setLabel("Role"); + $listeRole->addMultiOptions(getRolesArray()); + $listeRole->setValue($info_user['role']); + $listeRole->setDecorators(stdDecorator()); + + $submit = new Zend_Form_Element_Submit('login'); + $submit->setLabel('Modification'); + $submit->setDecorators(buttonDecorator()); + + $hidden = new Zend_Form_Element_Hidden('user_id'); + $hidden->setValue($user_id); + + $source = new Zend_Form_Element_Hidden('source'); + $source->setValue("admin"); + + $form->addElement($user,'user'); + $form->addElement($pass,'pass'); + $form->addElement($mail,'mail'); + $form->addElement($hidden,'user_id'); + $form->addElement($listeRole,'role'); + + $form->addElement($submit,'login'); + return $form; + } + + private function getListeModification(){ + $form = new Zend_Form(); + $form->setAction('/admin/utilisateur/modification'); + $form->setMethod('post'); + $form->setAttrib('class', 'formulaire'); + $form->setDecorators(formDecorator()); + + $user = new Zend_Form_Element_Select('user'); + $user->setRequired(true); + $user->setLabel("Utilisateur : "); + + $conf = new Zend_Config_Ini(CONFIG_PATH.'persistance.ini'); + + $config = $conf->general; + $base_auth = $conf->toArray(); + $auth = $base_auth["auth"]["db"]; + + $db = Zend_Db::factory($config->db); + Zend_Db_Table::setDefaultAdapter($db); + $select = $db->select(); + $select->from($auth["table"],$auth["champ"]["login"]); + + $result = $db->fetchAll($select); + foreach($result as $k=>$v){ + $user->addMultiOption($v[$auth["champ"]["login"]],$v[$auth["champ"]["login"]]); + } + + $user->setDecorators(stdDecorator()); + + + $source = new Zend_Form_Element_Hidden('source'); + $source->setValue("liste"); + + $submit = new Zend_Form_Element_Submit('login'); + $submit->setLabel('Modification'); + $submit->setDecorators(buttonDecorator()); + + $form->addElement($user,'user'); + $form->addElement($source,'source_form'); + $form->addElement($submit,'login'); + + return $form; + } + + + /* + * PARTIE SUR L'AJOUT + */ + + private function getFormAjout(){ + $form = new Zend_Form(); + $form->setAction('/login/register/register'); + $form->setMethod('post'); + $form->setAttrib('class', 'formulaire'); + $form->setDecorators(formDecorator()); + + $user = new Zend_Form_Element_Text('user'); + $user->addValidator('alnum'); + $user->setRequired(true); + $user->addFilter('StringToLower'); + $user->setLabel("Identifiant"); + $user->setDecorators(stdDecorator()); + + $pass = new Zend_Form_Element_Password('pass'); + $pass->addValidator('StringLength', false, array(6)); + $pass->setRequired(true); + $pass->setLabel("Mot de passe"); + $pass->setDecorators(stdDecorator()); + + $passconf = new Zend_Form_Element_Password('passconf'); + $passconf->addValidator('StringLength', false, array(6)); + $passconf->setRequired(true); + $passconf->setLabel("Confirmation"); + $passconf->setDecorators(stdDecorator()); + + $mail = new Zend_Form_Element_Text('mail'); + $mail->addValidator('EmailAddress'); + $mail->setRequired(true); + $mail->setLabel("Email"); + $mail->setDecorators(stdDecorator()); + + $listeRole = new Zend_Form_Element_Select('role'); + $listeRole->setRequired(true); + $listeRole->setLabel("Role"); + $listeRole->addMultiOptions(getRolesArray()); + $listeRole->setDecorators(stdDecorator()); + + $source = new Zend_Form_Element_Hidden('source_form'); + $source->setValue("admin"); + + $submit = new Zend_Form_Element_Submit('login'); + $submit->setLabel('Inscription'); + $submit->setDecorators(buttonDecorator()); + + $form->addElement($user,'user'); + $form->addElement($pass,'pass'); + $form->addElement($passconf,'passconf'); + $form->addElement($mail,'mail'); + $form->addElement($listeRole,'role'); + $form->addElement($source,'source_form'); + + $form->addElement($submit,'login'); + return $form; + } +} +?>
\ No newline at end of file diff --git a/applications/modules/admin/descriptor.ini b/applications/modules/admin/descriptor.ini new file mode 100755 index 0000000..5637c03 --- /dev/null +++ b/applications/modules/admin/descriptor.ini @@ -0,0 +1,38 @@ +; +----------------------------------------------------------------------+ +; | This file is part of TABARNAK - PHP Version 5 | +; +----------------------------------------------------------------------+ +; | Copyright (C) 2008-2009 Libricks | +; +----------------------------------------------------------------------+ +; | Ce programme est un logiciel libre distribue sous licence GNU/GPL. | +; | Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. | +; | | +; | This program 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 2 | +; | of the License, or (at your option) any later version. | +; | | +; | This program 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 this program; if not, write to | +; | the Free Software Foundation, Inc., | +; | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | +; | | +; +----------------------------------------------------------------------+ +; | Authors: * Marc-Henri PAMISEUX <[email protected]> | +; | * Jean-Baptiste BLANC <[email protected]> | +; +----------------------------------------------------------------------+ +; + +[general] +index = "index,phpinfo" +groupe = "index,droit,groupe,addgroupe,removegroupe" +module = "index,activation" +utilisateur = "index,ajout,suppression,modification" + +[activation] +active = "1" + diff --git a/applications/modules/admin/models/GroupRightForm.php b/applications/modules/admin/models/GroupRightForm.php new file mode 100644 index 0000000..4d39d6c --- /dev/null +++ b/applications/modules/admin/models/GroupRightForm.php @@ -0,0 +1,89 @@ +<?php +/** + * +----------------------------------------------------------------------+ + * | This file is part of TABARNAK - PHP Version 5 | + * +----------------------------------------------------------------------+ + * | Copyright (C) 2008-2009 Libricks | + * +----------------------------------------------------------------------+ + * | Ce programme est un logiciel libre distribue sous licence GNU/GPL. | + * | Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. | + * | | + * | This program 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 2 | + * | of the License, or (at your option) any later version. | + * | | + * | This program 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 this program; if not, write to | + * | the Free Software Foundation, Inc., | + * | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | + * | | + * +----------------------------------------------------------------------+ + * | Authors: * Marc-Henri PAMISEUX <[email protected]> | + * | * Jean-Baptiste BLANC <[email protected]> | + * +----------------------------------------------------------------------+ + */ +class GroupRightForm extends Zend_Form +{ + public function __construct($option=null) + { + parent::__construct($option); + $config = new Zend_Config_Ini(CONFIG_PATH.'tabarnak_acl.ini'); + $aListMod = getModulesNames(MOD_PATH); + $listeRole = getRolesArray(); + $this->setAction('/admin/groupe/droit'); + $this->setMethod('post'); + + foreach($aListMod as $module=>$modChemin){ + $liste = new Zend_Config_Ini($modChemin.DIRECTORY_SEPARATOR.'descriptor.ini','general'); + + //Création du sous formulaire + $subForm = new Zend_Form_SubForm(); + $subForm->setName($module); + $subForm->setLegend($module); + + //Listage des différents controllers et de leurs actions + foreach($liste->toArray() as $controller=>$actions){ + $subFormCont = new Zend_Form_SubForm(); + $subFormCont->setName($controller); + $subFormCont->setLegend($controller); + + $aActions = getArrayFromIniString($actions); + foreach($aActions as $action){ + $checked = array(); + $group = new Zend_Form_Element_MultiCheckbox($action); + foreach($listeRole as $role){ + $group->addMultiOption("allow_$role","Autoriser $action pour $role"); + + if(isAllowed($role,$module,$controller,$action)) + array_push($checked,"allow_$role"); + } + + + $group->setValue($checked); + + $subFormCont->addElement($group,$action); + } + + $subForm->addSubForm($subFormCont,$controller); + } + + //Ajout au formulaire de base + $this->addSubForm($subForm,$module); + } + + $submit = new Zend_Form_Element_Submit('enregistrer'); + $submit->setLabel('Enregistrer'); + $submit->setDecorators(array( + 'ViewHelper', + array(array('row' => 'HtmlTag'), array('tag' => '<p>'))) + ); + $this->addElement($submit,'enregistrer'); + } +} +?>
\ No newline at end of file diff --git a/applications/modules/login/controllers/IndexController.php b/applications/modules/login/controllers/IndexController.php new file mode 100644 index 0000000..aea8c8a --- /dev/null +++ b/applications/modules/login/controllers/IndexController.php @@ -0,0 +1,142 @@ +<?php +/** + * +----------------------------------------------------------------------+ + * | This file is part of TABARNAK - PHP Version 5 | + * +----------------------------------------------------------------------+ + * | Copyright (C) 2008-2009 Libricks | + * +----------------------------------------------------------------------+ + * | Ce programme est un logiciel libre distribue sous licence GNU/GPL. | + * | Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. | + * | | + * | This program 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 2 | + * | of the License, or (at your option) any later version. | + * | | + * | This program 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 this program; if not, write to | + * | the Free Software Foundation, Inc., | + * | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | + * | | + * +----------------------------------------------------------------------+ + * | Authors: * Marc-Henri PAMISEUX <[email protected]> | + * | * Jean-Baptiste BLANC <[email protected]> | + * +----------------------------------------------------------------------+ + */ + +/** + * Contrôleur principal de l'application + * + * @package application + * @subpackage controllers + */ + +class Login_IndexController extends Zend_Controller_Action +{ + public function getForm(){ + $form = new Zend_Form(); + $form->setAction('/login/index/connect'); + $form->setMethod('post'); + $form->setAttrib('class', 'formulaire'); + $form->setDecorators(formDecorator()); + + $user = new Zend_Form_Element_Text('user'); + $user->addValidator('alnum'); + $user->setRequired(true); + $user->addFilter('StringToLower'); + $user->setLabel("Identifiant"); + $user->setDecorators(stdDecorator()); + + $pass = new Zend_Form_Element_Password('pass'); + $pass->addValidator('StringLength', false, array(6)); + $pass->setRequired(true); + $pass->setLabel("Mot de passe"); + $pass->setDecorators(stdDecorator()); + + $submit = new Zend_Form_Element_Submit('login'); + $submit->setLabel('Connexion'); + $submit->setDecorators(buttonDecorator()); + + $form->addElement($user,'user'); + $form->addElement($pass,'pass'); + $form->addElement($submit,'login'); + return $form; + } + + /** + * Affichage de la page d'accueil + */ + public function indexAction() + { + if(Zend_Session::namespaceIsset('Membre')){ + $this->view->form = "Vous êtes déjà connecté."; + return null; + } + + $form = $this->getForm(); + $this->view->form = $form; + } + + public function connectAction(){ + if(Zend_Auth::getInstance()->hasIdentity()){ + $this->view->form = ""; + $this->view->erreur = "Vous êtes déjà connecté."; + return null; + } + + if (!$this->getRequest()->isPost()){ + return $this->_forward('index'); + } + + $form = $this->getForm(); + + if (!$form->isValid($_POST)) { + $this->view->form = $form; + $this->view->erreur = "Veuillez correctement remplir les champs !"; + } + else{ + $auth = Zend_Auth::getInstance(); + $authAdapter = new Tbk_AuthAdapter($_POST['user'],$_POST['pass']); + + $resultat = $auth->authenticate($authAdapter); + + if(!$resultat->isValid()){ + $this->view->form = $form; + $erreur = "Imposible de vous connecter !"; + foreach($resultat->getMessages() as $v){ + $erreur .= "<br/>".$v; + } + $this->view->erreur = $erreur; + } + else{ + //on stock les infos dans la session + $config = new Zend_Config_Ini(CONFIG_PATH.'persistance.ini', 'general'); + + $db = Zend_Db::factory($config->db); + Zend_Db_Table::setDefaultAdapter($db); + + $select = $db->select(); + $select->from("membre","*"); + $select->where("login=?",$_POST['user']); + + $result = $db->fetchAll($select); + + $infosSession = array('user' => $result[0]['login'], 'pass' => $result[0]['password'], + 'role' => $result[0]['role'], 'mail' => $result[0]['mail']); + Zend_Auth::getInstance()->getStorage()->write($infosSession); + $this->_forward('index','index','index'); + } + } + } + + public function disconnectAction(){ + Zend_Auth::getInstance()->clearIdentity(); + Zend_Session::destroy(); + $this->_forward('index','index','index'); + } +}
\ No newline at end of file diff --git a/applications/modules/login/controllers/RegisterController.php b/applications/modules/login/controllers/RegisterController.php new file mode 100644 index 0000000..b23b1e2 --- /dev/null +++ b/applications/modules/login/controllers/RegisterController.php @@ -0,0 +1,158 @@ +<?php +/** + * +----------------------------------------------------------------------+ + * | This file is part of TABARNAK - PHP Version 5 | + * +----------------------------------------------------------------------+ + * | Copyright (C) 2008-2009 Libricks | + * +----------------------------------------------------------------------+ + * | Ce programme est un logiciel libre distribue sous licence GNU/GPL. | + * | Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. | + * | | + * | This program 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 2 | + * | of the License, or (at your option) any later version. | + * | | + * | This program 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 this program; if not, write to | + * | the Free Software Foundation, Inc., | + * | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | + * | | + * +----------------------------------------------------------------------+ + * | Authors: * Marc-Henri PAMISEUX <[email protected]> | + * | * Jean-Baptiste BLANC <[email protected]> | + * +----------------------------------------------------------------------+ + */ + +/** + * Contrôleur principal de l'application + * + * @package application + * @subpackage controllers + */ + +class Login_RegisterController extends Zend_Controller_Action +{ + public function getForm(){ + $form = new Zend_Form(); + $form->setAction('/login/register/register'); + $form->setMethod('post'); + $form->setAttrib('class', 'formulaire'); + $form->setDecorators(formDecorator()); + + $user = new Zend_Form_Element_Text('user'); + $user->addValidator('alnum'); + $user->setRequired(true); + $user->addFilter('StringToLower'); + $user->setLabel("Identifiant"); + $user->setDecorators(stdDecorator()); + + $pass = new Zend_Form_Element_Password('pass'); + $pass->addValidator('StringLength', false, array(6)); + $pass->setRequired(true); + $pass->setLabel("Mot de passe"); + $pass->setDecorators(stdDecorator()); + + $passconf = new Zend_Form_Element_Password('passconf'); + $passconf->addValidator('StringLength', false, array(6)); + $passconf->setRequired(true); + $passconf->setLabel("Confirmation"); + $passconf->setDecorators(stdDecorator()); + + $mail = new Zend_Form_Element_Text('mail'); + $mail->addValidator('EmailAddress'); + $mail->setRequired(true); + $mail->setLabel("Email"); + $mail->setDecorators(stdDecorator()); + + $listeRole = new Zend_Form_Element_Hidden('role'); + $listeRole->setRequired(true); + $listeRole->setValue("membre"); + + $source = new Zend_Form_Element_Hidden('source_form'); + $source->setValue("register"); + + $submit = new Zend_Form_Element_Submit('login'); + $submit->setLabel('Inscription'); + $submit->setDecorators(buttonDecorator()); + + $form->addElement($user,'user'); + $form->addElement($pass,'pass'); + $form->addElement($passconf,'passconf'); + $form->addElement($mail,'mail'); + $form->addElement($listeRole,'role'); + $form->addElement($source,'source_form'); + $form->addElement($submit,'login'); + return $form; + } + + /** + * Affichage de la page d'accueil + */ + public function indexAction() + { + $form = $this->getForm(); + $this->view->form = $form; + } + + public function registerAction(){ + + if (!$this->getRequest()->isPost()){ + return $this->_forward('index'); + } + + $form = $this->getForm(); + + if (!$form->isValid($_POST)) { + $this->view->form = $form; + $this->view->erreur = "Veuillez correctement remplir les champs !"; + } + else{ + $conf = new Zend_Config_Ini(CONFIG_PATH.'persistance.ini'); + + $config = $conf->general; + $base_auth = $conf->toArray(); + $auth = $base_auth["auth"]["db"]; + + $db = Zend_Db::factory($config->db); + Zend_Db_Table::setDefaultAdapter($db); + + $select = $db->select(); + $select->from($auth["table"],"*"); + $select->where($auth["champ"]["login"]."=?",$_POST['user']); + + $result = $db->fetchAll($select); + + $erreur = array(); + + if(count($result)<=0){ + //Si personne ne porte ce nom + if($_POST['pass'] === $_POST['passconf']){ + $array = array(); + $array[$auth["champ"]["id"]] = null; + $array[$auth["champ"]["login"]] = $_POST['user']; + $array[$auth["champ"]["mdp"]] = md5($_POST['pass']); + $array[$auth["champ"]["mail"]] = $_POST['mail']; + $array[$auth["champ"]["role"]] = $_POST['role']; + $db->insert($auth["table"],$array); + $this->_forward('index','index','index'); + } + else{ + $this->view->erreur = "Les mots de passe entrés sont différents."; + } + } + else{ + $this->view->erreur = "Ce nom existe déjà dans la base de données."; + } + $this->view->form = $form; + } + if($_POST['source_form'] == 'admin') + $this->_forward('index','utilisateur','admin'); + } +} +?>
\ No newline at end of file diff --git a/applications/modules/login/descriptor.ini b/applications/modules/login/descriptor.ini new file mode 100755 index 0000000..951004a --- /dev/null +++ b/applications/modules/login/descriptor.ini @@ -0,0 +1,36 @@ +; +----------------------------------------------------------------------+ +; | This file is part of TABARNAK - PHP Version 5 | +; +----------------------------------------------------------------------+ +; | Copyright (C) 2008-2009 Libricks | +; +----------------------------------------------------------------------+ +; | Ce programme est un logiciel libre distribue sous licence GNU/GPL. | +; | Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. | +; | | +; | This program 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 2 | +; | of the License, or (at your option) any later version. | +; | | +; | This program 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 this program; if not, write to | +; | the Free Software Foundation, Inc., | +; | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | +; | | +; +----------------------------------------------------------------------+ +; | Authors: * Marc-Henri PAMISEUX <[email protected]> | +; | * Jean-Baptiste BLANC <[email protected]> | +; +----------------------------------------------------------------------+ +; + +[general] +index = "index,connect,disconnect" +register = "index,register" + +[activation] +active = "1" + diff --git a/applications/modules/pub/controllers/AdminController.php b/applications/modules/pub/controllers/AdminController.php new file mode 100644 index 0000000..f0066ad --- /dev/null +++ b/applications/modules/pub/controllers/AdminController.php @@ -0,0 +1,43 @@ +<?php +/** + * +----------------------------------------------------------------------+ + * | This file is part of TABARNAK - PHP Version 5 | + * +----------------------------------------------------------------------+ + * | Copyright (C) 2008-2009 Libricks | + * +----------------------------------------------------------------------+ + * | Ce programme est un logiciel libre distribue sous licence GNU/GPL. | + * | Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. | + * | | + * | This program 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 2 | + * | of the License, or (at your option) any later version. | + * | | + * | This program 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 this program; if not, write to | + * | the Free Software Foundation, Inc., | + * | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | + * | | + * +----------------------------------------------------------------------+ + * | Authors: * Marc-Henri PAMISEUX <[email protected]> | + * | * Jean-Baptiste BLANC <[email protected]> | + * +----------------------------------------------------------------------+ + */ + +class AdminController extends Zend_Controller_Action +{ + /** + * Affichage de la page d'accueil + */ + public function indexAction() + { + $this->view->test = "Mouahahahahahaha"; + } + +} +?>
\ No newline at end of file diff --git a/applications/modules/pub/controllers/IndexController.php b/applications/modules/pub/controllers/IndexController.php new file mode 100644 index 0000000..ddb8bc0 --- /dev/null +++ b/applications/modules/pub/controllers/IndexController.php @@ -0,0 +1,47 @@ +<?php +/** + * +----------------------------------------------------------------------+ + * | This file is part of TABARNAK - PHP Version 5 | + * +----------------------------------------------------------------------+ + * | Copyright (C) 2008-2009 Libricks | + * +----------------------------------------------------------------------+ + * | Ce programme est un logiciel libre distribue sous licence GNU/GPL. | + * | Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. | + * | | + * | This program 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 2 | + * | of the License, or (at your option) any later version. | + * | | + * | This program 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 this program; if not, write to | + * | the Free Software Foundation, Inc., | + * | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | + * | | + * +----------------------------------------------------------------------+ + * | Authors: * Marc-Henri PAMISEUX <[email protected]> | + * | * Jean-Baptiste BLANC <[email protected]> | + * +----------------------------------------------------------------------+ + */ + +/** + * Contrôleur principal de l'application + * + * @package application + * @subpackage controllers + */ +class IndexController extends Zend_Controller_Action +{ + /** + * Affichage de la page d'accueil + */ + public function indexAction() + { + $this->view->echo = 'Test MHP'; + } +}
\ No newline at end of file diff --git a/applications/modules/pub/descriptor.ini b/applications/modules/pub/descriptor.ini new file mode 100755 index 0000000..3645418 --- /dev/null +++ b/applications/modules/pub/descriptor.ini @@ -0,0 +1,36 @@ +; +----------------------------------------------------------------------+ +; | This file is part of TABARNAK - PHP Version 5 | +; +----------------------------------------------------------------------+ +; | Copyright (C) 2008-2009 Libricks | +; +----------------------------------------------------------------------+ +; | Ce programme est un logiciel libre distribue sous licence GNU/GPL. | +; | Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. | +; | | +; | This program 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 2 | +; | of the License, or (at your option) any later version. | +; | | +; | This program 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 this program; if not, write to | +; | the Free Software Foundation, Inc., | +; | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | +; | | +; +----------------------------------------------------------------------+ +; | Authors: * Marc-Henri PAMISEUX <[email protected]> | +; | * Jean-Baptiste BLANC <[email protected]> | +; +----------------------------------------------------------------------+ +; + +[general] +index = "index" +admin = "index" + +[activation] +active = "1" + diff --git a/applications/modules/setup/controllers/IndexController.php b/applications/modules/setup/controllers/IndexController.php new file mode 100644 index 0000000..4dd3276 --- /dev/null +++ b/applications/modules/setup/controllers/IndexController.php @@ -0,0 +1,53 @@ +<?php +/** + * +----------------------------------------------------------------------+ + * | This file is part of TABARNAK - PHP Version 5 | + * +----------------------------------------------------------------------+ + * | Copyright (C) 2008-2009 Libricks | + * +----------------------------------------------------------------------+ + * | Ce programme est un logiciel libre distribue sous licence GNU/GPL. | + * | Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. | + * | | + * | This program 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 2 | + * | of the License, or (at your option) any later version. | + * | | + * | This program 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 this program; if not, write to | + * | the Free Software Foundation, Inc., | + * | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | + * | | + * +----------------------------------------------------------------------+ + * | Authors: * Marc-Henri PAMISEUX <[email protected]> | + * | * Jean-Baptiste BLANC <[email protected]> | + * +----------------------------------------------------------------------+ + */ + +/** + * Contrôleur principal de l'application + * + * @package application + * @subpackage controllers + */ +class Setup_IndexController extends Zend_Controller_Action +{ + /** + * Affichage de la page d'accueil + */ + public function indexAction() + { + $this->view->liens_sidebar = array( + 'Test sidebar' => '/setup/index/index', + 'Sous-menu' => array( + 'Premier lien'=>'/admin', + 'Second lien'=>'/index' + )); + $this->view->content = "Test MHP 2"; + } +} diff --git a/applications/modules/setup/descriptor.ini b/applications/modules/setup/descriptor.ini new file mode 100755 index 0000000..6cb713d --- /dev/null +++ b/applications/modules/setup/descriptor.ini @@ -0,0 +1,35 @@ +; +----------------------------------------------------------------------+ +; | This file is part of TABARNAK - PHP Version 5 | +; +----------------------------------------------------------------------+ +; | Copyright (C) 2008-2009 Libricks | +; +----------------------------------------------------------------------+ +; | Ce programme est un logiciel libre distribue sous licence GNU/GPL. | +; | Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. | +; | | +; | This program 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 2 | +; | of the License, or (at your option) any later version. | +; | | +; | This program 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 this program; if not, write to | +; | the Free Software Foundation, Inc., | +; | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | +; | | +; +----------------------------------------------------------------------+ +; | Authors: * Marc-Henri PAMISEUX <[email protected]> | +; | * Jean-Baptiste BLANC <[email protected]> | +; +----------------------------------------------------------------------+ +; + +[general] +index = "index" + +[activation] +active = "1" + |
