public function processDefault() { _classInclude('sysutils|admin'); if (!Admin::canAdmin()) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.noRights'), 'back' => CopixUrl::get())); } echo "Récupération des classeurs de classe sans casier\n"; echo "----------------------------------------------------------------------\n\n"; // Récupération des classeurs de classe sans casier $sql = 'SELECT DISTINCT module_classeur.id' . ' FROM kernel_mod_enabled, module_classeur' . ' LEFT JOIN module_classeur_dossier ON (module_classeur_dossier.module_classeur_id = module_classeur.id)' . ' WHERE module_classeur.id = kernel_mod_enabled.module_id' . ' AND kernel_mod_enabled.module_type = "MOD_CLASSEUR"' . ' AND kernel_mod_enabled.node_type = "BU_CLASSE"' . ' AND (module_classeur_dossier.id IS NULL' . ' OR module_classeur_dossier.id NOT IN (SELECT id FROM module_classeur_dossier WHERE casier = 1 AND module_classeur_id = module_classeur.id))'; $results = _doQuery($sql); $dossierDAO = _ioDAO('classeur|classeurdossier'); _classInclude('classeur|classeurService'); echo count($results) . " casiers à créer.\n"; foreach ($results as $result) { $casier = _record('classeur|classeurdossier'); $casier->classeur_id = $result->id; $casier->parent_id = 0; $casier->nom = CopixI18N::get('classeur|classeur.casierNom'); $casier->nb_dossiers = 0; $casier->nb_fichiers = 0; $casier->taille = 0; $casier->cle = classeurService::createKey(); $casier->casier = 1; $casier->date_creation = date('Y-m-d H:i:s'); $dossierDAO->insert($casier); echo "Casier du classeur {$result->id} créé avec succès !\n"; } echo "\n\nFin de la tâche"; return _arNone(); }
/** * Plugin smarty type fonction * Purpose: generation of a copixed url * * Input: dest=module|desc|action * complete syntax will be: * desc|action for current module, desc and action * [action or |action] default desc, action * [|desc|action] project, desc and action * [||action] action in the project * [module||action] action in the default desc for the module * [|||] the only syntax for the current page * * * = any extra params will be used to generate the url * */ function smarty_function_copixurl($params, &$me) { if (isset($params['notxml'])) { $isxml = $params['notxml'] == 'true' ? false : true; unset($params['notxml']); } else { $isxml = true; } $assign = ''; if (isset($params['assign'])) { $assign = $params['assign']; unset($params['assign']); } if (!isset($params['dest']) && !isset($params['appendFrom'])) { $toReturn = _url(null, array(), $isxml); } if (isset($params['appendFrom'])) { $appendFrom = $params['appendFrom']; unset($params['appendFrom']); $toReturn = CopixUrl::appendToUrl($appendFrom, $params, $isxml); } if (isset($params['dest'])) { $dest = $params['dest']; unset($params['dest']); $toReturn = _url($dest, $params, $isxml); } if (strlen($assign) > 0) { $me->assign($assign, $toReturn); return ''; } else { return $toReturn; } }
/** * Plugin smarty type modifier * Purpose: A partir d'un article du RSS, extrait ce qu'il faut afficher en "enclosure" * Input: Chaine de caractères (tout l'article) * Output: Chaine de caractères (tags <enclosure> avec le bonc ontenu ou chaine vide si aucun contenu multimédia * Example: {$text|rss_enclosure} * @return string */ function smarty_modifier_rss_enclosure($string) { $txt = ''; //<enclosure url="http://www.scripting.com/mp3s/weatherReportSuite.mp3" length="12216320" type="audio/mpeg" /> if (preg_match_all("/\\[\\[(.*)\\]\\]/sU", $string, $regs, PREG_SET_ORDER)) { //print_r($regs); foreach ($regs as $reg) { //print_r($reg); list($url, $type) = explode("|", $reg[1]); $url = rawurldecode($url); $length = @filesize($url); $ext = substr($url, strrpos($url, ".") + 1); $infos = MalleService::getTypeInfos('', $url); //print_r($infos); if ($length && $infos['type_mime']) { $file = $url; $pos = strrpos($file, '/'); if ($pos === false) { $name = $file; $href = $name; } else { $name = substr($file, $pos + 1); $href = substr($file, 0, $pos + 1) . rawurlencode($name); } $txt .= '<enclosure url="' . CopixUrl::get() . $href . '" length="' . $length . '" type="' . $infos['type_mime'] . '" />'; } } } return $txt; }
/** * Affiche le chemin d'accès à une discussion ou un forum, depuis la racine d'un forum * * Les paramètres dépendent de la navigation dans le forum (il suffit de passer un paramètre) * * @author Christophe Beyer <*****@*****.**> * @since 2005/11/08 * @param integer $forum Id du forum * @param integer $topic Id de la discussion * @param integer $message Id du message * @param integer $modifyTopic Id de la discussion (formulaire de modification) */ public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $forum = $this->getParam('forum') ? $this->getParam('forum') : NULL; $topic = $this->getParam('topic') ? $this->getParam('topic') : NULL; $message = $this->getParam('message') ? $this->getParam('message') : NULL; $modifyTopic = $this->getParam('modifyTopic') ? $this->getParam('modifyTopic') : NULL; $res = array(); if ($forum) { $res[] = array("libelle" => CopixI18N::get('forum|forum.poucetIndex'), "lien" => CopixUrl::get('forum||getForum', array("id" => $forum->id))); } elseif ($topic) { $res[] = array("libelle" => CopixI18N::get('forum|forum.poucetIndex'), "lien" => CopixUrl::get('forum||getForum', array("id" => $topic->forum))); $res[] = array("libelle" => $topic->titre, "lien" => CopixUrl::get('forum||getTopic', array("id" => $topic->id))); } elseif ($message) { $res[] = array("libelle" => CopixI18N::get('forum|forum.poucetIndex'), "lien" => CopixUrl::get('forum||getForum', array("id" => $message->forum))); $res[] = array("libelle" => $message->topic_titre, "lien" => CopixUrl::get('forum||getTopic', array("id" => $message->topic))); } elseif ($modifyTopic) { //print_r($modifyTopic); $res[] = array("libelle" => CopixI18N::get('forum|forum.poucetIndex'), "lien" => CopixUrl::get('forum||getForum', array("id" => $modifyTopic->forum))); $res[] = array("libelle" => $modifyTopic->titre, "lien" => CopixUrl::get('forum||getTopic', array("id" => $modifyTopic->id))); } $tpl->assign('petitpoucet', $res); // retour de la fonction : $toReturn = $tpl->fetch('petitpoucet.tpl'); return true; }
public function processDefault() { $tpl = new CopixTpl(); $tplModule = new CopixTpl(); //if user is not connected : if (1) { // S'il y a un blog prevu a l'accueil $dispBlog = false; $getKernelLimitsIdBlog = Kernel::getKernelLimits('id_blog'); if ($getKernelLimitsIdBlog) { _classInclude('blog|kernelblog'); if ($blog = _ioDao('blog|blog')->getBlogById($getKernelLimitsIdBlog)) { // On v�rifie qu'il y a au moins un article $stats = KernelBlog::getStats($blog->id_blog); if ($stats['nbArticles']['value'] > 0) { $dispBlog = true; } } } if ($dispBlog) { //return CopixActionGroup::process ('blog|frontblog::getListArticle', array ('blog'=>$blog->url_blog)); return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('blog||', array('blog' => $blog->url_blog))); } if (!CopixConfig::exists('|can_public_rssfeed') || CopixConfig::get('|can_public_rssfeed')) { CopixHtmlHeader::addOthers('<link rel="alternate" href="' . CopixUrl::get('public||rss', array()) . '" type="application/rss+xml" title="' . htmlentities(CopixI18N::get('public|public.rss.flux.title')) . '" />'); } CopixHTMLHeader::addCSSLink(_resource("styles/module_fichesecoles.css")); $tplModule->assign('user', _currentUser()); $result = $tplModule->fetch('welcome|welcome_' . CopixI18N::getLang() . '.tpl'); $tpl->assign('TITLE_PAGE', '' . CopixI18N::get('public|public.welcome.title')); $tpl->assign('MAIN', $result); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); } }
/** * Accueil des stats * * @author Christophe Beyer <*****@*****.**> * @since 2007/03/19 */ public function home() { if (!Admin::canAdmin()) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.noRights'), 'back' => CopixUrl::get())); } $tpl = new CopixTpl(); $tpl->assign('TITLE_PAGE', CopixI18N::get('sysutils|admin.menu.stats')); $tpl->assign('MENU', Admin::getMenu('stats')); $tplStats = new CopixTpl(); $modules = Kernel::getAllModules(); $tab = array(); foreach ($modules as $mod_val) { $arModulesPath = CopixConfig::instance()->arModulesPath; foreach ($arModulesPath as $modulePath) { $class_file = $modulePath . $mod_val . '/' . COPIX_CLASSES_DIR . 'kernel' . $mod_val . '.class.php'; if (!file_exists($class_file)) { continue; } $module_class =& CopixClassesFactory::Create($mod_val . '|Kernel' . $mod_val); //print_r($module_class); if (!is_callable(array($module_class, 'getStatsRoot'))) { continue; } //$classeModule = CopixClassesFactory::create("$label|Kernel$label"); $tab[$mod_val]['module_nom'] = Kernel::Code2Name('mod_' . $mod_val); $tab[$mod_val]['stats'] = $module_class->getStatsRoot(); } } //print_r($tab); $tplStats->assign('tab', $tab); $tpl->assign('MAIN', $tplStats->fetch('sysutils|stats.modules.tpl')); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
public function processLogin() { include_once COPIX_UTILS_PATH . '../../CAS-1.2.2/CAS.php'; $_SESSION['chartValid'] = false; $ppo = new CopixPPO(); $ppo->user = _currentUser(); if ($ppo->user->isConnected()) { $url_return = CopixUrl::get('kernel||doSelectHome'); /* * PATCH FOR CHARTE */ $this->user->forceReload(); if (!$this->service('charte|CharteService')->checkUserValidation()) { $this->flash->redirect = $url_return; return $this->go('charte|charte|valid'); } return _arRedirect($url_return); //return new CopixActionReturn (COPIX_AR_REDIRECT, $url_return); } else { $conf_Cas_host = CopixConfig::get('default|conf_Cas_host'); $conf_Cas_port = CopixConfig::get('default|conf_Cas_port'); $conf_Cas_path = CopixConfig::get('default|conf_Cas_path'); phpCAS::client(CAS_VERSION_2_0, $conf_Cas_host, (int) $conf_Cas_port, $conf_Cas_path, false); phpCAS::setNoCasServerValidation(); phpCAS::forceAuthentication(); $ppo->cas_user = phpCAS::getUser(); if ($ppo->cas_user) { $ppo->iconito_user = Kernel::getUserInfo("LOGIN", $ppo->cas_user); if ($ppo->iconito_user['login']) { _currentUser()->login(array('login' => $ppo->iconito_user['login'], 'assistance' => true)); $url_return = CopixUrl::get('kernel||doSelectHome'); // $url_return = CopixUrl::get ('assistance||users'); $this->user->forceReload(); if (!$this->service('charte|CharteService')->checkUserValidation()) { $this->flash->redirect = $url_return; return $this->go('charte|charte|valid'); } return new CopixActionReturn(COPIX_AR_REDIRECT, $url_return); } else { $ppo->cas_error = 'no-iconito-user'; return _arPpo($ppo, 'cas.tpl'); } } } $ppo = new CopixPPO(); $ppo->TITLE_PAGE = $pTitle; phpCAS::setDebug(); $conf_Cas_host = CopixConfig::get('default|conf_Cas_host'); $conf_Cas_port = CopixConfig::get('default|conf_Cas_port'); $conf_Cas_path = CopixConfig::get('default|conf_Cas_path'); phpCAS::client(CAS_VERSION_2_0, $conf_Cas_host, (int) $conf_Cas_port, $conf_Cas_path, false); phpCAS::setNoCasServerValidation(); phpCAS::forceAuthentication(); if (isset($_REQUEST['logout'])) { phpCAS::logout(); } die(phpCAS::getUser()); die('ok'); return _arPpo($ppo, 'handlers.list.tpl'); }
public function process($pParams, $content) { extract($pParams); if (!isset($name)) { throw new CopixTemplateTagException("Manque nom"); } $toReturn = "<div id=\"wiki_toolbar\" style=\"clear:both\">\n"; $toReturn .= "<a class=\"wiki_toolbar\" onclick=\"javascript:fontStyle('**','**','" . _i18n("wiki|wiki.bold") . "');\" title=\"" . _i18n("wiki|wiki.bold") . "\"><img src=\"" . CopixUrl::getResource('/img/modules/wiki/bold.png') . "\" /></a>\n"; $toReturn .= "<a class=\"wiki_toolbar\" onclick=\"javascript:fontStyle('//','//','" . _i18n("wiki|wiki.italic") . "');\" title=\"" . _i18n("wiki|wiki.italic") . "\"><img src=\"" . CopixUrl::getResource('/img/modules/wiki/italic.png') . "\" /></a>\n"; $toReturn .= "<a class=\"wiki_toolbar\" onclick=\"javascript:fontStyle('__','__','" . _i18n("wiki|wiki.underline") . "');\" title=\"" . _i18n("wiki|wiki.underline") . "\"><img src=\"" . CopixUrl::getResource('/img/modules/wiki/underline.png') . "\" /></a>\n"; $toReturn .= "<a class=\"wiki_toolbar\" onclick=\"javascript:fontStyle(' *','','" . _i18n("wiki|wiki.listitem") . "');\" title=\"" . _i18n("wiki|wiki.listitem") . "\"><img src=\"" . CopixUrl::getResource('/img/modules/wiki/list.png') . "\" /></a>\n"; $toReturn .= "<a class=\"wiki_toolbar\" onclick=\"javascript:fontStyle('<del>','</del>','" . _i18n("wiki|wiki.strike") . "');\" title=\"" . _i18n("wiki|wiki.strike") . "\"><img src=\"" . CopixUrl::getResource('/img/modules/wiki/strike.png') . "\" /></a>\n"; $toReturn .= "<a class=\"wiki_toolbar\" onclick=\"javascript:fontStyle('\n----\n','','');\" title=\"" . _i18n("wiki|wiki.hr") . "\"><img src=\"" . CopixUrl::getResource('/img/modules/wiki/hr.png') . "\" /></a>\n"; $toReturn .= "<a class=\"wiki_toolbar\" onclick=\"javascript:fontStyle('\\'\\'','\\'\\'','" . _i18n("wiki|wiki.code") . "');\" title=\"" . _i18n("wiki|wiki.code") . "\"><img src=\"" . CopixUrl::getResource('/img/modules/wiki/code.png') . "\" /></a>\n"; $toReturn .= "<a class=\"wiki_toolbar\" onclick=\"javascript:addHeader(1);\" title=\"" . _i18n("wiki|wiki.header", 1) . "\"><img src=\"" . CopixUrl::getResource('/img/modules/wiki/h1.png') . "\" /></a>\n"; $toReturn .= "<a class=\"wiki_toolbar\" onclick=\"javascript:addHeader(2);\" title=\"" . _i18n("wiki|wiki.header", 2) . "\"><img src=\"" . CopixUrl::getResource('/img/modules/wiki/h2.png') . "\" /></a>\n"; $toReturn .= "<a class=\"wiki_toolbar\" onclick=\"javascript:addHeader(3);\" title=\"" . _i18n("wiki|wiki.header", 3) . "\"><img src=\"" . CopixUrl::getResource('/img/modules/wiki/h3.png') . "\" /></a>\n"; $toReturn .= "<a class=\"wiki_toolbar\" onclick=\"javascript:addHeader(4);\" title=\"" . _i18n("wiki|wiki.header", 4) . "\"><img src=\"" . CopixUrl::getResource('/img/modules/wiki/h4.png') . "\" /></a>\n"; $toReturn .= "<a class=\"wiki_toolbar\" onclick=\"javascript:addHeader(5);\" title=\"" . _i18n("wiki|wiki.header", 5) . "\"><img src=\"" . CopixUrl::getResource('/img/modules/wiki/h5.png') . "\" /></a>\n"; $toReturn .= "<a class=\"wiki_toolbar\" onclick=\"javascript:sendForPreview();\" title=\"" . _i18n("wiki|wiki.show.preview") . "\"><img src=\"" . CopixUrl::getResource('/img/modules/wiki/preview.png') . "\" /></a>\n"; $toReturn .= "</div>"; $toReturn .= "\n<textarea class=\"noresizable\" id=\"wiki_area_content\" name=\"{$name}\"\n cols=\"100\" rows=\"30\">{$content}\n</textarea>\n<div id=\"aj_wiki_prev\" style=\"display: none\">\n</div>\n\n "; $urlofrenderer = _url('generictools|ajax|getwikipreview'); CopixHTMLHeader::addJsCode("\nvar onPreviewMode = false;\nfunction sendForPreview()\n{\n if(!onPreviewMode){\n var borders=\$('wiki_area_content').getStyle('border');\n var width=\$('wiki_area_content').getStyle('width');\n \$('aj_wiki_prev').setStyles({\n 'border': borders,\n 'width' : width\n });\n var aj = new Ajax('" . $urlofrenderer . "',{\n method : 'post',\n update :'aj_wiki_prev',\n data : 'torender='+\$('wiki_area_content').value\n }).request();\n onPreviewMode = true;\n \$('wiki_area_content').setStyle('display','none')\n \$('aj_wiki_prev').setStyle('display','block')\n }else{\n \$('wiki_area_content').setStyle('display','block');\n \$('aj_wiki_prev').setStyle('display','none');\n onPreviewMode = false;\n }\n}\n\nfunction addHeader(n)\n{\n var h=\"\";\n if(n==1) h=\"======\";\n if(n==2) h=\"=====\";\n if(n==3) h=\"====\";\n if(n==4) h=\"===\";\n if(n==5) h=\"==\";\n\n var editor = document.getElementById('wiki_area_content');\n fontStyle(h+\" \",\" \"+h,\"Header\"+n);\n}\n\n/**\n * apply tagOpen/tagClose to selection in textarea, use sampleText instead\n * of selection if there is none copied and adapted from phpBB\n *\n * @author phpBB development team\n * @author MediaWiki development team\n * @author Andreas Gohr <*****@*****.**>\n * @author Jim Raynor <*****@*****.**>\n */\nfunction fontStyle(tagOpen, tagClose, sampleText)\n{\n var txtarea = document.getElementById('wiki_area_content');\n // IE\n if(document.selection && !is_gecko) {\n var theSelection = document.selection.createRange().text;\n var replaced = true;\n if(!theSelection){\n replaced = false;\n theSelection=sampleText;\n }\n txtarea.focus();\n\n // This has change\n text = theSelection;\n if(theSelection.charAt(theSelection.length - 1) == \" \"){// exclude ending space char, if any\n theSelection = theSelection.substring(0, theSelection.length - 1);\n r = document.selection.createRange();\n r.text = tagOpen + theSelection + tagClose + \" \";\n } else {\n r = document.selection.createRange();\n r.text = tagOpen + theSelection + tagClose;\n }\n if(!replaced){\n r.moveStart('character',-text.length-tagClose.length);\n r.moveEnd('character',-tagClose.length);\n }\n r.select();\n // Mozilla\n } else if(txtarea.selectionStart || txtarea.selectionStart == '0') {\n var replaced = false;\n var startPos = txtarea.selectionStart;\n var endPos = txtarea.selectionEnd;\n if(endPos - startPos) replaced = true;\n var scrollTop=txtarea.scrollTop;\n var myText = (txtarea.value).substring(startPos, endPos);\n if(!myText) { myText=sampleText;}\n if(myText.charAt(myText.length - 1) == \" \"){ // exclude ending space char, if any\n subst = tagOpen + myText.substring(0, (myText.length - 1)) + tagClose + \" \";\n } else {\n subst = tagOpen + myText + tagClose;\n }\n txtarea.value = txtarea.value.substring(0, startPos) + subst +\n txtarea.value.substring(endPos, txtarea.value.length);\n txtarea.focus();\n\n //set new selection\n //modified by Patrice Ferlet\n // - selection wasn't good for selected text replaced\n txtarea.selectionStart=startPos+tagOpen.length;\n txtarea.selectionEnd=startPos+tagOpen.length+myText.length;\n\n txtarea.scrollTop=scrollTop;\n // All others\n } else {\n var copy_alertText=alertText;\n var re1=new RegExp(\"\\\$1\",\"g\");\n var re2=new RegExp(\"\\\$2\",\"g\");\n copy_alertText=copy_alertText.replace(re1,sampleText);\n copy_alertText=copy_alertText.replace(re2,tagOpen+sampleText+tagClose);\n var text;\n if (sampleText) {\n text=prompt(copy_alertText);\n } else {\n text=\"\";\n }\n if(!text) { text=sampleText;}\n text=tagOpen+text+tagClose;\n //append to the end\n txtarea.value += text;\n\n // in Safari this causes scrolling\n if(!is_safari) {\n txtarea.focus();\n }\n\n }\n // reposition cursor if possible\n if (txtarea.createTextRange) txtarea.caretPos = document.selection.createRange().duplicate();\n}\n "); return $toReturn; }
/** * */ public function processLaunch() { //Si aucun test n'est donné, on redirige vers la page de choix if (($test = _request('tests')) === null) { return _arRedirect(_url('unittest|')); } //Si on a demandé à lancer les tests avec Ajax, on génère le template d'appel pour chaque élément if (_request('ajax')) { $ppo = new CopixPpo(); $ppo->TITLE_PAGE = 'Lancements des tests unitaires'; $ppo->arTests = $this->_getTest(); return _arPpo($ppo, 'tests.launch.php'); } else { //on a pas demandé d'appel type ajax, donc on lance directement les tests demandés. if (CopixAjax::isAJAXRequest()) { } else { //C'est une demande normale, la réponse sera de type HTML $more = ''; } } //On lance enfin la demande de test $httpClientRequest = new CopixHTTPClientRequest(CopixUrl::appendToUrl(_url() . 'test.php', array('tests' => $test, 'xml' => CopixAjax::isAJAXRequest()))); $httpClient = new CopixHttpClient(); $response = $httpClient->launch($httpClientRequest); return _arContent($response[0]->getBody(), array('content-type' => 'text/html')); }
public function getMenu() { $menu = array(); $menu[] = array('txt' => 'Regroupements', 'url' => CopixUrl::get('regroupements||')); $menu[] = array('txt' => 'Groupes de villes', 'url' => CopixUrl::get('regroupements|villes|')); $menu[] = array('txt' => 'Groupes d\'écoles', 'url' => CopixUrl::get('regroupements|ecoles|')); return $menu; }
/** * Gets the news list. */ function getExemple() { $tpl =& new CopixTpl(); $main = '<p>' . CopixI18N::get('exemple.defaultPageMessage') . '</p>' . '<p><a href="' . CopixUrl::get('hello') . '">' . CopixI18N::get('exemple.clickHere') . '</a> ' . CopixI18N::get('exemple.toSeeWelcome') . '</p>'; $tpl->assign('TITLE_PAGE', CopixI18N::get('exemple.title')); $tpl->assign('MAIN', $main); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
function smarty_function_htmlarea($params, &$smarty) { static $_init = false; extract($params); //check the initialisation if (!$_init) { CopixHtmlHeader::addJsCode('_editor_url = "' . CopixUrl::get() . 'js/htmlarea/";'); //path of the library if (empty($path)) { $path = CopixUrl::get() . 'js/htmlarea/'; //default path under CopiX } CopixHTMLHeader::addJSLink($path . 'htmlarea.js'); CopixHTMLHeader::addJSLink($path . 'dialog.js'); if (empty($lang)) { $lang = CopixI18N::getLang(); } CopixHTMLHeader::addJSLink($path . 'lang/' . $lang . '.js'); CopixHTMLHeader::addCSSLink($path . 'htmlarea.css'); CopixHTMLHeader::addJSLink($path . 'popupwin.js'); CopixHTMLHeader::addJSCode(' HTMLArea.loadPlugin("TableOperations"); HTMLArea.loadPlugin("InsertAnchor"); HTMLArea.loadPlugin("TableToggleBorder"); HTMLArea.loadPlugin("AstonTools"); HTMLArea.loadPlugin("ContextMenu"); '); $_init = true; } if (empty($content)) { $content = ''; } //name of the textarea. if (empty($name)) { $smarty->trigger_error('htmlarea: missing name parameter'); } else { // CopixHTMLHeader::addOthers ($script); if (!$width) { $width = 500; } if (!$height) { $height = 500; } $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("AstonTools"); editor' . $name . '.registerPlugin("ContextMenu"); editor' . $name . '.config.pageStyle = "@import url(\\"' . CopixUrl::get() . 'styles/styles_copix.css\\");"; editor' . $name . '.generate (); </script>'; } return $out; }
/** * Makes URI for list of articles * * @param string $date (YYYYmmdd) * * @return string */ public function makeVueJourUrl($cahierId, $date, $nodeType, $nodeId) { if ($nodeType == "USER_ELE") { $url = CopixUrl::get('cahierdetextes||voirTravaux', array('cahierId' => $cahierId, 'jour' => substr($date, 6, 2), 'mois' => substr($date, 4, 2), 'annee' => substr($date, 0, 4), 'eleve' => $nodeId)); } else { $url = CopixUrl::get('cahierdetextes||voirTravaux', array('cahierId' => $cahierId, 'jour' => substr($date, 6, 2), 'mois' => substr($date, 4, 2), 'annee' => substr($date, 0, 4))); } return $url; }
/** * Efface le cache de Copix (dossiers et BDD) * * @author Christophe Beyer <*****@*****.**> * @since 2006/12/05 */ public function clear() { if (!Admin::canAdmin()) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.noRights'), 'back' => CopixUrl::get())); } CacheServices::clearCache(); CacheServices::clearConfDB(); return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('sysutils||')); }
public function process($pParams, $pContent = null) { $toReturn = ' ' . $pContent . '<br /><br />'; $toReturn .= ' <a href="' . CopixUrl::get($pParams['yes']) . '">' . _i18n('copix:common.buttons.yes') . '</a>'; $toReturn .= ' <a href="' . CopixUrl::get($pParams['no']) . '">' . _i18n('copix:common.buttons.no') . '</a>'; _tag('mootools'); CopixHTMLHeader::addJsCode("\n window.addEvent('domready', function () {\n var elem = new Element('div');\n elem.setStyles({'z-index':99999,'background-color':'white','border':'1px solid black','width':'200px','height':'100px','top': window.getScrollTop().toInt()+window.getHeight ().toInt()/2-100+'px','left':window.getScrollLeft().toInt()+window.getWidth ().toInt()/2-100+'px','position':'absolute','text-align':'center'});\n elem.setHTML ('{$toReturn}');\n elem.injectInside(document.body);\n\n });\n\n "); return null; }
public function process($pParams) { extract($pParams); if (!isset($name)) { throw new CopixTemplateTagException('[AutoComplete] Required parameter name'); } if (!isset($field)) { $field = $name; } if (!isset($id)) { $id = $name; } if (!isset($value)) { $value = ""; } if (!isset($onSelect)) { $onSelect = ""; } if (!isset($onRequest)) { $onRequest = ''; } if (!isset($extra)) { $extra = ''; } if (!isset($pParams['datasource'])) { $pParams['datasource'] = 'dao'; } $toMaj = ''; $onSelectTemp = ''; if (isset($maj)) { $onSelectTemp .= "eleme.selected.id = 'selector_autocomplete';"; foreach ($maj as $key => $field) { $onSelectTemp .= "\n \$\$('#selector_autocomplete .{$key}').each (function (el) {\n \$('{$field}').value = el.innerHTML;\n });\n "; $toMaj .= $key . ';'; } } $onSelect = $onSelectTemp . $onSelect; $url = 'generictools|ajax|getAutoComplete'; if (isset($pParams['url'])) { $url = $pParams['url']; } $length = isset($length) ? $length : 1; $pParams['view'] = isset($pParams['view']) ? $pParams['view'] : $field; $tab = array(); foreach ($pParams as $key => $param) { $tab[$key] = $param; } $tab['nb'] = 10; $tab['tomaj'] = $toMaj; $js = new CopixJSWidget(); $js->tag_autocomplete($id, $name, $length, $tab, _url($url), $js->function_(null, 'el', $onRequest), $js->function_(null, 'el,eleme,element', $onSelect)); CopixHTMLHeader::addJSDOMReadyCode($js); CopixHTMLHeader::addJSLink(_resource('js/taglib/tag_autocomplete.js')); _eTag("mootools", array('plugin' => "observer;autocompleter")); $toReturn = '<input type="text" id="' . $name . '" name="' . $name . '" value="' . $value . '" ' . $extra . ' /><span id="autocompleteload_' . $name . '"><img src="' . CopixUrl::getResource('img/tools/load.gif') . '" /></span>'; return $toReturn; }
/** * Génération du code HTML * @return string */ public function process($pParams) { //Test si le parametre correspondant au type existe if (isset($pParams['type'])) { $type = $pParams['type']; } else { //Sinon on génère une exception précisant que le type est manquant throw new CopixTemplateTagException('CopixImage: missing type parameter'); } //Si une propriété correspond au type saisi if (CopixI18N::exists('copix:common.buttons.' . $type)) { //On récupère le libellé de ce type $alt = _i18n('copix:common.buttons.' . $type); } else { //Sinon on génère une erreur throw new CopixException('You must enter an existing type'); } //identifiant sur le href $idimg = ''; $idhref = ''; if (isset($pParams['id'])) { $idimg = 'id="' . $pParams['id'] . '_img"'; $idhref = 'id="' . $pParams['id'] . '_href"'; } //Initialisation du type if (isset($pParams['title'])) { $title = $pParams['title']; } else { $title = $alt; } if (isset($pParams['class'])) { $class = 'class="' . $pParams['class'] . '"'; } else { $class = ''; } //Création du chemin ou se trouve l'image $fileName = str_replace(CopixUrl::getRequestedBaseUrl(), './', _resource("img/tools/" . $type . ".png")); //Test si le fichier existe if (file_exists($fileName)) { $src = _resource("img/tools/" . $type . ".png"); } else { throw new CopixException('No icon does not correspond to your application'); } if (isset($pParams['text'])) { $text = $pParams['text']; } else { $text = ''; } //si une url a été renseignée if (isset($pParams['href'])) { $href = $pParams['href']; return '<a href="' . $href . '" ' . $idhref . ' title="' . $title . '" ' . $class . '><img src="' . $src . '" ' . $idimg . ' alt="' . $alt . '"/>' . $text . '</a>'; } else { return '<img src="' . $src . '" ' . $idimg . ' alt="' . $alt . '" title="' . $title . '" ' . $class . ' />' . $text; } }
public function _createContent(&$toReturn) { $ppo = new CopixPPO(); $toReturn = ""; $ppo->legals = _i18n('public|public.nav.copyright'); // $ppo->legals .= " | <a href=".CopixUrl::get ('aide||')." title="._i18n('public|public.aide')."><b>"._i18n('public|public.aide')."</b></a>"; $ppo->legals .= " - <a href=\"" . CopixUrl::get('public||aPropos') . "\" title=\"" . _i18n('public|public.apropos') . "\">" . _i18n('public|public.apropos') . "</a>"; $toReturn = $this->_usePPO($ppo, 'legals.tpl'); return true; }
/** * Plugin smarty type fonction * Purpose: get the current url. * * Input: assign = (optional) name of the template variable we'll assign * the output to instead of displaying it directly * * Examples: */ function smarty_function_currenturl($params, &$this) { $assign = CopixUrl::getCurrentUrl(); if (isset($params['assign'])) { $this->assign($params['assign'], $assign); return ''; } else { return $assign; } }
/** * Envoie un minimail * * @author Christophe Beyer <*****@*****.**> * @since 2005/10/18 * @param string title Titre du minimail * @param string message Corps du minimail * @param integer from_id Id utilisateur de l'exp�diteur * @param array destin Id tableau avec les destinataires (cl� = id user) * @return mixed Id du message cr�� ou NULL si erreur */ public function sendMinimail($title, $message, $from_id, $destin, $format) { $res = NULL; $DAOminimail_from = _dao("minimail|minimail_from"); $DAOminimail_to = _dao("minimail|minimail_to"); $newMp = _record("minimail|minimail_from"); $newMp->title = $title; $newMp->message = $message; $newMp->format = $format; $newMp->date_send = date("Y-m-d H:i:s"); $newMp->from_id = $from_id; $newMp->is_deleted = 0; $DAOminimail_from->insert($newMp); if ($newMp->id !== NULL) { //print_r($newMp); // On parcourt chaque destinataire while (list($to_id, ) = each($destin)) { // print_r("to_id=$to_id / to_login=$to_login"); $newDest = _record("minimail|minimail_to"); $newDest->id_message = $newMp->id; $newDest->to_id = $to_id; $newDest->date_read = 0; $newDest->is_read = 0; $newDest->is_replied = 0; $newDest->is_deleted = 0; $DAOminimail_to->insert($newDest); // ======= Alerte mail =============== // On vérifie que l'envoi de mails est activé, qu'un serveur SMTP est configuré, que le destinataire a coché l'option "etre prêvenu par mail" et qu'il a renseigné un mail if ($newDest->id2 && CopixConfig::get('|mailEnabled') == 1 && CopixConfig::get('|mailSmtpHost')) { $prefs = Prefs::getPrefs($to_id); if (isset($prefs['prefs']['alerte_mail_email']) && isset($prefs['minimail']['alerte_minimail']) && $prefs['prefs']['alerte_mail_email'] && $prefs['minimail']['alerte_minimail'] == 1) { $userInfoFrom = Kernel::getUserInfo("ID", $from_id); //print_r($userInfoFrom); $to = $prefs['prefs']['alerte_mail_email']; $auteur = utf8_decode($userInfoFrom['prenom'] . ' ' . $userInfoFrom['nom'] . ' (' . $userInfoFrom['login'] . ')'); $subject = CopixI18N::get('minimail|minimail.mail.alert.subject', array($auteur)); $message = str_replace('<br />', "\n", CopixI18N::get('minimail|minimail.mail.alert.body', array($auteur, CopixUrl::get('minimail||getMessage', array('id' => $newMp->id)), CopixUrl::get()))); $from = CopixConfig::get('default|mailFrom'); $fromName = CopixConfig::get('default|mailFromName'); $cc = $cci = ''; $monMail = new CopixTextEMail($to, $cc, $cci, $subject, $message); $send = $monMail->send($from, $fromName); } } // ======= Fin alerte mail =============== } $res = $newMp->id; if ($res) { $plugStats = CopixPluginRegistry::get("stats|stats"); $plugStats->setParams(array('module' => 'minimail', 'action' => 'sendMinimail', 'objet_a' => $res)); } } return $res; }
public function CopixSwfChart($swf = false, $library = false) { $this->swf_file = $swf; $this->library = $library; if (!$swf) { $this->swf_file = CopixUrl::get() . "swfs/charts.swf"; } if (!$library) { $this->library = CopixUrl::get() . "swfs/charts_library"; } }
/** * @author Christophe Beyer <*****@*****.**> * @since 2006/03/23 */ public function _createContent(&$toReturn) { $blog = $this->getParam('blog', null); $tpl = new CopixTpl(); $arArticle = _ioDAO('blog|blogarticle')->findPublic(array('categories' => true, 'nb' => intval(CopixConfig::get('public|rss.nbArticles')))); $rss = array('title' => CopixI18N::get('public|public.rss.flux.title'), 'link' => CopixUrl::get(), 'description' => CopixI18N::get('public|public.rss.flux.description'), 'language' => 'fr-fr', 'copyright' => "Iconito", 'generator' => "Iconito", 'logo' => 0); $tpl->assign('rss', $rss); $tpl->assign('blog', $blog); $tpl->assign('listArticle', $arArticle); $toReturn = $tpl->fetch('rss.tpl'); return true; }
public function __construct() { /* * CONFIG : */ $this->imageRootPath = COPIX_WWW_PATH . 'static' . DS . 'images' . DS; $this->imageRootURI = CopixUrl::get() . '/static/images/'; //initialization : make root directory if (!file_exists($this->imageRootPath)) { mkdir($this->imageRootPath, 0770, true); } }
public function setUp() { $this->_client = new soapClient(CopixUrl::getRequestedProtocol() . CopixUrl::getRequestedBasePath() . "index.php/wsserver/default/wsdl"); $sp = _daoSearchParams(); $sp->addCondition('login_dbuser', '=', 'WSUser'); _dao('auth|dbuser')->deleteBy($sp); $record = _daoRecord('auth|dbuser'); $record->login_dbuser = '******'; $record->password_dbuser = md5('WSUserPassword'); $record->email_dbuser = "******"; $record->enabled_dbuser = "******"; _dao('auth|dbuser')->insert($record); }
/** * Installe le jeu d'essai * * @author Christophe Beyer <*****@*****.**> * @since 2006/10/26 */ public function processInstall() { global $params; $db = new Demo_DB(); $tools = new Demo_Tools(); $db->extract_db_infos(); $db->db_connect(); $fileSQL = '../instal/demo/jeu_essai.sql'; $errors = array(); if (CopixConfig::get('kernel|jeuEssaiInstalled') == 1) { $errors[] = CopixI18N::get('sysutils|demo.error.alreadyInstalled'); } elseif (!is_file($fileSQL)) { $errors[] = CopixI18N::get('sysutils|demo.error.noFileSql'); } if ($errors) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $errors), 'back' => CopixUrl::get())); } $contents = file_get_contents($fileSQL); $lines = explode(";\n", $contents); $path = CopixUrl::getRequestedScriptPath(); foreach ($lines as $line) { $line = trim($line); if ($line) { $line = str_replace('<PATH>', $path, $line); // print_r("<br>***line=".$line); $db->run_query($line); } } $db->db_close(); // Copie des dossiers (pas de slashs à la fin!) $tools->installFolder('www/static/malle/2_9a4ba0cdef'); $tools->installFolder('var/data/blog/logos'); $tools->installFolder('www/static/album/2_be8550b87c'); $tools->installFolder('www/static/album/3_cf057489c9'); $tools->installFolder('www/static/album/4_c996b6cf13'); $tools->installFolder('www/static/prefs/avatar'); // Fin CopixConfig::set('kernel|jeuEssaiInstalled', 1); // Vidage de cache CacheServices::clearCache(); CacheServices::clearConfDB(); $tpl = new CopixTpl(); $tpl->assign('TITLE_PAGE', CopixI18N::get('sysutils|demo.titlePage')); $tplDemo = new CopixTpl(); //$tplDemo->assign ("toto", 1); $tplDemo->assign('demo_txt_installed', CopixI18N::get('sysutils|demo.txt.installed')); $tplDemo->assign('demo_txt_accounts', CopixI18N::get('sysutils|demo.txt.accounts')); $tpl->assign("MAIN", $tplDemo->fetch("demo_install.tpl")); $tpl->assign('MENU', Admin::getMenu('demo')); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
/** * ctor * @param string $action Action name * @param string $description Description name * @param string $module Module name * @param array $params specific parametres */ function ProjectUrl($action = null, $description = null, $module = null, $params = array()) { $_url = COPIX_NAME_CODE_ENTRY; CopixUrl::CopixUrl($_url, $params); if ($action !== null) { $this->setAction($action); } if ($description !== null) { $this->setDescription($description); } if ($module !== null) { $this->setModule($module); } }
public function home() { if (!Kernel::isAdmin()) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.noRights'), 'back' => CopixUrl::get())); } $tplHome = new CopixTpl(); $tpl = new CopixTpl(); $tpl->assign('TITLE_PAGE', CopixI18N::get('sysutils|admin.moduleDescription')); $tpl->assign('MENU', Admin::getMenu('sysutils')); $tplHome->assign('superadmin', Kernel::isSuperAdmin()); $tplHome->assign('adminfonctionnel', Kernel::isAdminFonctionnel()); $tpl->assign('MAIN', $tplHome->fetch('sysutils|home.tpl')); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
/** * Simple fonction de get pour tester les URL significatives */ public function get($dest, $parameters, $mode) { $toReturn = new CopixUrlHandlerGetResponse(); if ($dest['module'] == 'copixtest' && $dest['group'] == 'google') { $toReturn->externUrl = 'http://www.google.fr'; return $toReturn; } if (isset($parameters['var'])) { $toReturn->path = array_merge($dest, array('var' => CopixUrl::escapeSpecialChars($parameters['var']))); unset($parameters['var']); } $toReturn->vars = $parameters; 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 = ' '; } //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; }
/** * Plugin smarty type fonction * Purpose: get the current url. * * Input: assign = (optional) name of the template variable we'll assign * the output to instead of displaying it directly * * Examples: */ function smarty_function_currenturl($params, &$me) { if (isset($params['notxml'])) { $isxml = $params['notxml'] == 'true' ? false : true; } else { $isxml = true; } $assign = CopixUrl::getCurrentUrl($isxml); if (isset($params['assign'])) { $me->assign($params['assign'], $assign); return ''; } else { return $assign; } }