/** * Récupération de la liste de tous les tests possibles */ private function getAllTests() { $testables = array(); foreach (CopixModule::getList() as $modulePosition => $moduleName) { $testables = array_merge($testables, $this->getTestableForModule($moduleName)); } return $testables; }
/** * Récupération de toutes les DAO installées dans le proje */ public function _getAllDAO() { //on récupère la liste des modules. $arModules = CopixModule::getList(); $arDAOOfModule = array(); foreach ($arModules as $modulePosition => $moduleName) { $arDAOOfModule[$moduleName] = $this->_getAllDAOForModule($moduleName); } return $arDAOOfModule; }
/** * gets module list, we only get modules with parameters */ function _getModuleWithParams() { $toReturn = array(); foreach (CopixModule::getList() as $moduleName) { if (count(CopixConfig::getParams($moduleName)) > 0) { $informations = CopixModule::getInformations($moduleName); $toReturn[$moduleName] = $informations->description; } } return $toReturn; }
/** * Construction du message * @param mixed $pParams tableau de paramètre ou clef * @param mixed $pContent null (ImageProtect n'est pas censé recevoir de contenu) * @return string balise html contenant le bouton de selection i18n */ public function process($pParams, $pContent = null) { if (!isset($pParams['name'])) { throw new CopixTagException("[ImageProtect] Missing name parameter"); } if (!isset($pParams['id'])) { throw new CopixTagException("[ImageProtect] Missing id parameter"); } $caption = isset($pParams['caption']) ? $pParams['caption'] : ''; $listeModules = CopixModule::getList(false); sort($listeModules); $winSelecter = '<div id="divpopup_' . $pParams['id'] . '" style="display:none; border:1px; border-style:solid; border-color:#000; background-color:#FFF ;" >' . "\n\n" . ' <div id="divpopup1_' . $pParams['id'] . '" style="float:left;" >' . "\n" . ' ' . _tag('select', array('id' => 'selectmodule1_' . $pParams['id'], 'name' => 'selectmodule_' . $pParams['id'], 'values' => $listeModules, 'extra' => 'style="width:200px;" size="12"', 'emptyShow' => false)) . "\n" . ' </div>' . "\n\n" . ' <div id="divpopup2_' . $pParams['id'] . '" style="display:none;float:left;" >' . "\n" . ' ' . _tag('select', array('id' => 'selectmodule2_' . $pParams['id'], 'name' => 'selectmodule_' . $pParams['id'], 'values' => $listeModules, 'extra' => 'style="width:200px;" size="10"', 'emptyShow' => false)) . "\n" . ' <div id="divtrad_' . $pParams['id'] . '" > ' . "\n" . ' <textarea cols="30" rows="1" readonly="readonly" style="width:200px; overflow:hidden;" >traduction de \'i18n</textarea>' . "\n" . ' </div>' . "\n" . ' </div>' . "\n\n" . '</div>' . "\n"; $javascript = '<script type="text/javascript">' . "\n" . '$("' . $pParams['id'] . '").addEvent("mouseover", function (){' . "\n" . ' $("divpopup_' . $pParams['id'] . '").setStyles({' . "\n" . ' "position":"absolute",' . "\n" . ' "top" : 200+"px",' . "\n" . ' "left" : 200+"px",' . "\n" . ' "zIndex":"1000",' . "\n" . ' "display":"block"' . "\n" . ' });' . "\n" . '});' . "\n\n" . '$("selectmodule1_' . $pParams['id'] . '").addEvent("change", function () {' . "\n" . ' $("divpopup2_' . $pParams['id'] . '").setStyle("display","block");' . "\n" . '});' . "\n" . '</script>' . "\n"; return '<label>' . $caption . '<input type="text" name="' . $pParams['name'] . '" /></label>' . "\n" . '<img src="' . _resource("img/icons/languages.gif") . '" id="' . $pParams['id'] . '" alt="' . _i18n('copix:common.buttons.select') . '" />' . "\n" . $winSelecter . $javascript; }
public function _createContent(&$toReturn) { $moduleName = CopixZone::getParam('moduleName'); $infos = CopixModule::getInformations($moduleName); $tpl = new CopixTpl(); if (in_array($moduleName, CopixModule::getList())) { $arModule = CopixModule::getDependenciesForDelete($moduleName); $template = 'detailmoduledelete.tpl'; $record = _dao('Copix:copixmodule')->get($moduleName); $tpl->assign('version', $record->version_cpm); } else { $arDependencies = CopixModule::getDependenciesForInstall($moduleName); $arModule = array(); $arExtension = array(); $install = true; foreach ($arDependencies as $key => $dependency) { if ($dependency->kind === 'module') { if (CopixModule::testDependency($dependency)) { $dependency->exists = true; $dependency->isInabled = CopixModule::isEnabled($dependency->name); $arModule[] = $dependency; } else { $dependency->exists = false; $install = false; $arModule[] = $dependency; } } else { if (CopixModule::testDependency($dependency)) { $dependency->exists = true; $arExtension[] = $dependency; } else { $dependency->exists = false; $install = false; $arExtension[] = $dependency; } } } $tpl->assign('arExtension', $arExtension); $tpl->assign('install', $install); $template = 'detailmoduleinstall.tpl'; } $tpl->assign('path', CopixModule::getPath($moduleName)); $tpl->assign('arModule', $arModule); $tpl->assign('info', $infos); $tpl->assign('moduleName', $moduleName); $toReturn = $tpl->fetch($template); return true; }
/** * Ecran d'accueil des opérations d'administration * */ public function processDefault() { //Inclusion de la classe checker pour tester les pré-requis _classInclude('InstallChecker'); $checker = new InstallChecker(); $ppo = new CopixPPO(); $ppo->TITLE_PAGE = _i18n('install.title.admin'); $tips = $this->_getTips(); $ppo->tips = $tips->tips; $ppo->warning = $tips->warning; $ppo->homePageUrl = CopixConfig::get('|homePage'); $ppo->pdomysqlEnabled = $checker->typeDbInstalled('pdo_mysql'); if (!$ppo->pdomysqlEnabled) { $ppo->tips[] = _i18n('install.tips.pdomysql'); } $ppo->phpunitEnabled = @(include_once 'PHPUnit/Framework.php'); if (!$ppo->phpunitEnabled) { $ppo->tips[] = _i18n('install.tips.unittest'); } $ppo->databaseEnabled = $checker->isValidDefaultDatabase(); if (!$ppo->databaseEnabled) { $ppo->tips[] = _i18n('install.tips.database'); } if (!_currentUser()->testCredential('basic:admin')) { $ppo->tips = array(); } // recherche des liens $ppo->links = array(); foreach (CopixModule::getList() as $moduleName) { $moduleInformations = CopixModule::getInformations($moduleName); // si on a au moins un lien if (count($moduleInformations->admin_links) > 0) { $groupid = !is_null($moduleInformations->admin_links_group->id) ? $moduleInformations->admin_links_group->id : uniqid(); foreach ($moduleInformations->admin_links as $linkInformations) { if ($linkInformations['credentials'] == null || CopixAuth::getCurrentUser()->testCredential($linkInformations['credentials'])) { $ppo->links[$groupid]['modules'][][$linkInformations['url']] = $linkInformations['caption']; $ppo->links[$groupid]['caption'] = $moduleInformations->description; $ppo->links[$groupid]['groupcaption'] = $moduleInformations->admin_links_group->caption; $ppo->links[$groupid]['icon'] = !is_null($moduleInformations->admin_links_group->icon) ? $moduleInformations->admin_links_group->icon : $moduleInformations->icon; } } } } return _arPPO($ppo, 'admin.tpl'); }
/** * Récupération des modules dans l'ordre de leur description * */ public function _getModuleOrderByDescription() { $arReturn = array(); foreach (CopixModule::getList(true) as $module) { $temp = CopixModule::getInformations($module); $modulePath = CopixModule::getPath($module); if (is_dir($modulePath . COPIX_CLASSES_DIR)) { $servicesDir = opendir($modulePath . COPIX_CLASSES_DIR); while ($file = readdir($servicesDir)) { if (preg_match("/class.php\$/", $file)) { $temp->services[] = $file; } } } if (isset($temp->services)) { $arReturn[] = $temp; } } return $arReturn; }
/** * get all installable modules and their status (install or not), and depedency * @return array of object * @access private */ public function getModules($pGroupId = null) { $toReturn = array(); $arInstalledModule = CopixModule::getList(true); //Liste des modules installables foreach (CopixModule::getList(false, $pGroupId) as $name) { if (($temp = CopixModule::getInformations($name)) !== null) { //check if they are installed or not if (in_array($temp->name, $arInstalledModule)) { $temp->isInstalled = true; } else { $temp->isInstalled = false; } $toReturn[] = $temp; } } // tri des modules par ordre alphabétique sur la description $tri = true; $nbrModule = count($toReturn); while ($tri) { $tri = false; for ($boucle = 1; $boucle < $nbrModule; $boucle++) { $moduleDesc1 = $toReturn[$boucle - 1]->description != '' ? $toReturn[$boucle - 1]->description : $toReturn[$boucle - 1]->name; $moduleDesc2 = $toReturn[$boucle]->description != '' ? $toReturn[$boucle]->description : $toReturn[$boucle]->name; //echo '[<b>' . $moduleDesc1 . '</b>] [<font color="red">' . $moduleDesc2 . '</font>]<br />'; $comp = strcasecmp($moduleDesc1, $moduleDesc2); if ($comp > 0) { $temp = $toReturn[$boucle - 1]; $toReturn[$boucle - 1] = $toReturn[$boucle]; $toReturn[$boucle] = $temp; $tri = true; } } } return $toReturn; }
/** * Says if we have to compile the file */ function _mustCompile() { if ($this->config->compile_forced) { return true; } //no compiled file ? if (!is_readable($config->compile_dir . 'significanturl.php')) { return true; } if ($this->config->compile_check) { //compiled file, checking if there is an updated module.xml file since the compilation $compilationTime = filemtime($config->compile_dir . 'significanturl.php'); $modulesList = CopixModule::getList(); foreach ($modulesList as $dir) { $xmlFilename = COPIX_MODULE_PATH . $dir . '/module.xml'; if (is_readable($xmlFilename)) { if (filemtime($xmlFilename) > $compilationTime) { return true; } } } } return false; }
/** * Analyse l'url $pUrl et retourne un tableau associatif avec les paramètres trouvés. * index.php/modulename/group/action as a default * * @param string $pUrl l'url à analyser * @return array les paramètres de l'url */ private static function _parsePrepend($pUrl) { //We don't want the first slash in the string if (strpos($pUrl, '/') === 0) { $pUrl = substr($pUrl, 1); } //We unescape spaces (we replaced spaces with - and - with -- before) //We only unescape the path part of the url, not the parameters $pUrl = strtr($pUrl, array('--' => '-', '-' => ' ')); //exploding the url with slashes $urlX = explode('/', $pUrl); if (($countUrl = count($urlX)) === 1 && $urlX[0] === '') { //no parameter return array(); } $module = $urlX[0]; //On essaye ensuite de transmettre l'url au module dont le nom commence par la première occurence du chemin if (($significantUrlHandler = self::_createModuleHandler($module)) !== null) { if (($vars = $significantUrlHandler->parse($urlX, 'prepend')) !== false) { return $vars; } } //Cela n'a rien donné, on va tenter l'expérience avec tous les autres modules foreach (CopixModule::getList() as $moduleKey => $moduleName) { if (($significantUrlHandler = self::_createModuleHandler($moduleName)) !== null) { if (($vars = $significantUrlHandler->parse($urlX, 'prepend')) !== false) { return $vars; } } } //Aucun handler trouvé if ($countUrl >= 2) { $group = $urlX[1]; } else { $group = 'default'; } if ($countUrl >= 3) { $action = $urlX[2]; } else { $action = 'default'; } return array('module' => $module, 'group' => $group, 'action' => $action); }
/** * Return the dependance Tree * @param : string $moduleName : moduleName to use * @param : string $todo : action (add // remove) * @param : array $arModules : modules to remove/add */ function _getDependenciesArray($moduleName, $toDo, $arModules) { if ($toDo == "add") { $toCheck = CopixModule::getInformations($moduleName); foreach ($toCheck->dependencies as $dependency) { if (!in_array($dependency, CopixModule::getList(true)) && !in_array($dependency, $arModules)) { $arModules[] = $dependency; $arModules = CopixModule::_getDependenciesArray($dependency, $toDo, $arModules); } } } elseif ($toDo == "remove") { $strResult = ''; foreach (CopixModule::getList(true) as $installedModule) { $toCheck = CopixModule::getInformations($installedModule); foreach ((array) $toCheck->dependencies as $dependency) { if ($dependency == $moduleName && !in_array($toCheck->name, $arModules)) { $arModules[] = $toCheck->name; $arModules = CopixModule::_getDependenciesArray($toCheck->name, $toDo, $arModules); } } } } return $arModules; }
/** * get all installable modules and their status (install or not), and depedency * @return array of object * @access private */ function getModules() { $toReturn = array(); $arInstalledModule = CopixModule::getList(true); //lsit all available modules foreach (CopixModule::getList(false) as $name) { //check they have an xml description file if (($temp = CopixModule::getInformations($name)) !== null) { //check if they are installed or not if (in_array($temp->name, $arInstalledModule)) { $temp->isInstalled = true; } else { $temp->isInstalled = false; } $toReturn[] = $temp; } } return $toReturn; }
function compile(&$pluginConfig) { // la verification pour savoir si il faut compiler ou non : dans le plugin significanturl require_once COPIX_UTILS_PATH . 'CopixSimpleXml.class.php'; $modulesList = CopixModule::getList(false); $parser =& new CopixSimpleXml(); $_compile_decodeUrl_suffixe = ''; $_compile_decodeUrl_other = ''; $_compile_createUrl = ''; foreach ($modulesList as $module) { if (!($xml =& $parser->parseFile(COPIX_MODULE_PATH . $module . '/module.xml'))) { $parser->raiseError(); } if (!isset($xml->SIGNIFICANTURL)) { continue; } if (!isset($xml->SIGNIFICANTURL->URL)) { continue; } /* schema attendu <significanturl> <url desc="" action="" suffix="" entrypoint="toto.php"> <encode params="annee,mois,id" schema="/test/%1/%2/%3"/> <encoder class="" method="" /> <decode pathinfo="/ ... /"> <createvar name="bla" value="cequejeveux" /> <createvar name="mois" valuefrom="2" /> <createvar name="annee" valuefrom="1" /> </decode> </url> </significanturl> */ foreach (is_array($xml->SIGNIFICANTURL->URL) ? $xml->SIGNIFICANTURL->URL : array($xml->SIGNIFICANTURL->URL) as $sigurl) { $attr = $sigurl->attributes(); if (isset($attr['DESC'])) { $desc = $attr['DESC'] != '' ? $attr['DESC'] : COPIX_DEFAULT_VALUE_DESC; } else { $desc = COPIX_DEFAULT_VALUE_DESC; } if (isset($attr['ACTION'])) { $action = $attr['ACTION'] != '' ? $attr['ACTION'] : COPIX_DEFAULT_VALUE_ACTION; } else { $action = COPIX_DEFAULT_VALUE_ACTION; } $suffixe = isset($attr['SUFFIX']) ? $attr['SUFFIX'] : ''; $entrypoint = isset($attr['ENTRYPOINT']) ? $attr['ENTRYPOINT'] : ''; // debut partie traitement des balises DECODE if (isset($sigurl->DECODE)) { /* <decode pathinfo="/ ... /"> <createvar name="bla" value="cequejeveux" /> <createvar name="mois" valuefrom="2" /> <createvar name="annee" valuefrom="1" /> </decode> génèee $_compile_dataDecodeUrl_suffix = array( 'suffix1'=>$infodecode ) $_compile_dataDecodeUrl_other = array( $infodecode,$infodecode... ) où $infodecode = array( 'module','desc','action', 'pathinfo', array('bla'=>'cequejeveux' ) // tableau des valeurs statiques array('annee','mois') // tableau des valeurs dynamiques, classées par ordre croissant ) */ foreach (is_array($sigurl->DECODE) ? $sigurl->DECODE : array($sigurl->DECODE) as $decurl) { if (!isset($sigurl->DECODE->CREATEVAR)) { trigger_error('erreur dans module.xml significanturl, balises createvar manquante', E_USER_ERROR); } // analyse des createvars $str_createvars_statique = ''; $_createvars_dyn = array(); foreach (is_array($sigurl->DECODE->CREATEVAR) ? $sigurl->DECODE->CREATEVAR : array($sigurl->DECODE->CREATEVAR) as $createvar) { $attrcv = $createvar->attributes(); if (isset($attrcv['NAME'])) { if (isset($attrcv['VALUE'])) { $str_createvars_statique .= ', \'' . $attrcv['NAME'] . '\'=>\'' . str_replace("'", "\\'", $attrcv['VALUE']) . '\''; } elseif (isset($attrcv['VALUEFROM'])) { $_createvars_dyn[intval($attrcv['VALUEFROM'])] = $attrcv['NAME']; } else { trigger_error('erreur dans module.xml significanturl, pas d\'attribut value ou valuefrom pour une balise createvar', E_USER_ERROR); } } else { trigger_error('erreur dans module.xml significanturl, pas d\'attribut name pour une balise createvar', E_USER_ERROR); } } $str_createvars_statique = ', array(' . substr($str_createvars_statique, 1) . ')'; if (count($_createvars_dyn)) { ksort($_createvars_dyn); $_createvars_dyn = array_merge($_createvars_dyn, array()); // on consolide les indexes $str_createvars_dyn = ''; foreach ($_createvars_dyn as $varnom) { $str_createvars_dyn .= ', \'' . $varnom . '\''; } $str_createvars_dyn = ', array(' . substr($str_createvars_dyn, 1) . ')'; } else { $str_createvars_dyn = ', array()'; } // analyse des attributs de decode $attrdec = $decurl->attributes(); if (!isset($attrdec['PATHINFO'])) { trigger_error('erreur dans module.xml significanturl, pas d\'attribut pathinfo pour une balise decodeurl', E_USER_ERROR); } // génération du code PHP pour decode $infodecode = 'array(\'' . $module . '\',\'' . $desc . '\',\'' . $action . '\',\'' . str_replace("'", "\\'", $attrdec['PATHINFO']) . '\''; $infodecode .= $str_createvars_statique . $str_createvars_dyn . ') '; if ($suffixe != '') { if ($_compile_decodeUrl_suffixe != '') { $_compile_decodeUrl_suffixe .= ",\n'" . $suffixe . '\'=>' . $infodecode; } else { $_compile_decodeUrl_suffixe .= '\'' . $suffixe . '\'=>' . $infodecode; } } else { if ($_compile_decodeUrl_other != '') { $_compile_decodeUrl_other .= ",\n" . $infodecode; } else { $_compile_decodeUrl_other .= $infodecode; } } } //fin foreach decode } // fin partie sur les balises <decode> // debut partie sur les balises <encode> et <encodeurl> /* on doit obtenir $_compile_createUrl = array( 'news|default|show' => array(suffix, bool,// bool = indique si c'est sur un schema(=true) ou un encoder(=false) array('annee','mois','jour','id','titre'), "/news/%1/%2/%3/%4-%5", ou "class", "method", 'entrypoint' ), 'cms_truc'=> ... ) */ if (isset($sigurl->ENCODE)) { //<encode params="annee,mois,id" schema="/test/%1/%2/%3"/> $attrenc = $sigurl->ENCODE->attributes(); if (!isset($attrenc['PARAMS']) || !isset($attrenc['SCHEMA'])) { trigger_error('erreur dans module.xml significanturl, attribut params ou schema manquant dans un encode', E_USER_ERROR); } $params = str_replace("'", "\\'", $attrenc['PARAMS']); $params = str_replace(",", "','", $params); $createurl_str = 'true, array(\'' . $params . '\'), \'' . str_replace("'", "\\'", $attrenc['SCHEMA']) . '\''; } elseif (isset($sigurl->ENCODER)) { //<encoder class="" method="" /> $attrenc = $sigurl->ENCODER->attributes(); if (!isset($attrenc['CLASS']) || !isset($attrenc['METHOD'])) { trigger_error('erreur dans module.xml significanturl, attribut class ou method manquant dans un encoder', E_USER_ERROR); } $createurl_str = 'false, \'' . str_replace("'", "\\'", $attrenc['CLASS']) . '\', \'' . str_replace("'", "\\'", $attrenc['METHOD']) . '\''; } if ($createurl_str != '') { if ($_compile_createUrl != '') { $_compile_createUrl .= ",\n'"; } else { $_compile_createUrl .= "'"; } $_compile_createUrl .= $module . '|' . $desc . '|' . $action . '\'=>array(\'' . $suffixe . '\',' . $createurl_str . ',\'' . $entrypoint . '\')'; } // fin partie sur les balises <createurl> } // fin boucle sur les urls } // fin boucle sur les modules $_compile_decodeUrl_suffixe = '$_compile_decodeUrl_suffixe = array(' . $_compile_decodeUrl_suffixe . ");\n\n"; $_compile_decodeUrl_other = '$_compile_decodeUrl_other = array(' . $_compile_decodeUrl_other . ");\n\n"; $_compile_createUrl = '$_compile_createUrl = array(' . $_compile_createUrl . ");\n\n"; $_resources = "<?php\n\n" . $_compile_decodeUrl_suffixe . "\n\n" . $_compile_decodeUrl_other . "\n\n" . $_compile_createUrl . "\n\n?>"; //echo '<pre>',htmlspecialchars($_resources),'</pre>'; //writing the PHP code to the disk require_once COPIX_UTILS_PATH . 'CopixFile.class.php'; $objectWriter =& new CopixFile(); $fic = $pluginConfig->compile_dir . 'significanturl.php'; //$fic=$this->_compiledFileName (); // peut pas y faire appel -> le plugin n'est pas encore enregistré auprés du coord, car compile() est appelé dans le constructeur du plugin $res = $objectWriter->write($fic, $_resources); }
/** * Retourne la liste des plugins que l'on peut enregistrer * @return array */ public static function getAvailable() { $conf = CopixConfig::instance(); $toReturn = array(); /* TODO: arPluginsPath désactivé jusqu'à ce qu'on l'implémente vraiment, cf #151. //recherche des plugins dans les répertoires configurés à cet effet. foreach ($conf->arPluginsPath as $path){ if (substr ($path, -1) != '/') { $path .= '/'; } foreach (self::_findPluginsIn ($path) as $pluginName){ $toReturn[] = $pluginName; } } */ //recherche des plugins configurés dans les répertoires de modules foreach (CopixModule::getList() as $moduleName) { foreach (self::_findPluginsIn(CopixModule::getPath($moduleName) . 'plugins/', $moduleName) as $pluginName) { $toReturn[] = $pluginName; } } return $toReturn; }
public function processList() { CopixRequest::assert('id_group', 'handler_group'); $id_group = _request('id_group'); $handler_group = _request('handler_group'); $arDroit = array(); $arDroitSansModule = array(); foreach (CopixModule::getList() as $module) { $arDroitSansModule = array_merge($arDroitSansModule, CopixModule::getInformations($module)->credential_notspecific); $arDroit[$module] = CopixModule::getInformations($module)->credential; //Creation des droits si ils n'existent pas foreach ($arDroit[$module] as $name => $values) { $results = _dao('modulecredentials')->findBy(_daoSP()->addCondition('name_mc', '=', $name)->addCondition('module_mc', '=', $module)); $id_mc = null; if (count($results) == 0) { $record = _record('modulecredentials'); $record->name_mc = $name; $record->module_mc = $module; _dao('modulecredentials')->insert($record); $id_mc = $record->id_mc; } else { $id_mc = $results[0]->id_mc; } foreach ($values as $value) { $results = _dao('modulecredentialsvalues')->findBy(_daoSP()->addCondition('id_mc', '=', $id_mc)->addCondition('value_mcv', '=', $value->name)->addCondition('level_mcv', '=', $value->level)); if (count($results) == 0) { $record = _record('modulecredentialsvalues'); $record->id_mc = $id_mc; $record->value_mcv = $value->name; $record->level_mcv = $value->level; _dao('modulecredentialsvalues')->insert($record); } } } //Fin de création des droits } $arData = array(); $arModuleCredential = _dao('modulecredentials')->findBy(_daoSP()->groupBy('module_mc')); foreach ($arModuleCredential as $module) { $module = $module->module_mc; $droits = new StdClass(); $droits->name = $module; $droits->delete = false; if ($module != null) { if (!isset($arDroit[$module]) || count($arDroit[$module]) == 0) { $droits->delete = true; } } $arMc = _dao('modulecredentials')->findBy(_daoSP()->addCondition('module_mc', '=', $module)); $arDroitMc = array(); foreach ($arMc as $mc) { $arDroitMCTemp = new stdClass(); $arDroitMCTemp->record = $mc; $arDroitMCTemp->checked = count(_dao('modulecredentialsgroups')->findBy(_daoSP()->addCondition('id_mc', '=', $mc->id_mc)->addCondition('id_mcv', '=', null)->addCondition('id_group', '=', $id_group)->addCondition('handler_group', '=', $handler_group))) > 0 ? 'checked' : ''; $arDroitMCTemp->delete = true; if ($module != null) { if (isset($arDroit[$module]) && isset($arDroit[$module][$mc->name_mc])) { $arDroitMCTemp->delete = false; } } else { if (isset($arDroitSansModule[$mc->name_mc])) { $arDroitMCTemp->delete = false; } } $arValues = array(); foreach (_dao('modulecredentialsvalues')->findBy(_daoSP()->addCondition('id_mc', '=', $mc->id_mc)->orderBy('level_mcv')) as $value) { $value->checked = count(_dao('modulecredentialsgroups')->findBy(_daoSP()->addCondition('id_mc', '=', $mc->id_mc)->addCondition('id_mcv', '=', $value->id_mcv)->addCondition('id_group', '=', $id_group)->addCondition('handler_group', '=', $handler_group))) > 0 ? 'checked' : ''; $value->delete = true; if ($module != null) { if (isset($arDroit[$module]) && isset($arDroit[$module][$mc->name_mc])) { $valueName = $value->value_mcv; foreach ($arDroit[$mc->module_mc][$mc->name_mc] as $ssDroit) { if ($ssDroit->name == $valueName) { $value->delete = false; } } } } else { if (isset($arDroitSansModule[$mc->name_mc])) { $valueName = $value->value_mcv; foreach ($arDroitSansModule[$mc->name_mc] as $ssDroit) { if ($ssDroit->name == $valueName) { $value->delete = false; } } } } $arValues[] = $value; } $arDroitMCTemp->data = $arValues; $arDroitMc[] = $arDroitMCTemp; } $droits->data = $arDroitMc; $arData[] = $droits; } //Le groupe en cours de modification est en session, on peut le récupérer. if ($group = CopixSession::get('auth|group')) { $groupName = $group->id_dbgroup === null ? _i18n('auth.newGroup') : $group->caption_dbgroup; } else { $groupName = _i18n('auth.newGroup'); } return _arPpo(new CopixPpo(array('TITLE_PAGE' => _i18n('auth.editModuleCredentials', $groupName), 'id_group' => $id_group, 'handler_group' => $handler_group, 'list' => $arData, 'url_return' => _request('url_return', _url('#')))), 'modules.list.php'); }
/** * Compilation des listeners */ function _loadListeners() { //have we compiled or load this before ? if ($this->_eventInfos === null) { require_once COPIX_EVENTS_PATH . 'CopixListener.class.php'; //we have to compile, then go trhougth the modules. if ($this->_mustCompile()) { $listenersToLoad = array(); require_once COPIX_UTILS_PATH . 'CopixSimpleXml.class.php'; $modulesList = CopixModule::getList(); $parser =& new CopixSimpleXml(); foreach ($modulesList as $dir) { $xmlFilename = COPIX_MODULE_PATH . $dir . '/module.xml'; if (is_readable($xmlFilename)) { if (!($xml =& $parser->parseFile($xmlFilename))) { $parser->raiseError(); } if (isset($xml->EVENTS->LISTENERS->LISTENER)) { foreach (is_array($xml->EVENTS->LISTENERS->LISTENER) ? $xml->EVENTS->LISTENERS->LISTENER : array($xml->EVENTS->LISTENERS->LISTENER) as $listener) { $listenTo = array(); foreach (is_array($listener->EVENT) ? $listener->EVENT : array($listener->EVENT) as $eventListened) { $attributes = $eventListened->attributes(); $listenTo[] = $attributes['NAME']; } $attributes = $listener->attributes(); //Before we had this //$listenersToLoad[] = array ('dir'=>$dir, 'name'=>$attributes['NAME'], 'listenTo'=>$listenTo); //For speed purposes, we did 0==dir, 1==name, listenTo==2 //this is significant enougth to keep this $listenersToLoad[] = array(0 => $dir, 1 => $attributes['NAME'], 2 => $listenTo); } } } } $this->_writePHPCode($listenersToLoad); } else { //We load the PHP Code require $this->_compiledFileName(); } //now we load listeners. foreach ($listenersToLoad as $arListenerInformation) { $this->_addListenerInfo($arListenerInformation[0], $arListenerInformation[1], $arListenerInformation[2]); } } }
/** * Récupération de la liste de tous les tests possibles */ public static function getAllTests() { $arModules = CopixModule::getList(); $testables = array(); foreach ($arModules as $modulePosition => $moduleName) { $testables = array_merge($testables, self::getTestableForModule($moduleName)); } return $testables; }
/** * Lecture des informations sur les listeners (qui écoute quel événement) */ private function _loadListeners() { //have we compiled or load this before ? if ($this->_eventInfos === null) { //we have to compile, then go trhougth the modules. if ($this->_mustCompile()) { //$listenersToLoad = array (); $eventList = array(); $modulesList = CopixModule::getList(); foreach ($modulesList as $dir) { $xmlFilename = CopixModule::getPath($dir) . 'module.xml'; if (is_readable($xmlFilename)) { $xml = simplexml_load_file($xmlFilename); if (@isset($xml->events->listeners->listener)) { foreach (is_array($xml->events->listeners->listener) ? $xml->events->listeners->listener : array($xml->events->listeners->listener) as $listener) { //$listenTo = array (); $attributes = $listener->attributes(); $listenerName = (string) $attributes['name']; foreach ($listener->event as $eventListened) { //DDT modification de la boucle for, car cela occasionnait des plantages avec le nouveau parser XML. $attributes = $eventListened->attributes(); //$listenTo[] = $attributes['NAME']; if (!isset($eventList[(string) $attributes['name']])) { $eventList[(string) $attributes['name']] = array(); } // clé = nom de l'event, valeur = liste des fichiers listener $eventList[(string) $attributes['name']][] = array($dir, $listenerName); } } } } } $this->_writePHPCode($eventList); } else { //We load the PHP Code require $this->_compiledFileName(); } $this->_eventInfos = $eventList; } }