Example #1
0
 /**
  * Returns and if needed creates a instance
  * Singleton
  *
  * @access public static
  * @return object Instance of the class
  **/
 public static function getInstance()
 {
     if (self::$logWriter == null) {
         throw new Zend_Log_Exception('Incorrect $writer, check settings, type: ' . gettype($writer));
     }
     if (self::$instance == null) {
         self::$instance = new self(self::$logWriter);
     }
     return self::$instance;
 }
Example #2
0
 /**
  * Main Entry point, this function should be called from the
  * boot file to begin the application
  *
  * @access public static
  * @return void
  **/
 public function dispatch()
 {
     try {
         $this->setup();
         $this->run();
         $this->shutdown();
     } catch (Zend_Log_Exception $zle) {
         echo "[INIT ERROR] ";
         echo $zle->getMessage();
     } catch (Exception $e) {
         if (self::$DEBUG) {
             Gecko_Utils::Error($e->getMessage() . "<br />Trace: " . $e->getTraceAsString(), "Uncaught Exception", $e->getMessage() . "\nTrace\n" . $e->getTraceAsString());
         } else {
             Gecko_Log::getInstance()->log($e->getMessage() . "\nTrace:\n" . $e->getTraceAsString(), Zend_Log::DEBUG);
             Gecko_Utils::Error("Internal Server Error", "Internal Server Error");
         }
     }
 }
Example #3
0
 /**
  * Creates a error message
  *
  * @param string $msg
  * @param string $log_msg
  * @return void
  **/
 public static function Error($msg, $title = "", $log_msg = "")
 {
     ob_end_clean();
     $cfg = Zend_Registry::get("config");
     $baseDir = Zend_Registry::get("baseDir");
     $error = $baseDir . $cfg->Template->error;
     if (empty($error)) {
         $template = Gecko_Router::LIBRARY_DIR . "/Assets/files/error.php";
     } else {
         $template = $error;
     }
     if (!empty($log_msg)) {
         Gecko_Log::getInstance()->Log($log_msg, Zend_Log::DEBUG);
     }
     if (empty($title)) {
         $title = "Critical Error";
     }
     $output = Gecko_Template::renderTemplate($template, array("title" => $title, "error" => $msg), true);
     die($output);
 }