Ejemplo n.º 1
0
 public static function __autoload($classname)
 {
     $filename = $classname . ".php";
     if (strpos($classname, "Controller") !== false) {
         // TODO: CHECK MODULES CONTROLLERS
         // LOAD ROOT CONTROLLER
         Brightery::loadFile([CONTROLLERS, $filename]);
     } elseif (strpos($classname, "_helper") !== false) {
         $helper_path = HELPERS . '/' . ucfirst($filename);
         if (file_exists($helper_path)) {
             Brightery::loadFile($helper_path);
         } else {
             Brightery::loadFile(SYSTEM_HELPERS . '/' . ucfirst($filename));
         }
     } elseif (strpos($classname, "models") !== false) {
         $model_path = APPLICATION . '/' . str_replace('\\', '/', lcfirst($filename));
         if (file_exists($model_path)) {
             Brightery::loadFile($model_path);
         }
     } else {
         if (Brightery::$RunningModule) {
             Brightery::loadFile(APPLICATION . '/modules/' . Brightery::$RunningModule . '/models/' . ucfirst($filename));
         } else {
             Brightery::loadFile([MODELS, ucfirst($filename)]);
         }
     }
 }
Ejemplo n.º 2
0
 private function setupSystemValidationMessages()
 {
     $this->language =& Brightery::SuperInstance()->Language;
     if (isset($this->language)) {
         $defaultLanguage = Brightery::SuperInstance()->language->getDefaultLanguage(true);
     }
     $this->systemValidationMessages = Brightery::loadFile([ROOT, 'languages', $defaultLanguage, 'system.php']);
 }
Ejemplo n.º 3
0
 /**
  * Handles uncaught PHP exceptions.
  *
  * This method is implemented as a PHP exception handler.
  *
  * @param \Exception $exception the exception that is not caught
  */
 public function handleException($exception)
 {
     if ($exception instanceof ExitException) {
         print_r($exception);
         return;
     }
     // disable error capturing to avoid recursive errors while handling exceptions
     $this->unregister();
     if ($exception instanceof PDOException) {
         $last_query = null;
         if (method_exists(Brightery::SuperInstance()->Database, 'getLastQuery')) {
             $last_query = Brightery::SuperInstance()->Database->getLastQuery();
         }
         Brightery::loadFile([ROOT, 'styles', 'system', 'database_error.php'], false, ['exception' => $exception, 'last_query' => $last_query]);
     } else {
         //            print_r($exception);
         Brightery::loadFile([ROOT, 'styles', 'system', 'exceptions.php'], false, ['exception' => $exception]);
     }
     $this->exception = $exception;
     print_r($exception);
     exit(500);
     //        try {
     //            $this->logException($exception);
     //            if ($this->discardExistingOutput) {
     //                $this->clearOutput();
     //            }
     //            $this->renderException($exception);
     //            if (!YII_ENV_TEST) {
     //                exit(1);
     //            }
     //        } catch (\Exception $e) {
     //            // an other exception could be thrown while displaying the exception
     //            $msg = (string) $e;
     //            $msg .= "\nPrevious exception:\n";
     //            $msg .= (string) $exception;
     //            if (YII_DEBUG) {
     //                if (PHP_SAPI === 'cli') {
     //                    echo $msg . "\n";
     //                } else {
     //                    echo '<pre>' . htmlspecialchars($msg, ENT_QUOTES, Yii::$app->charset) . '</pre>';
     //                }
     //            }
     //            $msg .= "\n\$_SERVER = " . var_dump($_SERVER);
     //            error_log($msg);
     //            exit(1);
     //        }
     $this->exception = null;
 }
Ejemplo n.º 4
0
 public function displayDebugger()
 {
     $data['memory'] = $this->getMemory();
     $data['brightery_version'] = $this->getFrameworkVersion();
     $data['php_version'] = $this->getPhpVersion();
     $data['status_code'] = $this->getStatusCode();
     $data['route'] = $this->getRoute();
     $data['execution_time'] = $this->getExecutionTime();
     $data['config'] = $this->getConfiguration();
     $data['queries'] = $this->getDatabase();
     $data['phpinfo'] = $this->getPHPinfo();
     $data['mac_address'] = $this->getMacAddress();
     $data['db_connection'] = $this->getCurrentConnections();
     $data['log'] = Log::get();
     $data['assets'] = $this->getAssets();
     return Brightery::loadFile([ROOT, 'styles', 'system', 'debug.php'], false, $data);
 }