/** * 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) { //the very first. $old_error_handler = set_error_handler('CopixErrorHandler'); $this->url =& new CopixUrl($_SERVER['PHP_SELF'], $_GET); $this->vars = array_merge($_POST, $_GET); // 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; // registering and creating plugins. foreach ($GLOBALS['COPIX']['CONFIG']->plugins as $name) { if ($plug =& CopixPluginFactory::create($name)) { $this->plugins[strtolower($name)] =& $plug; } } // do what we need for each plugin before starting the session $this->_beforeSessionStart(); session_start(); }
/** * 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(); }