Beispiel #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));
     }
 }
Beispiel #2
0
 function parent($el)
 {
     if ($this->parent) {
         Orror::dump($this->id, $this->parent);
         throw new Exception("Can't have two parents");
     }
     $this->parent = $el;
 }
Beispiel #3
0
 public function routeStartup(Zend_Controller_Request_Abstract $request)
 {
     if (Strass::onDevelopment()) {
         $level = E_ALL & ~(E_STRICT | E_DEPRECATED);
         ini_set('display_errors', 1);
     } else {
         $level = 0;
         ini_set('display_errors', 0);
     }
     Orror::init($level, array($this, 'errorHandler'), array($this, 'kill'), false);
 }
Beispiel #4
0
 function &addChild($instance)
 {
     if (is_string($instance)) {
         $args = func_get_args();
         $name = array_shift($args);
         $instance = call_user_func_array(array($this, 'add' . $name), $args);
         return $instance;
     }
     if (!$instance instanceof Wtk_Form_Model_Instance) {
         Orror::kill($instance);
     }
     $instance->setPath($this->path . '/' . $instance->id);
     $this->value[$instance->id] = $instance;
     return $instance;
 }
Beispiel #5
0
 function unparent()
 {
     if ($this instanceof Wtk_Form_Fieldset) {
         $dbg = debug_backtrace();
         foreach ($dbg as $i => $stack) {
             $dbg[$i]['object'] = get_class($stack['object']);
             $dbg[$i]['args'] = array();
             foreach ($stack['args'] as $arg) {
                 $dbg[$i]['args'][] = is_object($arg) ? get_class($arg) : $arg;
             }
         }
         Orror::kill($dbg);
     }
     if ($this->parent instanceof Wtk_Container) {
         $parent = $this->parent;
         $this->parent = null;
         // éviter la boucle car removeChild va appeler cette
         // fonction.
         $parent->removeChild($this);
     }
 }
Beispiel #6
0
 function retrieve($value)
 {
     preg_match("/#?([0-9a-fA-F]{1,2}){3}/", $value, $res);
     Orror::kill($value, $res);
 }
Beispiel #7
0
 static function comment()
 {
     $args = func_get_args();
     $error['msg'] = self::print_r($args, TRUE);
     // Recherche du fichier et de la ligne de l'erreur.
     $error['file'] = null;
     $error['line'] = null;
     $error['class'] = null;
     $error['function'] = null;
     $error['level'] = null;
     Orror::callHandler($error);
 }
Beispiel #8
0
 static function main()
 {
     self::bootstrapStage1();
     /* On affiche la page de maintenance avant d'initialiser Wtk et
      * strass. Ainsi, seuls index.php et ce fichier sont requis pour
      * afficher la page de maintenance. Pas d'inclusion de Zend, Wtk,
      * etc. */
     if (self::onMaintenance()) {
         return self::showMaintenance();
     }
     self::bootstrapStage2();
     if (!self::isInstalled()) {
         return Strass_Installer::main();
     }
     try {
         self::run();
     } catch (Exception $e) {
         self::saveSession();
         try {
             try {
                 $logger = Zend_Registry::get('logger');
             } catch (Exception $_) {
                 $logger = new Strass_Logger();
             }
             $logger->critical($e->getMessage(), null, print_r($e, true));
         } catch (Exception $_) {
         }
         // Affichage complet des exceptions non interceptées par le
         // controlleur.
         $msg = ":(\n\n";
         $msg .= $e->getMessage() . "\n\n";
         $msg .= " à " . $e->getFile() . ":" . $e->getLine() . "\n\n";
         $msg .= str_replace('#', '<br/>#', $e->getTraceAsString()) . "\n";
         header('HTTP/1.1 500 Internal Server Error');
         error_log(strtok($e->getMessage(), "\n"));
         Orror::kill(strip_tags($msg));
         return;
     }
     self::saveProfile();
 }
Beispiel #9
0
<?php

$_ENV['STRASS_UNIT_TEST'] = 1;
putenv('STRASS_UNIT_TEST=1');
$paths = explode(':', get_include_path());
array_shift($paths);
array_unshift($paths, '.', dirname(dirname(__FILE__)) . '/../include');
set_include_path(implode(':', $paths));
require_once 'Strass.php';
require_once 'Orror.php';
chdir(realpath(getenv('STRASS_ROOT')));
Strass::bootstrap();
Orror::init(E_ALL | E_STRICT);
Strass_Cache::setup();
Strass_Db::setup();
Zend_Registry::set('config', new Zend_Config(array(), true));