浏览代码

Allow database based preferences to read in default settings from the
default_pref file next to hardcoding them into the DB class, thanks
Thierry Godefroy.

Thijs Kinkhorst 17 年之前
父节点
当前提交
c582eb3d3a
共有 2 个文件被更改,包括 24 次插入1 次删除
  1. 3 1
      ChangeLog
  2. 21 0
      functions/db_prefs.php

+ 3 - 1
ChangeLog

@@ -244,7 +244,9 @@ Version 1.5.2 - SVN
   - Added "Secured Configuration" mode.
   - Added "Secured Configuration" mode.
   - Added edit list, checkbox, radio group, multiple-select folder list
   - Added edit list, checkbox, radio group, multiple-select folder list
     and multiple-select string list option widget types.
     and multiple-select string list option widget types.
-
+  - Allow database based preferences to read in default settings from the
+    default_pref file next to hardcoding them into the DB class, thanks
+    Thierry Godefroy.
 
 
 Version 1.5.1 (branched on 2006-02-12)
 Version 1.5.1 (branched on 2006-02-12)
 --------------------------------------
 --------------------------------------

+ 21 - 0
functions/db_prefs.php

@@ -164,6 +164,27 @@ class dbPrefs {
 
 
 
 
 
 
+    /**
+     * initialize the default preferences array.
+     *
+     */
+    function dbPrefs() {
+        // Try and read the default preferences file.
+        $default_pref = SM_PATH . 'config/default_pref';
+        if (@file_exists($default_pref)) {
+            if ($file = @fopen($default_pref, 'r')) {
+                while (!feof($file)) {
+                    $pref = fgets($file, 1024);
+                    $i = strpos($pref, '=');
+                    if ($i > 0) {
+                        $this->default[trim(substr($pref, 0, $i))] = trim(substr($pref, $i + 1));
+                    }
+                }
+                fclose($file);
+            }
+        }
+    }
+
     /**
     /**
      * initialize DB connection object
      * initialize DB connection object
      *
      *