コード例 #1
0
ファイル: main.php プロジェクト: CariteColas/projetTKB
 private function processInscription()
 {
     if (!_root::getRequest()->isPost()) {
         return null;
     }
     $tAccount = model_example::getInstance()->getListAccount();
     $sLogin = _root::getParam('login');
     $sPassword = _root::getParam('password');
     if ($sPassword != _root::getParam('password2')) {
         return 'Les deux mots de passe doivent etre identiques';
     } elseif (_root::getParam('login') == '') {
         return 'Vous devez remplir le nom d utilisateur';
     } elseif ($sPassword == '') {
         return 'Vous devez remplir le mot de passe';
     } elseif (strlen($sPassword) > $this->maxPasswordLength) {
         return 'Mot de passe trop long';
     } elseif (isset($tAccount[$sLogin])) {
         return 'Utilisateur déjà existant';
     }
     $oExample = new row_example();
     $oExample->loginField = $sLogin;
     $oExample->passField = model_example::getInstance()->hashPassword($sPassword);
     $oExample->save();
     return 'Votre compte a bien été créé';
 }
コード例 #2
0
ファイル: main.php プロジェクト: clavat/mkframework
 private function save()
 {
     if (!_root::getRequest()->isPost()) {
         return false;
     }
     $oPluginXsrf = new plugin_xsrf();
     if (!$oPluginXsrf->checkToken(_root::getParam('token'))) {
         //on verifie que le token est valide
         return array('token' => $oPluginXsrf->getMessage());
     }
     $oArticleModel = new model_article();
     $iId = _root::getParam('id', null);
     if ($iId == null) {
         $oArticle = new row_article();
     } else {
         $oArticle = $oArticleModel->findById(_root::getParam('id', null));
     }
     foreach ($oArticleModel->getListColumn() as $sColumn) {
         if (_root::getParam($sColumn, null) == null) {
             continue;
         }
         if (in_array($sColumn, $oArticleModel->getIdTab())) {
             continue;
         }
         $oArticle->{$sColumn} = _root::getParam($sColumn, null);
     }
     if ($oArticle->save()) {
         //une fois enregistre on redirige (vers la page de liste)
         _root::redirect('prive::list');
     } else {
         return $oArticle->getListError();
     }
 }
コード例 #3
0
ファイル: main.php プロジェクト: CariteColas/projetTKB
 public function _index()
 {
     $msg = '';
     $detail = '';
     if (_root::getRequest()->isPost()) {
         $sModule = _root::getParam('module');
         $sActions = _root::getParam('actions');
         $tAction = explode("\n", $sActions);
         if (module_builder::getTools()->projetmkdir('module/' . $sModule) == true) {
             $detail = 'Création repertoire module/' . $sModule;
         } else {
             $detail = 'Warning: repertoire déjà existant module/' . $sModule;
         }
         if (module_builder::getTools()->projetmkdir('module/' . $sModule . '/view') == true) {
             $detail .= '<br />Cr&eacute;ation repertoire module/' . $sModule . '/view';
         } else {
             $detail .= '<br />Warning: repertoire d&eacute;j&agrave; existant module/' . $sModule . '/view';
         }
         $this->genModuleMain($sModule, $tAction);
         $msg = 'Module ' . $sModule . ' (actions: ' . implode(',', $tAction) . ') genere avec succes';
         $detail .= '<br />Cr&eacute;ation fichier module/' . $sModule . '/main.php';
         foreach ($tAction as $sAction) {
             $detail .= '<br />Cr&eacute;ation fichier module/' . $sModule . '/view/' . $sAction . '.php';
         }
         $detail .= '<br />Accessible via';
         foreach ($tAction as $sAction) {
             $detail .= '<br />- <a href="data/genere/' . _root::getParam('id') . '/public/index.php?:nav=' . $sModule . '::' . $sAction . '">index.php?:nav=' . $sModule . '::' . $sAction . '</a>';
         }
     }
     $oTpl = new _Tpl('moduleModule::index');
     $oTpl->msg = $msg;
     $oTpl->detail = $detail;
     return $oTpl;
 }
コード例 #4
0
ファイル: main.php プロジェクト: clavat/mkframework
 public function _login()
 {
     $oView = new _view('auth::login');
     $this->oLayout->add('main', $oView);
     if (_root::getRequest()->isPost()) {
         $sLogin = _root::getParam('login');
         $sPass = sha1(_root::getParam('password'));
         $oModelAccount = new model_account();
         $tAccount = $oModelAccount->getListAccount();
         if (_root::getAuth()->checkLoginPass($tAccount, $sLogin, $sPass)) {
             $oAccount = _root::getAuth()->getAccount();
             $tPermission = model_permission::getInstance()->findByGroup($oAccount->groupe);
             //on purge les permissions en session
             _root::getACL()->purge();
             //boucle sur les permissions
             if ($tPermission) {
                 foreach ($tPermission as $oPermission) {
                     if ($oPermission->allowdeny == 'ALLOW') {
                         _root::getACL()->allow($oPermission->action, $oPermission->element);
                     } else {
                         _root::getACL()->deny($oPermission->action, $oPermission->element);
                     }
                 }
             }
             _root::redirect('prive::list');
         }
     }
 }
コード例 #5
0
 /** 
  * constructeur
  * @access public
  * @param object $oObject objet en edition
  */
 public function __construct()
 {
     $this->isPost = false;
     if (_root::getRequest()->isPost()) {
         $this->isPost = true;
     }
 }
コード例 #6
0
ファイル: plugin_form.php プロジェクト: clavat/mkMarket
 /** 
  * constructeur
  * @access public
  * @param object $oObject objet en edition
  */
 public function __construct($oObject = null)
 {
     $this->oObject = $oObject;
     $this->isPost = false;
     if (_root::getRequest()->isPost()) {
         $this->isPost = true;
     }
 }
コード例 #7
0
ファイル: main.php プロジェクト: clavat/mkMarket
    private function process()
    {
        if (_root::getRequest()->isPost() == false or _root::getParam('formu') != 'generate') {
            return null;
        }
        $oPluginValid = new plugin_valid(_root::getRequest()->getParams());
        $oPluginValid->isNotEmpty('modulename', 'Le champ doit &ecirc;tre rempli');
        $oPluginValid->isNotEmpty('classmodel', 'Le champ doit &ecirc;tre rempli');
        $oPluginValid->isNotEmpty('redirect', 'Le champ doit &ecirc;tre rempli');
        if (!$oPluginValid->isValid()) {
            return $oPluginValid->getListError();
        }
        $sModuleName = _root::getParam('modulename');
        $sClassModuleName = 'module_' . $sModuleName;
        $sRedirectModuleAction = _root::getParam('redirect');
        $sModelName = _root::getParam('classmodel');
        $sViewName = $sModuleName . '::login';
        $this->projectMkdir('module/' . $sModuleName);
        /*SOURCE*/
        $oSourceMain = $this->getObjectSource('example/main.php');
        /*SOURCE*/
        $oSourceMain->setPattern('#MODULE#', $sModuleName);
        /*SOURCE*/
        $oSourceMain->setPattern('#privatemodule_action#', $sRedirectModuleAction);
        /*SOURCE*/
        $oSourceMain->setPattern('#model_example#', $sModelName);
        /*SOURCE*/
        $oSourceMain->setPattern('#auth_login#', $sViewName);
        /*SOURCE*/
        $oSourceMain->save();
        $this->projectMkdir('module/' . $sModuleName . '/view');
        /*SOURCE*/
        $oSourceViewLogin = $this->getObjectSource('example/view/login.php');
        /*SOURCE*/
        $oSourceViewLogin->setPattern('#MODULE#', $sModuleName);
        /*SOURCE*/
        $oSourceViewLogin->save();
        $sModuleName = _root::getParam('modulename');
        $this->msg = 'Cr&eacute;ation du module ' . $sModuleName;
        $this->detail = trR('creationRepertoire', array('#REPERTOIRE#' => 'module/' . $sModuleName));
        $this->detail .= '<br/>' . trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModuleName . '/main.php'));
        $this->detail .= '<br/>' . trR('creationRepertoire', array('#REPERTOIRE#' => 'module/' . $sModuleName));
        $this->detail .= '<br/>' . trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModuleName . '/view/login.php'));
        $this->detail .= '<br/>';
        $this->detail .= '<br/>' . trR('editezVotreFichier', array('#link#' => '<a target="_blank" href="' . _root::getLink('code::index', array('project' => _root::getParam('id'), 'file' => 'conf/site.ini.php')) . '">conf/site.ini.php</a>'));
        $this->detail .= '<br/>
		<div style="padding:8px;border:2px dotted gray">
		[auth]<br/>
		enabled=1<br/>
		' . tr('et') . '<br/>
		module=' . $sModuleName . '::login
		</div>
		';
    }
コード例 #8
0
ファイル: main.php プロジェクト: CariteColas/projetTKB
 public function _index()
 {
     if (_root::getParam('config') == '') {
         return $this->xmlindexselect();
     }
     module_builder::getTools()->rootAddConf('conf/connexion.ini.php');
     $msg = '';
     $detail = '';
     $tTables = array();
     $tTableColumn = array();
     $sConfig = _root::getParam('config');
     $tTables = module_builder::getTools()->getListTablesFromConfig($sConfig);
     $tTableColumn = array();
     foreach ($tTables as $sTable) {
         $tTableColumn[$sTable] = module_builder::getTools()->getListColumnFromConfigAndTable($sConfig, $sTable);
     }
     $tFileIndex = array();
     if (_root::getParam('sTable') != '') {
         $oDir = new _dir(_root::getConfigVar('path.generation') . _root::getParam('id') . '/data/json/base/' . _root::getParam('sTable') . '/index');
         if (!$oDir->exist()) {
             $oDir->save();
         }
         $tFile = array();
         foreach ($oDir->getListDir() as $oFile) {
             if (preg_match('/.index/', $oFile->getName())) {
                 $tFileIndex[] = $oFile->getName();
             }
         }
     }
     if (_root::getParam('regenerateIndexXml') != '') {
         $this->regenerateIndexXml($sConfig, _root::getParam('sTable'), _root::getParam('regenerateIndexXml'));
     }
     if (_root::getRequest()->isPost()) {
         $sTable = _root::getParam('sTable');
         $tField = _root::getParam('tField');
         module_builder::getTools()->projetmkdir('data/json/base/' . $sTable . '/index');
         module_builder::getTools()->projetmkdir('data/json/base/' . $sTable . '/index/' . implode('.', $tField) . '.index');
         $this->regenerateIndexXml($sConfig, $sTable, implode('.', $tField) . '.index');
         $msg = 'Index ' . implode('.', $tField) . ' sur la table ' . $sTable . ' g&eacute;n&eacute;r&eacute; avec succ&egrave;s';
         $detail = 'Cr&eacute;ation repertoire data/json/base/' . $sTable . '/index';
         $detail .= '<br />Cr&eacute;ation repertoire index data/json/base/' . $sTable . '/index/' . implode('.', $tField);
         $detail .= '<br />Reg&eacute;n&eacute;ration de l\'index';
     }
     $oTpl = new _Tpl('moduleJsonIndex::index');
     $oTpl->msg = $msg;
     $oTpl->detail = $detail;
     $oTpl->tTables = $tTables;
     $oTpl->tTableColumn = $tTableColumn;
     $oTpl->tFileIndex = $tFileIndex;
     return $oTpl;
 }
コード例 #9
0
 public function enable()
 {
     _root::startSession();
     $sModuleToLoad = _root::getRequest()->getModule();
     if (preg_match('/::/', _root::getConfigVar('auth.module'))) {
         $tModuleAction = preg_split('/::/', _root::getConfigVar('auth.module'));
         $sAuthModule = $tModuleAction[0];
     } else {
         $sAuthModule = _root::getConfigVar('auth.module');
     }
     if (!_root::getAuth()->isConnected() and $sModuleToLoad != $sAuthModule) {
         _root::redirect(_root::getConfigVar('auth.module'));
     }
 }
コード例 #10
0
ファイル: main.php プロジェクト: clavat/mkMarket
 public function _index()
 {
     if (_root::getParam('config') == '') {
         return $this->xmlindexselect();
     }
     module_builder::getTools()->rootAddConf('conf/connexion.ini.php');
     $msg = '';
     $detail = '';
     $tTables = array();
     $tTableColumn = array();
     $sConfig = _root::getParam('config');
     $tTables = module_builder::getTools()->getListTablesFromConfig($sConfig);
     $tTableColumn = array();
     foreach ($tTables as $sTable) {
         $tTableColumn[$sTable] = module_builder::getTools()->getListColumnFromConfigAndTable($sConfig, $sTable);
     }
     $tFileIndex = array();
     if (_root::getParam('sTable') != '') {
         $oDir = new _dir(_root::getConfigVar('path.generation') . _root::getParam('id') . '/data/json/base/' . _root::getParam('sTable') . '/index');
         if (!$oDir->exist()) {
             $oDir->save();
         }
         $tFile = array();
         foreach ($oDir->getListDir() as $oFile) {
             if (preg_match('/.index/', $oFile->getName())) {
                 $tFileIndex[] = $oFile->getName();
             }
         }
     }
     if (_root::getParam('regenerateIndexXml') != '') {
         $this->regenerateIndexXml($sConfig, _root::getParam('sTable'), _root::getParam('regenerateIndexXml'));
     }
     if (_root::getRequest()->isPost()) {
         $sTable = _root::getParam('sTable');
         $tField = _root::getParam('tField');
         module_builder::getTools()->projetmkdir('data/json/base/' . $sTable . '/index');
         module_builder::getTools()->projetmkdir('data/json/base/' . $sTable . '/index/' . implode('.', $tField) . '.index');
         $this->regenerateIndexXml($sConfig, $sTable, implode('.', $tField) . '.index');
         $msg = trR('indexGenereAvecSucces', array('#listField#' => implode('.', $tField), '#maTable#' => $sTable));
         $detail = trR('creationRepertoire', array('#REPERTOIRE#' => 'data/json/base/' . $sTable . '/index'));
         $detail .= '<br />' . trR('creationRepertoire', array('#REPERTOIRE#' => 'index data/json/base/' . $sTable . '/index/' . implode('.', $tField)));
     }
     $oTpl = $this->getView('index');
     $oTpl->msg = $msg;
     $oTpl->detail = $detail;
     $oTpl->tTables = $tTables;
     $oTpl->tTableColumn = $tTableColumn;
     $oTpl->tFileIndex = $tFileIndex;
     return $oTpl;
 }
コード例 #11
0
ファイル: main.php プロジェクト: CariteColas/projetTKB
 public function _index()
 {
     module_builder::getTools()->rootAddConf('conf/connexion.ini.php');
     $tConnexion = _root::getConfigVar('db');
     $tSqlite = array();
     foreach ($tConnexion as $sConfig => $val) {
         if (substr($val, 0, 6) == 'sqlite') {
             $tSqlite[substr($sConfig, 0, -4)] = $val;
         }
     }
     $msg = '';
     $detail = '';
     if (_root::getRequest()->isPost()) {
         $sDbFilename = _root::getParam('sDbFilename');
         $sTable = _root::getParam('sTable');
         $tField = _root::getParam('tField');
         $tType = _root::getParam('tType');
         $tSize = _root::getParam('tSize');
         try {
             $oDb = new PDO($sDbFilename);
         } catch (PDOException $exception) {
             die($exception->getMessage());
         }
         $oDb->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         $sSql = 'CREATE TABLE IF NOT EXISTS ' . $sTable . '(';
         $sSql .= 'id  INTEGER PRIMARY KEY AUTOINCREMENT';
         foreach ($tField as $i => $sField) {
             $sSql .= ',';
             $sSql .= $sField . ' ' . $tType[$i];
             if ($tType[$i] == 'VARCHAR') {
                 $sSql .= '(' . $tSize[$i] . ')';
             }
         }
         $sSql .= ')';
         try {
             $oDb->exec($sSql);
         } catch (PDOException $exception) {
             die($exception->getMessage());
         }
         $msg = 'Table ' . $sTable . ' (champs: ' . implode(',', $tField) . ') g&eacute;n&eacute;r&eacute; avec succ&egrave;s';
         $detail = 'Cr&eacute;ation du fichier sqlite ' . $sDbFilename;
     }
     $oTpl = new _Tpl('moduleSqlite::index');
     $oTpl->msg = $msg;
     $oTpl->detail = $detail;
     $oTpl->tSqlite = $tSqlite;
     return $oTpl;
 }
コード例 #12
0
ファイル: abstract_auth.php プロジェクト: clavat/mkframework
 public function enable()
 {
     _root::startSession();
     $sModuleToLoad = _root::getRequest()->getModule();
     if (preg_match('/::/', _root::getConfigVar('auth.module'))) {
         $tModuleAction = preg_split('/::/', _root::getConfigVar('auth.module'));
         $sAuthModule = $tModuleAction[0];
     } else {
         $sAuthModule = _root::getConfigVar('auth.module');
     }
     $tExcludeModule = explode(',', _root::getConfigVar('auth.module.disabled.list') . ',');
     $tExcludeModule[] = $sAuthModule;
     if (!_root::getAuth()->isConnected() and in_array($sModuleToLoad, $tExcludeModule) == false) {
         _root::redirect(_root::getConfigVar('auth.module'));
     }
 }
コード例 #13
0
ファイル: main.php プロジェクト: CariteColas/projetTKB
 public function _index()
 {
     $msg = '';
     $detail = '';
     if (_root::getRequest()->isPost()) {
         $sTable = _root::getParam('sTable');
         $tField = explode("\n", _root::getParam('sField'));
         $this->generate($sTable, $tField);
         $msg = 'Base ' . $sTable . ' (champs: ' . implode(',', $tField) . ') g&eacute;n&eacute;r&eacute; avec succ&egrave;s';
         $detail .= '<br />Cr&eacute;ation fichier data/csv/base/' . $sTable . '.csv';
     }
     $oTpl = new _Tpl('moduleCsv::index');
     $oTpl->msg = $msg;
     $oTpl->detail = $detail;
     return $oTpl;
 }
コード例 #14
0
ファイル: main.php プロジェクト: clavat/mkMarket
 public function _index()
 {
     module_builder::getTools()->rootAddConf('conf/connexion.ini.php');
     if (_root::getParam('sAction') == 'mongodbAddCollection') {
         $this->mongodbAddCollection();
     }
     $msg = '';
     $detail = '';
     $tTables = array();
     $tTableColumn = array();
     if (_root::getParam('sConfig') != '') {
         $sConfig = _root::getParam('sConfig');
         $tTables = module_builder::getTools()->getListTablesFromConfig($sConfig);
         $tTableColumn = array();
         foreach ($tTables as $sTable) {
             $tTableColumn[$sTable] = module_builder::getTools()->getListColumnFromConfigAndTable($sConfig, $sTable);
         }
     }
     if (_root::getRequest()->isPost()) {
         $tEnable = _root::getParam('tEnable');
         $tTables = _root::getParam('tTable');
         $tPrimary = _root::getParam('tPrimary');
         $tSelectEnable = _root::getParam('tSelectEnable');
         $tSelectKey = _root::getParam('tSelectKey');
         $tSelectVal = _root::getParam('tSelectVal');
         foreach ($tTables as $i => $sTable) {
             if (!in_array($sTable, $tEnable)) {
                 continue;
             }
             $tSelect = null;
             if (is_array($tSelectEnable) and in_array($sTable, $tSelectEnable)) {
                 $tSelect = array('key' => $tSelectKey[$i], 'val' => $tSelectVal[$i]);
             }
             $this->generate($sTable, $sConfig, $tPrimary[$i], $tSelect);
             $detail .= trR('CreationDuFichierVAR', array('#FICHIER#' => 'model/model_' . $sTable)) . '<br />';
         }
         $msg = tr('coucheModeleGenereAvecSucces');
     }
     $oTpl = $this->getView('index');
     $oTpl->tTables = $tTables;
     $oTpl->tTableColumn = $tTableColumn;
     $oTpl->msg = $msg;
     $oTpl->detail = $detail;
     $oTpl->tConnexion = _root::getConfigVar('db');
     return $oTpl;
 }
コード例 #15
0
ファイル: main.php プロジェクト: CariteColas/projetTKB
 public function _index()
 {
     module_builder::getTools()->rootAddConf('conf/connexion.ini.php');
     if (_root::getParam('sAction') == 'mongodbAddCollection') {
         $this->mongodbAddCollection();
     }
     $msg = '';
     $detail = '';
     $tTables = array();
     $tTableColumn = array();
     if (_root::getParam('sConfig') != '') {
         $sConfig = _root::getParam('sConfig');
         $tTables = module_builder::getTools()->getListTablesFromConfig($sConfig);
         $tTableColumn = array();
         foreach ($tTables as $sTable) {
             $tTableColumn[$sTable] = module_builder::getTools()->getListColumnFromConfigAndTable($sConfig, $sTable);
         }
     }
     if (_root::getRequest()->isPost()) {
         $tEnable = _root::getParam('tEnable');
         $tTables = _root::getParam('tTable');
         $tPrimary = _root::getParam('tPrimary');
         $tSelectEnable = _root::getParam('tSelectEnable');
         $tSelectKey = _root::getParam('tSelectKey');
         $tSelectVal = _root::getParam('tSelectVal');
         foreach ($tTables as $i => $sTable) {
             if (!in_array($sTable, $tEnable)) {
                 continue;
             }
             $tSelect = null;
             if (is_array($tSelectEnable) and in_array($sTable, $tSelectEnable)) {
                 $tSelect = array('key' => $tSelectKey[$i], 'val' => $tSelectVal[$i]);
             }
             $this->genModelAndRowByTableConfigAndId($sTable, $sConfig, $tPrimary[$i], $tSelect);
             $detail .= 'Creation du fichier model/model_' . $sTable . '.php<br />';
         }
         $msg = 'Couche mod&egrave;le g&eacute;n&eacute;r&eacute;e avec succ&egrave;s';
     }
     $oTpl = new _Tpl('moduleModel::index');
     $oTpl->tTables = $tTables;
     $oTpl->tTableColumn = $tTableColumn;
     $oTpl->msg = $msg;
     $oTpl->detail = $detail;
     $oTpl->tConnexion = _root::getConfigVar('db');
     return $oTpl;
 }
コード例 #16
0
ファイル: main.php プロジェクト: EhteshamMehmood/BlogMVC
 public function processSave()
 {
     if (!_root::getRequest()->isPost() or _root::getParam('formmodule') != self::$sModuleName) {
         //si ce n'est pas une requete POST on ne soumet pas
         return null;
     }
     $oPluginXsrf = new plugin_xsrf();
     if (!$oPluginXsrf->checkToken(_root::getParam('token'))) {
         //on verifie que le token est valide
         return array('token' => $oPluginXsrf->getMessage());
     }
     $iId = module_comments::getParam('id', null);
     if ($iId == null) {
         $oComments = new row_comments();
     } else {
         $oComments = model_comments::getInstance()->findById(module_comments::getParam('id', null));
     }
     $tId = model_comments::getInstance()->getIdTab();
     $tColumn = model_comments::getInstance()->getListColumn();
     foreach ($tColumn as $sColumn) {
         $oPluginUpload = new plugin_upload($sColumn);
         if ($oPluginUpload->isValid()) {
             $sNewFileName = _root::getConfigVar('path.upload') . $sColumn . '_' . date('Ymdhis');
             $oPluginUpload->saveAs($sNewFileName);
             $oComments->{$sColumn} = $oPluginUpload->getPath();
             continue;
         } else {
             if (_root::getParam($sColumn, null) === null) {
                 continue;
             } else {
                 if (in_array($sColumn, $tId)) {
                     continue;
                 }
             }
         }
         $oComments->{$sColumn} = _root::getParam($sColumn, null);
     }
     $oComments->post_id = $this->post_id;
     if ($oComments->save()) {
         //une fois enregistre on redirige (vers la page liste)
         $this->redirect('list');
     } else {
         return $oComments->getListError();
     }
 }
コード例 #17
0
ファイル: main.php プロジェクト: clavat/mkMarket
 private function process()
 {
     if (_root::getRequest()->isPost() == false) {
         return null;
     }
     $this->msg = tr('coucheModeleGenereAvecSucces');
     $this->detail = trR('CreationDuFichierVAR', array('#FICHIER#' => 'model/model_' . $sTable));
     $this->projectMkdir('module/' . $sModuleMenuName);
     /*SOURCE*/
     $oSourceModel = $this->getObjectSource('example.php');
     /*SOURCE*/
     $oSourceModel->setPattern('#maTable#', $maTable);
     $sSnippet = $oSourceModel->getSnippet('monSnippet', array('#maVar#' => $maValeur));
     /*SOURCE*/
     $oSourceModel->setPattern('#sSnippet#', $sSnippet);
     /*SOURCE*/
     $oSourceModel->save();
 }
コード例 #18
0
ファイル: main.php プロジェクト: clavat/mkMarket
    private function process()
    {
        if (_root::getRequest()->isPost() == false) {
            return null;
        }
        $tError = null;
        $msg = null;
        $detail = null;
        $sModule = _root::getParam('modulename');
        $tMethod = _root::getParam('tMethod');
        $tLabel = _root::getParam('tLabel');
        $ok = 1;
        //check formulaire
        foreach ($tMethod as $i => $sMethod) {
            if ($tLabel[$i] == '') {
                $tError[$i] = tr('remplissezLeLibelle');
                $ok = 0;
            }
        }
        if ($ok) {
            if (module_builder::getTools()->projetmkdir('module/' . $sModule) == true) {
                $detail = trR('creationRepertoire', array('#REPERTOIRE#' => 'module/' . $sModule));
                if (module_builder::getTools()->projetmkdir('module/' . $sModule . '/view') == true) {
                    $detail .= '<br />' . trR('creationRepertoire', array('#REPERTOIRE#' => 'module/' . $sModule . '/view'));
                    $this->genModuleMenuMain($sModule, $tMethod, $tLabel);
                    $msg = trR('moduleGenereAvecSucces', array('#MODULE#' => $sModule));
                    $detail .= '<br />' . trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModule . '/main.php'));
                    $detail .= '<br />' . trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModule . '/view/index.php'));
                    $sCode = '<?php ' . "\n";
                    $sCode .= '//assignez le menu a l\'emplacement menu' . "\n";
                    $sCode .= '$this->oLayout->addModule(\'menu\',\'' . $sModule . '::index\');' . "\n";
                    $detail .= '<br/><br/>' . tr('pourLutiliserAjoutez') . '<br />
					' . highlight_string($sCode, 1);
                } else {
                    $detail .= '<br />' . trR('repertoireDejaExistant', array('#REPERTOIRE#' => 'module/' . $sModule . '/view'));
                }
            } else {
                $detail = trR('repertoireDejaExistant', array('#REPERTOIRE#' => 'module/' . $sModule . '/view'));
            }
        }
        $this->tError = $tError;
        $this->detail = $detail;
        $this->msg = $msg;
    }
コード例 #19
0
ファイル: main.php プロジェクト: CariteColas/projetTKB
 public function _index()
 {
     $msg = '';
     $detail = '';
     if (_root::getRequest()->isPost()) {
         $sTable = _root::getParam('sTable');
         $tField = explode("\n", _root::getParam('sField'));
         module_builder::getTools()->projetmkdir('data/json/base/' . $sTable);
         $this->generate($sTable, $tField);
         $msg = 'Base ' . $sTable . ' (champs: ' . implode(',', $tField) . ') g&eacute;n&eacute;r&eacute; avec succ&egrave;s';
         $detail = 'Cr&eacute;ation repertoire data/json/base/' . $sTable;
         $detail .= '<br />Cr&eacute;ation fichier data/json/base/' . $sTable . '/structure.csv';
         $detail .= '<br />Cr&eacute;ation fichier data/json/base/' . $sTable . '/max.txt';
     }
     $oTpl = new _Tpl('moduleJson::index');
     $oTpl->msg = $msg;
     $oTpl->detail = $detail;
     return $oTpl;
 }
コード例 #20
0
ファイル: plugin_debug.php プロジェクト: clavat/mkMarket
 public function __construct($sMicrotime)
 {
     $this->iStartMicrotime = self::microtime($sMicrotime);
     $iEndTime = self::microtime();
     self::$tTime[] = array('End', $iEndTime);
     $iDiff = $iEndTime - $this->iStartMicrotime;
     $this->add('Time', sprintf('%0.3f', $iDiff) . 's');
     $this->addComplexTimes('times', self::$tTime);
     $this->addComplex('$_GET', print_r($_GET, 1));
     if (isset($_POST)) {
         $this->addComplex('$_POST', print_r($_POST, 1));
     }
     if (isset($_SESSION)) {
         $this->addComplex('$_SESSION', print_r($_SESSION, 1));
     }
     if (isset($_SERVER)) {
         $this->addComplex('$_SERVER', print_r($_SERVER, 1));
     }
     $oRequest = _root::getRequest();
     $this->add('Module', $oRequest->getModule());
     $this->add('Action', $oRequest->getAction());
     $oFileLog = new _file(_root::getConfigVar('path.log', 'data/log/') . date('Y-m-d') . '_log.csv');
     if ($oFileLog->exist()) {
         $oFileLog->load();
         $sContentLog = $oFileLog->getContent();
         $this->addFileLog('File log', $sContentLog);
     }
     $sVarIniConfig = _root::getConfigVar('model.ini.var', 'db');
     $tClassSgbd = _root::getConfigVar($sVarIniConfig);
     $this->addComplexIni('Connexions', array($sVarIniConfig => $tClassSgbd));
     $tConfigSection = array('path', 'cache', 'language', 'auth', 'acl', 'navigation', 'urlrewriting', 'security', 'log', 'check', 'path', 'model');
     $tConfig = array();
     foreach ($tConfigSection as $sSection) {
         $tConfig[$sSection] = _root::getConfigVar($sSection);
     }
     $this->addComplexIni('Config', $tConfig);
     if (self::$tSpy) {
         $this->addComplexSpy('Spy variables', self::$tSpy);
     }
     $this->addAcl();
 }
コード例 #21
0
ファイル: main.php プロジェクト: CariteColas/projetTKB
 private function checkLoginPass()
 {
     //si le formulaire n'est pas envoye on s'arrete la
     if (!_root::getRequest()->isPost()) {
         return null;
     }
     $sLogin = _root::getParam('login');
     $sPassword = _root::getParam('password');
     if (strlen($sPassword > $this->maxPasswordLength)) {
         return 'Mot de passe trop long';
     }
     //on stoque les mots de passe hashe dans la classe model_example
     $sHashPassword = model_example::getInstance()->hashPassword($sPassword);
     $tAccount = model_example::getInstance()->getListAccount();
     //on va verifier que l'on trouve dans le tableau retourne par notre model
     //l'entree $tAccount[ login ][ mot de passe hashe ]
     if (!_root::getAuth()->checkLoginPass($tAccount, $sLogin, $sHashPassword)) {
         return 'Mauvais login/mot de passe';
     }
     _root::redirect('privatemodule_action');
 }
コード例 #22
0
ファイル: main.php プロジェクト: CariteColas/projetTKB
    public function _index()
    {
        $msg = '';
        $detail = '';
        if (_root::getRequest()->isPost()) {
            $sModule = _root::getParam('module');
            $sActions = _root::getParam('actions');
            $tAction = explode("\n", $sActions);
            if (module_builder::getTools()->projetmkdir('module/' . $sModule) == true) {
                $detail = 'Cr&eacute;ation repertoire module/' . $sModule;
            } else {
                $detail = 'Warning: repertoire d&eacute;j&agrave; existant module/' . $sModule;
            }
            if (module_builder::getTools()->projetmkdir('module/' . $sModule . '/view') == true) {
                $detail .= '<br />Cr&eacute;ation repertoire module/' . $sModule . '/view';
            } else {
                $detail .= '<br />Warning: repertoire d&eacute;j&agrave; existant module/' . $sModule . '/view';
            }
            $this->genModuleMainEmbedded($sModule, $tAction);
            $msg = 'Module ' . $sModule . ' (actions: ' . implode(',', $tAction) . ') genere avec succes';
            $detail .= '<br />Cr&eacute;ation fichier module/' . $sModule . '/main.php';
            foreach ($tAction as $sAction) {
                $detail .= '<br />Cr&eacute;ation fichier module/' . $sModule . '/view/' . $sAction . '.php';
            }
            $sCode = '<?php ' . "\n";
            $sCode .= '//instancier le module' . "\n";
            $sCode .= '$oModule' . ucfirst(strtolower($sModule)) . '=new module_' . $sModule . ";\n";
            $sCode .= '//recupere la vue du module' . "\n";
            $sCode .= '$oView=$oModule' . ucfirst(strtolower($sModule)) . '->_index();' . "\n";
            $sCode .= "\n";
            $sCode .= '//assigner la vue retournee a votre layout' . "\n";
            $sCode .= '$this->oLayout->add(\'main\',$oView);' . "\n";
            $detail .= '<br/><br/>Pour l\'utiliser, indiquez:<br />
			' . highlight_string($sCode, 1);
        }
        $oTpl = new _Tpl('moduleModuleEmbeddedWithBootstrap::index');
        $oTpl->msg = $msg;
        $oTpl->detail = $detail;
        return $oTpl;
    }
コード例 #23
0
ファイル: main.php プロジェクト: CariteColas/projetTKB
    public function _index()
    {
        module_builder::getTools()->rootAddConf('conf/connexion.ini.php');
        $msg = '';
        $detail = '';
        $oDir = new _dir(_root::getConfigVar('path.generation') . _root::getParam('id') . '/model/');
        $tFile = array();
        $tRowMethodes = array();
        foreach ($oDir->getListFile() as $oFile) {
            if (preg_match('/.sample.php/', $oFile->getName()) or !preg_match('/.php$/', $oFile->getName())) {
                continue;
            }
            $tFile[] = $oFile->getName();
            require_once $oFile->getAdresse();
            $sClassFoo = substr($oFile->getName(), 0, -4);
            $oModelFoo = new $sClassFoo();
            if (method_exists($oModelFoo, 'getSelect')) {
                $tRowMethodes[substr($oFile->getName(), 0, -4)] = substr($oFile->getName(), 0, -4) . '::getSelect()';
            }
        }
        $oTpl = new _Tpl('moduleCrudEmbeddedReadonly::index');
        if (_root::getParam('class') != '') {
            $sClass = substr(_root::getParam('class'), 0, -4);
            require_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $sClass . '.php';
            $tColumn = module_builder::getTools()->getListColumnFromClass($sClass);
            $oTpl->sClass = $sClass;
            $tId = module_builder::getTools()->getIdTabFromClass($sClass);
            foreach ($tColumn as $i => $sColumn) {
                if (in_array($sColumn, $tId)) {
                    unset($tColumn[$i]);
                }
            }
            $oTpl->tColumn = $tColumn;
            $oTpl->tRowMethodes = $tRowMethodes;
            $oModel = new $sClass();
            $oTpl->sModuleToCreate = $oModel->getTable();
        }
        if (_root::getRequest()->isPost()) {
            $sModuleToCreate = _root::getParam('moduleToCreate');
            $sClass = _root::getParam('sClass');
            $tColumn = _root::getParam('tColumn');
            $tType = _root::getParam('tType');
            $tEnable = _root::getParam('tEnable');
            foreach ($tColumn as $i => $sColumn) {
                if (!in_array($sColumn, $tEnable)) {
                    unset($tColumn[$i]);
                }
            }
            require_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $sClass . '.php';
            $oModel = new $sClass();
            $sModule = $sModuleToCreate;
            module_builder::getTools()->projetmkdir('module/' . $sModule);
            module_builder::getTools()->projetmkdir('module/' . $sModule . '/view');
            $this->genModelMainCrudembeddedReadonly($sModuleToCreate, $oModel->getTable(), $sClass, $tColumn);
            $this->genModelTplCrudembeddedReadonly($sModuleToCreate, $sClass, $tColumn, $oModel->getTable());
            $msg = 'Module ' . $sModule . ' g&eacute;n&eacute;r&eacute; avec succ&egrave;s';
            $detail = 'Cr&eacute;ation repertoire module/' . $sModule;
            $detail .= '<br />Cr&eacute;ation repertoire module/' . $sModule . '/view';
            $detail .= '<br />Cr&eacute;ation fichier module/' . $sModule . '/main.php';
            $detail .= '<br />Cr&eacute;ation fichier module/' . $sModule . '/view/list.php';
            $detail .= '<br />Cr&eacute;ation fichier module/' . $sModule . '/view/edit.php';
            $detail .= '<br />Cr&eacute;ation fichier module/' . $sModule . '/view/new.php';
            $detail .= '<br />Cr&eacute;ation fichier module/' . $sModule . '/view/show.php';
            $detail .= '<br />Cr&eacute;ation fichier module/' . $sModule . '/view/delete.php';
            $sCode = '<?php ' . "\n";
            $sCode .= '//instancier le module' . "\n";
            $sCode .= '$oModule' . ucfirst(strtolower($sModule)) . '=new module_' . $sModule . ";\n\n";
            $sCode .= '//si vous souhaitez indiquer au module integrable des informations sur le module parent' . "\n";
            $sCode .= '//$oModuleExamplemodule->setRootLink(\'module::action\',array(\'parametre\'=>_root::getParam(\'parametre\')));' . "\n\n";
            $sCode .= '//recupere la vue du module' . "\n";
            $sCode .= '$oView=$oModule' . ucfirst(strtolower($sModule)) . '->_index();' . "\n";
            $sCode .= "\n";
            $sCode .= '//assigner la vue retournee a votre layout' . "\n";
            $sCode .= '$this->oLayout->add(\'main\',$oView);' . "\n";
            $detail .= '<br/><br/>Pour l\'utiliser, indiquez:<br />
			' . highlight_string($sCode, 1);
        }
        $oTpl->msg = $msg;
        $oTpl->detail = $detail;
        $oTpl->tFile = $tFile;
        return $oTpl;
    }
コード例 #24
0
ファイル: index.php プロジェクト: clavat/mkMarket
    if ($this->tMethod) {
    }
    foreach ($this->tMethod as $sMethod) {
        ?>
	<?php 
        if (_root::getParam('method') == $sMethod) {
            ?>
		<li class="selectionne"><?php 
            echo $sMethod;
            ?>
</li>
	<?php 
        } else {
            ?>
		<li><a href="<?php 
            echo _root::getLink(_root::getRequest()->getParamNav(), array('id' => _root::getParam('id'), 'action' => _root::getParam('action'), 'model' => _root::getParam('model'), 'method' => $sMethod));
            ?>
#editcrud"><?php 
            echo $sMethod;
            ?>
</a></li>
	<?php 
        }
    }
    ?>
</ul>
</div>
<?php 
}
?>
コード例 #25
0
ファイル: main.php プロジェクト: CariteColas/projetTKB
 public function _index()
 {
     module_builder::getTools()->rootAddConf('conf/connexion.ini.php');
     $msg = '';
     $detail = '';
     $oDir = new _dir(_root::getConfigVar('path.generation') . _root::getParam('id') . '/model/');
     $tFile = array();
     $tRowMethodes = array();
     foreach ($oDir->getListFile() as $oFile) {
         if (preg_match('/.sample.php/', $oFile->getName()) or !preg_match('/.php$/', $oFile->getName())) {
             continue;
         }
         $tFile[] = $oFile->getName();
         require_once $oFile->getAdresse();
         $sClassFoo = substr($oFile->getName(), 0, -4);
         $oModelFoo = new $sClassFoo();
         if (method_exists($oModelFoo, 'getSelect')) {
             $tRowMethodes[substr($oFile->getName(), 0, -4)] = substr($oFile->getName(), 0, -4) . '::getSelect()';
         }
     }
     $oTpl = new _Tpl('moduleCrudBootstrap::index');
     if (_root::getParam('class') != '') {
         $sClass = substr(_root::getParam('class'), 0, -4);
         require_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $sClass . '.php';
         $tColumn = module_builder::getTools()->getListColumnFromClass($sClass);
         $oTpl->sClass = $sClass;
         $tId = module_builder::getTools()->getIdTabFromClass($sClass);
         foreach ($tColumn as $i => $sColumn) {
             if (in_array($sColumn, $tId)) {
                 unset($tColumn[$i]);
             }
         }
         $oTpl->tColumn = $tColumn;
         $oTpl->tRowMethodes = $tRowMethodes;
         $oModel = new $sClass();
         $oTpl->sModuleToCreate = $oModel->getTable();
     }
     if (_root::getRequest()->isPost()) {
         $sModuleToCreate = _root::getParam('moduleToCreate');
         $sClass = _root::getParam('sClass');
         $tColumn = _root::getParam('tColumn');
         $tLabel = _root::getParam('tLabel');
         $tType = _root::getParam('tType');
         $tEnable = _root::getParam('tEnable');
         foreach ($tColumn as $i => $sColumn) {
             if (!in_array($sColumn, $tEnable)) {
                 unset($tColumn[$i]);
             }
         }
         require_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $sClass . '.php';
         $oModel = new $sClass();
         $sModule = $sModuleToCreate;
         module_builder::getTools()->projetmkdir('module/' . $sModule);
         module_builder::getTools()->projetmkdir('module/' . $sModule . '/view');
         $tCrud = _root::getParam('crud', null);
         $bWithPagination = _root::getParam('withPagination');
         $this->genModelMain($sModuleToCreate, $oModel->getTable(), $sClass, $tColumn, $tCrud, $bWithPagination);
         $this->genModelTpl($sModuleToCreate, $sClass, $tColumn, $oModel->getTable(), $tCrud, $tLabel);
         $msg = 'Module ' . $sModule . ' g&eacute;n&eacute;r&eacute; avec succ&egrave;s';
         $detail = 'Cr&eacute;ation repertoire module/' . $sModule;
         $detail .= '<br />Cr&eacute;ation repertoire module/' . $sModule . '/view';
         $detail .= '<br />Cr&eacute;ation fichier module/' . $sModule . '/main.php';
         $detail .= '<br />Cr&eacute;ation fichier module/' . $sModule . '/view/list.php';
         if (in_array('crudEdit', $tCrud)) {
             $detail .= '<br />Cr&eacute;ation fichier module/' . $sModule . '/view/edit.php';
         }
         if (in_array('crudNew', $tCrud)) {
             $detail .= '<br />Cr&eacute;ation fichier module/' . $sModule . '/view/new.php';
         }
         if (in_array('crudShow', $tCrud)) {
             $detail .= '<br />Cr&eacute;ation fichier module/' . $sModule . '/view/show.php';
         }
         if (in_array('crudDelete', $tCrud)) {
             $detail .= '<br />Cr&eacute;ation fichier module/' . $sModule . '/view/delete.php';
         }
         $detail .= '<br/><br/>Pour y acc&eacute;der <a href="' . _root::getConfigVar('path.generation') . _root::getParam('id') . '/public/index.php?:nav=' . $sModule . '::index">cliquer ici (index.php?:nav=' . $sModule . '::index)</a>';
     }
     $oTpl->msg = $msg;
     $oTpl->detail = $detail;
     $oTpl->tFile = $tFile;
     return $oTpl;
 }
コード例 #26
0
ファイル: main.php プロジェクト: clavat/mkframework
 public function delete()
 {
     if (!_root::getRequest()->isPost()) {
         //si ce n'est pas une requete POST on ne soumet pas
         return null;
     }
     $oPluginXsrf = new plugin_xsrf();
     if (!$oPluginXsrf->checkToken(_root::getParam('token'))) {
         //on verifie que le token est valide
         return array('token' => $oPluginXsrf->getMessage());
     }
     $oAccountModel = new model_account();
     $iId = _root::getParam('id', null);
     if ($iId != null) {
         $oAccount = $oAccountModel->findById(_root::getParam('id', null));
     }
     $oAccount->delete();
     //une fois enregistre on redirige (vers la page d'edition)
     _root::redirect('account::list');
 }
コード例 #27
0
ファイル: main.php プロジェクト: clavat/mkframework
 private function processUpdates()
 {
     if (!_root::getRequest()->isPost()) {
         return null;
     }
     $sUrl = _root::getConfigVar('market.builder.versions.url');
     try {
         $sRemoteVersions = file_get_contents($sUrl);
     } catch (Exception $e) {
         $oView = $this->getView('error');
         $oView->message = trR('problemeUrlmarket', array('#message#' => $e->getMessage()));
         return $oView;
     }
     $tRemoteIni = parse_ini_string($sRemoteVersions);
     $sRootUrl = _root::getConfigVar('market.builder.url');
     $tModuleToUpdate = _root::getParam('toUpdate');
     if ($tModuleToUpdate) {
         foreach ($tModuleToUpdate as $sModule) {
             $sPathModule = str_replace('_', '/', $sModule);
             if (!$this->unzipTo($sRootUrl . '/module/' . $sModule . $tRemoteIni[$sModule] . '.zip', _root::getConfigVar('path.module') . '/' . $sPathModule)) {
                 return $this->errorZip;
             }
         }
     }
 }
コード例 #28
0
ファイル: main.php プロジェクト: clavat/mkMarket
 private function process()
 {
     if (_root::getRequest()->isPost() == false or _root::getParam('actioncode') != 'generate') {
         return null;
     }
     $tField = $this->tField;
     $oValid = new plugin_valid(_root::getRequest()->getParams());
     foreach ($tField as $sField) {
         $oValid->isLongerOrEqualThan($sField, 2, 'obligatoire');
     }
     if (!$oValid->isValid()) {
         return $oValid->getListError();
     }
     //ok
     $sClassModelRightsManager = 'model_' . _root::getParam('modelToGenerate');
     $sClassRowRightsManager = 'row_' . _root::getParam('modelToGenerate');
     $sObjectRightManger = 'o' . ucfirst(_root::getParam('modelToGenerate'));
     $sModuleRightsManager = _root::getParam('moduleToGenerate');
     //permissions
     $classModelPermission = _root::getParam('classModelPermission');
     include_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $classModelPermission . '.php';
     $oPermission = new $classModelPermission();
     //actions
     $classModelAction = _root::getParam('classModelAction');
     include_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $classModelAction . '.php';
     $oAction = new $classModelAction();
     //items
     $classModelItem = _root::getParam('classModelItem');
     include_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $classModelItem . '.php';
     $oItem = new $classModelItem();
     //groups
     $classModelGroup = _root::getParam('classModelGroup');
     include_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $classModelGroup . '.php';
     $oGroup = new $classModelGroup();
     //groupsUser
     $classModelGroupUser = _root::getParam('classModelGroupUser');
     include_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $classModelGroupUser . '.php';
     $oGroupUser = new $classModelGroupUser();
     //users
     $classModelUser = _root::getParam('classModelUser');
     include_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $classModelUser . '.php';
     $oUser = new $classModelUser();
     $exampleConfig = $oPermission->getConfig();
     $exampleTable = $oPermission->getTable();
     $exampleUserGroups_id = _root::getParam('classModelUser_groups_id');
     $exampleAction_name = _root::getParam('classModelAction_name');
     $exampleItem_name = _root::getParam('classModelItem_name');
     //exampleGroups_id
     //exampleAction_name
     //exampleItem_name
     $sPermissionTable = $oPermission->getTable();
     $sPermissionActionId = _root::getParam('classModelPermission_actions_id');
     $sPermissionItemId = _root::getParam('classModelPermission_items_id');
     $sPermissionGroupId = _root::getParam('classModelPermission_groups_id');
     $sPermissionId = _root::getParam('classModelPermission_id');
     $sActionTable = $oAction->getTable();
     $sActionId = _root::getParam('classModelAction_id');
     $sActionName = _root::getParam('classModelAction_name');
     $sItemTable = $oItem->getTable();
     $sItemId = _root::getParam('classModelItem_id');
     $sItemName = _root::getParam('classModelItem_name');
     $sGroupTable = $oGroup->getTable();
     $sGroupId = _root::getParam('classModelGroup_id');
     $sGroupName = _root::getParam('classModelGroup_name');
     $sGroupUserTable = $oGroupUser->getTable();
     $sGroupUserUserId = _root::getParam('classModelGroupUser_users_id');
     $sGroupUserGroupId = _root::getParam('classModelGroupUser_groups_id');
     $sUserTable = $oUser->getTable();
     $sUserId = _root::getParam('classModelUser_id');
     $sUserGroupId = _root::getParam('classModelUser_groups_id');
     $sUserLogin = _root::getParam('classModelUser_login');
     $r = "\n";
     $t = "\t";
     //requete requeteFindListByUser
     /*SOURCE*/
     $oSourceModel = $this->getObjectSource('model_rightsManagerMulti.php');
     $exampleRequeteFindListByUser = $oSourceModel->getSnippet('requeteFindListByUser', array('#sActionTable#' => $sActionTable, '#sActionId#' => $sActionId, '#sActionName#' => $sActionName, '#sItemTable#' => $sItemTable, '#sItemId#' => $sItemId, '#sItemName#' => $sItemName, '#sGroupUserTable#' => $sGroupUserTable, '#sGroupUserGroupId#' => $sGroupUserGroupId, '#sGroupUserUserId#' => $sGroupUserUserId, '#sPermissionTable#' => $sPermissionTable, '#sPermissionItemId#' => $sPermissionItemId, '#sPermissionActionId#' => $sPermissionActionId, '#sPermissionGroupId#' => $sPermissionGroupId));
     //requete findAll
     $exampleRequeteFindAll = $oSourceModel->getSnippet('exampleRequeteFindAll', array('#sActionTable#' => $sActionTable, '#sActionId#' => $sActionId, '#sActionName#' => $sActionName, '#sItemTable#' => $sItemTable, '#sItemId#' => $sItemId, '#sItemName#' => $sItemName, '#sGroupTable#' => $sGroupTable, '#sGroupId#' => $sGroupId, '#sGroupName#' => $sGroupName, '#sPermissionId#' => $sPermissionId, '#sPermissionTable#' => $sPermissionTable, '#sPermissionItemId#' => $sPermissionItemId, '#sPermissionActionId#' => $sPermissionActionId, '#sPermissionGroupId#' => $sPermissionGroupId));
     /*SOURCE*/
     $oSourceModel->setPattern('#model_examplemodel#', $sClassModelRightsManager);
     /*SOURCE*/
     $oSourceModel->setPattern('#row_examplemodel#', $sClassRowRightsManager);
     /*SOURCE*/
     $oSourceModel->setPattern('#exampleTable#', $exampleTable);
     /*SOURCE*/
     $oSourceModel->setPattern('#exampleConfig#', $exampleConfig);
     /*SOURCE*/
     $oSourceModel->setPattern('#requeteFindListByUser#', $exampleRequeteFindListByUser);
     /*SOURCE*/
     $oSourceModel->setPattern('#exampleRequeteFindAll#', $exampleRequeteFindAll);
     /*SOURCE*/
     $oSourceModel->setPattern('#examplePermission_id#', $sPermissionId);
     /*SOURCE*/
     $oSourceModel->setPattern('#exampleUserGroups_id#', $sUserGroupId);
     /*SOURCE*/
     $oSourceModel->setPattern('#exampleAction_name#', $sActionName);
     /*SOURCE*/
     $oSourceModel->setPattern('#exampleItem_name#', $sItemName);
     /*SOURCE*/
     $oSourceModel->setPattern('#exampleGroupTable#', $sGroupTable);
     /*SOURCE*/
     $oSourceModel->setPattern('#exampleGroup_id#', $sGroupId);
     /*SOURCE*/
     $oSourceModel->setPattern('#exampleGroup_name#', $sGroupName);
     /*SOURCE*/
     $oSourceModel->setPattern('#exampleActionTable#', $sActionTable);
     /*SOURCE*/
     $oSourceModel->setPattern('#exampleAction_id#', $sActionId);
     /*SOURCE*/
     $oSourceModel->setPattern('#exampleAction_name#', $sActionName);
     /*SOURCE*/
     $oSourceModel->setPattern('#exampleItemTable#', $sItemTable);
     /*SOURCE*/
     $oSourceModel->setPattern('#exampleItem_id#', $sItemId);
     /*SOURCE*/
     $oSourceModel->setPattern('#exampleItem_name#', $sItemName);
     /*SOURCE*/
     $oSourceModel->setPattern('#exampleUserTable#', $sUserTable);
     /*SOURCE*/
     $oSourceModel->setPattern('#exampleUser_id#', $sUserId);
     /*SOURCE*/
     $oSourceModel->setPattern('#exampleUser_login#', $sUserLogin);
     /*SOURCE*/
     $oSourceModel->setPattern('#exampleUser_groupsId#', $sUserGroupId);
     /*SOURCE*/
     $oSourceModel->setPattern('#exampleGroupUserTable#', $sGroupUserTable);
     /*SOURCE*/
     $oSourceModel->setPattern('#exampleGroupUserGroupId#', $sGroupUserGroupId);
     /*SOURCE*/
     $oSourceModel->setPattern('#exampleGroupUserUserId#', $sGroupUserUserId);
     /*SOURCE*/
     $oSourceModel->setPattern('#sClassModelRightsManager#', $sClassModelRightsManager);
     /*SOURCE*/
     $bSave = $oSourceModel->save();
     if ($bSave == false) {
         return array('error' => trR('fichierExisteDeja', array('#FICHIER#' => 'model/' . $sClassModelRightsManager . '.php')));
     }
     //--module main
     /*SOURCE*/
     $oSourceMain = $this->getObjectSource('example/main.php');
     /*SOURCE*/
     $oSourceMain->setPattern('#MODULE#', $sModuleRightsManager);
     $tReplace = array('#examplemodule#' => $sModuleRightsManager, '#model_examplemodel#' => $sClassModelRightsManager, '#row_examplemodel#' => $sClassRowRightsManager, '#oExamplemodel#' => $sObjectRightManger, '#examplePermissionId#' => $sPermissionId, '#exampleGroupId#' => $sPermissionGroupId, '#exampleActionId#' => $sPermissionActionId, '#exampleItemId#' => $sPermissionItemId, '#exampleUserTable#' => $sUserTable, '#exampleUser_id#' => $sUserId, '#exampleUser_login#' => $sUserLogin, '#exampleUser_groupsId#' => $sUserGroupId, '#exampleUserTable#' => $sUserTable, '#exampleUser_id#' => $sUserId, '#exampleUser_login#' => $sUserLogin, '#exampleUser_groupsId#' => $sUserGroupId);
     /*SOURCE*/
     $oSourceMain->setListPattern($tReplace);
     /*SOURCE*/
     $bSave = $oSourceMain->save();
     if ($bSave == false) {
         return array('error' => trR('fichierExisteDeja', array('#FICHIER#' => 'module/' . $sModuleRightsManager . '/main.php')));
     }
     $tView = array('index', 'new', 'edit', 'delete', 'userEdit');
     foreach ($tView as $sView) {
         //--view
         /*SOURCE*/
         $oSourceView = $this->getObjectSource('example/view/' . $sView . '.php');
         /*SOURCE*/
         $oSourceView->setPattern('#MODULE#', $sModuleRightsManager);
         /*SOURCE*/
         $oSourceView->setListPattern($tReplace);
         /*SOURCE*/
         $bSave = $oSourceView->save();
         if ($bSave == false) {
             return array('error' => trR('fichierExisteDeja', array('#FICHIER#' => 'module/' . $sModuleRightsManager . '/view/' . $sView . '.php')));
         }
     }
     //-----------
     $sMsg = null;
     $sDetail = null;
     $sMsg = 'Model ' . $sClassModelRightsManager . ' et Module ' . $sModuleRightsManager . ' g&eacute;n&eacute;r&eacute;s avec succ&egrave;s';
     $sDetail .= trR('CreationDuFichierVAR', array('#FICHIER#' => 'model/' . $sClassModelRightsManager . '.php')) . ' <br/><br/>';
     $sDetail .= trR('creationRepertoire', array('#REPERTOIRE#' => 'module/' . $sModuleRightsManager . '/')) . '<br/>';
     $sDetail .= trR('creationRepertoire', array('#REPERTOIRE#' => 'Cr&eacute;ation du repertoire module/' . $sModuleRightsManager . '/view/')) . ' <br/>';
     $sDetail .= trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModuleRightsManager . '/main.php')) . ' <br/>';
     $sDetail .= trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModuleRightsManager . '/view/index.php')) . ' <br/>';
     $sDetail .= trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModuleRightsManager . '/view/new.php')) . ' <br/>';
     $sDetail .= trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModuleRightsManager . '/view/edit.php')) . ' <br/>';
     $sDetail .= trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModuleRightsManager . '/view/delete.php')) . ' <br/>';
     $sDetail .= '<br/><br/>' . tr('accessibleVia') . ' <a href="' . _root::getConfigVar('path.generation') . _root::getParam('id') . '/public/index.php?:nav=' . $sModuleRightsManager . '::index">index.php?:nav=' . $sModuleRightsManager . '::index</a>';
     $sModuleAuth = 'auth';
     $tConfig = module_builder::getTools()->rootAddConf('conf/site.ini.php');
     if (isset($tConfig['auth']) and isset($tConfig['auth']['module'])) {
         $sModuleAuthAndAction = $tConfig['auth']['module'];
         if (preg_match('/:/', $sModuleAuthAndAction)) {
             list($sModuleAuth, $foo) = explode(':', $sModuleAuthAndAction);
         }
     }
     $r = "\n";
     $t = "\t";
     $sCode = null;
     $sCode = '<?php ' . "\n";
     $sCode .= 'private function checkLoginPass(){' . $r;
     $sCode .= $t . '(...)' . $r;
     $sCode .= $t . '$oUser=_root::getAuth()->getAccount();' . $r;
     $sCode .= $t . $sClassModelRightsManager . '::getInstance()->loadForUser($oUser);' . $r;
     $sCode .= $r;
     $sCode .= $t . '_root::redirect(\'privatemodule_action\');' . $r;
     $sCode .= '}' . $r;
     $sCodeHighli = highlight_string($sCode, 1);
     return array('msg' => $sMsg, 'detail' => $sDetail, 'code' => $sCodeHighli, 'auth' => $sModuleAuth);
 }
コード例 #29
0
ファイル: index.php プロジェクト: clavat/mkMarket
if ($this->tFile) {
}
foreach ($this->tFile as $sFile) {
    ?>
	<?php 
    if (_root::getParam('class') == $sFile) {
        ?>
		<li class="selectionne"><?php 
        echo $sFile;
        ?>
</li>
	<?php 
    } else {
        ?>
		<li><a href="<?php 
        echo _root::getLink(_root::getRequest()->getParamNav(), array('id' => _root::getParam('id'), 'action' => _root::getParam('action'), 'class' => $sFile));
        ?>
#editcrud"><?php 
        echo $sFile;
        ?>
</a></li>
	<?php 
    }
}
?>
</ul>
</div>
<br />

<?php 
if (_root::getParam('class') != '') {
コード例 #30
0
ファイル: main.php プロジェクト: CariteColas/projetTKB
    public function _index()
    {
        $detail = null;
        $tError = array();
        $tModuleAndMethod = array();
        $bExist = 0;
        if (_root::getRequest()->isPost()) {
            $sModule = _root::getParam('modulename');
            $tMethod = _root::getParam('tMethod');
            $tLabel = _root::getParam('tLabel');
            $ok = 1;
            //check formulaire
            foreach ($tMethod as $i => $sMethod) {
                if ($tLabel[$i] == '') {
                    $tError[$i] = 'Remplissez le libell&eacute; du lien';
                    $ok = 0;
                }
            }
            if ($ok) {
                if (module_builder::getTools()->projetmkdir('module/' . $sModule) == true) {
                    $detail = 'Cr&eacute;ation repertoire module/' . $sModule;
                    if (module_builder::getTools()->projetmkdir('module/' . $sModule . '/view') == true) {
                        $detail .= '<br />Cr&eacute;ation r&eacute;pertoire module/' . $sModule . '/view';
                        $this->genModuleMenuMain($sModule, $tMethod, $tLabel);
                        $msg = 'Module ' . $sModule . ' g&eacute;n&eacute;r&eacute; avec succ&egrave;s';
                        $detail .= '<br />Cr&eacute;ation fichier module/' . $sModule . '/main.php';
                        $detail .= '<br />Cr&eacute;ation fichier module/' . $sModule . '/view/index.php';
                        $sCode = '<?php ' . "\n";
                        $sCode .= '//assignez le menu a l\'emplacement menu' . "\n";
                        $sCode .= '$this->oLayout->addModule(\'menu\',\'' . $sModule . '::index\');' . "\n";
                        $detail .= '<br/><br/>Pour l\'utiliser, ajoutez dans votre methode before():<br />
						' . highlight_string($sCode, 1);
                    } else {
                        $detail .= '<br />Warning: repertoire d&eacute;j&agrave; existant module/' . $sModule . '/view';
                    }
                } else {
                    $detail = 'Warning: repertoire module/' . $sModule . ' d&eacute;j&agrave; existant: modifiez le nom du module menu';
                }
            }
        } else {
            $tModule = module_builder::getTools()->getListModule();
            $tModuleAndMethod = array();
            foreach ($tModule as $oModule) {
                $sModuleName = $oModule->getName();
                if (in_array($sModuleName, array('menu', 'builder', 'example', 'exampleembedded'))) {
                    continue;
                }
                include module_builder::getTools()->getRootWebsite() . 'module/' . $sModuleName . '/main.php';
                if (get_parent_class('module_' . $sModuleName) != 'abstract_module') {
                    continue;
                }
                $tMethods = get_class_methods('module_' . $sModuleName);
                foreach ($tMethods as $i => $sMethod) {
                    if ($sMethod[0] != '_' or substr($sMethod, 0, 2) == '__') {
                        unset($tMethods[$i]);
                    }
                }
                if (empty($tMethods)) {
                    continue;
                }
                $tModuleAndMethod[$sModuleName] = $tMethods;
            }
            $oDir = new _dir(module_builder::getTools()->getRootWebsite() . 'module/menu');
            $bExist = $oDir->exist();
        }
        $oView = new _view('moduleMenuBootstrap::index');
        $oView->tModuleAndMethod = $tModuleAndMethod;
        $oView->detail = $detail;
        $oView->bExist = $bExist;
        $oView->tError = $tError;
        return $oView;
    }