small optimisation so that we can not automatically connect to db on some pages....
authorchriskl <chriskl>
Fri, 18 Apr 2003 08:43:40 +0000 (08:43 +0000)
committerchriskl <chriskl>
Fri, 18 Apr 2003 08:43:40 +0000 (08:43 +0000)
intro.php
libraries/lib.inc.php

index 3a0bdeb5035cd03883cbf28ccc0d3a2a3a9570d2..9c9bfb65eae5b3ebfca2e7c2ec9f1388cadb958a 100755 (executable)
--- a/intro.php
+++ b/intro.php
@@ -3,10 +3,11 @@
        /**
         * Intro screen
         *
-        * $Id: intro.php,v 1.4 2003/03/17 05:20:30 chriskl Exp $
+        * $Id: intro.php,v 1.5 2003/04/18 08:43:41 chriskl Exp $
         */
 
-       // Include application functions
+       // Include application functions (no db conn)
+       $_no_db_connection = true;
        include_once('libraries/lib.inc.php');
        
        $misc->printHeader();
index 914ef670d9242c3179d7ab94c4d29a7c58447ed2..c00746d91d380abb66d06609227cf749668060d1 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * Function library read in upon startup
         *
-        * $Id: lib.inc.php,v 1.34 2003/04/17 06:11:41 chriskl Exp $
+        * $Id: lib.inc.php,v 1.35 2003/04/18 08:43:40 chriskl Exp $
         */
 
        // Application name 
        // Import language file
        include("lang/recoded/" . strtolower($_SESSION['webdbLanguage']) . ".php");
 
-       // Create data accessor object, if valid
-       if (isset($_SESSION['webdbServerID']) && isset($confServers[$_SESSION['webdbServerID']])) {
-               if (!isset($confServers[$_SESSION['webdbServerID']]['type']))
-                       $confServers[$_SESSION['webdbServerID']]['type'] = 'postgres7';
-               $_type = $misc->getDriver($confServers[$_SESSION['webdbServerID']]['host'],
+       // Create data accessor object, if valid, and if necessary
+       if (!isset($_no_db_connection)) {
+               if (isset($_SESSION['webdbServerID']) && isset($confServers[$_SESSION['webdbServerID']])) {
+                       if (!isset($confServers[$_SESSION['webdbServerID']]['type']))
+                               $confServers[$_SESSION['webdbServerID']]['type'] = 'postgres7';
+                       $_type = $misc->getDriver($confServers[$_SESSION['webdbServerID']]['host'],
+                                                       $confServers[$_SESSION['webdbServerID']]['port'],
+                                                       $_SESSION['webdbUsername'],
+                                                       $_SESSION['webdbPassword'],
+                                                       $confServers[$_SESSION['webdbServerID']]['type']);
+                       // Check return type
+                       if ($_type == -1) {
+                               echo $lang['strnotloaded'];
+                               exit;
+                       }
+                       // @@ NEED TO CHECK MORE RETURN VALS HERE
+
+                       require_once('classes/database/' . $_type . '.php');
+                       $data = new $_type($confServers[$_SESSION['webdbServerID']]['host'],
                                                $confServers[$_SESSION['webdbServerID']]['port'],
+                                               null,
                                                $_SESSION['webdbUsername'],
-                                               $_SESSION['webdbPassword'],
-                                               $confServers[$_SESSION['webdbServerID']]['type']);
-               // Check return type
-               if ($_type == -1) {
-                       echo $lang['strnotloaded'];
-                       exit;
+                                               $_SESSION['webdbPassword']);
                }
-               // @@ NEED TO CHECK MORE RETURN VALS HERE
-
-               require_once('classes/database/' . $_type . '.php');
-               $data = new $_type($confServers[$_SESSION['webdbServerID']]['host'],
-                                       $confServers[$_SESSION['webdbServerID']]['port'],
-                                       null,
-                                       $_SESSION['webdbUsername'],
-                                       $_SESSION['webdbPassword']);
-       }
 
-       // Create local (database-specific) data accessor object, if valid
-       if (isset($_SESSION['webdbServerID']) && isset($confServers[$_SESSION['webdbServerID']]) && isset($_REQUEST['database'])) {
-               require_once('classes/database/' . $_type . '.php');
-               $localData = new $_type(        $confServers[$_SESSION['webdbServerID']]['host'],
-                                                                                       $confServers[$_SESSION['webdbServerID']]['port'],
-                                                                                       $_REQUEST['database'],
-                                                                                       $_SESSION['webdbUsername'],
-                                                                                       $_SESSION['webdbPassword']);
-               
-               // If schema is defined and database supports schemas, then set the schema explicitly
-               if (isset($_REQUEST['schema']) && $localData->hasSchemas()) {
-                       $status = $localData->setSchema($_REQUEST['schema']);
-                       if ($status != 0) {
-                               echo $lang['strbadschema'];
-                               exit;
+               // Create local (database-specific) data accessor object, if valid
+               if (isset($_SESSION['webdbServerID']) && isset($confServers[$_SESSION['webdbServerID']]) && isset($_REQUEST['database'])) {
+                       require_once('classes/database/' . $_type . '.php');
+                       $localData = new $_type(        $confServers[$_SESSION['webdbServerID']]['host'],
+                                                                                               $confServers[$_SESSION['webdbServerID']]['port'],
+                                                                                               $_REQUEST['database'],
+                                                                                               $_SESSION['webdbUsername'],
+                                                                                               $_SESSION['webdbPassword']);
+
+                       // If schema is defined and database supports schemas, then set the schema explicitly
+                       if (isset($_REQUEST['schema']) && $localData->hasSchemas()) {
+                               $status = $localData->setSchema($_REQUEST['schema']);
+                               if ($status != 0) {
+                                       echo $lang['strbadschema'];
+                                       exit;
+                               }
                        }
+
                }
-               
        }
 
        // Get database encoding