public function _createContent(&$toReturn)
 {
     $arModuleToInstall = CopixSession::get('arModuleToInstall', 'copix');
     $arInstalledModule = CopixSession::get('arInstalledModule', 'copix');
     $moduleName = array_pop($arModuleToInstall);
     $url = $this->getParam('url');
     if (($message = CopixModule::installModule($moduleName)) === true) {
         $toReturn = _i18n('install.module.install') . ' ' . $moduleName . ' <img src="' . _resource('img/tools/valid.png') . '" />';
         if (count($arModuleToInstall) > 0) {
             $toReturn .= _tag('copixzone', array('id' => uniqid(), 'process' => 'admin|installmodule', 'url' => $url, 'auto' => true, 'ajax' => true));
         } elseif ($url) {
             $toReturn .= sprintf('<form action="%s" method="post"><input type="submit" value="%s"/></form>', htmlspecialchars($url), _i18n('copix:common.buttons.next'));
         } else {
             $toReturn .= "<script>\$('back').setStyle('display','');</script>";
         }
         array_push($arInstalledModule, $moduleName);
     } else {
         array_push($arInstalledModule, $moduleName);
         $toReturn = _i18n('install.module.install') . ' ' . $moduleName . ' ' . _tag('popupinformation', array('img' => _resource('img/tools/delete.png')), $message);
         $toReturn .= '<div class="errorMessage">' . $message . '</div>';
         if (count($arInstalledModule) > 0) {
             CopixSession::set('arModuleToDelete', $arInstalledModule, 'copix');
             CopixSession::set('arInstalledModule', null, 'copix');
             CopixSession::set('arModuleToInstall', null, 'copix');
             $toReturn .= _tag('copixzone', array('id' => uniqid(), 'process' => 'admin|deletemodule', 'auto' => true, 'ajax' => true));
         }
     }
     CopixSession::set('arModuleToInstall', $arModuleToInstall, 'copix');
     CopixSession::set('arInstalledModule', $arInstalledModule, 'copix');
     return true;
 }
 /**
  * S'assure que l'utilisateur peut réaliser la chaine de droit donnée
  *
  * @param	string		$pString	La chaine de droit à tester
  * @param 	CopixUser	$pUser		L'utilisateur dont on teste les droits
  * @return	boolean
  */
 public function assert($pStringType, $pString, $pUser)
 {
     if (!CopixModule::isEnabled('auth')) {
         return true;
     }
     return null;
 }
 /**
  * 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;
 }
 public function _createContent(&$toReturn)
 {
     $moduleName = CopixZone::getParam('moduleName');
     if (($message = CopixModule::updateModule($moduleName)) === true) {
         $toReturn = _i18n('install.module.update') . ' ' . $moduleName . ' <img src="' . _resource('img/tools/valid.png') . '" />';
     } else {
         $toReturn = _i18n('install.module.update') . ' ' . $moduleName . ' ' . _tag('popupinformation', array('img' => _resource('img/tools/delete.png')), $message);
         $toReturn .= '<div class="errorMessage">' . $message . '</div>';
     }
     return true;
 }
 /**
  * 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;
 }
 /**
  * Création d'une instance d'un objet service
  * @param Object $pServiceDescription un objet qui décrit les composantes du service (avec les propriétés module, service, methode)
  */
 private static function _create($pServiceDescription, $pParams = array())
 {
     $serviceID = $pServiceDescription->module . '|' . $pServiceDescription->service;
     $execPath = CopixModule::getPath($pServiceDescription->module);
     $fileName = $execPath . COPIX_CLASSES_DIR . strtolower(strtolower($pServiceDescription->service)) . '.services.php';
     if (!Copix::RequireOnce($fileName)) {
         throw new CopixServicesException('Cannot load service from ' . $fileName);
     }
     //Nom des objets/méthodes à utiliser.
     $objName = 'Services' . $pServiceDescription->service;
     return new $objName($pParams);
 }
 public function _createContent(&$toReturn)
 {
     $moduleName = CopixZone::getParam('moduleName');
     $arDependency = CopixModule::getDependenciesForDelete($moduleName);
     $tpl = new CopixTpl();
     $tpl->assign('arDependency', $arDependency);
     $tpl->assign('arModuleToDelete', $arDependency);
     CopixSession::set('arModuleToDelete', $arDependency, 'copix');
     $tpl->assign('id', uniqid());
     $tpl->assign('arModuleToDelete', $arDependency);
     $toReturn = $tpl->fetch('delete.script.tpl');
     return true;
 }
 /**
  * Récupération de la liste des DAO d'un module donné
  * @param $pModuleName le nom du module
  */
 public function _getAllDAOForModule($pModuleName)
 {
     //on va rechercher l'ensemble des fichiers DAO pour le module donné.
     $toReturn = array();
     $filePath = CopixModule::getPath($pModuleName) . 'resources/*.dao.xml';
     //$filePath = str_replace ('/', '\\', $filePath);
     if (($files = glob($filePath)) !== false) {
         foreach ($files as $fileName) {
             $className = basename($fileName, '.dao.xml');
             $toReturn[] = $pModuleName . '|' . $className;
         }
     }
     return $toReturn;
 }
 public function process($pParams)
 {
     static $_init = false;
     static $htmlPath = '';
     extract($pParams);
     //check the initialisation
     if (!$_init) {
         $path = CopixModule::getPath('htmleditor') . COPIX_CLASSES_DIR;
         $htmlPath = CopixUrl::get() . 'js/FCKeditor/';
         require_once $path . 'fckeditor.php';
         $_init = true;
     }
     if (empty($content)) {
         $content = '&nbsp;';
     }
     //name of the textarea.
     if (empty($name)) {
         throw new CopixTemplateTagException('htmleditor: missing name parameter');
     } else {
         if (!isset($width)) {
             $width = CopixConfig::get('htmleditor|width');
             //$width = '100%';
         }
         if (!isset($height)) {
             $height = CopixConfig::get('htmleditor|height');
             //$height = '450px';
         }
         /*
          * ATTENTION les éléments de config viewPhototèque etc font doublon avec la sélection de la toolbarset, mais sont nécessaire à Copix
          * Par contre si on ne les load pas, on a une erreur de FCKeditor, il faut donc supprimer ce gestionnaire d'erreur sinon on se prend un alert javascript
          * le gestionnaire en question se trouve dans "FCKToolbarItems.GetItem" (chercher cette chaîne pour le trouver) et désactiver "alert( FCKLang.UnknownToolbarItem.replace( /%1/g, itemName ) ) ;
          */
         $oFCKeditor = new FCKeditor($name);
         $oFCKeditor->BasePath = $htmlPath;
         $oFCKeditor->Value = $content;
         $oFCKeditor->ToolbarSet = 'Copix';
         $oFCKeditor->Width = $width;
         $oFCKeditor->Height = $height;
         $oFCKeditor->Config['viewPhototheque'] = CopixModule::isEnabled('pictures') ? 'true' : 'false';
         $oFCKeditor->Config['viewCmsLink'] = CopixModule::isEnabled('cms') ? 'true' : 'false';
         $oFCKeditor->Config['viewLinkPopup'] = CopixModule::isEnabled('cms') ? 'true' : 'false';
         $oFCKeditor->Config['viewDocument'] = CopixModule::isEnabled('document') ? 'true' : 'false';
         $oFCKeditor->Config['viewMailto'] = 'true';
         // Configuration de la feuille de style à utiliser.
         //$oFCKeditor->Config['EditorAreaCSS'] = CopixUrl::get ().'styles/themes/hivers/hivers.css';
         $out = $oFCKeditor->CreateHtml();
     }
     return $out;
 }
 /**
  * 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;
 }
 function _createContent(&$toReturn)
 {
     $tpl =& new CopixTpl();
     $toAdd = $this->params['toAdd'];
     $toDelete = $this->params['toDelete'];
     foreach ($toAdd as $key => $elem) {
         $toAdd[$key] = CopixModule::getInformations($elem);
     }
     foreach ($toDelete as $key => $elem) {
         $toDelete[$key] = CopixModule::getInformations($elem);
     }
     $tpl->assign('toAdd', $toAdd);
     $tpl->assign('toDelete', $toDelete);
     $toReturn = $tpl->fetch('install.confirm.tpl');
     return true;
 }
 public function setUp()
 {
     $config = CopixConfig::Instance();
     if (method_exists($config, 'copixtpl_clearPaths')) {
         $config->copixtpl_clearPaths();
         $config->copixtpl_addPath(COPIX_PROJECT_PATH . 'themes/');
         CopixTpl::clearFilePathCache();
     }
     $config->i18n_path_enabled = true;
     CopixTpl::setTheme('testtheme');
     CopixI18N::setLang('fr');
     CopixI18N::setCountry('FR');
     $this->themeDir = COPIX_PROJECT_PATH . 'themes/testtheme/';
     $this->defaultDir = COPIX_PROJECT_PATH . 'themes/default/';
     $this->moduleDir = CopixModule::getBasePath('copixtest') . '/copixtest/' . COPIX_TEMPLATES_DIR;
 }
 /**
  * Préparation de l'installation
  */
 public function processInstallFramework()
 {
     // find the current connection type (defined in /plugins/copixDB/profils.definition.xml)
     $config = CopixConfig::instance();
     $driver = $config->copixdb_getProfile();
     $typeDB = $driver->getDriverName();
     // Search each module install file
     $scriptName = 'prepareinstall.' . $typeDB . '.sql';
     $file = CopixModule::getPath('admin') . COPIX_INSTALL_DIR . 'scripts/' . $scriptName;
     CopixDB::getConnection()->doSQLScript($file);
     //make sure that copixmodule is reset
     CopixModule::reset();
     $tpl = new CopixTpl();
     $tpl->assignZone('MAIN', 'admin|installmodulewithdep', array('arModule' => array('generictools', 'auth', 'default', 'admin'), 'url_return' => _url('admin|database|done'), 'messageConfirm' => false));
     return _arDisplay($tpl);
 }
 /**
  * Vérifie que l'on est bien authentifié (A voir).
  */
 public function beforeAction()
 {
     $pServiceName = CopixRequest::get('wsname');
     $this->_path = CopixModule::getPath('wsserver');
     if (isset($pServiceName)) {
         $this->_wsname = $pServiceName;
         $arRes = _ioDAO('wsservices')->findBy(_daoSP()->addCondition('name_wsservices', '=', $pServiceName));
         if (count($arRes) == 0) {
             throw new CopixException('Service introuvable ' . htmlentities($pServiceName));
         }
         $wsServiceInfo = $arRes[0];
         $this->_exportModule = $wsServiceInfo->module_wsservices;
         $this->_exportClass = $wsServiceInfo->class_wsservices;
         $this->_exportClassFilename = CopixModule::getPath($this->_exportModule) . COPIX_CLASSES_DIR . strtolower($wsServiceInfo->file_wsservices);
     } else {
         $this->_exportModule = CopixConfig::get('wsserver|exportedModule');
         $this->_exportClass = CopixConfig::get('wsserver|exportedClass');
         $this->_exportClassFilename = CopixModule::getPath($this->_exportModule) . COPIX_CLASSES_DIR . strtolower(CopixConfig::get('wsserver|exportedClassFile'));
     }
 }
 /**
  * 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;
 }
 /**
  * Méthode qui gère réellement les handlers
  *
  * @param string $pType le type de handler que l'on gère
  * @param strng $pTitle le title de la page
  * @return ActionReturn
  */
 private function _handlers($pType, $pTitle)
 {
     $ppo = new CopixPPO();
     $ppo->TITLE_PAGE = $pTitle;
     //On lance la récupération depuis les module.xml
     $handlers = CopixModule::getParsedModuleInformation('copix|' . $pType . 'handlers', '/moduledefinition/' . $pType . 'handlers/' . $pType . 'handler', array('CopixAuthParserHandler', 'parse' . $pType . 'Handler'));
     //Instanciation de l'objet qui récupère la config dans le fichier
     _classInclude('auth|useConfigurationFile');
     $configurationFile = new useConfigurationFile($pType);
     $activeHandler = $configurationFile->get();
     $ppo->handlers = array();
     //On tri les handlers activer
     foreach ($handlers as $key => $handler) {
         $ppo->handlers[$key] = false;
         if (in_array($key, $activeHandler)) {
             $ppo->handlers[$key] = true;
         }
     }
     $ppo->type = $pType;
     return _arPpo($ppo, 'handlers.list.tpl');
 }
 public function _createContent(&$toReturn)
 {
     if (CopixZone::getParam('arModule') !== null && is_array(CopixZone::getParam('arModule'))) {
         $arModule = CopixZone::getParam('arModule');
     } else {
         $arModule = array(CopixZone::getParam('moduleName'));
     }
     $arModuleToInstall = array();
     $arOrder = array();
     foreach ($arModule as $moduleName) {
         $arDependency = CopixModule::getDependenciesForInstall($moduleName);
         foreach ($arDependency as $key => $dependency) {
             if ($dependency->kind === 'module') {
                 //Gestion des modules en double avec les dependences
                 if (!in_array($dependency->name, $arModuleToInstall)) {
                     $arModuleToInstall[] = $dependency->name;
                     $arOrder[] = $dependency->level;
                 } else {
                     //Gestion du niveau d'install des dependences
                     $key = array_search($dependency->name, $arModuleToInstall);
                     if ($arOrder[$key] < $dependency->level) {
                         $arOrder[$key] = $dependency->level;
                     }
                 }
             }
         }
     }
     array_multisort($arOrder, SORT_ASC, $arModuleToInstall, SORT_DESC);
     $arModuleInfos = array();
     $tpl = new CopixTpl();
     $tpl->assign('arModuleToInstall', $arModuleToInstall);
     $tpl->assign('arModuleInfos', $arModuleInfos);
     CopixSession::set('arModuleToInstall', $arModuleToInstall, 'copix');
     CopixSession::set('arInstalledModule', array(), 'copix');
     $tpl->assign('id', uniqid());
     $tpl->assign('url', CopixZone::getParam('url_return', _url('admin|install|manageModules')));
     $tpl->assign('messageConfirm', CopixZone::getParam('messageConfirm', true));
     $toReturn = $tpl->fetch('admin|install.script.tpl');
     return true;
 }
 public function _createContent(&$toReturn)
 {
     $arModuleToDelete = CopixSession::get('arModuleToDelete', 'copix');
     $moduleName = array_pop($arModuleToDelete);
     if (($message = CopixModule::deleteModule($moduleName)) === true) {
         $toReturn = _i18n('install.module.delete') . ' ' . $moduleName . ' <img src="' . _resource('img/tools/valid.png') . '" />';
         if (count($arModuleToDelete) > 0) {
             $toReturn .= _tag('copixzone', array('id' => uniqid(), 'process' => 'admin|deletemodule', 'auto' => true, 'ajax' => true));
         } else {
             $toReturn .= "<script>\$('back').setStyle('display','');</script>";
         }
     } else {
         $toReturn = _i18n('install.module.delete') . ' ' . $moduleName . ' ' . _tag('popupinformation', array('img' => _resource('img/tools/delete.png')), $message);
         $toReturn .= '<div class="errorMessage">' . $message . '</div>';
         if (count($arModuleToDelete) > 0) {
             $toReturn .= _tag('copixzone', array('id' => uniqid(), 'process' => 'admin|deletemodule', 'auto' => true, 'ajax' => true));
         } else {
             $toReturn .= "<script>\$('back').setStyle('display','');</script>";
         }
     }
     CopixSession::set('arModuleToDelete', $arModuleToDelete, 'copix');
     return true;
 }
 /**
  * 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;
 }
 public function process($pParams)
 {
     $size = '';
     if (isset($pParams['width'])) {
         $size .= ' width="' . $pParams['width'] . '"';
     }
     if (isset($pParams['height'])) {
         $size .= ' height="' . $pParams['height'] . '"';
     }
     $src = '';
     if (isset($pParams['resource'])) {
         $src = CopixUrl::getResource($pParams['resource']);
     }
     if (isset($pParams['id']) && $src == '') {
         if (!CopixModule::isEnabled('pictures')) {
             throw new CopixException('Vous devez activer le module pictures');
         }
         $arParams = array('picture_id' => $pParams['id']);
         if (isset($pParams['width'])) {
             $arParams['width'] = $pParams['width'];
         }
         if (isset($pParams['height'])) {
             $arParams['height'] = $pParams['height'];
         }
         $src = CopixUrl::get('pictures|default|getImage', $arParams);
     }
     $title = '';
     if (isset($pParams['title'])) {
         $title = $pParams['title'];
     }
     $alt = $title;
     if (isset($pParams['alt'])) {
         $alt = $pParams['alt'];
     }
     return '<img src="' . $src . '" alt="' . $alt . '" title="' . $title . '" ' . $size . ' />';
 }
 public function afterInstall()
 {
     // find the current connection type (defined in /plugins/copixDB/profils.definition.xml)
     $config = CopixConfig::instance();
     $driver = $config->copixdb_getProfile();
     $typeDB = $driver->getDriverName();
     // Search each module install file
     $scriptName = 'afterinstall.' . $typeDB . '.sql';
     $file = CopixModule::getPath('admin') . COPIX_INSTALL_DIR . 'scripts/' . $scriptName;
     CopixDB::getConnection()->doSQLScript($file);
 }
 /**
  * Permet d'exporter les classes des modukes
  *
  * @return CopixActionReturn
  */
 public function processExportClass()
 {
     $pModuleName = CopixRequest::get('moduleName');
     $pClassFileName = CopixRequest::get('classFileName');
     // si on a confirmé l'ajout
     if (CopixRequest::get('confirm')) {
         $pServiceName = trim(CopixRequest::get('serviceName'));
         $pClassName = CopixRequest::get('className');
         $pClassFileName = _request('classFileName');
         $pModuleName = _request('moduleName');
         // nom de service vide
         if ($pServiceName == '') {
             return _arRedirect(_url('admin|ExportClass', array('error' => 'serviceEmpty', 'moduleName' => $pModuleName, 'classFileName' => $pClassFileName)));
         }
         // verification si on n'a pas déja un service de ce nom
         $wsservices = _ioDao('wsservices')->findBy(_daoSP()->addCondition('name_wsservices', '=', $pServiceName));
         if (count($wsservices) > 0) {
             return _arRedirect(_url('admin|ExportClass', array('error' => 'serviceExists', 'moduleName' => $pModuleName, 'classFileName' => $pClassFileName)));
         }
         CopixDB::getConnection()->doQuery("insert into wsservices (name_wsservices, module_wsservices, file_wsservices, class_wsservices) values ('" . $pServiceName . "','" . $pModuleName . "','" . $pClassFileName . "', '" . $pClassName . "')");
         $res = 'Url du Webservice  : <a href="' . _url('wsserver||', array('wsname' => $pServiceName)) . '">' . _url('wsserver||', array('wsname' => $pServiceName)) . '</a><br/>' . "\n";
         $res .= 'Url du fichier wsdl : <a href="' . _url('wsserver|default|wsdl', array('wsname' => $pServiceName)) . '">' . _url('wsserver|default|wsdl', array('wsname' => $pServiceName)) . '</a><br/>' . "\n";
         $res .= '<br />';
         $res .= '<input type="button" value="' . _i18n('wsserver.back') . '" onclick="javascript: document.location=\'' . _url('admin|manageWebServices') . '\';" />';
         $tpl = new CopixTpl();
         $tpl->assign('MAIN', $res);
         return new CopixActionReturn(CopixActionReturn::DISPLAY, $tpl);
         // si on doit afficher le formulaire d'ajout
     } else {
         $ppo = new CopixPPO();
         $ppo->TITLE_PAGE = _i18n('wsserver.title.manageWebServices');
         $ppo->classFileName = $pClassFileName;
         $ppo->arErrors = array();
         // erreur "service existant" passée en paramètre
         if (_request('error') !== null) {
             $ppo->arErrors[] = _i18n('wsserver.error.' . _request('error'));
         }
         $ppo->ModuleName = $pModuleName;
         $arBefore = get_declared_classes();
         include CopixModule::getPath($pModuleName) . COPIX_CLASSES_DIR . $pClassFileName;
         $arAfter = get_declared_classes();
         $arClass = array_diff($arAfter, $arBefore);
         sort($arClass);
         if (count($arClass) == 0) {
             throw new Exception('Pas de classe à exporter');
         }
         $ppo->arClass = $arClass;
         return _arPPO($ppo, 'wsservices.add.php');
     }
 }
 /**
  * Analyse et découpe une sélecteur de ressource.
  *
  * Accepte les deux formes suivantes :
  * - chemin/vers/ressource.txt
  * - module|chemin/vers/ressource.txt
  *
  * Le '/' initial du chemin est supprimé.
  *
  * @param unknown_type $pResourcePath Sélecteur de la ressource.
  * @return array Tableau de la forme (chemin, nom_du_module ou null, chemin_du_module ou null)
  */
 private static function _parseResourcePath($pResourcePath)
 {
     if (!preg_match('@^((\\w+)?\\|)?/?(.+)$@', $pResourcePath, $parts)) {
         throw new CopixException(_i18n("copix:copix.error.resource.invalidResource", $pResourcePath));
     }
     list(, $modulePrefix, $moduleName, $resourcePath) = $parts;
     if (!empty($modulePrefix) && empty($moduleName)) {
         $moduleName = CopixContext::get();
     }
     return array($resourcePath, $moduleName, empty($moduleName) ? null : CopixModule::getPath($moduleName));
 }
 public function testObject()
 {
     $element = new CopixSessionObject($object = _ioClass('fooclass'), CopixModule::getPath('copixtest') . 'classes/fooclass.class.php');
     $this->assertEquals($element->getSessionObject(), $object);
     $serialized = serialize($element);
     $elementBack = unserialize($serialized);
     $this->assertEquals(strtolower(get_class($elementBack->getSessionObject())), 'fooclass');
     $this->assertEquals(1, $elementBack->getParam(1));
     $this->assertEquals(array(1, 2), $elementBack->getArrayWith(1, 2));
     $elementBack->test = 2;
     $this->assertEquals($elementBack->test, 2);
     $this->assertEquals($elementBack->getSessionObject()->test, 2);
     $elementBack->notExists = 3;
     $this->assertEquals($elementBack->notExists, 3);
     $this->assertEquals($elementBack->getSessionObject()->notExists, 3);
     $elementBack->setPublicPropertyTest(4);
     $this->assertEquals($elementBack->test, 4);
     $this->assertEquals($elementBack->getSessionObject()->test, 4);
     $this->assertEquals($elementBack->getPublicPropertyTest(), 4);
     $this->assertEquals($elementBack->getSessionObject()->getPublicPropertyTest(), 4);
     $elementBack->setPrivatePropertyTest(5);
     $this->assertEquals($elementBack->getPrivatePropertyTest(), 5);
     $this->assertEquals($elementBack->getSessionObject()->getPrivatePropertyTest(), 5);
     $elementBack->setUnknownProperty('notexists', 6);
     $this->assertEquals($elementBack->getUnknownProperty('notexists'), 6);
     $this->assertEquals($elementBack->getSessionObject()->getUnknownProperty('notexists'), 6);
     $this->assertEquals($elementBack->notexists, 6);
     $this->assertEquals($elementBack->getSessionObject()->notexists, 6);
 }
function smarty_function_htmleditor($params, &$smarty)
{
    static $_init = false;
    extract($params);
    //check the initialisation
    if (!$_init) {
        switch (strtolower(CopixConfig::get('htmleditor|type'))) {
            case 'htmlarea':
                CopixHtmlHeader::addJsCode('_editor_url = "' . CopixUrl::get() . 'js/htmlarea/";');
                //path of the library
                if (empty($htmlPath)) {
                    $htmlPath = CopixUrl::get() . 'js/htmlarea/';
                    //default path under CopiX
                }
                CopixHTMLHeader::addJSLink($htmlPath . 'htmlarea.js');
                CopixHTMLHeader::addJSLink($htmlPath . 'dialog.js');
                if (empty($lang)) {
                    $lang = CopixI18N::getLang();
                }
                CopixHTMLHeader::addJSLink($htmlPath . 'lang/' . $lang . '.js');
                CopixHTMLHeader::addCSSLink($htmlPath . 'htmlarea.css');
                CopixHTMLHeader::addJSLink($htmlPath . 'popupwin.js');
                $jsCode = 'HTMLArea.loadPlugin("TableOperations");
                HTMLArea.loadPlugin("InsertAnchor");
                HTMLArea.loadPlugin("TableToggleBorder");
                HTMLArea.loadPlugin("ContextMenu");';
                if (CopixModule::isValid('pictures') && CopixModule::isValid('cms') && CopixModule::isValid('document')) {
                    $jsCode = 'HTMLArea.loadPlugin("AstonTools");';
                }
                CopixHTMLHeader::addJSCode($jsCode);
                break;
            case 'fckeditor':
            default:
                $path = COPIX_MODULE_PATH . 'htmleditor/' . COPIX_CLASSES_DIR;
                $htmlPath = CopixUrl::get() . 'js/FCKeditor/';
                require_once $path . 'fckeditor.php';
                break;
        }
        //     CopixHTMLHeader::addJSLink ($path.'fckconfig.js');
        //		 CopixHTMLHeader::addJSLink ($path.'fckeditor.js');
        $_init = true;
    }
    if (empty($content)) {
        $content = '&nbsp;';
    }
    //name of the textarea.
    if (empty($name)) {
        $smarty->trigger_error('htmleditor: missing name parameter');
    } else {
        if (!$width) {
            $width = CopixConfig::get('htmleditor|width');
            //$width = '100%';
        }
        if (!$height) {
            $height = CopixConfig::get('htmleditor|height');
            //$height = '450px';
        }
        switch (strtolower(CopixConfig::get('htmleditor|type'))) {
            case 'htmlarea':
                $out = '<textarea id="' . $name . '" name="' . $name . '" style="width: ' . $width . 'px; height:' . $height . 'px;" >' . $content . '</textarea>';
                $out .= '<script type="text/javascript" defer="1">
         var editor' . $name . ' = null;
         editor' . $name . ' = new HTMLArea("' . $name . '");
         editor' . $name . '.registerPlugin("TableOperations");
         editor' . $name . '.registerPlugin("TableToggleBorder");
         editor' . $name . '.registerPlugin("InsertAnchor");
         editor' . $name . '.registerPlugin("ContextMenu");';
                if (CopixModule::isValid('pictures') && CopixModule::isValid('cms') && CopixModule::isValid('document')) {
                    $out .= 'editor' . $name . '.registerPlugin("AstonTools");';
                }
                $out .= 'editor' . $name . '.config.pageStyle = "@import url(\\"' . CopixUrl::get() . 'styles/styles_copix.css\\");";
         editor' . $name . '.generate ();
         </script>';
                break;
            case 'fckeditor':
            default:
                /*
                 * ATTENTION les éléments de config viewPhototèque etc font doublon avec la sélection de la toolbarset, mais sont nécessaire à Copix
                 * Par contre si on ne les load pas, on a une erreur de FCKeditor, il faut donc supprimer ce gestionnaire d'erreur sinon on se prend un alert javascript
                 * le gestionnaire en question se trouve dans "FCKToolbarItems.GetItem" (chercher cette chaîne pour le trouver) et désactiver "alert( FCKLang.UnknownToolbarItem.replace( /%1/g, itemName ) ) ;"
                 */
                $oFCKeditor = new FCKeditor($name);
                $oFCKeditor->BasePath = $htmlPath;
                $oFCKeditor->Value = $content;
                $oFCKeditor->ToolbarSet = 'Copix';
                $oFCKeditor->Width = $width;
                $oFCKeditor->Height = $height;
                $oFCKeditor->Config['viewPhototheque'] = CopixModule::isValid('pictures') ? 'true' : 'false';
                $oFCKeditor->Config['viewCmsLink'] = CopixModule::isValid('cms') ? 'true' : 'false';
                $oFCKeditor->Config['viewLinkPopup'] = CopixModule::isValid('cms') ? 'true' : 'false';
                $oFCKeditor->Config['viewDocument'] = CopixModule::isValid('document') ? 'true' : 'false';
                // Configuration de la feuille de style à utiliser.
                $oFCKeditor->Config['EditorAreaCSS'] = CopixUrl::get() . 'styles/styles_copix.css';
                $out = $oFCKeditor->CreateHtml();
                break;
        }
    }
    return $out;
}
 /**
  * Retourne vrai ou faux selon que l'admin est possible ou pas
  *
  * @return boolean
  */
 public function adminIsInstall()
 {
     return CopixModule::isEnabled('admin');
 }
 /**
  * Create code highlights
  * @param _wikielement codeelement
  */
 private function _treatCode($code)
 {
     //syntaxe highlight
     $code->data = preg_replace('/\\[code(.*?)\\]/', "", $code->data);
     $code->data = preg_replace('/\\[\\/code(.*?)\\]/', "", $code->data);
     require_once CopixModule::getPath('geshi') . 'lib/geshi/geshi.php';
     $lang = $code->other;
     $code = $code->data;
     $geshi = new GeSHi($code, $lang);
     $geshi->set_header_type(GESHI_HEADER_DIV);
     $code = $geshi->parse_code();
     $code = "\n" . '<div class="wiki_code">' . $code . '</div>' . "\n";
     return $code;
 }
示例#29
0
"></script>
<!--[if IE]>
  <link rel="stylesheet" href="<?php 
echo _resource("styles/ie.css");
?>
" type="text/css"/>
<![endif]-->
</head>
<body>
<div id="allcontent">
<div id="banner"><span id="slogan">100% communautaire, 100%
professionnel... 200% efficace.</span></div>
<!-- end banner -->
<div id="menu">
<?php 
if (CopixModule::isEnabled('quicksearch')) {
    echo CopixZone::process('quicksearch|quicksearchform');
}
?>
<ul>
<?php 
if (isset($menuItems)) {
    foreach ($menuItems as $menuCaption => $menuUrl) {
        echo '<li><a href="' . $menuUrl . '">' . $menuCaption . '</a></li>';
    }
}
?>
</ul>
</div>
 <div id="maincontent">
  <h1 class="main"><?php 
 /**
  * Check if the module has a correct name
  * Check (if trusted module is on) if the module name belongs to the trusted module list
  * Check if there is a module.xml file
  * Handles a cache as it is called very very very often
  */
 function isValid($moduleName)
 {
     static $okNames = array();
     if (isset($okNames[$moduleName])) {
         return $okNames[$moduleName];
     }
     return $okNames[$moduleName] = CopixModule::_isValid($moduleName);
 }