From df52d4b33c0267ef9be6d68864d1f14aaad9ab59 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 19 Sep 2007 11:46:42 -0400
Subject: [PATCH] Fixed some bugs in the website module.

---
 interface/lib/classes/db_mysql.inc.php |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/interface/lib/classes/db_mysql.inc.php b/interface/lib/classes/db_mysql.inc.php
index 564b7b6..2a2d640 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()
     {
@@ -252,7 +252,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 +261,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 +341,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