Esempio n. 1
0
 /**
  * The "main" function
  *
  * The starting point of the TIP system. This must be called somewhere from
  * your index.php.
  */
 public function go()
 {
     // Configure the locale
     $locale_module = $this->shared_modules['locale'];
     if (TIP::setLocaleId(TIP::getOption($locale_module, 'locale'))) {
         date_default_timezone_set(TIP::getOption($locale_module, 'timezone'));
     }
     // Executes the action
     if ($this->_request['module'] && $this->_request['action']) {
         if (is_null($module =& TIP_Type::getInstance($this->_request['module'], false))) {
             TIP::notifyError('module');
         } else {
             if (isset($this->_request['id'])) {
                 // Now the module is loaded: force id type casting
                 $id_type = $module->getProperty('id_type');
                 isset($id_type) || ($id_type = 'integer');
                 settype($this->_request['id'], $id_type);
                 $this->keys['ID'] = $this->_request['id'];
             }
             if (is_null($module->callAction($this->_request['action']))) {
                 TIP::notifyError(is_null(TIP::getUserId()) ? 'reserved' : 'denied');
             }
         }
     } elseif ($this->_request['module']) {
         TIP::notifyError('noaction');
     } elseif ($this->_request['action']) {
         TIP::notifyError('nomodule');
     } elseif (TIP_AHAH) {
         // AHAH request without module/action specified: perform a test
         $this->content = "<pre>\n" . TIP::toHtml(print_r($_SERVER, true)) . "\n</pre>\n";
     }
     if (TIP_AHAH) {
         // AHAH request: output the page and return
         header('Content-Type: application/xml');
         echo $this->content;
         return;
     }
     // Generates the page: body must be called before the head because
     // some head tags can be modified by body templates
     $body = $this->tagRun($this->body_template);
     echo str_replace('{locale}', TIP::getLocaleId('-'), $this->incipit);
     $this->run($this->head_template);
     echo $body . $this->explicit;
     $this->_session_started && HTTP_Session2::pause();
 }