[5121] trunk/htdocs/system/classes/options.php: Allow values in the options table to be specified by default in the config file .

1 view
Skip to first unread message

s...@habariproject.org

unread,
May 11, 2011, 8:48:22 PM5/11/11
to habar...@googlegroups.com
Revision
5121
Author
ringmaster
Date
2011-05-12 00:48:21 +0000 (Thu, 12 May 2011)

Log Message

Allow values in the options table to be specified by default in the config file.  Settings assigned to the array in the config file for default_options can be overridden by settings in the database but will provide an initial setting.  Settings assigned to the array in the config file for static_options will override any values that are specified in the database.

Modified Paths

Diff

Modified: trunk/htdocs/system/classes/options.php (5120 => 5121)


--- trunk/htdocs/system/classes/options.php	2011-05-12 00:45:50 UTC (rev 5120)
+++ trunk/htdocs/system/classes/options.php	2011-05-12 00:48:21 UTC (rev 5121)
@@ -217,6 +217,9 @@
 			'pagination' => 10,
 			'comments_require_id' => false,
 		);
+		if(Config::exists('default_options')) {
+			$this->options = array_merge($this->options, Config::get('default_options'));
+		}
 		$results = DB::get_results( 'SELECT name, value, type FROM {options}', array(), 'QueryRecord' );
 		foreach ( $results as $result ) {
 			if ( $result->type == 1 ) {
@@ -226,6 +229,9 @@
 				$this->options[$result->name] = $result->value;
 			}
 		}
+		if(Config::exists('static_options')) {
+			$this->options = array_merge($this->options, Config::get('static_options'));
+		}
 	}
 
 	/**
Reply all
Reply to author
Forward
0 new messages