--- phpMyAdmin-2.2.2-rc1/libraries/common.lib.php	Fri Nov 16 18:47:16 2001
+++ phpMyAdmin/libraries/common.lib.php	Sun Nov 18 14:34:26 2001
@@ -300,11 +300,73 @@
         return ($i < $max) ? $i : -1;
     }  // end of the 'pmaIsInto()' function
 
-
-    /**
+	/**
      * Use mysql_connect() or mysql_pconnect()?
      */
     $connect_func = ($cfgPersistentConnections) ? 'mysql_pconnect' : 'mysql_connect';
+
+	/**
+	* If Server List is being stored in the Database, fetch and store it in
+	* $GLOBALS[$cfgServers]. All variables start with cfgDB to prevent overwritting
+	* variables already in use.
+	*/
+	if (isset($GLOBALS["cfgDBServers"]) && $GLOBALS["cfgDBServers"] == true) {
+		// Unset cfgServers so PHPMyAdmin don't get confused
+		unset ($cfgServers);
+
+		// Getting Configuration and setting up a connection
+		$cfgDB = $GLOBALS["cfgDBServer"];
+
+		$cfgDBConnection = $connect_func($cfgDB["host"], $cfgDB["user"], $cfgDB["password"])
+			or die("[DB VALUES] : Could not connect for fetching DB values<br />Mysql said: ".mysql_error($dbconnection));
+		mysql_select_db($cfgDB["database"], $cfgDBConnection)
+			or die("[DB VALUES] : Could not set database '".$cfgDB["database"]."' for fetching DB values<br />Mysql said: ".mysql_error($cfgDBConnection));
+
+		// Getting Server Configuration, ordered by verbose
+		$cfgDBQuery = "SELECT * FROM ".$cfgDB["table"]." ORDER BY verbose";
+		$cfgDBResult = mysql_query($cfgDBQuery, $cfgDBConnection)
+			or die("[DB VALUES] : Query for fetching DB Values failed { ".$cfgDBQuery." } <br />Mysql said: ".mysql_error($cfgDBConnection));
+		while ($cfgDBTemp = mysql_fetch_array($cfgDBResult))
+			$cfgDBServerTemp[] = $cfgDBTemp;
+
+		// Setting Default Values, which will be overwritten, if configuration is different.
+		$cfgDBDefault = array("adv_auth" => $cfgDB["adv_auth"], "stduser" => $cfgDB["stduser"], "stdpass" => $cfgDB["stdpass"]);
+
+		// Storing Array, but only by Key Values which are strings and if there is an array
+		if (is_array($cfgDBServerTemp)) {
+			foreach($cfgDBServerTemp as $cfgDBServer) {
+				$cfgDBArr = array();
+				foreach($cfgDBServer as $cfgDBKey=>$cfgDBVal)
+					if (is_string($cfgDBKey)) {
+						// Do we have a default value for this key?
+						if (in_array($cfgDBKey, array("adv_auth", "stduser", "stdpass"))) {
+							// Do we have a special value?
+							if ($cfgDBVal == FALSE || strlen($cfgDBVal) == 0)
+								$cfgDBVal == $cfgDBDefault[$cfgDBKey];
+						}
+						$cfgDBArr[$cfgDBKey] = $cfgDBVal;
+					}
+				// Add to cfgServers, setting id manually, because it would start with 0 otherwise.
+				$cfgServers[count($cfgServers) + 1] = $cfgDBArr;
+				unset($cfgDBArr);
+			}
+		} else {
+			// Array was empty, which means there are no servers stored.
+			// Setting Local server, so we can start with anything.
+			$cfgServers[1] = array(
+				"host"			=>	"localhost",
+				"connect_type"	=>	"tcp",
+				"adv_auth"		=>	FALSE,
+				"user"			=>	"root",
+				"password"		=>	"",
+				"port"			=>	"",
+				"adv_auth"		=>	$cfgDB["adv_auth"],
+				"stduser"		=>	$cfgDB["stduser"],
+				"stdpass"		=>	$cfgDB["stdpass"]
+			);
+		}
+	}
+
     $dblist       = array();
 
