예제 #1
0
파일: Zip.php 프로젝트: valdeirpsr/fuel-zip
 /**
  * Gets a new instance of the Zip class.
  *
  * @param   string $name    instance name
  *
  * @return object Zip_Instance
  */
 public static function forge($name = 'default')
 {
     if ($exists = static::instance($name)) {
         \Errorhandler::notice('Zip with this name exists already, cannot be overwritten.');
         return $exists;
     }
     static::$_instances[$name] = new Zip_Instance($name);
     if ($name == 'default') {
         static::$_instance = static::$_instances[$name];
     }
     return static::$_instances[$name];
 }
예제 #2
0
 /**
  * Yellow Screen of Death (YSOD) is used to display a Koch Framework Exception
  */
 public function yellowScreenOfDeath()
 {
     ob_start();
     /**
      * @todo add backlink to the exception codes list
      */
     if ($this->code > 0) {
         $code = '(#' . $this->code . ')';
     } else {
         $code = '';
     }
     // Header
     $html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
     $html .= '<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">';
     $html .= '<head>';
     $html .= '<title>Clansuite Exception ' . $code . ' - ' . $this->message . '</title>';
     $html .= '<link rel="stylesheet" href="' . WWW_ROOT_THEMES_CORE . 'css/error.css" type="text/css" />';
     $html .= '</head>';
     // Body
     $html .= '<body>';
     // Fieldset
     $html .= '<fieldset id="top" class="error_yellow">';
     // Errorlogo
     $html .= '<div style="float: left; margin: 5px; margin-right: 25px; padding: 20px;">';
     $html .= '<img src="' . WWW_ROOT_THEMES_CORE . 'images/Clansuite-Toolbar-Icon-64-exception.png" ';
     $html .= 'style="border: 2px groove #000000;" alt="Clansuite Exception Icon" /></div>';
     // Fieldset Legend
     $html .= '<legend>Clansuite Exception</legend>';
     // Exception Table
     $html .= '<table width="80%"><tr><td>';
     /**
      * Panel 1
      *
      * Exception Message and File
      */
     $html .= '<div id="panel1" class="panel">';
     $html .= '<h3>Exception ' . $code . '</h3><h4>' . $this->message . '</h4>';
     $html .= '<strong>' . Errorhandler::getFileLink($this->file, $this->line) . '.</strong>';
     $html .= '</div>';
     /**
      * Panel 2
      *
      * Debug Backtrace
      */
     if (defined('DEBUG') and DEBUG == 1) {
         // lets get the backtrace as html table
         $html .= Errorhandler::getDebugBacktrace($this->trace);
     }
     /**
      * Panel 3
      *
      * Server Environment Informations
      */
     if (defined('DEBUG') and DEBUG == 1) {
         $html .= '<div id="panel3" class="panel">';
         $html .= '<h3>Server Environment</h3>';
         $html .= '<table width="95%">';
         $html .= '<tr><td><strong>Date: </strong></td><td>' . date('r') . '</td></tr>';
         $html .= '<tr><td><strong>Remote: </strong></td><td>' . $_SERVER['REMOTE_ADDR'] . '</td></tr>';
         $html .= '<tr><td><strong>Request: </strong></td><td>index.php?' . $_SERVER['QUERY_STRING'] . '</td></tr>';
         $html .= '<tr><td><strong>PHP: </strong></td><td>' . PHP_VERSION . ' ' . PHP_EXTRA_VERSION . '</td></tr>';
         $html .= '<tr><td><strong>Server: </strong></td><td>' . $_SERVER['SERVER_SOFTWARE'] . '</td></tr>';
         $html .= '<tr><td><strong>Agent: </strong></td><td>' . $_SERVER['HTTP_USER_AGENT'] . '</td></tr>';
         $html .= '<tr><td><strong>Clansuite: </strong></td><td>' . CLANSUITE_VERSION . ' ' . CLANSUITE_VERSION_STATE;
         $html .= ' (' . CLANSUITE_VERSION_NAME . ')</td></tr>';
         $html .= '</table></div>';
     }
     /**
      * Panel 4
      *
      * Additional Information
      */
     if (empty(self::$exception_template) === false) {
         $html .= '<div id="panel4" class="panel">';
         $html .= '<h3>Additional Information & Solution Suggestion</h3>';
         $html .= self::$exception_template . '</div>';
     }
     /**
      * Panel 5
      *
      * Rapid Development
      */
     $placeholders = array();
     // assign placeholders for replacements in the html
     if (strpos($this->message, 'action_')) {
         $placeholders['actionname'] = substr($this->message, strpos($this->message, 'action_'));
     } elseif (strpos($this->message, 'module_')) {
         $placeholders['classname'] = substr($this->message, strpos($this->message, 'module_'));
     }
     if (empty($_GET['mod']) == false) {
         $placeholders['modulename'] = (string) stripslashes($_GET['mod']);
     } else {
         $placeholders['modulename'] = '';
     }
     // add development helper template to exceptions
     if (defined('DEVELOPMENT') and DEVELOPMENT == 1 and defined('RAPIDDEVTPL') and RAPIDDEVTPL == 1) {
         $html .= '<div id="panel5" class="panel">';
         $html .= '<h3>Rapid Application Development</h3>';
         $html .= self::getExceptionDevelopmentTemplate($placeholders) . '</div>';
     }
     /**
      * Panel 6
      *
      * Backlink to Bugtracker with Exceptionmessage
      * @link http://trac.clansuite.com/newticket
      */
     $html .= Errorhandler::getBugtrackerBacklinks($this->message, $this->file, $this->line, $this->trace);
     // close all html element table
     $html .= '</table>';
     /**
      * Panel 7
      *
      * Footer with Support-Backlinks
      */
     $html .= Errorhandler::getSupportBacklinks($this);
     // close all html elements: fieldset, body+page
     $html .= '</fieldset>';
     $html .= '</body></html>';
     // save session before exit - but only if this is not a pdo exception
     // that would trigger a fatal error, when trying to write to the db during session save
     if ((bool) session_id() and false === strpos($this->message, 'SQLSTATE')) {
         session_write_close();
     }
     // clear all output buffers
     if (ob_get_length()) {
         ob_end_clean();
     }
     // Output the errormessage
     return $html;
 }
 /**
  * Prepare the environment, registering the Error and Exception handlers, and allowing HTTP method parameter overriding.
  */
 protected function bootstrapEnvironment()
 {
     $this["debug"] = !!$this["app.config"]["environment.debug"];
     Errorhandler::register();
     ExceptionHandler::register($this["debug"]);
     Request::enableHttpMethodParameterOverride();
 }