diff --git a/img/messages/close.png b/img/messages/close.png old mode 100755 new mode 100644 diff --git a/img/messages/cross.png b/img/messages/cross.png old mode 100755 new mode 100644 diff --git a/img/messages/help.png b/img/messages/help.png old mode 100755 new mode 100644 diff --git a/img/messages/tick.png b/img/messages/tick.png old mode 100755 new mode 100644 diff --git a/img/messages/warning.png b/img/messages/warning.png old mode 100755 new mode 100644 diff --git a/inc/config.php b/inc/config.php index 2de725f..bd9287f 100644 --- a/inc/config.php +++ b/inc/config.php @@ -14,6 +14,7 @@ if (!is_dir('db/')) { @mkdir('db/',0705); } +define ('MODE_DEMO', FALSE); define ('ABS_PATH', 'assets/'); define ('CONVERT_LINKS_FOOTNOTES', TRUE); define ('REVERT_FORCED_PARAGRAPH_ELEMENTS',FALSE); diff --git a/inc/store/sqlite.class.php b/inc/store/sqlite.class.php index 4bfbb29..2108160 100644 --- a/inc/store/sqlite.class.php +++ b/inc/store/sqlite.class.php @@ -74,6 +74,13 @@ class Sqlite extends Store { return isset($pass[0]['value']) ? $pass[0]['value'] : FALSE; } + public function updatePassword($password) + { + $sql_update = "UPDATE config SET value=? WHERE name='password'"; + $params_update = array($password); + $query = $this->executeQuery($sql_update, $params_update); + } + private function executeQuery($sql, $params) { try { diff --git a/index.php b/index.php index 91d0b30..0a778d0 100644 --- a/index.php +++ b/index.php @@ -54,14 +54,17 @@ elseif (isset($_GET['config'])) { if (isset($_POST['password']) && isset($_POST['password_repeat'])) { if ($_POST['password'] == $_POST['password_repeat'] && $_POST['password'] != "") { logm('password updated'); - $store->updatePassword(encode_string($_POST['password'] . $_SESSION['login'])); - $msg->add('s', 'your password has been updated'); + if (!DEMO) { + $store->updatePassword(encode_string($_POST['password'] . $_SESSION['login'])); + $msg->add('s', 'your password has been updated'); + } + else { + $msg->add('i', 'in demo mode, you can\'t update password'); + } } else $msg->add('e', 'your password can\'t be empty and you have to repeat it in the second field'); } - else - $msg->add('e', 'error in your password update'); } # Traitement des paramètres et déclenchement des actions