function beforeSessionStart()
 {
     // Détection Requete XmlRpc
     if ($this->coordination->vars['action'] == 'xmlrpc') {
         // Récupération de la requete
         global $HTTP_RAW_POST_DATA;
         if (isset($HTTP_RAW_POST_DATA)) {
             $requestXml = $HTTP_RAW_POST_DATA;
         } else {
             $requestXml = file('php://input');
             $requestXml = implode("\n", $requestXml);
         }
         // Décodage de la requete
         list($nom, $vars) = CopixXmlRpc::decodeRequest($requestXml);
         list($module, $action) = explode('.', $nom);
         // Définition de l'action a executer et des paramètres
         $this->coordination->vars['module'] = $module;
         $this->coordination->vars['action'] = $action;
         $this->coordination->vars['params'] = $vars;
         $this->coordination->vars['desc'] = 'xmlrpc';
     }
 }
 /**
  *
  * @param
  * @return
  * @access private
  */
 function _encodeValue($value)
 {
     $response = '<value>';
     if (is_array($value)) {
         $isArray = true;
         $datas = array();
         $structkeys = array();
         foreach ($value as $key => $val) {
             if (!is_numeric($key)) {
                 $isArray = false;
             }
             $structkeys[] = '<name>' . $key . '</name>';
             $datas[] = CopixXmlRpc::_encodeValue($val);
         }
         if ($isArray) {
             $response .= '<array><data>' . implode(' ', $datas) . '</data></array>';
         } else {
             $response .= '<struct>';
             foreach ($datas as $k => $v) {
                 $response .= '<member>' . $structkeys[$k] . $v . '</member>';
             }
             $response .= '</struct>';
         }
     } else {
         if (is_bool($value)) {
             $response .= '<boolean>' . ($value ? 1 : 0) . '</boolean>';
         } else {
             if (is_int($value)) {
                 $response .= '<int>' . intval($value) . '</int>';
             } else {
                 if (is_string($value)) {
                     $response .= '<string>' . htmlspecialchars($value) . '</string>';
                 } else {
                     if (is_float($value)) {
                         $response .= '<double>' . doubleval($value) . '</double>';
                     } else {
                         if (is_object($value)) {
                             switch (get_class($value)) {
                                 case 'copixdatetime':
                                     $response .= '<dateTime.iso8601>' . $value->toString($value->ISO8601_FORMAT) . '</dateTime.iso8601>';
                                     break;
                                 case 'copixbinary':
                                     $response .= '<base64>' . $value->toBase64String() . '</base64>';
                                     break;
                             }
                         }
                     }
                 }
             }
         }
     }
     return $response . '</value>';
 }
 /**
  * Agit selon le résultat de l'execution de l'action de la méthode de l'objet ActionGroup
  * Methode qui va effectuer un affichage de template, une redirection etc... en fonction
  * du code indiqué par le CopixActionReturn.
  * @param CopixActionReturn      $ToProcess   indique le type de resultat
  * @see CopixActionGroup
  * @todo rajouter une sorte de "Fin de traitement" _DoEnd / _DoFirst
  * @access private
  */
 function _processResult($toProcess)
 {
     //ending
     switch ($toProcess->code) {
         case COPIX_AR_ERROR:
             //erreur
             header("Content-Type: text/html");
             $tpl = new CopixTpl();
             if (($assignedTitlePage = $tpl->getAssigned('TITLE_PAGE')) !== null) {
                 $tpl->assign('TITLE_PAGE', '[' . CopixI18N::get('copix:common.messages.error') . ']' . $assignedTitlePage);
             } else {
                 $tpl->assign('TITLE_PAGE', '[' . CopixI18N::get('copix:common.messages.error') . ']');
             }
             $this->_processStandard($tpl);
             $this->_doHTMLHeaders($tpl);
             $tpl->assign('MAIN', $toProcess->data);
             $content = $tpl->fetch('|error.tpl');
             CopixContext::clear();
             $this->_callPluginsMethod_beforeDisplay($content);
             echo $content;
             break;
         case COPIX_AR_DISPLAY:
             header("Content-Type: text/html");
             $this->_processStandard($toProcess->data);
             //appel de la méthode de préparation de la page standard.
             $this->_doHTMLHeaders($toProcess->data);
             //Par ex, bandeaux de pub, menus dynamiques, ... (propres aux projets.)
             CopixContext::clear();
             $content = $toProcess->data->fetch($GLOBALS['COPIX']['CONFIG']->mainTemplate);
             //$content = str_replace ('./', $GLOBALS['COPIX']['CONFIG']->significant_url_basepath, $content);
             $this->_callPluginsMethod_beforeDisplay($content);
             echo $content;
             break;
         case COPIX_AR_DISPLAY_IN:
             $this->_processStandard($toProcess->data);
             //appel de la méthode de préparation de la page standard.
             $this->_doHTMLHeaders($toProcess->data);
             //Par ex, bandeaux de pub, menus dynamiques, ... (propres aux projets.)
             $content = $toProcess->data->fetch($toProcess->more);
             $this->_callPluginsMethod_beforeDisplay($content);
             echo $content;
             break;
         case COPIX_AR_REDIRECT:
             //redirection standard, message http.
             header('location: ' . $toProcess->data);
             break;
         case COPIX_AR_STATIC:
             $tpl =& new CopixTpl();
             $tpl->assign('MAIN', $this->includeStatic($toProcess->data));
             $this->_processStandard($tpl);
             $this->_doHTMLHeaders($tpl);
             $waitForMore = array('TITLE_PAGE', 'TITLE_BAR');
             foreach ($waitForMore as $key) {
                 if (isset($toProcess->more[$key])) {
                     $tpl->assign($key, $toProcess->more[$key]);
                 }
             }
             //Affichage dans le template principal.
             CopixContext::clear();
             $content = $tpl->fetch($GLOBALS['COPIX']['CONFIG']->mainTemplate);
             $this->_callPluginsMethod_beforeDisplay($content);
             echo $content;
             break;
         case COPIX_AR_DOWNLOAD:
             $fileName = $toProcess->data;
             if (is_readable($fileName) && is_file($fileName)) {
                 //quick and dirty..... still.
                 if (strlen(trim($toProcess->more))) {
                     $fileNameOnly = $toProcess->more;
                 } else {
                     $fileNameOnly = explode('/', str_replace('\\', '/', $fileName));
                     $fileNameOnly = $fileNameOnly[count($fileNameOnly) - 1];
                 }
                 header("Content-Type: application/forcedownload");
                 header("Content-Disposition: attachment; filename=" . $fileNameOnly);
                 header("Content-Description: File Transfert");
                 header("Content-Transfer-Encoding: binary");
                 header("Pragma: no-cache");
                 header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
                 header("Expires: 0");
                 header("Content-Length: " . filesize($fileName));
                 readfile($fileName);
                 flush();
             }
             break;
         case COPIX_AR_BINARY:
             $fileName = $toProcess->data;
             //echo $fileName;
             if (is_readable($fileName) && is_file($fileName)) {
                 header("Content-Type: " . $toProcess->more);
                 header("Content-Length: " . filesize($fileName));
                 readfile($fileName);
                 flush();
             }
             break;
         case COPIX_AR_BINARY_CONTENT:
             $content = $toProcess->data;
             header("Content-Type: " . $toProcess->more);
             header("Content-Length: " . strlen($content));
             echo $content;
             flush();
             break;
         case COPIX_AR_DOWNLOAD_CONTENT:
             $content = $toProcess->data;
             header("Content-Type: application/forcedownload");
             header("Content-Disposition: attachment; filename=" . $toProcess->more);
             header("Content-Description: File Transfert");
             header("Content-Transfer-Encoding: binary");
             header("Pragma: no-cache");
             header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
             header("Expires: 0");
             header("Content-Length: " . strlen($content));
             echo $content;
             flush();
             break;
         case COPIX_AR_NONE:
             break;
         case COPIX_AR_XMLRPC:
             header("Content-Type: text/xml");
             require_once COPIX_UTILS_PATH . 'CopixXmlRpc.class.php';
             $content = CopixXmlRpc::encodeResponse($toProcess->data);
             header("Content-length: " . strlen($content));
             echo $content;
             break;
         case COPIX_AR_XMLRPC_FAULT:
             header("Content-Type: text/xml");
             require_once COPIX_UTILS_PATH . 'CopixXmlRpc.class.php';
             $content = CopixXmlRpc::encodeFaultResponse($toProcess->data[0], $toProcess->data[1]);
             header("Content-length: " . strlen($content));
             echo $content;
             break;
         default:
             trigger_error(CopixI18N::get('copix:copix.error.noActionReturn'), E_USER_ERROR);
             break;
     }
     //Calling plugins
     //appel les plugins de post-processing.
     $this->_callPluginsMethod_afterProcess($toProcess);
 }