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); }
/** * 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; }
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'); }
/** * 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 testGet() { // Test si on récupère une adresse par défault $this->assertRegexp('/^http:\\/\\/.*www\\/$/', CopixUrl::get()); $this->assertRegexp('/^http:\\/\\/.*www/', CopixUrl::get("#")); // Test des URL récupérées en mode prepend CopixConfig::instance()->significant_url_mode = 'prepend'; // On attend ici une URL en utilisant tous les cas du paramètre $pDest // @todo : Changer le test quand on voudra enlever le deuxième default $this->assertRegexp('/^http:\\/\\/.*\\/default\\/default\\/copixtest/', _url('copixtest')); $params = new StdClass(); $this->assertRegexp('/^http:\\/\\/.*\\/default\\/default\\/copixtest/', _url('copixtest', $params)); $this->assertRegexp('/^http:\\/\\/.*\\/default\\/copixtest/', _url('copixtest|')); $this->assertRegexp('/^http:\\/\\/.*\\/copixtest/', _url('copixtest||')); // On cherche l'URL d'un module avec une variable définie dans une fichier significanturl $this->assertRegexp('/^http:\\/\\/.*?test=value$/', _url('copixtest||', array('test' => 'value'))); $params = new StdClass(); $params->test = 'value'; $this->assertRegexp('/^http:\\/\\/.*?test=value$/', _url('copixtest||', $params)); // On cherche l'URL d'un module avec une variable non définie dans une fichier significanturl $this->assertRegexp('/^http:\\/\\/.*\\/value$/', _url('copixtest||', array('var' => 'value'))); // On cherche l'URL d'un module inexistant dans le site // @todo : Changer le test quand on voudra enlever le deuxième default $this->assertRegexp('/^http:\\/\\/.*\\/test$/', _url('test||')); // Test des URL récupérées en mode default CopixConfig::instance()->significant_url_mode = 'default'; // On cherche l'URL d'un module avec une variable définie dans une fichier significanturl $this->assertRegexp('/^http:\\/\\/.*\\?module=copixtest.*&test=value$/', _url('copixtest||', array('test' => 'value'))); // On cherche l'URL d'un module avec une variable non définie dans une fichier significanturl $this->assertRegexp('/^http:\\/\\/.*\\?module=copixtest.*&var=value$/', _url('copixtest||', array('var' => 'value'))); // On cherche l'URL d'un module inexistant dans le site $this->assertRegexp('/^http:\\/\\/.*\\?module=test/', _url('test||')); $this->assertEquals('http://www.google.fr', _url('copixtest|google|')); }
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(); }
/** * 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); }
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; }
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 _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; }
/** * 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); } }
/** * 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); }
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); }
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; }
/** * Logs out * @return Object CopixActionReturn */ function doLogout() { $plugAuth =& $GLOBALS['COPIX']['COORD']->getPlugin('auth|auth'); $user =& $plugAuth->getUser(); $user->logout(); if (intval(CopixConfig::get('auth|enableAfterLogoutOverride')) == 1 && isset($this->vars['auth_url_return']) && !empty($this->vars['auth_url_return'])) { $url_return = $this->vars['auth_url_return']; } else { $url_return = CopixConfig::get('auth|afterLogout'); } //check if the url return is correct. if (strpos($url_return, 'http://') === false) { $url_return = CopixUrl::get() . $url_return; } return new CopixActionReturn(COPIX_AR_REDIRECT, $url_return); }
/** * Affiche la liste des blogs ayant au moins un article * * @author Christophe Beyer <*****@*****.**> * @since 2006/03/23 * @param string $kw Mot-clé pour la recherche (option) */ public function _createContent(&$toReturn) { CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_fichesecoles.js'); $kw = $this->getParam('kw', null); $tpl = new CopixTpl(); $dao = _dao("blog|blog"); if ($kw) { $critere = " SELECT * FROM module_blog WHERE is_public=1 AND name_blog LIKE '%" . addslashes($kw) . "%' ORDER BY name_blog"; } else { $critere = " SELECT * FROM module_blog WHERE is_public=1 AND 1 ORDER BY name_blog"; } $sql = _doQuery($critere); $list = array(); //print_r($sql); foreach ($sql as $blog) { $parent = Kernel::getModParentInfo("MOD_BLOG", $blog->id_blog); if ($parent) { $blog->parent = $parent['nom']; switch ($parent['type']) { case 'CLUB': $blog->type = CopixI18N::get('public.blog.typeClub'); break; case 'BU_CLASSE': $blog->type = CopixI18N::get('public.blog.typeClasse'); break; case 'BU_ECOLE': $blog->type = CopixI18N::get('public.blog.typeEcole'); break; case 'BU_VILLE': $blog->type = CopixI18N::get('public.blog.typeVille'); break; default: $blog->type = $parent['type']; break; } } $blog->stats = KernelBlog::getStats($blog->id_blog); //print_r($blog); if ($blog->stats['nbArticles']['value'] > 0) { $list[] = $blog; } } usort($list, "order_tab_blogs"); $tpl->assign('list', $list); $toReturn = $tpl->fetch('getlistblogszone.tpl'); return true; }
/** * Ajoute un message à une liste, et s'occupe de l'envoyer à tous ses membres en minimail * * @author Christophe Beyer <*****@*****.**> * @since 2005/11/23 * @param integer $liste Id de la liste * @param integer $auteur Id de l'utilisateur auteur du message * @param string $titre Titre du message * @param string $message Corps du message * @return integer l'Id du message inséré ou NULL si erreur */ public function addListeMessage($liste, $auteur, $titre, $message) { $daoListes = _dao("liste|liste_listes"); $daoMessages = _dao("liste|liste_messages"); $kernelService =& CopixClassesFactory::Create('kernel|kernel'); $minimailService =& CopixClassesFactory::Create('minimail|minimailService'); $res = NULL; $rListe = $daoListes->get($liste); if ($rListe) { $parent = $kernelService->getModParentInfo("MOD_LISTE", $liste); //print_r($parent); $rListe->parent = $parent; //die(); $newMessage = _record("liste|liste_messages"); $newMessage->liste = $liste; $newMessage->auteur = $auteur; $newMessage->titre = $titre; $newMessage->message = $message; $newMessage->date = date("Y-m-d H:i:s"); $daoMessages->insert($newMessage); if ($newMessage->id !== NULL) { $dest = array(); // On cherche le parent $parent = $kernelService->getModParentInfo("MOD_LISTE", $liste); // Puis les membres du parent $childs = $kernelService->getNodeChilds($parent["type"], $parent["id"]); // On parcourt les membres foreach ($childs as $child) { $userInfo = $kernelService->getUserInfo($child["type"], $child["id"]); if ($userInfo && $userInfo["user_id"] && $userInfo["user_id"] != $auteur) { $dest[$userInfo["user_id"]] = 1; } } if ($dest) { $format = CopixConfig::get('minimail|default_format'); if ($format == 'dokuwiki' || $format == 'wiki') { $message .= "\n\n----\n" . CopixI18N::get('liste|liste.message.footer', array(1 => $rListe->parent["nom"], 2 => CopixUrl::get($rListe->parent["module"] . '||getHomeAdmin', array("id" => $rListe->parent["id"])))); } else { $message .= "<p>-- </p><p>" . CopixI18N::get('liste|liste.message.footerHtml', array(1 => $rListe->parent["nom"], 2 => CopixUrl::get($rListe->parent["module"] . '||getHomeAdmin', array("id" => $rListe->parent["id"])))) . "</p>"; } $send = $minimailService->sendMinimail($titre, $message, $auteur, $dest, CopixConfig::get('minimail|default_format')); } $res = $newMessage->id; } } return $res; }
public function beforeProcess(&$action) { if (CopixConfig::get('conf_Saml_actif') != 1) { return; } require_once COPIX_UTILS_PATH . '../../simplesamlphp/lib/_autoload.php'; $asId = 'iconito-sql'; if (CopixConfig::exists('default|conf_Saml_authSource') && CopixConfig::get('default|conf_Saml_authSource')) { $asId = CopixConfig::get('default|conf_Saml_authSource'); } $as = new SimpleSAML_Auth_Simple($asId); $ppo->user = _currentUser(); if ($as->isAuthenticated() && !$ppo->user->isConnected()) { $attributes = $as->getAttributes(); $uidAttribute = 'login_dbuser'; if (CopixConfig::exists('default|conf_Saml_uidAttribute') && CopixConfig::get('default|conf_Saml_uidAttribute')) { $uidAttribute = CopixConfig::get('default|conf_Saml_uidAttribute'); } $ppo->saml_user = null; if (isset($attributes[$uidAttribute]) && isset($attributes[$uidAttribute][0])) { $ppo->saml_user = $attributes[$uidAttribute][0]; } if ($ppo->saml_user) { $ppo->iconito_user = Kernel::getUserInfo("LOGIN", $ppo->saml_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'); return new CopixActionReturn(COPIX_AR_REDIRECT, $url_return); } else { $ppo->cas_error = 'no-iconito-user'; return _arPpo($ppo, 'cas.tpl'); } } } if (!$as->isAuthenticated() && $ppo->user->isConnected()) { $ppo->user = _currentUser(); if ($ppo->user->isConnected()) { CopixAuth::getCurrentUser()->logout(array()); CopixEventNotifier::notify('logout', array('login' => CopixAuth::getCurrentUser()->getLogin())); CopixAuth::destroyCurrentUser(); CopixSession::destroyNamespace('default'); } } }
public function _createContent(&$toReturn) { //Getting the user. //Create Services, and DAO CopixHTMLHeader::addCSSLink(_resource("styles/module_blog_admin.css")); CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_blog.js'); $tpl = new CopixTpl(); $id_blog = $this->getParam('id_blog', ''); $tpl->assign('article', $this->getParam('article', null)); $tpl->assign('kind', $this->getParam('kind', null)); $tpl->assign('id_blog', $id_blog); $tpl->assign('id_bact', $this->getParam('id_bact', '')); $tpl->assign('errors', $this->getParam('errors', '')); $tpl->assign('showErrors', $this->getParam('showErrors', false)); $tpl->assign('preview', $this->getParam('preview', '0')); $tpl->assign('tabArticleCategory', $this->getParam('tabArticleCategory', null)); $tpl->assign('can_format_articles', CopixConfig::get('blog|blog.default.can_format_articles')); $tpl->assign('default_format_articles', CopixConfig::get('blog|blog.default.default_format_articles')); $formats = CopixConfig::get('blog|blog.formats_articles'); $tabFormats = explode(',', $formats); $values = $output = array(); foreach ($tabFormats as $k) { $values[] = $k; $output[] = CopixI18N::get('blog|blog.default_format_articles.' . $k); } $tpl->assign('format_bact', array('values' => $values, 'output' => $output)); $art = $this->getParam('article'); $tpl->assign('edition_sumary', CopixZone::process('kernel|edition', array('field' => 'sumary_bact', 'format' => $art->format_bact, 'content' => $art->sumary_bact, 'options' => array('toolbarSet' => 'IconitoBlog'), 'object' => array('type' => 'MOD_BLOG', 'id' => $this->getParam('id_blog')), 'height' => 160))); $tpl->assign('edition_content', CopixZone::process('kernel|edition', array('field' => 'content_bact', 'format' => $art->format_bact, 'content' => $art->content_bact, 'options' => array('toolbarSet' => 'IconitoBlog'), 'object' => array('type' => 'MOD_BLOG', 'id' => $this->getParam('id_blog')), 'height' => 290))); //cat�gorie de l'article if ($this->getParam('kind', null) == 1) { $article = $this->getParam('article', null); $idCategorie = $article->tabSelectCat[0]; foreach ($this->getParam('tabArticleCategory', null) as $key => $obj) { if ($obj->id_bacg == $idCategorie) { $categorie = $obj->name_bacg; } } $tpl->assign('categorie', $categorie); } $tpl->assign('canWriteOnline', BlogAuth::canMakeInBlog('ADMIN_ARTICLE_MAKE_ONLINE', create_blog_object($id_blog))); // retour de la fonction : $toReturn = $tpl->fetch('article.edit.tpl'); return true; }
/** * Affiche le chemin d'accès à un dossier, depuis la racine d'une malle * * @author Christophe Beyer <*****@*****.**> * @since 2005/12/07 * @param integer $malle Id de la malle * @param integer $folder Id du dossier courant (0 si racine) * @param string $action Action (au sens Copix) des liens utilisés. Si vide=>"getMalle" * @param string $field (option) Nom du champ pour l'insertion d'un lien vers un doc, utilisé en mode Popup * @param string $format (option) Format de la zone de saisie (wiki, html, fckeditor...), utilisé en mode Popup */ public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $daoFolders = _dao("malle|malle_folders"); $res = array(); $malle = $this->getParam('malle') ? $this->getParam('malle') : NULL; $folder = $this->getParam('folder') ? $this->getParam('folder') : NULL; $action = $this->getParam('action') ? $this->getParam('action') : 'getMalle'; $field = $this->getParam('field') ? $this->getParam('field') : NULL; $format = $this->getParam('format') ? $this->getParam('format') : NULL; //Kernel::deb("format=$format"); //print_r ("malle=$malle / folder=$folder"); if ($folder) { $fusible = 99; $parent = -1; while ($fusible > 0 && $parent != 0) { $rFolder = $daoFolders->get($folder); if ($rFolder) { //print_r($rFolder); $linkParams = array("id" => $malle, "folder" => $rFolder->id); if ($field) { $linkParams['field'] = $field; } if ($format) { $linkParams['format'] = $format; } $res[] = array("libelle" => $rFolder->nom, "lien" => CopixUrl::get('malle||' . $action, $linkParams)); $parent = $rFolder->parent; $folder = $parent; } $fusible--; } } $linkParams = array("id" => $malle); if ($field) { $linkParams['field'] = $field; } if ($format) { $linkParams['format'] = $format; } $res[] = array("libelle" => CopixI18N::get('malle|malle.root'), "lien" => CopixUrl::get('malle||' . $action, $linkParams)); $tpl->assign('petitpoucet', array_reverse($res)); $toReturn = $tpl->fetch('petitpoucet.tpl'); return true; }
function smarty_function_calendar($params, &$smarty) { static $_init = false; extract($params); //check the initialisation if (!$_init) { //path of the library CopixHTMLHeader::addCSSLink(CopixUrl::get() . "js/dynCal/dynCalendar.css", array('media' => 'screen')); CopixHTMLHeader::addJSLink(CopixUrl::get() . "js/dynCal/browserSniffer.js"); CopixHTMLHeader::addJSLink(CopixUrl::get() . "js/dynCal/dynCalendar.js"); if (empty($lang)) { $lang = CopixI18N::getLang(); } CopixHTMLHeader::addJSLink(CopixUrl::get() . "js/dynCal/lang/" . $lang . ".js"); $_init = true; } //Calculating the jsCode (kind of silly trick to use a separator as a part of jsCode, but still quick) $jsCode = str_replace(array('d', 'm', 'Y'), array('day', 'month', 'year'), CopixI18N::getDateFormat(" + '/' + ")); CopixHTMLHeader::addJSCode("\n\r" . ' function calendarCallback' . $name . '(day, month, year) { var tmp; if (String(month).length == 1) { month = \'0\' + month; } if (String(day).length == 1) { day = \'0\' + day; } tmp = document.getElementById (\'' . $name . '\'); tmp.value = ' . $jsCode . '; } ' . "\n\r"); //name of the textarea. if (empty($name)) { $smarty->trigger_error('[smarty_calendar] missing name parameter'); } else { $out = '<input type="text" class="calendar" id="' . $name . '" name="' . $name . '" value="' . $value . '">' . "\n\r"; $out .= '<script language="javascript" type="text/javascript">' . "\n\r"; $out .= '<!--' . "\n\r"; $out .= 'calendar_' . $name . ' = new dynCalendar(\'calendar_' . $name . '\', \'calendarCallback' . $name . '\', \'' . CopixUrl::get() . 'js/dynCal/images/\');' . "\n\r"; $out .= '//-->' . "\n\r"; $out .= '</script>' . "\n\r"; } return $out; }
/** * Renvoie le menu de toutes les pages d'admin * * @author Christophe Beyer <*****@*****.**> * @since 2007/03/19 * @param string $iCurrentTab Onglet selectionne * @return string Contenu du menu (liens...) */ public function getMenu($iCurrentTab = '') { $menu = array(); $menu[] = array('txt' => CopixI18N::get('sysutils|admin.shortDescription'), 'url' => CopixUrl::get('sysutils||'), 'current' => $iCurrentTab == 'sysutils'); $menu[] = array('txt' => CopixI18N::get('sysutils|admin.menu.cache'), 'url' => CopixUrl::get('sysutils|cache|'), 'current' => $iCurrentTab == 'cache'); $menu[] = array('txt' => CopixI18N::get('sysutils|admin.menu.stats'), 'url' => CopixUrl::get('sysutils|stats|'), 'current' => $iCurrentTab == 'stats'); if (Kernel::isSuperAdmin()) { $menu[] = array('txt' => CopixI18N::get('sysutils|admin.menu.demo'), 'url' => CopixUrl::get('sysutils|demo|'), 'current' => $iCurrentTab == 'demo'); /* $menu[] = array( 'txt' => CopixI18N::get ('sysutils|admin.menu.grvilles'), 'url' => CopixUrl::get ('sysutils|grvilles|') ); */ $menu[] = array('txt' => CopixI18N::get('sysutils|admin.menu.phpinfo'), 'url' => CopixUrl::get('sysutils|admin|phpinfo'), 'current' => $iCurrentTab == 'phpinfo'); } $menu[] = array('txt' => CopixI18N::get('sysutils|admin.menu.groupes'), 'url' => CopixUrl::get('sysutils|groupes|'), 'current' => $iCurrentTab == 'groupes'); return $menu; }
public function getHomePage() { if (!Kernel::isAdmin()) { return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('||')); } $tpl = new CopixTpl(); $tplRegroupements = new CopixTpl(); // CopixHTMLHeader::addCSSLink (_resource("styles/module_grvilles.css")); // $tpl->assign ('TITLE_PAGE', CopixI18N::get ('grvilles|grvilles.module.titre')); $dao_grvilles = CopixDAOFactory::create("regroupements|grvilles"); $grvilles = $dao_grvilles->findAll(); $tplRegroupements->assign('GRVILLES', count($grvilles)); $dao_grecoles = CopixDAOFactory::create("regroupements|grecoles"); $grecoles = $dao_grecoles->findAll(); $tplRegroupements->assign('GRECOLES', count($grecoles)); $main = $tplRegroupements->fetch('default.tpl'); $tpl->assign('MAIN', $main); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }