Browse code

config() liest die Datenbank bei Bedarf selbst aus

git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1527 87cf0b9e-d624-0410-a070-f6ee81989793

bernd authored on05/12/2009 16:28:20
Showing2 changed files
... ...
@@ -5,18 +5,6 @@ require_once('inc/debug.php');
5 5
 require_once('inc/db_connect.php');
6 6
 require_once("inc/base.php");
7 7
 
8
-/*
9
- read configuration from database
10
-*/
11
-
12
-$options = db_query( "SELECT `key`, value FROM misc.config" );
13
-
14
-while( $object = mysql_fetch_assoc( $options ) ) {
15
-//	echo "1";
16
-//	echo $object['key'];
17
-	$config[$object['key']]=$object['value'];
18
-}
19
-//print_r($config);
20 8
 
21 9
 $go = $_GET['go'];
22 10
 
... ...
@@ -6,6 +6,16 @@ require_once('inc/db_connect.php');
6 6
 function config($key)
7 7
 {
8 8
   global $config;
9
+  if (array_key_exists($key, $config))
10
+    return $config[$key];
11
+  
12
+  /* read configuration from database */
13
+  $options = db_query( "SELECT `key`, value FROM misc.config" );
14
+  
15
+  while( $object = mysql_fetch_assoc( $options ) ) {
16
+	  $config[$object['key']]=$object['value'];
17
+  }
18
+  DEBUG($config);
9 19
   if (array_key_exists($key, $config))
10 20
     return $config[$key];
11 21
   else