From 97b643fce0b6323bde954157a931a87ca05b52e5 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Sun, 06 Jan 2008 13:56:59 -0500
Subject: [PATCH] Fixed some typo.

---
 interface/lib/classes/db_mysql.inc.php |   33 ++++++++++++++++++++++-----------
 1 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/interface/lib/classes/db_mysql.inc.php b/interface/lib/classes/db_mysql.inc.php
index 564b7b6..eeb7c59 100644
--- a/interface/lib/classes/db_mysql.inc.php
+++ b/interface/lib/classes/db_mysql.inc.php
@@ -49,7 +49,7 @@
 	private $errorNumber = 0;	// last error number
 	public $errorMessage = '';	// last error message
 	private $errorLocation = '';// last error location
-	private $show_error_messages = false;
+	public $show_error_messages = false;
 
 	public function __construct()
     {
@@ -217,10 +217,21 @@
        
     public function closeConn()
     {
+    	if($this->linkId)
+    	{
+    		mysql_close($this->linkId);
+    		return true;
+    	} else { return false; }
     }
        
-    public function freeResult() 
+    public function freeResult($query) 
     {
+    	if(mysql_free_result($query))
+    	{
+    		return true;
+    	} else {
+    		return false;
+    	}
     }
        
     public function delete()
@@ -252,7 +263,7 @@
         foreach($columns as $col){
             $sql .= $col['name'].' '.$this->mapType($col['type'], $col['typeValue']).' ';
             //* Set default value
-            if($col['defaultValue'] != '') {
+            if(isset($col['defaultValue']) && $col['defaultValue'] != '') {
 			    if($col['defaultValue'] == 'NULL' or $col['defaultValue'] == 'NOT NULL') {
 				    $sql .= 'DEFAULT '.$col['defaultValue'].' ';
 			    } else {
@@ -261,19 +272,19 @@
 		    } elseif($col['defaultValue'] != false) {
 			    $sql .= "DEFAULT '' ";
 		    }
-		    if($col['defaultValue'] != 'NULL' && $col['defaultValue'] != 'NOT NULL') {
+		    if(isset($col['defaultValue']) && $col['defaultValue'] != 'NULL' && $col['defaultValue'] != 'NOT NULL') {
                 if($col['notNull'] == true) {
                     $sql .= 'NOT NULL ';
                 } else {
                     $sql .= 'NULL ';
                 }
 		    }
-            if($col['autoInc'] == true){ $sql .= 'auto_increment '; }
+            if(isset($col['autoInc']) && $col['autoInc'] == true){ $sql .= 'auto_increment '; }
             $sql.= ',';
             //* Index Definitions
-            if($col['option'] == 'primary'){ $index .= 'PRIMARY KEY ('.$col['name'].'),'; }
-            if($col['option'] == 'index'){   $index .= 'INDEX ('.$col['name'].'),'; }
-            if($col['option'] == 'unique'){  $index .= 'UNIQUE ('.$col['name'].'),'; }
+            if(isset($col['option']) && $col['option'] == 'primary'){ $index .= 'PRIMARY KEY ('.$col['name'].'),'; }
+            if(isset($col['option']) && $col['option'] == 'index'){   $index .= 'INDEX ('.$col['name'].'),'; }
+            if(isset($col['option']) && $col['option'] == 'unique'){  $index .= 'UNIQUE ('.$col['name'].'),'; }
         }
        $sql .= $index;
        $sql = substr($sql,0,-1);
@@ -341,10 +352,10 @@
 		if($database_name == ''){
             $database_name = $this->dbName;
         }
-        $result = mysql_list_tables($database_name);
+        $result = @mysql_list_tables($database_name);
         $tb_names = array();
-        for ($i = 0; $i < mysql_num_rows($result); $i++) {
-            $tb_names[$i] = mysql_tablename($result, $i);
+        for ($i = 0; $i < @mysql_num_rows($result); $i++) {
+            $tb_names[$i] = @mysql_tablename($result, $i);
         }
         return $tb_names;       
     }

--
Gitblit v1.9.1