Esempio n. 1
0
 public function __construct($code = '', $message = '', $previous = '')
 {
     BaseConfig::load(Package::get_file('system/config/exception.yml'));
     $this->exception_messages = ini('exception/messages');
     if ($this->exception_messages[$code]) {
         $message = '(' . $code . ') ' . sprintf(_($this->exception_messages[$code]), $message);
     }
     $this->message = $message;
     $this->code = $code;
 }
Esempio n. 2
0
 public static function init($dsn = null, $init_connect = true)
 {
     BaseConfig::load(Package::get_file('etc/conf.d/database.yml'));
     self::$dsn = sprintf('%s://%s:%s@%s:%s/%s', ini('database/' . RUN_MODE . '/adapter'), ini('database/' . RUN_MODE . '/user'), ini('database/' . RUN_MODE . '/passwd'), ini('database/' . RUN_MODE . '/host'), ini('database/' . RUN_MODE . '/port'), ini('database/' . RUN_MODE . '/name'));
     if (self::$inited !== true) {
         import('system/vendors/Doctrine/Doctrine');
         spl_autoload_register(array('Doctrine', 'autoload'));
         self::$inited = true;
     }
     if ($dsn) {
         self::$dsn = $dsn;
     }
     if ($init_connect) {
         self::create_connection(null, self::$dsn, ini('database/' . RUN_MODE . '/charset'));
     }
     spl_autoload_register(array('Doctrine_Core', 'modelsAutoload'));
 }
Esempio n. 3
0
 protected function __load__mongo_model__($model)
 {
     import('system/bin/mongo');
     list($model_path, $model_name) = explode('.', $model);
     import('applications/' . $model_path . '/mongo_models/' . $model_name);
     BaseConfig::load(Package::get_file('etc/conf.d/database.yml'));
     $dbinfo = ini('database/mongo_' . RUN_MODE);
     call_user_func(array($model_name, 'setup'), $dbinfo);
     //        $model_name::setup($dbinfo);
 }