diff --git a/config-default.php b/config-default.php index 469c419..cfc0370 100644 --- a/config-default.php +++ b/config-default.php @@ -6,13 +6,11 @@ ini_set('display_startup_errors', '1'); error_reporting(E_ALL); // Application -define('BASE_URL', 'https://kvazar.ml'); +define('BASE_URL', '/'); define('PAGE_LIMIT', 10); -define('SEF_MODE', true); +define('SEF_MODE', false); // Database -define('DB_HOST', 'localhost'); -define('DB_PORT', '3306'); -define('DB_NAME', ''); +define('DB_NAME', 'kvazar.dat'); define('DB_USERNAME', ''); define('DB_PASSWORD', ''); diff --git a/library/mysql.php b/library/sqlite.php old mode 100755 new mode 100644 similarity index 96% rename from library/mysql.php rename to library/sqlite.php index fa9c3b3..0b2a779 --- a/library/mysql.php +++ b/library/sqlite.php @@ -1,12 +1,12 @@ _db = new PDO('mysql:dbname=' . DB_NAME . ';host=' . DB_HOST . ';port=' . DB_PORT . ';charset=utf8', DB_USERNAME, DB_PASSWORD, [PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8']); + $this->_db = new PDO('sqlite:' . $database, $username, $password, [PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8']); $this->_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $this->_db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); $this->_db->setAttribute(PDO::ATTR_TIMEOUT, 600); diff --git a/public/index.php b/public/index.php index 287cf2e..d259e9b 100755 --- a/public/index.php +++ b/public/index.php @@ -2,7 +2,7 @@ require_once('../config.php'); require_once('../library/icon.php'); -require_once('../library/mysql.php'); +require_once('../library/sqlite.php'); $query = isset($_GET['q']) ? $_GET['q'] : false; $ns = isset($_GET['ns']) ? preg_replace('/[^a-zA-Z0-9]+/', '', $_GET['ns']) : false; @@ -38,7 +38,7 @@ if ($page > 0) { $limit = PAGE_LIMIT * $page; } -$db = new MySQL(); +$db = new SQLite(DB_NAME, DB_USERNAME, DB_PASSWORD); if ($ns) { $namespaceValue = $db->getNamespaceName($ns);