Esempio n. 1
0
 protected function __construct()
 {
     $this->query_string = $_GET;
     $this->request_path = BFL_Register::getVar('request_path');
     $this->base_path = BFL_Register::getVar('base_path');
     BFL_Register::unsetVar('request_path');
     BFL_Register::unsetVar('base_path');
     $this->base_path .= '/' . $this->getPathSection(0) . '/' . $this->getPathSection(1);
     if ($this->base_path[0] == '/') {
         $this->base_path = substr($this->base_path, 1);
     }
     $path = $this->request_path;
     unset($path[1], $path[2]);
     $iskey = false;
     $key = '';
     $result = array();
     foreach ($path as $item) {
         $iskey = !$iskey;
         if ($iskey) {
             $key = $item;
         } else {
             $result[$key] = $item;
         }
     }
     $this->path_option = $result;
 }
Esempio n. 2
0
 protected function connect()
 {
     $db_info = BFL_Register::getVar('db_info');
     BFL_Register::unsetVar('db_info');
     try {
         $dsn = $db_info['type'] . ':host=' . $db_info['host'] . ';dbname=' . $db_info['name'];
         $this->pdo = new PDO($dsn, $db_info['user'], $db_info['password']);
         $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         $this->pdo->exec('SET NAMES UTF8');
     } catch (PDOException $e) {
         die("Database Error: " . $e->getMessage());
     }
 }
Esempio n. 3
0
 public static function load_plugins($plugins_path)
 {
     $dh = opendir($plugins_path);
     while ($file = readdir($dh)) {
         if ($file != "." && $file != "..") {
             $plugin_file = $plugins_path . $file . '/';
             if (is_dir($plugin_file)) {
                 $interface = $plugin_file . 'interface.php';
                 if (file_exists($interface)) {
                     self::$plugins[] = strtolower($file);
                     BFL_Register::setVar('plugin_file', $plugin_file);
                     include_once $interface;
                     BFL_Register::unsetVar('plugin_file');
                 }
             }
         }
     }
     closedir($dh);
 }