]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
demo mode (you can't update password in demo mode
authorNicolas Lœuillet <nicolas@loeuillet.org>
Sat, 1 Jun 2013 06:29:37 +0000 (08:29 +0200)
committerNicolas Lœuillet <nicolas@loeuillet.org>
Sat, 1 Jun 2013 06:29:37 +0000 (08:29 +0200)
img/messages/close.png [changed mode: 0755->0644]
img/messages/cross.png [changed mode: 0755->0644]
img/messages/help.png [changed mode: 0755->0644]
img/messages/tick.png [changed mode: 0755->0644]
img/messages/warning.png [changed mode: 0755->0644]
inc/config.php
inc/store/sqlite.class.php
index.php

old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 2de725f4087888dad9c1282e924f87969b068398..bd9287fe143ad0c539b34858d53f11640e56fc71 100644 (file)
@@ -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);
index 4bfbb29e83632d26f353647574a313dc2809cd94..210816084e1e0042e381b5bd6783fdcea8db2126 100644 (file)
@@ -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
         {
index 91d0b3047fef9770c7ae80b1d5f67b7f498d6b27..0a778d0843f2fd20c55be7f1f089f3c1cf537aa4 100644 (file)
--- 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