]> git.agnieray.net Git - galette.git/blobdiff - galette/lib/Galette/Core/Preferences.php
Rely on static methods rather than constants comparison
[galette.git] / galette / lib / Galette / Core / Preferences.php
index e3bedf85b93f8053f40dc121069b5d4d41e4ea07..e8ff0954143782a61a4880a44faa54cf7da4d6a1 100644 (file)
@@ -496,7 +496,7 @@ class Preferences
     public function check(array $values, Login $login)
     {
         $insert_values = array();
-        if ($login->isSuperAdmin() && GALETTE_MODE !== Galette::MODE_DEMO) {
+        if ($login->isSuperAdmin() && !Galette::isDemo()) {
             $this->required[] = 'pref_admin_login';
         }
 
@@ -512,7 +512,7 @@ class Preferences
         }
 
         //cleanup fields for demo
-        if (GALETTE_MODE == Galette::MODE_DEMO) {
+        if (Galette::isDemo()) {
             unset(
                 $insert_values['pref_admin_login'],
                 $insert_values['pref_admin_pass'],
@@ -522,7 +522,7 @@ class Preferences
 
         // missing relations
         if (
-            GALETTE_MODE !== Galette::MODE_DEMO
+            !Galette::isDemo()
             && isset($insert_values['pref_mail_method'])
         ) {
             if ($insert_values['pref_mail_method'] > GaletteMail::METHOD_DISABLED) {
@@ -596,7 +596,7 @@ class Preferences
             }
         }
 
-        if (GALETTE_MODE !== Galette::MODE_DEMO && isset($values['pref_admin_pass_check'])) {
+        if (!Galette::isDemo() && isset($values['pref_admin_pass_check'])) {
             // Check passwords. Hash will be done into the Preferences class
             if (strcmp($insert_values['pref_admin_pass'], $values['pref_admin_pass_check']) != 0) {
                 $this->errors[] = _T("Passwords mismatch");
@@ -674,7 +674,7 @@ class Preferences
                 }
                 break;
             case 'pref_admin_login':
-                if (GALETTE_MODE === Galette::MODE_DEMO) {
+                if (Galette::isDemo()) {
                     Analog::log(
                         'Trying to set superadmin login while in DEMO.',
                         Analog::WARNING
@@ -729,7 +729,7 @@ class Preferences
                 }
                 break;
             case 'pref_admin_pass':
-                if (GALETTE_MODE == Galette::MODE_DEMO) {
+                if (Galette::isDemo()) {
                     Analog::log(
                         'Trying to set superadmin pass while in DEMO.',
                         Analog::WARNING
@@ -799,7 +799,7 @@ class Preferences
 
             foreach (self::$defaults as $k => $v) {
                 if (
-                    GALETTE_MODE == Galette::MODE_DEMO
+                    Galette::isDemo()
                     && in_array($k, ['pref_admin_pass', 'pref_admin_login', 'pref_mail_method'])
                 ) {
                     continue;
@@ -970,7 +970,7 @@ class Preferences
 
         if (!in_array($name, $forbidden) && isset($this->prefs[$name])) {
             if (
-                GALETTE_MODE === Galette::MODE_DEMO
+                Galette::isDemo()
                 && $name == 'pref_mail_method'
             ) {
                 return GaletteMail::METHOD_DISABLED;
@@ -1071,7 +1071,7 @@ class Preferences
             || $name == 'pref_email_newadh'
             || $name == 'pref_email_reply_to'
         ) {
-            if (GALETTE_MODE === Galette::MODE_DEMO) {
+            if (Galette::isDemo()) {
                 Analog::log(
                     'Trying to set pref_email while in DEMO.',
                     Analog::WARNING