public function _createContent(&$toReturn) { //Getting the user. //Create Services, and DAO $tpl = new CopixTpl(); $tpl->assign('blog', $this->getParam('blog', null)); $tpl->assign('kind', $this->getParam('kind', null)); $tpl->assign('id_blog', $this->getParam('id_blog', '')); $tpl->assign('errors', $this->getParam('errors', '')); $tpl->assign('showErrors', $this->getParam('showErrors', '')); $tpl->assign('logoPath', $this->getParam('logoPath', null)); $tpl->assign('tabBlogFunctions', $this->getParam('tabBlogFunctions', null)); $tpl->assign('can_format_articles', CopixConfig::get('blog|blog.default.can_format_articles')); $tpl->assign('is_public', array('values' => array(1, 0), 'output' => array(CopixI18N::get('blog|blog.oui'), CopixI18N::get('blog|blog.non')))); $tpl->assign('has_comments_activated', array('values' => array(1, 0), 'output' => array(CopixI18N::get('blog|blog.oui'), CopixI18N::get('blog|blog.non')))); $tpl->assign('type_moderation_comments', array('values' => array('POST', 'PRE'), 'output' => array(CopixI18N::get('blog|blog.type_moderation_comments.post'), CopixI18N::get('blog|blog.type_moderation_comments.pre')))); if (CopixConfig::get('blog|blog.default.can_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('default_format_articles', array('values' => $values, 'output' => $output)); } else { $tpl->assign('default_format_articles', CopixConfig::get('blog|blog.default.default_format_articles')); } $tpl->assign('logo_max_width', CopixConfig::get('blog|blog.default.logo_max_width')); // retour de la fonction : $toReturn = $tpl->fetch('blog.edit.tpl'); return true; }
/** * Création du contenu de la page */ public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $tpl->assign('arModulesPath', CopixConfig::instance()->arModulesPath); $tpl->assign('arModules', $this->_getModuleOrderByDescription()); $toReturn = $tpl->fetch('modules.list.tpl'); }
/** * Surcharge de la fonction de vérification de l'enregistrement pour avoir les bons libellés. * @param DAORecord $pRecord L'enregistrement à vérifier */ public function check($pRecord) { //vérifications standards. if (($arErrors = $this->_compiled_check($pRecord)) === true) { $arErrors = array(); } //vérification du format du mail try { if (isset($pRecord->authoremail_comment)) { CopixFormatter::getMail($pRecord->authoremail_comment); } } catch (Exception $e) { $arErrors[] = $e->getMessage(); } // vérification de l'antispam if (CopixConfig::get('comments|captcha') != 0 && !isset($pRecord->noCaptcha)) { $results = _ioDAO('commentscaptcha')->findBy(_ioDAOSp()->addCondition("captcha_id", "=", $pRecord->captcha_id)); if (!(isset($results[0]) && $results[0]->captcha_answer == $pRecord->captcha_answer)) { $arErrors[] = _i18n('comments.admin.captcha.error'); } } //on remplace avec les bons libellés foreach ($arErrors as $key => $error) { $arErrors[$key] = str_replace(array('"content_comment"', '"authoremail_comment"', '"authorsite_comment"', '"authorlogin_comment"'), array(_i18n('comments.list.content'), _i18n('comments.list.mail'), _i18n('comments.list.site'), _i18n('comments.list.author')), $error); } //erreurs s'il en existe, true sinon return count($arErrors) == 0 ? true : $arErrors; }
public function _createContent(&$toReturn) { $ppo = new CopixPPO(); // Récupération des paramètres $ppo->classeurId = $this->getParam('classeurId'); $ppo->dossierId = $this->getParam('dossierId'); $ppo->current = $this->getParam('current'); // Gestion des droits $ppo->niveauUtilisateur = Kernel::getLevel('MOD_CLASSEUR', $ppo->classeurId); $ppo->typeUtilisateur = _currentUser()->getExtra('type'); $ppo->vue = !is_null(_sessionGet('classeur|typeVue')) ? _sessionGet('classeur|typeVue') : 'liste'; $ppo->conf_ModClasseur_options = CopixConfig::exists('default|conf_ModClasseur_options') ? CopixConfig::get('default|conf_ModClasseur_options') : 0; // L'album public est t-il publié ? $ppo->estPublic = false; if (!is_null($ppo->dossierId) && $ppo->dossierId != 0) { $dossierDAO = _ioDAO('classeur|classeurdossier'); $ppo->dossier = $dossierDAO->get($ppo->dossierId); if ($ppo->dossier->public) { $ppo->estPublic = true; } } else { $classeurDAO = _ioDAO('classeur|classeur'); $classeur = $classeurDAO->get($ppo->classeurId); if ($classeur->public) { $ppo->estPublic = true; } } $toReturn = $this->_usePPO($ppo, '_affichage_menu.tpl'); }
public function getTagsByGroups($idGroups = array()) { $groupsCollection = array(); foreach ($idGroups as $idGroup) { $groupsCollection[$idGroup]['tags'] = $this->getTagsByGroup($idGroup); } //calculate tags weight for group List $tagCollection = array(); $max = 1; foreach ($groupsCollection as $group) { foreach ($group['tags'] as $tag) { if (!isset($tagCollection[$tag['name']])) { $tagCollection[$tag['name']] = 1; } else { $tagCollection[$tag['name']]++; if ($tagCollection[$tag['name']] > $max) { $max = $tagCollection[$tag['name']]; } } } } //ponderate between 1 and 100 $ponde = 100 / $max; $ponderation = CopixConfig::get('groupe|ponderation'); foreach ($tagCollection as $tagName => $weight) { $tagCollection[$tagName] = round($weight * $ponde / $ponderation); } return $return = array('tags' => $tagCollection, 'groups' => $groupsCollection); }
function _createContent(&$toReturn) { $tpl =& new CopixTpl(); $dao =& CopixDAOFactory::create('Comment'); $sp =& CopixDAOFactory::createSearchConditions(); $sp->addCondition('id_cmt', '=', $this->params['id']); $sp->addCondition('type_cmt', '=', $this->params['type']); $sp->addItemOrder('position_cmt', 'desc'); $arData = $dao->findBy($sp); if (count($arData) > 0) { $perPage = isset($this->params['perPage']) ? intval($this->params['perPage']) : intval(CopixConfig::get('comment|perPage')); $params = array('perPage' => $perPage, 'delta' => 5, 'recordSet' => $arData, 'template' => '|pager.tpl'); $Pager = CopixPager::Load($params); $tpl->assign('pager', $Pager->GetMultipage()); $tpl->assign('comments', $Pager->data); } $tpl->assign('back', $this->params['back']); $tpl->assign('id', $this->params['id']); $tpl->assign('type', $this->params['type']); $adminEnabled = CopixUserProfile::valueOf('site', 'siteAdmin') >= PROFILE_CCV_MODERATE; $tpl->assign('adminEnabled', $adminEnabled); $plugAuth =& $GLOBALS['COPIX']['COORD']->getPlugin('auth|auth'); $user =& $plugAuth->getUser(); $tpl->assign('login', $user->login); $toReturn = $tpl->fetch('comment.list.tpl'); return true; }
/** * Commentaires d'une procedure * * @author Christophe Beyer <*****@*****.**> * @since 2008/01/30 * @param object $rFiche Recordset de la procedure */ public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $rFiche = $this->getParam('rFiche'); $mondroit = $this->getParam('mondroit'); $daoinfo =& _dao('infosupp'); $sql = 'SELECT * FROM module_teleprocedure_infosupp WHERE idinter=' . $rFiche->idinter . ''; $canCheckVisible = TeleproceduresService::canMakeInTelep('CHECK_VISIBLE', $mondroit); $canAddComment = TeleproceduresService::canMakeInTelep('ADD_COMMENT', $mondroit); if (!$canCheckVisible) { $sql .= " AND info_message!='' AND info_message IS NOT NULL"; } $sql .= " ORDER BY dateinfo ASC, idinfo ASC"; $results = _doQuery($sql); // Pour chaque message on cherche les infos de son auteur $list = array(); foreach ($results as $r) { $userInfo = Kernel::getUserInfo("ID", $r->iduser); //var_dump($userInfo); $avatar = Prefs::get('prefs', 'avatar', $r->iduser); $userInfo['avatar'] = $avatar ? CopixConfig::get('prefs|avatar_path') . $avatar : ''; $r->user = $userInfo; $list[] = $r; } //print_r($rFiche); $tpl->assign('info_message_edition', CopixZone::process('kernel|edition', array('field' => 'info_message', 'format' => $rFiche->type_format, 'content' => '', 'width' => 350, 'height' => 135, 'options' => array('toolbarSet' => 'IconitoBasic', 'enterMode' => 'br', 'toolbarStartupExpanded' => 'false')))); $tpl->assign('info_commentaire_edition', CopixZone::process('kernel|edition', array('field' => 'info_commentaire', 'format' => $rFiche->type_format, 'content' => '', 'width' => 350, 'height' => 135, 'options' => array('toolbarSet' => 'IconitoBasic', 'enterMode' => 'br', 'toolbarStartupExpanded' => 'false')))); $tpl->assign('canCheckVisible', $canCheckVisible); $tpl->assign('canAddComment', $canAddComment); $tpl->assign('list', $list); $tpl->assign('rFiche', $rFiche); $toReturn = $tpl->fetch('fiche-comms-zone.tpl'); return true; }
public function _createContent(&$toReturn) { $ppo = new CopixPPO(); $ppo->conf = new CopixPPO(); $ppo->conf->directorGlobalAffectation = CopixConfig::get('gestionautonome|directorGlobalAffectation'); // Récupérations des filtres en session $ppo->selected = $this->getParam('selected', 0); $ppo->withLabel = $this->getParam('with_label', true); $ppo->withEmpty = $this->getParam('with_empty', true); $ppo->labelEmpty = $this->getParam('label_empty', null); $ppo->name = $this->getParam('name', null); $ppo->cityGroupsIds = array(); $ppo->cityGroupsNames = array(); $citiesGroupDAO = _ioDAO('kernel|kernel_bu_groupe_villes'); if (_currentUser()->testCredential('module:*||cities_group|create@gestionautonome') || _currentUser()->isDirector && $ppo->conf->directorGlobalAffectation) { $criteria = _daoSp(); $criteria->orderBy('nom_groupe'); $cityGroups = $citiesGroupDAO->findBy($criteria); } else { $groups = _currentUser()->getGroups(); $cityGroups = $citiesGroupDAO->findByUserGroups($groups['gestionautonome|iconitogrouphandler']); } foreach ($cityGroups as $cityGroup) { $ppo->cityGroupsIds[] = $cityGroup->id_grv; $ppo->cityGroupsNames[] = $cityGroup->nom_groupe; } $toReturn = $this->_usePPO($ppo, '_filter_groupcity.tpl'); }
/** * Demarrage de la session * @param string $pId l'identifiant de la session, * utile si vous avez plusieurs copix sur un même serveur * et que vous ne souhaitez pas partager les sessions */ public static function start($pId = null) { if ($pId === null) { $pId = CopixConfig::instance()->sessionName; } session_start($pId); }
public function _createContent(&$toReturn) { //load PPO $ppo = new CopixPPO(); $ppo->user = _currentUser(); //if user is connected : load personal informations if ($ppo->user->isConnected()) { $ppo->animateur = _sessionGet('user_animateur') ? 1 : 0; $ppo->ien = _sessionGet('prisedecontrole_ien') ? 1 : 0; $type = $ppo->user->getExtra('type'); $sexe = $ppo->user->getExtra('sexe') == 2 ? 2 : ''; $ppo->usertype = strtolower($type) . $sexe; } // Get vocabulary catalog to use if ($myNode = CopixSession::get('myNode')) { $nodeVocabularyCatalogDAO = _ioDAO('kernel|kernel_i18n_node_vocabularycatalog'); $vocabularyCatalog = $nodeVocabularyCatalogDAO->getCatalogForNode($myNode['type'], $myNode['id']); } $ppo->vocabularyCatalogId = isset($vocabularyCatalog) ? $vocabularyCatalog->id_vc : CopixConfig::get('kernel|defaultVocabularyCatalog'); $this->addJs('js/iconito/module_auth.js'); $this->addCss('styles/module_auth.css'); $ppo->conf_Cas_actif = CopixConfig::exists('default|conf_Cas_actif') ? CopixConfig::get('default|conf_Cas_actif') : 0; $ppo->conf_Saml_actif = CopixConfig::exists('default|conf_Saml_actif') ? CopixConfig::get('default|conf_Saml_actif') : 0; //load tpl $toReturn = $this->_usePPO($ppo, 'userlogged.tpl'); }
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); } }
public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $tpl->assign('homepageUrl', CopixConfig::get('|homePage')); $toReturn = $tpl->fetch('selecthomepage.form.tpl'); return true; }
public function _createContent(&$toReturn) { //Getting the user. //Create Services, and DAO $tpl = new CopixTpl(); $id_blog = $this->getParam('id_blog', ''); $tpl->assign('blog', $this->getParam('blog', null)); $tpl->assign('id_blog', $id_blog); $tpl->assign('kind', $this->getParam('kind', '')); $tpl->assign('tabBlogFunctions', $this->getParam('tabBlogFunctions', null)); $tpl->assign('can_format_articles', CopixConfig::get('blog|blog.default.can_format_articles')); $tpl->assign('RESULT', $this->getParam('RESULT', '')); $parent = Kernel::getModParentInfo("MOD_BLOG", $id_blog); if ($parent) { $mods = Kernel::getModEnabled($parent['type'], $parent['id'], '', 0, 1); // _dump($mods); $mods = Kernel::filterModuleList($mods, 'MOD_MAGICMAIL'); if (count($mods)) { $magicmail_infos = _dao('module_magicmail')->get($mods[0]->module_id); $tpl->assign('magicmail_infos', $magicmail_infos); // _dump($magicmail_infos); /* 'id' => '32', 'login' => 'cepapeti', 'domain' => 'magicmail.iconito.fr', */ } } // retour de la fonction : $toReturn = $tpl->fetch('blog.show.tpl'); return true; }
/** * 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 _createContent(&$toReturn) { $tpl = new CopixTpl(); $blog = $this->getParam('blog', ''); $cat = $this->getParam('cat', null); $critere = $this->getParam('critere', null); //on récupère l'ensemble des articles du blog $dao = _dao('blog|blogarticle'); if ($cat == null) { $date = $this->getParam('date', null); $arData = $dao->getAllArticlesFromBlog($blog->id_blog, $date); } else { $arData = $dao->getAllArticlesFromBlogByCat($blog->id_blog, $cat->id_bacg); $tpl->assign('cat', $cat); } //on filtre si on a fait une recherche sur les articles if ($critere != null) { $arData = $dao->getAllArticlesFromBlogByCritere($blog->id_blog, $critere); } //var_dump($arData); //on construit un tableau associatif entre l'identifiant de l'article et le nombre de commentaires foreach ($arData as $article) { //var_dump($article); $daoArticleComment =& CopixDAOFactory::getInstanceOf('blog|blogarticlecomment'); $record = _record('blog|blogarticlecomment'); $criteres = _daoSp(); $criteres->addCondition('id_bact', '=', $article->id_bact); $criteres->addCondition('is_online', '=', 1); $resultat = $daoArticleComment->findBy($criteres); $arNbCommentByArticle[$article->id_bact] = count($resultat); } if (count($arData) > 0) { //encodage des URL des catégories pour caractères spéciaux foreach ($arData as $key => $data) { //Modification suite à apparition d'un warning due à l'absence de catégories , vboniface 06.11.2006 $arData[$key]->key = $key; if (isset($arData[$key]->categories)) { foreach ($arData[$key]->categories as $keyCat => $categorie) { $arData[$key]->categories[$keyCat]->url_bacg = urlencode($categorie->url_bacg); } } } if (count($arData) <= intval(CopixConfig::get('blog|nbMaxArticles'))) { $tpl->assign('pager', ""); $tpl->assign('listArticle', $arData); $tpl->assign('arNbCommentByArticle', $arNbCommentByArticle); } else { $params = array('perPage' => intval(CopixConfig::get('blog|nbMaxArticles')), 'delta' => 5, 'recordSet' => $arData, 'template' => '|pager.tpl'); $Pager = CopixPager::Load($params); $tpl->assign('pager', $Pager->GetMultipage()); $tpl->assign('listArticle', $Pager->data); $tpl->assign('arNbCommentByArticle', $arNbCommentByArticle); } //rajout suite à bug mantis 54 vboniface 06.11.2006 $tpl->assign('blog', $blog); } // retour de la fonction : $toReturn = $tpl->fetch('listarticle.tpl'); return true; }
/** * Retourne le catalogue de vocabulaire par défaut * * @return DAORecordKernel_i18n_vocabulary_catalog or false */ public function getDefaultCatalog() { $criteria = _daoSp(); $criteria->addCondition('id_vc', '=', CopixConfig::get('kernel|defaultVocabularyCatalog')); $results = $this->findBy($criteria); return isset($results[0]) ? $results[0] : false; }
public function getChart($php_source, $width = 400, $height = 250, $bg_color = "666666", $transparent = false) { $flash_file = $this->swf_file; $library_path = $this->library; $php_source = urlencode($php_source); $library_path = urlencode($library_path); $html = "<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' "; $html .= "WIDTH=" . $width . " HEIGHT=" . $height . " id='charts' ALIGN=''>"; $u = strpos($flash_file, "?") === false ? "?" : (substr($flash_file, -1) === "&" ? "" : "&"); $html .= "<PARAM NAME=movie VALUE='" . $flash_file . $u . "library_path=" . $library_path . "&php_source=" . $php_source; if (($license = CopixConfig::get('chart_swf|license')) != "") { $html .= "&license=" . $license; } $html .= "'> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#" . $bg_color . "> "; if ($transparent) { $html .= "<PARAM NAME=wmode VALUE=transparent> "; } $html .= "<EMBED src='" . $flash_file . $u . "library_path=" . $library_path . "&php_source=" . $php_source; if (($license = CopixConfig::get('chart_swf|license')) != "") { $html .= "&license=" . $license; } $html .= "' quality=high bgcolor=#" . $bg_color . " WIDTH=" . $width . " HEIGHT=" . $height . " NAME='charts' ALIGN='' swLiveConnect='true' "; if ($transparent) { $html .= "wmode=transparent "; } $html .= "TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></EMBED></OBJECT>"; return $html; }
/** * Pr�paration � l'�dition d'une page. */ public function doPrepareEditPage() { $id_blog = $this->getRequest('id_blog', null); $blogDAO = CopixDAOFactory::create('blog|blog'); $blog = $blogDAO->get($id_blog); if ($id_blog == null) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('blog.error.param'), 'back' => CopixUrl::get('blog|admin|listBlog'))); } if (!BlogAuth::canMakeInBlog('ADMIN_PAGES', $blog)) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('blog.error.cannotManagePage'), 'back' => CopixUrl::get('blog|admin|listBlog'))); } $tpl = new CopixTpl(); $id_bpge = $this->getRequest('id_bpge', null); $page = null; if ($id_bpge != null) { // EDITION D'UNE PAGE $pageDAO = CopixDAOFactory::create('blog|blogpage'); $page = $pageDAO->get($id_bpge); } else { $page->is_online = CopixConfig::get('blog|blog.default.default_is_online_page'); $page->format_bpge = $blog->default_format_articles; } $tpl->assign('TITLE_PAGE', $blog->name_blog); // $menu = '<a href="'.CopixUrl::get ('blog|admin|showBlog', array("id_blog"=>$id_blog, "kind"=>5)).'">'.CopixI18N::get('blog|blog.nav.pages').'</a>'; $menu = getBlogAdminMenu($blog, 5); $tpl->assign('MENU', $menu); $tpl->assign('MAIN', CopixZone::process('EditPage', array('id_blog' => $id_blog, 'id_bpge' => $id_bpge, 'page' => $page, 'kind' => $this->getRequest('kind', '0')))); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
public function create($infos = array()) { $blogDAO = _dao('blog|blog'); $res = null; $tabBlogFunctions = returnAllBlogFunctions(); $blog = _record('blog|blog'); if ($infos['title']) { $blog->name_blog = $infos['title'] . (isset($infos['subtitle']) && strlen($infos['subtitle']) > 0 ? ' (' . $infos['subtitle'] . ')' : ''); } else { $blog->name_blog = CopixI18N::get('blog|blog.default.titre'); } $blog->id_ctpt = 1; $blog->style_blog_file = 0; $is_public_default = CopixConfig::exists('blog|blog.default.is_public') ? CopixConfig::get('blog|blog.default.is_public') : 1; $blog->is_public = isset($infos['is_public']) ? $infos['is_public'] : $is_public_default; $blog->has_comments_activated = 0; $blog->type_moderation_comments = CopixConfig::get('blog|blog.default.type_moderation_comments'); $blog->default_format_articles = CopixConfig::get('blog|blog.default.default_format_articles'); $blog->privacy = CopixConfig::exists('blog|blog.default.privacy') ? CopixConfig::get('blog|blog.default.privacy') : 0; $blogDAO->insert($blog); if ($blog->id_blog !== NULL) { // On détermine l'URL titre $blog->url_blog = KernelBlog::calcule_url_blog($blog->id_blog, $blog->name_blog); $blogDAO->update($blog); // On ajoute une catégorie $categoryDAO = _dao('blog|blogarticlecategory'); $category = _record('blog|blogarticlecategory'); $category->id_blog = $blog->id_blog; $category->name_bacg = CopixI18N::get('blog|blog.default.categorie'); $category->url_bacg = killBadUrlChars($category->name_bacg) . date('YmdHis'); $category->order_bacg = $categoryDAO->getNewPos($blog->id_blog); $categoryDAO->insert($category); } return $blog->id_blog !== NULL ? $blog->id_blog : NULL; }
public function _createContent(&$toReturn) { $ppo = new CopixPPO(); $ppo->conf = new CopixPPO(); $ppo->conf->directorGlobalAffectation = CopixConfig::get('gestionautonome|directorGlobalAffectation'); // Récupérations des filtres en session $ppo->selected = $this->getParam('selected', null); $ppo->withLabel = $this->getParam('with_label', true); $ppo->withEmpty = $this->getParam('with_empty', true); $ppo->name = $this->getParam('name', null); if (!is_null($cityId = $this->getParam('city_id', null))) { // Récupération des écoles de la ville sélectionnée pour liste déroulante $schoolDAO = _dao('kernel|kernel_bu_ecole'); if (_currentUser()->testCredential('module:city|' . $cityId . '|school|create@gestionautonome') || _currentUser()->isDirector && $ppo->conf->directorGlobalAffectation) { $schools = $schoolDAO->getByCity($cityId); } else { $groups = _currentUser()->getGroups(); $schools = $schoolDAO->findByCityIdAndUserGroups($cityId, $groups['gestionautonome|iconitogrouphandler']); } $ppo->schoolsIds = array(); $ppo->schoolsNames = array(); foreach ($schools as $school) { $ppo->schoolsIds[] = $school->numero; $ppo->schoolsNames[] = $school->nom; } } $toReturn = $this->_usePPO($ppo, '_filter_school.tpl'); }
public function _createContent(&$toReturn) { $ppo = new CopixPPO(); $ppo->conf = new CopixPPO(); $ppo->conf->directorGlobalAffectation = CopixConfig::get('gestionautonome|directorGlobalAffectation'); // Récupérations des filtres en session $ppo->selected = $this->getParam('selected', null); $ppo->withLabel = $this->getParam('with_label', true); $ppo->withEmpty = $this->getParam('with_empty', true); $ppo->labelEmpty = $this->getParam('label_empty', null); $ppo->name = $this->getParam('name', null); if (!is_null($cityGroupId = $this->getParam('city_group_id', null))) { $cityDAO = _dao('kernel|kernel_bu_ville'); if (_currentUser()->testCredential('module:cities_group|' . $cityGroupId . '|city|create@gestionautonome') || _currentUser()->isDirector && $ppo->conf->directorGlobalAffectation) { $cities = $cityDAO->getByIdGrville($cityGroupId); } else { $groups = _currentUser()->getGroups(); $cities = $cityDAO->findByCitiesGroupIdAndUserGroups($cityGroupId, $groups['gestionautonome|iconitogrouphandler']); } $ppo->citiesIds = array(); $ppo->citiesNames = array(); foreach ($cities as $city) { $ppo->citiesIds[] = $city->id_vi; $ppo->citiesNames[] = $city->nom; } } $toReturn = $this->_usePPO($ppo, '_filter_city.tpl'); }
public function testMain() { //compte le nombre de profils au départ $nbStart = count(CopixConfig::instance()->copixdb_getProfiles()); //vérifie que l'on arrive bien à définir un profil CopixConfig::instance()->copixdb_defineProfile('test', 'pdo_mysql:host=localhost;dbname=copix_3_beta', 'root', ''); $this->assertNotNull(CopixConfig::instance()->copixdb_getProfile('test')); $this->assertEquals($nbStart + 1, count(CopixConfig::instance()->copixdb_getProfiles())); $this->assertEquals(CopixConfig::instance()->copixdb_getProfile('test')->getName(), 'test'); $parts = CopixConfig::instance()->copixdb_getProfile('test')->getConnectionStringParts(); $this->assertEquals('localhost', $parts['host']); $this->assertEquals('copix_3_beta', $parts['dbname']); $this->assertEquals('pdo_mysql', CopixConfig::instance()->copixdb_getProfile('test')->getDriverName()); $this->assertEquals(array(), CopixConfig::instance()->copixdb_getProfile('test')->getOptions()); $this->assertEquals('mysql', CopixConfig::instance()->copixdb_getProfile('test')->getDatabase()); CopixConfig::instance()->copixdb_getProfile('test')->setOptions(array('FOO' => 'FOOVALUE')); $this->assertEquals(array('FOO' => 'FOOVALUE'), CopixConfig::instance()->copixdb_getProfile('test')->getOptions()); CopixConfig::instance()->copixdb_getProfile('test')->setOptions(array('FOO2' => 'FOOVALUE2')); $this->assertEquals(array('FOO' => 'FOOVALUE', 'FOO2' => 'FOOVALUE2'), CopixConfig::instance()->copixdb_getProfile('test')->getOptions()); CopixConfig::instance()->copixdb_getProfile('test')->clearOptions(); $this->assertEquals(array(), CopixConfig::instance()->copixdb_getProfile('test')->getOptions()); //vérifie que l'on arrive à ajouter encore un 2ème profil CopixConfig::instance()->copixdb_defineProfile('test2', 'pdo_mysql:host=localhost;dbname=copix_3_beta', 'root', ''); $this->assertNotNull(CopixConfig::instance()->copixdb_getProfile('test2')); $this->assertEquals($nbStart + 2, count(CopixConfig::instance()->copixdb_getProfiles())); $this->assertEquals(CopixConfig::instance()->copixdb_getProfile('test2')->getName(), 'test2'); }
function _createContent(&$toReturn) { $tpl =& new CopixTpl(); $tpl->assign('login', $this->params['login']); $tpl->assign('enabledSendLogin', CopixConfig::get('auth|enableSendLostPassword')); $toReturn = $tpl->fetch('login.failed.tpl'); }
function _createContent(&$toReturn) { //Création du sous template. $tpl =& new CopixTpl(); //require_once (COPIX_MODULE_PATH.'cms/'.COPIX_CLASSES_DIR.'cmsworkflow.class.php'); require_once COPIX_MODULE_PATH . 'cms/' . COPIX_CLASSES_DIR . 'cmspage.services.class.php'; CopixContext::push('cms'); $sHeadings =& CopixClassesFactory::instanceOf('copixheadings|CopixHeadingsServices'); $headings = $sHeadings->getTree(); $cmsPages =& new ServicesCMSPage(); $pages = $cmsPages->getList(); if (isset($this->params['onlyLastVersion']) && $this->params['onlyLastVersion'] == 1) { $pages = $this->_filterLastVersion($pages); } CopixContext::pop(); //pagination foreach ($pages as $page) { $arPages[$page->id_head][] = $page; } $tpl->assign('arPublished', $arPages); $tpl->assign('arHeadings', $headings); $tpl->assign('select', $this->params['select']); $tpl->assign('back', $this->params['back']); $tpl->assign('popup', $this->params['popup']); $tpl->assign('height', Copixconfig::get('htmleditor|height')); $tpl->assign('width', Copixconfig::get('htmleditor|width')); $tpl->assign('editorType', CopixConfig::get('htmleditor|type')); $tpl->assign('editorName', $this->params['editorName']); $toReturn = $tpl->fetch('page.select.ptpl'); return true; }
/** * Write a file to the disk. * This function is heavily based on the way smarty process its own files. * Is using a temporary file and then rename the file. We guess the file system will be smarter than us, avoiding a writing / reading * while renaming the file. */ function write($file, $data) { $_dirname = dirname($file); //asking to create the directory structure if needed. $this->_createDir($_dirname); if (!@is_writable($_dirname)) { // cache_dir not writable, see if it exists if (!@is_dir($_dirname)) { trigger_error(CopixI18N::get('copix:copix.error.cache.directoryNotExists', array($_dirname))); return false; } trigger_error(CopixI18N::get('copix:copix.error.cache.notWritable', array($file, $_dirname))); return false; } // write to tmp file, then rename it to avoid // file locking race condition $_tmp_file = tempnam($_dirname, 'wrt'); if (!($fd = @fopen($_tmp_file, 'wb'))) { $_tmp_file = $_dirname . '/' . uniqid('wrt'); if (!($fd = @fopen($_tmp_file, 'wb'))) { trigger_error(CopixI18N::get('copix:copix.error.cache.errorWhileWritingFile', array($file, $_tmp_file))); return false; } } fwrite($fd, $data); fclose($fd); // Delete the file if it allready exists (this is needed on Win, // because it cannot overwrite files with rename()) if (CopixConfig::osIsWindows() && file_exists($file)) { @unlink($file); } @rename($_tmp_file, $file); @chmod($file, 0644); return true; }
public function processTest() { if (!Kernel::isAdmin()) { return $this->error('rssmix.noRight', true, '||'); } try { $feed = $this->service->getRssFeed($this->request('url'), 2); echo '<p class="mesgSuccess">' . $this->i18n('rssmix.feedValid') . '</p>'; foreach ($feed as $item) { echo '<h4>' . $item['title'] . '</h4>'; echo '<p>' . $item['content'] . '</p>'; echo '<hr />'; } } catch (Exception $e) { $config = CopixConfig::instance(); echo '<p class="mesgError">' . $this->i18n('rssmix.feedNoValid') . '</p>'; if ($config->getMode() == CopixConfig::DEVEL) { echo '<div class="content-panel"><h3>Debug informations (only in devel)</h3> <p> url : ' . $this->request('url') . '</p> <p>' . $e->getMessage() . '</p> <p><pre>' . $e->getFile() . ' : ' . $e->getLine() . '</pre></p> <p><pre>' . $e->getTraceAsString() . '</pre></p> </div>'; } } return _arNone(); }
/** * On s'assure que pour ces tâche ce soit bien un administrateur */ public function beforeAction() { CopixAuth::getCurrentUser()->assertCredential('basic:admin'); if (!CopixConfig::instance()->copixauth_isRegisteredCredentialHandler('auth|dbdynamiccredentialhandler')) { throw new CopixException(_i18n('auth.dynamicHandlerNotRegister')); } }
/** * It set many properties of the object, get all GET and POST parameters, and start session. * @param string $configFile chemin du fichier de configuration du projet */ function CopixCoordination($configFile) { // register itself in the global variable. $GLOBALS['COPIX']['COORD'] =& $this; // creating CopixConfig Object and includes the asked configuration file. $GLOBALS['COPIX']['CONFIG'] =& CopixConfig::instance(); require $configFile; /** * EXPERIMENTAL : support des URLs significatifs */ $scriptNameAndPath = $_SERVER['SCRIPT_NAME']; //condidering : http://mysite.com/subdir/index.php/mypath/myaction?myparams=myvalues //following is subdir/ $GLOBALS['COPIX']['CONFIG']->significant_url_script_path = substr($scriptNameAndPath, 0, strrpos($scriptNameAndPath, '/')) . '/'; //following is index.php $GLOBALS['COPIX']['CONFIG']->significant_url_script_name = substr($scriptNameAndPath, strrpos($scriptNameAndPath, '/') + 1); //following is mysite.com $GLOBALS['COPIX']['CONFIG']->significant_url_domain = $_SERVER['HTTP_HOST']; //following is http://mysite.com/subdir/ $GLOBALS['COPIX']['CONFIG']->significant_url_basepath = 'http://' . $GLOBALS['COPIX']['CONFIG']->significant_url_domain . $GLOBALS['COPIX']['CONFIG']->significant_url_script_path; //following is index.php/mypath/myaction if (isset($_SERVER['PATH_INFO'])) { $pathinfo = $_SERVER['PATH_INFO']; $pos = strpos($_SERVER['PATH_INFO'], $GLOBALS['COPIX']['CONFIG']->significant_url_script_path . $GLOBALS['COPIX']['CONFIG']->significant_url_script_name); if ($pos !== false) { //under IIS, we may get as PATH_INFO /subdir/index.php/mypath/myaction (wich is incorrect) $pathinfo = substr($_SERVER['PATH_INFO'], strlen($GLOBALS['COPIX']['CONFIG']->significant_url_script_path . $GLOBALS['COPIX']['CONFIG']->significant_url_script_name)); } } else { $pathinfo = substr($_SERVER["PHP_SELF"], strlen($_SERVER['SCRIPT_NAME'])); } $GLOBALS['COPIX']['CONFIG']->significant_url_path_info = $pathinfo; /** * Fin de "en développement / Test" */ if ($GLOBALS['COPIX']['CONFIG']->errorHandlerOn) { $ficEH = COPIX_CONFIG_PATH . $GLOBALS['COPIX']['CONFIG']->errorHandlerConfigFile; if (file_exists($ficEH)) { require_once COPIX_CORE_PATH . 'CopixErrorHandler.lib.php'; $GLOBALS['COPIX']['CONFIG']->errorHandler = new CopixErrorHandlerConfig(); require $ficEH; set_error_handler('CopixErrorHandler'); } } // registering and creating plugins. foreach ($GLOBALS['COPIX']['CONFIG']->plugins as $name => $conf) { // pour create, on ne donne pas $conf, car le foreach fait une copie du tableau plugins pour le parcourir // et cela ne prend donc pas en compte les eventuelles modifs effectuées dans plugins par un plugin, // notament dans debug, si celui ci précise un fichier de conf spécifique if ($plug =& CopixPluginFactory::create($name, $GLOBALS['COPIX']['CONFIG']->plugins[$name])) { $this->plugins[strtolower($name)] =& $plug; } } $this->url =& new CopixUrl($_SERVER['SCRIPT_NAME'], $_GET, $GLOBALS['COPIX']['CONFIG']->significant_url_path_info); $this->vars = CopixUrl::parse($GLOBALS['COPIX']['CONFIG']->significant_url_path_info, false, true); // do what we need for each plugin before starting the session $this->_beforeSessionStart(); session_start(); }
public function testCopixObject() { //on test que les objets autoloadés Copix ne soient pas pris en charge $element = new CopixSessionObject(CopixConfig::instance()); $serialized = serialize($element); $elementBack = unserialize($serialized); //si ça ne génère pas d'erreurs, c'est ok }
public function testParse() { $testUrl = "test.php?var=value"; CopixConfig::instance()->significant_url_mode = 'default'; $this->assertContains("value", CopixUrl::parse($testUrl, true)); CopixConfig::instance()->significant_url_mode = 'prepend'; $this->assertContains("value", CopixUrl::parse($testUrl, true)); }