/**
  * Envoie un minimail
  *
  * @author Christophe Beyer <cbeyer@cap-tic.fr>
  * @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 _createContent(&$toReturn)
 {
     $tpl = new CopixTpl();
     $blog = $this->getParam('blog', '');
     $comment = $this->getParam('comment', NULL);
     //on récupère l'ensemble des articles du blog
     $dao = _dao('blog|blogarticle');
     //$article = $dao->getArticleByUrl($blog->id_blog, $this->getParam('article', ''));
     list($id_bact, ) = explode("-", $this->getParam('article', ''));
     $article = $dao->getArticleById($blog->id_blog, $id_bact);
     if (!$article) {
         $toReturn = '{/}' . $tpl->fetch('showarticle.tpl');
         return true;
     }
     //encodage des URL des catégories pour caractères spéciaux
     if (is_array($article->categories)) {
         foreach ($article->categories as $key => $categorie) {
             $article->categories[$key]->url_bacg = urlencode($categorie->url_bacg);
         }
     }
     $tpl->assign('article', $article);
     // Recherche de tous les commentaires associés à cet article
     $commentDAO = _dao('blog|blogarticlecomment');
     $res = $commentDAO->findCommentOrderBy($article->id_bact, 1);
     $listComment = array();
     foreach ($res as $r) {
         $r->time_bacc = BDToTime($r->time_bacc);
         array_push($listComment, $r);
     }
     if ($comment) {
         $toEdit = $comment;
     } else {
         // On récupère l'utilisateur connecté
         $user = BlogAuth::getUserInfos();
         $toEdit = _record('blogarticlecomment');
         $toEdit->authorid_bacc = $user->userId;
         $toEdit->authorname_bacc = $user->name;
         $toEdit->authoremail_bacc = $user->email;
         $toEdit->authorweb_bacc = $user->web;
     }
     $tpl->assign('blog', $blog);
     $tpl->assign('toEdit', $toEdit);
     $tpl->assign('listComment', $listComment);
     $tpl->assign('errors', $this->getParam('errors', null));
     $tpl->assign('showErrors', $this->getParam('showErrors', false));
     $tpl->assign('canComment', BlogAuth::canComment($blog->id_blog));
     $plugStats = CopixPluginRegistry::get("stats|stats");
     $plugStats->setParams(array('objet_a' => $article->id_bact));
     // retour de la fonction :
     $toReturn = $article->name_bact . '{/}' . $tpl->fetch('showarticle.tpl');
     return true;
 }
 /**
  * Ajout d'un plugin dans la liste
  */
 public function processAddPlugin()
 {
     //on vérifie que le plugin demandé existe bien dans la liste des plugins disponibles
     if (in_array($pluginName = CopixRequest::get('plugin'), CopixPluginregistry::getAvailable())) {
         //si le plugin n'est pas déjà activé, on l'active
         if (!CopixPluginRegistry::isRegistered($pluginName)) {
             //on récupère la liste des plugins enregistrés et on ajoute le nouveau plugin
             $arPlugins = CopixConfig::instance()->plugin_getRegistered();
             $arPlugins[] = $pluginName;
             //écriture du fichier
             _class('PluginsConfigurationFile')->write($arPlugins);
         }
     }
     //création du tableau des plugins à enregistrer plus le plugin en question
     return _arRedirect(_url('plugin|'));
 }
 public function _createContent(&$toReturn)
 {
     if (!CopixPluginRegistry::isRegistered('themechooser|themechooser')) {
         $toReturn = "";
         return true;
     }
     $tpl = new CopixTpl();
     $arThemes = CopixPluginRegistry::getConfig('themechooser|themechooser')->getThemeList();
     $arThemesToReturn = array();
     foreach ($arThemes as $theme) {
         $arThemesToReturn[] = CopixTpl::getThemeInformations($theme);
     }
     $selectedTheme = CopixSession::get('themechooser|theme');
     $tpl->assign('selectedTheme', $selectedTheme);
     $tpl->assign('arThemes', $arThemesToReturn);
     $toReturn = $tpl->fetch('combo.list.tpl');
     return true;
 }
 public function _createContent(&$toReturn)
 {
     $tpl = new CopixTpl();
     $blog = $this->getParam('blog', '');
     //on récupère l'ensemble des articles du blog
     $dao = _dao('blog|blogpage');
     $page = $dao->getPageByUrl($blog->id_blog, $this->getParam('page', ''));
     if (!$page) {
         $toReturn = $tpl->fetch('showpage.tpl');
         return true;
     }
     $tpl->assign('page', $page);
     $plugStats = CopixPluginRegistry::get("stats|stats");
     $plugStats->setParams(array('objet_a' => $page->id_bpge));
     // retour de la fonction :
     $toReturn = $tpl->fetch('showpage.tpl');
     return true;
 }
 /**
  * Affiche un minimail en d�tail
  *
  * @author Christophe Beyer <cbeyer@cap-tic.fr>
  * @since 2005/10/18
  * @param integer $id Id du minimail
  */
 public function getMessage()
 {
     $this->addJs('js/iconito/module_minimail.js');
     $MinimailService =& CopixClassesFactory::Create('minimail|MinimailService');
     // 2 DAO -> 2 assign
     $idUser = _currentUser()->getId();
     $idMessage = _request("id");
     $errors = array();
     $daoFrom = CopixDAOFactory::create("minimail_from");
     $daoTo = CopixDAOFactory::create("minimail_to");
     $message = $daoFrom->getMessage($idMessage);
     $dest = $daoTo->selectDestFromId($idMessage);
     $isRecv = $isSend = false;
     if ($message) {
         $message->prev = NULL;
         $message->next = NULL;
     }
     if ($message && $message->from_id == $idUser) {
         // Message qu'il a envoy�
         $message->type = "send";
         $prev = $daoFrom->getFromPrevMessage($message->date_send, $idUser);
         if ($prev) {
             $message->prev = $prev->id;
         }
         $next = $daoFrom->getFromNextMessage($message->date_send, $idUser);
         if ($next) {
             $message->next = $next->id;
         }
         $isSend = true;
     } else {
         // Il en est peut-�tre destinataire
         $isDest = $daoTo->selectDestFromIdAndToUser($idMessage, $idUser);
         // Test s'il est dans les destin
         if ($isDest) {
             $serv = CopixClassesFactory::create("MinimailService");
             $serv->markMinimailAsRead($dest, $idUser);
             $message->type = "recv";
             $prev = $daoTo->getToPrevMessage($message->date_send, $idUser);
             if ($prev) {
                 $message->prev = $prev->id;
             }
             $next = $daoTo->getToNextMessage($message->date_send, $idUser);
             if ($next) {
                 $message->next = $next->id;
             }
             $isRecv = true;
         } else {
             // Il tente d'afficher un message qu'il n'a pas envoy� ni re�u !
             $errors[] = CopixI18N::get('minimail.error.cantDisplay');
         }
     }
     if ($errors) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $errors), 'back' => CopixUrl::get('minimail||')));
     } else {
         $userInfo = Kernel::getUserInfo("ID", $message->from_id);
         $message->from = $userInfo;
         $message->from_id_infos = $userInfo["prenom"] . " " . $userInfo["nom"] . " (" . $userInfo["login"] . ")";
         foreach ($dest as $j => $null) {
             //print_r($dest[$j]->to_id);
             $userInfo = Kernel::getUserInfo("ID", $dest[$j]->to_id);
             $dest[$j]->to = $userInfo;
             $dest[$j]->to_id_infos = $userInfo["prenom"] . " " . $userInfo["nom"] . " (" . $userInfo["login"] . ")";
         }
         // Avatar de l'exp�diteur
         $avatar = Prefs::get('prefs', 'avatar', $message->from_id);
         $message->avatar = $avatar ? CopixConfig::get('prefs|avatar_path') . $avatar : '';
         $tpl = new CopixTpl();
         $tpl->assign('TITLE_PAGE', $message->title);
         $menu = array();
         $menu[] = array('txt' => CopixI18N::get('minimail.mess_recv'), 'url' => CopixUrl::get('minimail||getListRecv'), 'current' => $isRecv);
         $menu[] = array('txt' => CopixI18N::get('minimail.mess_send'), 'url' => CopixUrl::get('minimail||getListSend'), 'current' => $isSend);
         $menu[] = array('txt' => CopixI18N::get('minimail.mess_write'), 'url' => CopixUrl::get('minimail||getNewForm'));
         $tpl->assign('MENU', $menu);
         $message->attachment1IsImage = $MinimailService->isAttachmentImage($message->attachment1);
         $message->attachment2IsImage = $MinimailService->isAttachmentImage($message->attachment2);
         $message->attachment3IsImage = $MinimailService->isAttachmentImage($message->attachment3);
         $message->attachment1Name = $MinimailService->getAttachmentName($message->attachment1);
         $message->attachment2Name = $MinimailService->getAttachmentName($message->attachment2);
         $message->attachment3Name = $MinimailService->getAttachmentName($message->attachment3);
         //print_r($message);
         $tplListe = new CopixTpl();
         $tplListe->assign('message', $message);
         $tplListe->assign('dest', $dest);
         $result = $tplListe->fetch('getmessage.tpl');
         $tpl->assign('MAIN', $result);
         $plugStats = CopixPluginRegistry::get("stats|stats");
         $plugStats->setParams(array('objet_a' => $idMessage));
         return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
     }
 }
 /**
  * création d'une connection.
  * @access private
  * @param string  $named  nom du profil de connection
  * @return CopixLdapConnection  l'objet de connection
  */
 private function _createConnection($profilName)
 {
     $profil =& CopixLdapFactory::_getProfil($profilName);
     //Création de l'objet
     $obj = new CopixLdapConnection();
     if ($profil->shared) {
         $GLOBALS['COPIX']['LDAP'][$profilName] =& $obj;
     }
     if (CopixPluginRegistry::getConf('CopixLdap', 'showLdapQueryEnabled') && isset($_GET['showLdapQuery']) && $_GET['showLdapQuery'] == '1') {
         $obj->_debugQuery = true;
     }
     $obj->connect($profil);
     return $obj;
 }
 /**
  * Validation des modification sur le profil de log
  */
 public function processValid()
 {
     $profile = CopixSession::get('admin|log|edit');
     if (_request('enabled')) {
         $profile['enabled'] = true;
     } else {
         $profile['enabled'] = false;
     }
     $profile['strategy'] = _request('strategy');
     if (_request('strategy_class', null, true)) {
         $profile['strategy'] = _request('strategy_class');
     }
     $profile['level'] = _request('level');
     if ($handle = _request('handle', null, true)) {
         if (is_array($profile['handle'])) {
             if (!in_array($handle, $profile['handle'])) {
                 $profile['handle'][] = $handle;
             }
         } else {
             $profile['handle'] = array($handle);
         }
     }
     if (!isset($profile['handleExcept'])) {
         $profile['handleExcept'] = array();
     }
     if (!is_array($profile['handle'])) {
         if ($handleExcept = _request('handleExcept', null, true)) {
             if (is_array($profile['handleExcept'])) {
                 if (!in_array($handleExcept, $profile['handleExcept'])) {
                     $profile['handleExcept'][] = $handleExcept;
                 }
             } else {
                 $profile['handleExcept'] = array($handleExcept);
             }
         }
     } else {
         if (is_array($profile['handleExcept'])) {
             unset($profile['handleExcept']);
         }
     }
     // email de destination dans le cas d'une stratégie de profil de type email
     if ($profile['strategy'] == 'email') {
         $emails = explode(';', _request('email'));
         foreach ($emails as $email) {
             try {
                 $email = CopixFormatter::getMail($email);
             } catch (CopixException $e) {
                 return _arRedirect(_url('log|edit', array('profile' => $profile['name'], 'error' => 'invalidEMail')));
             }
         }
         $profile['email'] = _request('email');
     }
     CopixSession::set('admin|log|edit', $profile);
     if (_request('save')) {
         $profiles = CopixConfig::instance()->copixlog_getRegisteredProfiles();
         $profiles[$profile['name']] = $profile;
         _class('LogConfigurationFile')->write($profiles);
         CopixSession::set('admin|log|edit', null);
         if (strtoupper($profile['strategy']) == "FIREBUG") {
             if (!CopixPluginRegistry::isRegistered("admin|firebug")) {
                 //on récupère la liste des plugins enregistrés et on ajoute le nouveau plugin
                 $arPlugins = CopixConfig::instance()->plugin_getRegistered();
                 $arPlugins[] = "admin|firebug";
                 //écriture du fichier
                 _class('PluginsConfigurationFile')->write($arPlugins);
             }
         }
         return _arRedirect(_url('log|admin'));
     } else {
         return _arRedirect(_url('log|edit'));
     }
 }
 /**
  * Affichage de LA PAGE demand� pour le blog.
  */
 public function getPage()
 {
     if (!_request('blog')) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('blog.error.missingParameters'), 'back' => CopixUrl::get('')));
     }
     //On verifit que le blog existe (on r�cup�re le blog avec son nom)
     $dao = CopixDAOFactory::create('blog|blog');
     if (!($blog = $dao->getBlogByName(_request('blog')))) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('blog.error.unableToFindBlog'), 'back' => CopixUrl::get('')));
     }
     // On v�rifie que le droit de lecture est pr�sent
     if (!BlogAuth::canMakeInBlog('READ', $blog)) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.noRights'), 'back' => CopixUrl::get('')));
     }
     if (!_request('page')) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('blog.error.missingParameters'), 'back' => CopixUrl::get('blog||', array('blog' => _request('blog')))));
     }
     //		$menu = array();
     $parent = Kernel::getModParentInfo("MOD_BLOG", $blog->id_blog);
     //print_r($parent);
     $blog->parent = $parent;
     /*
             if ($parent['type']=='CLUB') {
                 $droit = Kernel::getLevel($parent['type'], $parent['id']);
                 //print_r($droit);
                 if (GroupeService::canMakeInGroupe('VIEW_HOME', $droit))
                     $menu[] = array('url'=>CopixUrl::get ('groupe||getHome', array("id"=>$parent['id'])), 'txt'=>CopixI18N::get ('blog.menuToGroup'));
             }
             if (BlogAuth::canMakeInBlog('ACCESS_ADMIN',$blog))
                 $menu[] = array('url'=>CopixUrl::get ('admin|showBlog', array("id_blog"=>$blog->id_blog)), 'txt'=>CopixI18N::get ('blog.menuAdmin'));
     */
     $menu = array();
     if (BlogAuth::canMakeInBlog('ACCESS_ADMIN', $blog)) {
         $menu = getBlogAdminMenu($blog);
     }
     CopixHTMLHeader::addCSSLink(CopixUrl::get('blog||getBlogCss', array('id_blog' => $blog->id_blog)));
     $tpl = new CopixTpl();
     $tpl->assign('TITLE_PAGE', $blog->name_blog);
     $tpl->assign('blog', $blog);
     $tpl->assign('MENU', $menu);
     $tpl->assign('Page', CopixZone::process('ShowPage', array('blog' => $blog, 'page' => _request('page'))));
     $tpl->assign('ListLink', CopixZone::process('ListLink', array('blog' => $blog)));
     $tpl->assign('ListCategory', CopixZone::process('ListCategory', array('blog' => $blog)));
     $tpl->assign('ListArchive', CopixZone::process('ListArchive', array('blog' => $blog)));
     $tpl->assign('ListPage', CopixZone::process('ListPage', array('blog' => $blog)));
     $tpl->assign('ListSearch', CopixZone::process('ListSearch', array('blog' => $blog)));
     $tpl->assign('ListFluxRss', CopixZone::process('ListFluxRss', array('blog' => $blog)));
     CopixHtmlHeader::addOthers('<link rel="alternate" href="' . CopixUrl::get('blog||rss', array("blog" => $blog->url_blog)) . '" type="application/rss+xml" title="' . htmlentities($blog->name_blog) . '" />');
     if ($blog->template) {
         $MAIN = $tpl->fetch($blog->template);
     } else {
         $MAIN = $tpl->fetch('blog_main.tpl');
     }
     $tpl->assign('MAIN', $MAIN);
     $tpl->assign('HEADER_MODE', 'compact');
     $plugStats = CopixPluginRegistry::get("stats|stats");
     $plugStats->setParams(array('module_id' => $blog->id_blog, 'parent_type' => $parent['type'], 'parent_id' => $parent['id']));
     return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
 }
 /**
  * Est ce que le plugin magicquote est installé?
  *
  * @return boolean
  */
 public function magicquotesPluginInstalled()
 {
     return CopixPluginRegistry::isRegistered('default|magicquotes');
 }
 /**
  * Définition du thème à utiliser
  */
 public function processDoSelectTheme()
 {
     CopixSession::set('themechooser|theme', CopixRequest::getInArray('id_ctpt', CopixPluginRegistry::getConfig('themechooser|themechooser', true)->getThemeList(), true));
     return _arRedirect(_url());
 }
 /**
  * Réalise les derniers traitements (généralement d'affichage ou de redirection).
  *
  * En fonction du code retour de l'action CopixActionReturn::CONST, Copix réalise
  * un certain nombre de traitements pour terminer la requête en cours.
  *
  * @param	CopixActionReturn      $pToProcess   Ce qui a été retourné par CopixActionGroup::process ()
  * @see CopixActionGroup
  */
 protected function _processResult($toProcess)
 {
     $config = CopixConfig::instance();
     //appel les plugins de post-processing.
     foreach (CopixPluginRegistry::getRegistered() as $name => $plugin) {
         $plugin->afterProcess($toProcess);
     }
     //Analyse du résultat du process
     switch ($toProcess->code) {
         case CopixActionReturn::ERROR:
             //erreur
             header("Content-Type: text/html");
             $tpl = new CopixTpl();
             if (($assignedTitlePage = $tpl->getAssigned('TITLE_PAGE')) !== null) {
                 $tpl->assign('TITLE_PAGE', '[' . _i18n('copix:common.messages.error') . ']' . $assignedTitlePage);
             } else {
                 $tpl->assign('TITLE_PAGE', '[' . _i18n('copix:common.messages.error') . ']');
             }
             $this->_processStandard($tpl);
             $tpl->assign('HTML_HEAD', '<$HTML_HEAD />');
             $tpl->assign('MAIN', $toProcess->data);
             $content = $tpl->fetch('|error.tpl');
             CopixContext::clear();
             $this->_beforeDisplay($content);
             echo $content;
             break;
         case CopixActionReturn::DISPLAY:
             $charset = CopixI18N::getCharset();
             header("Content-Type: text/html;charset=" . $charset);
             $this->_processStandard($toProcess->data);
             //appel de la méthode de préparation de la page standard.
             $toProcess->data->assign('HTML_HEAD', '<$HTML_HEAD />');
             //Par ex, bandeaux de pub, menus dynamiques, ... (propres aux projets.)
             CopixContext::clear();
             $content = $toProcess->data->fetch($config->mainTemplate);
             $this->_beforeDisplay($content);
             echo $content;
             break;
         case CopixActionReturn::DISPLAY_IN:
             $charset = CopixI18N::getCharset();
             header("Content-Type: text/html;charset=" . $charset);
             $this->_processStandard($toProcess->data);
             //appel de la méthode de préparation de la page standard.
             $toProcess->data->assign('HTML_HEAD', '<$HTML_HEAD />');
             //Par ex, bandeaux de pub, menus dynamiques, ... (propres aux projets.)
             $content = $toProcess->data->fetch($toProcess->more);
             $this->_beforeDisplay($content);
             echo $content;
             break;
         case CopixActionReturn::FILE:
         case CopixActionReturn::CONTENT:
             $contentDisposition = 'inline';
             $contentTransfertEnconding = 'binary';
             $contentType = null;
             $fileNameOnly = null;
             if ($toProcess->code == CopixActionReturn::FILE) {
                 $fileName = $toProcess->data;
                 $fileNameOnly = explode('/', str_replace('\\', '/', $fileName));
                 $fileNameOnly = $fileNameOnly[count($fileNameOnly) - 1];
             }
             if (is_array($toProcess->more)) {
                 if (isset($toProcess->more['content-disposition'])) {
                     $contentDisposition = $toProcess->more['content-disposition'];
                 }
                 if (isset($toProcess->more['filename'])) {
                     $fileNameOnly = $toProcess->more['filename'];
                 }
                 if (isset($toProcess->more['content-type'])) {
                     $contentType = $toProcess->more['content-type'];
                 }
                 if (isset($toProcess->more['content-transfer-encoding'])) {
                     $contentTransfertEnconding = $toProcess->more['content-transfer-encoding'];
                 }
             } elseif (strlen(trim($toProcess->more))) {
                 $contentType = $toProcess->more;
             }
             if ($contentType === null) {
                 $contentType = CopixMIMETypes::getFromFileName($fileNameOnly);
             }
             header("Pragma: public");
             header("Expires: 0");
             header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
             header("Cache-Control: protected", false);
             header("Content-Type: " . $contentType);
             header("Content-Disposition: " . $contentDisposition . "; filename=\"" . $fileNameOnly . "\";");
             header("Content-Transfer-Encoding: " . $contentTransfertEnconding);
             header("Content-Length: " . ($toProcess->code == CopixActionReturn::FILE ? filesize($fileName) : strlen($toProcess->data)));
             if ($toProcess->code == CopixActionReturn::FILE) {
                 readfile($fileName);
             } else {
                 echo $toProcess->data;
             }
             flush();
             break;
         case CopixActionReturn::PPO:
             $contentType = 'text/html';
             $cacheControl = false;
             $mainTemplate = $config->mainTemplate;
             $charset = CopixI18N::getCharset();
             if (is_array($toProcess->more)) {
                 $template = $toProcess->more['template'];
                 if (isset($toProcess->more['content-type'])) {
                     $contentType = $toProcess->more['content-type'];
                 }
                 if (array_key_exists('mainTemplate', $toProcess->more)) {
                     $mainTemplate = $toProcess->more['mainTemplate'];
                 }
                 if (isset($toProcess->more['charset'])) {
                     $charset = $toProcess->more['charset'];
                 }
                 if (isset($toProcess->more['cache-control'])) {
                     $cacheControl = $toProcess->more['cache-control'];
                 }
             } else {
                 $template = $toProcess->more;
             }
             $tplContent = new CopixTpl();
             $tplContent->assign('ppo', $toProcess->data);
             header("Content-Type: " . $contentType . ";charset=" . $charset);
             if ($cacheControl !== false) {
                 header('Cache-Control: ' . $cacheControl);
             }
             if ($mainTemplate !== null) {
                 $tplMain = new CopixTpl();
                 $tplMain->assign('TITLE_PAGE', isset($toProcess->data->TITLE_PAGE) ? $toProcess->data->TITLE_PAGE : null);
                 $tplMain->assign('TITLE_BAR', isset($toProcess->data->TITLE_BAR) ? $toProcess->data->TITLE_BAR : null);
                 $tplMain->assign('POPUP', isset($toProcess->data->POPUP) ? $toProcess->data->POPUP : null);
                 $tplMain->assign('MENU', isset($toProcess->data->MENU) ? $toProcess->data->MENU : null);
                 $tplMain->assign('CAN_CLOSE', isset($toProcess->data->CAN_CLOSE) ? $toProcess->data->CAN_CLOSE : null);
                 $tplMain->assign('BODY_ON_LOAD', isset($toProcess->data->BODY_ON_LOAD) ? $toProcess->data->BODY_ON_LOAD : null);
                 $tplMain->assign('BODY_ON_UNLOAD', isset($toProcess->data->BODY_ON_UNLOAD) ? $toProcess->data->BODY_ON_UNLOAD : null);
                 $tplMain->assign('MAIN', $tplContent->fetch($template));
                 $tplContent = null;
                 //on libère la mémoire
                 $tplMain->assign('ppo', $toProcess->data);
                 $this->_processStandard($tplMain);
                 $tplMain->assign('HTML_HEAD', '<$HTML_HEAD />');
                 $content = $tplMain->fetch($mainTemplate);
             } else {
                 $tplContent->assign('TITLE_PAGE', isset($toProcess->data->TITLE_PAGE) ? $toProcess->data->TITLE_PAGE : null);
                 $tplContent->assign('TITLE_BAR', isset($toProcess->data->TITLE_BAR) ? $toProcess->data->TITLE_BAR : null);
                 $tplContent->assign('BODY_ON_LOAD', isset($toProcess->data->BODY_ON_LOAD) ? $toProcess->data->BODY_ON_LOAD : null);
                 $tplContent->assign('BODY_ON_UNLOAD', isset($toProcess->data->BODY_ON_UNLOAD) ? $toProcess->data->BODY_ON_UNLOAD : null);
                 $this->_processStandard($tplContent);
                 $tplContent->assign('HTML_HEAD', '<$HTML_HEAD />');
                 $content = $tplContent->fetch($template);
             }
             CopixContext::clear();
             $this->_beforeDisplay($content);
             echo $content;
             break;
         case CopixActionReturn::REDIRECT:
             //redirection standard, message http.
             header('location: ' . $toProcess->data);
             break;
         case CopixActionReturn::HTTPCODE:
             foreach ($toProcess->data as $code) {
                 header($code);
             }
             echo $toProcess->more;
             break;
         case CopixActionReturn::NONE:
             break;
     }
     //Appel des méthodes afterDisplay des plugins
     foreach (CopixPluginRegistry::getRegistered() as $name => $plugin) {
         $plugin->afterDisplay();
     }
     session_write_close();
 }
 /**
  * Page d'accueil d'un groupe
  *
  * @author Christophe Beyer <cbeyer@cap-tic.fr>
  * @since 2005/11/15
  * @param integer $id Id du groupe
  */
 public function getHome()
 {
     $kernel_service =& CopixClassesFactory::Create('kernel|kernel');
     $groupeService =& CopixClassesFactory::Create('groupe|groupeService');
     $id = $this->getRequest('id', null);
     $errors = array();
     $dao = CopixDAOFactory::create("groupe");
     $groupe = $dao->getGroupe($id);
     if (!$groupe) {
         $errors[] = CopixI18N::get('groupe|groupe.error.noGroup');
     }
     $mondroit = $kernel_service->getLevel("CLUB", $id);
     //print_r("mondroit=$mondroit");
     if (!$groupeService->canMakeInGroupe('VIEW_HOME', $mondroit)) {
         $errors[] = CopixI18N::get('kernel|kernel.error.noRights');
     }
     if ($errors) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $errors), 'back' => CopixUrl::get('groupe||')));
     } else {
         // On r�cup�re les modules du groupe
         $his_modules = $kernel_service->getModEnabled("club", $id);
         foreach ($his_modules as $k => $node) {
             //print_r(explode("_",$node->module_type));
             list($tmp, $module) = explode("_", $node->module_type);
             $module = strtolower($module);
             $classeModule = CopixClassesFactory::create("{$module}|Kernel{$module}");
             $infos = $classeModule->getStats($node->module_id);
             //print_r($infos);
             $his_modules[$k]->infos = $infos;
             $his_modules[$k]->module_nom = Kernel::Code2Name($node->module_type);
         }
         // Infos du groupe
         $classeModule = CopixClassesFactory::create("groupe|Kernelgroupe");
         $infos = $classeModule->getStats($id);
         $groupe[0]->infos = $infos;
         $groupe[0]->nbMembers = $infos['nbMembers']['name'];
         $userInfo = $kernel_service->getUserInfo("ID", $groupe[0]->createur);
         $groupe[0]->createur_nom = $userInfo["prenom"] . " " . $userInfo["nom"];
         $groupe[0]->createur_infos = $userInfo;
         //print_r($groupe[0]);
         $tpl = new CopixTpl();
         $tpl->assign('TITLE_PAGE', $groupe[0]->titre);
         // $tpl->assign ('MENU', '<a href="'.CopixUrl::get ('groupe||getListMy').'">'.CopixI18N::get ('groupe|groupe.backMy').'</a>');
         $menu = array();
         //$menu[] = array('url' => CopixUrl::get ('groupe||getListMy'), 'txt'=>CopixI18N::get ('groupe|groupe.backMy'), 'size'=>120);
         $tpl->assign('MENU', $menu);
         $tplHome = new CopixTpl();
         $tplHome->assign('groupe', $groupe[0]);
         $tplHome->assign('canViewAdmin', $groupeService->canMakeInGroupe('ADMIN', $mondroit) ? 1 : 0);
         $tplHome->assign('canUnsubscribeHimself', $groupeService->canMakeInGroupe('UNSUBSCRIBE_HIMSELF', $mondroit) ? 1 : 0);
         $tplHome->assign('his_modules', $his_modules);
         $result = $tplHome->fetch('gethome.tpl');
         $tpl->assign('MAIN', $result);
         $plugStats = CopixPluginRegistry::get("stats|stats");
         $plugStats->setParams(array('module_id' => $groupe[0]->id));
         return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
     }
 }