diff options
Diffstat (limited to 'inc/poche/Database.class.php')
-rwxr-xr-x | inc/poche/Database.class.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php index 2c80b64b..b5dd2120 100755 --- a/inc/poche/Database.class.php +++ b/inc/poche/Database.class.php | |||
@@ -23,6 +23,10 @@ class Database { | |||
23 | { | 23 | { |
24 | switch (STORAGE) { | 24 | switch (STORAGE) { |
25 | case 'sqlite': | 25 | case 'sqlite': |
26 | // Check if /db is writeable | ||
27 | if ( !is_writable(STORAGE_SQLITE) || !is_writable(dirname(STORAGE_SQLITE))) { | ||
28 | die('An error occured: "db" directory must be writeable for your web server user!'); | ||
29 | } | ||
26 | $db_path = 'sqlite:' . STORAGE_SQLITE; | 30 | $db_path = 'sqlite:' . STORAGE_SQLITE; |
27 | $this->handle = new PDO($db_path); | 31 | $this->handle = new PDO($db_path); |
28 | break; | 32 | break; |
@@ -113,10 +117,10 @@ class Database { | |||
113 | $query = $this->executeQuery($sql, array()); | 117 | $query = $this->executeQuery($sql, array()); |
114 | } | 118 | } |
115 | 119 | ||
116 | public function install($login, $password) | 120 | public function install($login, $password, $email = '') |
117 | { | 121 | { |
118 | $sql = 'INSERT INTO users ( username, password, name, email) VALUES (?, ?, ?, ?)'; | 122 | $sql = 'INSERT INTO users ( username, password, name, email) VALUES (?, ?, ?, ?)'; |
119 | $params = array($login, $password, $login, ' '); | 123 | $params = array($login, $password, $login, $email); |
120 | $query = $this->executeQuery($sql, $params); | 124 | $query = $this->executeQuery($sql, $params); |
121 | 125 | ||
122 | $sequence = ''; | 126 | $sequence = ''; |