/** * Overload the setBaseURL method. */ public function setBaseURL($base = null) { // First get the config object $registry = Zmax_Bootstrap::getRegistry(); $zmax_context = $registry->get("zmax_context"); $config = $zmax_context->config; // Remove the trailing '/' parent::setBaseUrl($this->cleanUrl($config->app->base_url)); }
// Load the controller that makes a few initialisations // so that V1 functions remain compatible with V2 functions require_once "myreview_v1/Constant.php"; require_once "myreview_v1/Myreview_Controller_Action.php"; require_once "myreview_v1/Myreview_Controller_Action_Auth.php"; require_once "myreview_v1/BD.class.php"; require_once "myreview_v1/Codes.class.php"; require_once "myreview_v1/Tableau.class.php"; require_once "myreview_v1/Formulaire.class.php"; require_once "myreview_v1/IhmBD.class.php"; // Get the codes of the application (V1). $CODES = new Codes("Codes.xml"); // This system might potentially reach the memory // limit of PHP. Check that this does not happen if (function_exists("memory_get_usage")) { // The following instruction can raise the memory limit ini_set("memory_limit", "100M"); ini_set("max_execution_time", "300"); // 5 mns } if (isset($_GET["zmax_init_failed"])) { // The Boostrap initialization failed. Zmax_Bootstrap::failure($root); } else { try { // Init and run the Zmax application Zmax_Bootstrap::init($root, $configDir); } catch (Zmax_Exception $e) { echo "Unable to initialize the MyReview environment.<br/>" . "<b>Message:</b> " . $e->getMessage() . " in " . $e->getFile() . " at line " . $e->getLine() . "<br/>"; } }
/** * This function is executed when a Paper object is instantiated. We * look for the associated object if this is an existing paper. */ function init() { $this->_authors = array(); $this->_answers = array(); $this->_abstract = array(); $this->_hideAuthors = false; if (!empty($this->id)) { $authorTbl = new Author(); $authors = $authorTbl->fetchAll("id_paper='{$this->id}'", 'position ASC'); $i = 0; foreach ($authors as $author) { $user = $author->findParentUser(); if (!is_object($user)) { echo "Unkown user in {$this->id}<br/>"; } else { $this->_authors[] = $user; if ($this->emailContact == $user->email) { $this->_contactAuthor = $i; } } $i++; } // Fetch the answers if (self::$loadAnswers) { $answers = $this->findPaperAnswer(); foreach ($answers as $answer) { $this->_answers[$answer->id_question] = $answer; } } // Fetch the abstract if (self::$loadAbstracts) { $this->_abstract = $this->initAbstracts(); } } // get the default number of authors $registry = Zmax_Bootstrap::getRegistry(); $zmax_context = $registry->get("zmax_context"); $config = $zmax_context->config; $defaultNbAuthorsInform = $config->app->nb_authors_in_form; // Set the file path $this->_filePath = $config->app->upload_path; // NB: the nb of authors shown is at least $defaultNbAuthorsInform, or the current number of authors // if the latter is greater. $this->nb_authors_in_form = max($defaultNbAuthorsInform, $this->nbAuthors()); }
/** * Authenticate a user * * */ private function authenticate() { // Check the authentication method switch ($this->auth_method) { case "cas": // Attempt authentication, saving the result $result = $this->auth->authenticate($this->adapter); if ($result->isValid()) { Zmax_Bootstrap::setupUser(); // Gets the user //Zmax_Bootstrap::setupAuthentication(); } return $result->isValid(); break; default: // Default authentication: digest if ($this->getRequest()->getParam("submit_login")) { // Attempt authentication, saving the result $result = $this->auth->authenticate($this->adapter); if (!$result->isValid()) { // Authentication failed; print the reasons why $this->auth_messages .= "<b>Error during authentication :</b> "; foreach ($result->getMessages() as $message) { $this->auth_messages .= "{$message}<br/>\n"; } return false; } else { Zmax_Bootstrap::setupUser(); // Gets the user return true; } } } return false; }
public static function setupFrontController() { $zmax_context = self::getRegistry()->get("zmax_context"); $config = $zmax_context->config; $app_dir = self::getRoot() . 'application' . DIRECTORY_SEPARATOR; self::$frontController = Zmax_Controller_Front::getInstance(); // Keep the front controller from sending exceptions self::$frontController->throwExceptions(false); // This tells where the controllers code can be found self::$frontController->setControllerDirectory(array('default' => $app_dir . 'controllers' . DIRECTORY_SEPARATOR, 'admin' => $app_dir . 'admin' . DIRECTORY_SEPARATOR . 'controllers' . DIRECTORY_SEPARATOR)); // Set the error handler // PR: does not work, because it shows a warning when used // with Zend View and Zend_Layout .... if ($config->view->zmax_view_system == "phplib") { set_error_handler(array(self::$frontController, "errorHandler")); } // Change the error handler plugin, to forward exceptions // to the 'stalled' action of the index controller $eh = new Zend_Controller_Plugin_ErrorHandler(); $eh->setErrorHandlerController('index')->setErrorHandlerAction('stalled'); self::$frontController->registerPlugin($eh); // Remove all automatic escaping self::$frontController->normalizeHTTP(); // Set the base url self::$frontController->setBaseUrl(); }