/**
  * Return the name of the database driver to be used.
  *
  * @return string
  */
 protected function getDatabaseDriver()
 {
     $type = $this->parser->get('db_type');
     // FluxBB has multiple different database adapters for MySQL
     if (str_contains($type, 'mysql')) {
         return 'mysql';
     }
     // Laravel only supports SQLite3
     if ($type == 'sqlite3') {
         return 'sqlite';
     }
     if ($type == 'sqlite') {
         throw new \Exception('Cannot use SQLite2 database with Laravel.');
     }
     return $type;
 }
示例#2
0
 /**
  * Read the current user's identifier from the cookie.
  *
  * @return array|null
  */
 public function getId()
 {
     $cookieName = $this->parser->get('cookie_name');
     $content = array_get($_COOKIE, $cookieName);
     if (!is_null($content) && preg_match('%^(\\d+)\\|([0-9a-fA-F]+)\\|(\\d+)\\|([0-9a-fA-F]+)$%', $content, $matches)) {
         $id = intval($matches[1]);
         $expire = intval($matches[3]);
         $remember = $expire > time() + 1800;
         return array($id, $remember);
     }
     return null;
 }