Example #1
0
 static function main()
 {
     Zend_Registry::set('config', new Strass_Config_Php('strass', array()));
     Zend_Registry::set('acl', new Strass_Installer_FakeAcl());
     Strass_Cache::setup();
     try {
         $fc = Zend_Controller_Front::getInstance();
         $fc->setRequest(new Strass_Controller_Request_Http());
         $fc->setParam('useDefaultControllerAlways', true);
         $fc->setParam('noViewRenderer', true);
         $fc->setModuleControllerDirectoryName('Installer');
         $fc->addControllerDirectory(Strass::getPrefix() . 'include/Strass/Installer/Controller', 'Strass');
         $fc->setDefaultModule('Strass');
         $fc->registerPlugin(new Strass_Controller_Plugin_Error());
         $fc->dispatch();
         Zend_Session::writeClose();
     } catch (Exception $e) {
         // affichage complet des exceptions non intercepté par le controlleur. À améliorer.
         $msg = ":(\n\n";
         $msg .= $e->getMessage() . "\n\n";
         $msg .= " à " . $e->getFile() . ":" . $e->getLine() . "\n\n";
         $msg .= str_replace('#', '<br/>#', $e->getTraceAsString()) . "\n";
         Orror::kill(strip_tags($msg));
     }
 }
Example #2
0
 static function bootstrapStage2()
 {
     /* Initialise une installation existante (avec Wtk, styles, etc.). */
     require_once 'Wtk.php';
     Wtk::init();
     Wtk_Document_Style::$path = array(Strass::getPrefix() . 'static/styles/', 'data/styles/');
     Wtk_Document_Style::$basestyle = Strass::getPrefix() . 'static/styles/strass/';
 }
Example #3
0
 function postDispatch()
 {
     $format = $this->_getParam('format');
     $page = Zend_Registry::get('page');
     if (!in_array($format, $this->_formats)) {
         $format = 'html';
     }
     //throw new Strass_Controller_Action_Exception("Ce document n'est pas disponible dans ce format.");
     $available_formats = (require Strass::getPrefix() . 'include/Strass/formats.php');
     foreach ($available_formats as $name) {
         if (!($f = Strass_Format::factory($name))) {
             continue;
         }
         if (in_array($f->suffix, $this->_formats)) {
             $page->addFormat($f);
         }
     }
     // choper le format actuel
     $page->selectFormat($format);
     $this->viewSuffix = $page->format->viewSuffix . '.php';
     $response = $this->getResponse();
     // rendu effectif du document.
     $output = $page->format->render($this);
     $response->setHeader('Content-Type', $page->format->mimeType . '; charset=utf-8');
     if ($page->format->download) {
         $filename = $page->format->getFilename($this->view);
         $response->setHeader('Content-Disposition', 'attachment; filename=' . urlencode($filename));
     }
     $response->appendBody($output);
 }