mysql_connect() deprecated

Change-Id: Id02701e8e55d9a8f5e77cab5098233d8606ef78a
diff --git a/addons/babel.eclipse.org/backend_functions.php b/addons/babel.eclipse.org/backend_functions.php
index 9074eb9..07defba 100644
--- a/addons/babel.eclipse.org/backend_functions.php
+++ b/addons/babel.eclipse.org/backend_functions.php
@@ -73,11 +73,11 @@
 
             } else {
                 // password failed
-                $GLOBALS['g_ERRSTRS'][1] = mysqli_error();
+                $GLOBALS['g_ERRSTRS'][1] = mysqli_error($dbh);
             }
         } else {
             // username failed
-            $GLOBALS['g_ERRSTRS'][1] = mysqli_error();
+            $GLOBALS['g_ERRSTRS'][1] = mysqli_error($dbh);
         }
     }
 
diff --git a/classes/database_versioning/abstractschemachecker.class.php b/classes/database_versioning/abstractschemachecker.class.php
index 4d00ca1..349af1d 100644
--- a/classes/database_versioning/abstractschemachecker.class.php
+++ b/classes/database_versioning/abstractschemachecker.class.php
@@ -53,7 +53,7 @@
 		} else {
 			$table_name = $tablename.$tablenamesuffix;		
 			$result = remember_query($dbh, "DESCRIBE $tablename$tablenamesuffix");
-			if( strlen(mysqli_error()) > 0 ) {
+			if( strlen(mysqli_error($dbh)) > 0 ) {
 				if( $context->devmode
 				 || $context->testmode
 				 || $databasename == 'myfoundation' ) {
@@ -69,7 +69,7 @@
 						return false;
 					}
 				} else {
-//				print mysqli_error();
+//				print mysqli_error($dbh);
 					echo "..does not exist, error <br>\n";
 					$this->createTableFromSchema($table_name,$schemas[count($schemas)],$dbh,$context);				
 					$result = remember_query($dbh, "DESCRIBE $tablename$tablenamesuffix");
diff --git a/classes/export/dbmaintenance_15min.php b/classes/export/dbmaintenance_15min.php
index 17d9863..23d448a 100644
--- a/classes/export/dbmaintenance_15min.php
+++ b/classes/export/dbmaintenance_15min.php
@@ -94,7 +94,7 @@
 					        AND v.version = '" . addslashes($myrow['version']) . "'
 					 )";
 		mysqli_query($dbh, $sql);
-		echo mysqli_error();
+		echo mysqli_error($dbh);
 		
 		# Let's lock and unlock in the loop to allow other queries to go through. There's no rush on completing these stats.
 		mysqli_query($dbh, "UNLOCK TABLES");
diff --git a/classes/export/generate1.php b/classes/export/generate1.php
index 4b7b2b9..0dd332f 100755
--- a/classes/export/generate1.php
+++ b/classes/export/generate1.php
@@ -675,7 +675,7 @@
 	fwrite($language_pack_links_file, "\n\t<br />\n</body>\n</html>");
 	fclose($language_pack_links_file);
 
-	$dbh = $dbc->disconnect();
+	$dbc->disconnect($dbh);
 
 	/*
 	 * Generate and save site.xml/content.jar/artifacts.jar with mirrorsURL
diff --git a/classes/export/generate_orion.php b/classes/export/generate_orion.php
index 04695f9..9eb7ca8 100644
--- a/classes/export/generate_orion.php
+++ b/classes/export/generate_orion.php
@@ -353,7 +353,7 @@
 	fwrite($language_pack_links_file, "\n\t<br />\n</body>\n</html>");
 	fclose($language_pack_links_file);
 
-	$dbh = $dbc->disconnect();
+	$dbc->disconnect($dbh);
 	echo "Completed  language packs for: $train_id\n";
 }
 
diff --git a/classes/file/file.class.php b/classes/file/file.class.php
index 940ee9f..8ea76f9 100755
--- a/classes/file/file.class.php
+++ b/classes/file/file.class.php
@@ -68,7 +68,7 @@
 			}
 			else {
 				echo $sql . "\n";
-				$GLOBALS['g_ERRSTRS'][1] = mysqli_error();
+				$GLOBALS['g_ERRSTRS'][1] = mysqli_error($dbh);
 			}
 		}
 		else {
diff --git a/classes/heal/fix_deactivated_translations.php b/classes/heal/fix_deactivated_translations.php
index 99782be..99bd10a 100644
--- a/classes/heal/fix_deactivated_translations.php
+++ b/classes/heal/fix_deactivated_translations.php
@@ -134,7 +134,7 @@
 			$query = "update translations set is_active = 1 where string_id = $string_id and language_id = $language_id and version = $max";			
 			print $query."\n";
 //			mysqli_query($dbh, $query);			
-			print mysqli_error();
+			print mysqli_error($dbh);
 			
 		}elseif($found_active > 1){
 			$query = "select max(version) as max from translations where string_id = $string_id and language_id = $language_id ";
@@ -143,12 +143,12 @@
 			$query = "update translations set is_active = 0 where string_id = $string_id and language_id = $language_id and version != $max";
 			print $query."\n";
 //			mysqli_query($dbh, $query);			
-			print mysqli_error();
+			print mysqli_error($dbh);
 			
 			$query =  "update translations set is_active = 1 where string_id = $string_id and language_id = $language_id and version = $max";
 			print $query."\n";
 //			mysqli_query($dbh, $query);
-			print mysqli_error();
+			print mysqli_error($dbh);
 			
 		}
 	}
diff --git a/classes/string/string.class.php b/classes/string/string.class.php
index eb0e855..378b913 100755
--- a/classes/string/string.class.php
+++ b/classes/string/string.class.php
@@ -59,7 +59,7 @@
 					$rValue = true;
 				}
 				else {
-					$GLOBALS['g_ERRSTRS'][1] = mysqli_error();
+					$GLOBALS['g_ERRSTRS'][1] = mysqli_error($dbh);
 				}
 			}
 			else {
@@ -108,7 +108,7 @@
 					$rValue = true;
 				}
 				else {
-					$GLOBALS['g_ERRSTRS'][1] = mysqli_error();
+					$GLOBALS['g_ERRSTRS'][1] = mysqli_error($dbh);
 				}
 			}
 			else {
diff --git a/classes/system/dbconnection.class.php b/classes/system/dbconnection.class.php
index ab55823..8fc8d21 100755
--- a/classes/system/dbconnection.class.php
+++ b/classes/system/dbconnection.class.php
@@ -30,7 +30,7 @@
     	$database = $db_params['db_read_name'];
 		if (isset($database)) {
 			if (!mysqli_select_db($dbh, $database)) {
-				errorLog("Failed attempt to open database: $database - aborting \n\t" . mysqli_error());
+				errorLog("Failed attempt to open database: $database - aborting \n\t" . mysqli_error($dbh));
 				exitTo("/error.php?errNo=101303","error: 101303 - unknown database name");
 			}
 		}
@@ -39,8 +39,8 @@
 		return $dbh;
 	}
 
-	function disconnect() {
-		mysqli_close();
+	function disconnect($dbh) {
+		return mysqli_close($dbh);
 	}
 }
 ?>
\ No newline at end of file
diff --git a/classes/system/event_log.class.php b/classes/system/event_log.class.php
index d0f1480..42caa2e 100755
--- a/classes/system/event_log.class.php
+++ b/classes/system/event_log.class.php
@@ -62,10 +62,10 @@
 					created_on = NOW()";
 
 			mysqli_query($dbh, $sql);
-			if(mysqli_error() != "") {
+			if(mysqli_error($dbh) != "") {
 				echo "An unknown database error has occurred while logging information.  Please contact the System Administrator.";
-				echo mysqli_error();
-				$rValue = "MYSQL: " . mysqli_error();
+				echo mysqli_error($dbh);
+				$rValue = "MYSQL: " . mysqli_error($dbh);
 			}
 		}
 		else {
diff --git a/classes/system/session.class.php b/classes/system/session.class.php
index 764b59e..a16c6b6 100644
--- a/classes/system/session.class.php
+++ b/classes/system/session.class.php
@@ -55,7 +55,7 @@
 			$this->updated_at	= $myrow['updated_at'];
 		}
 		else {
-			$GLOBALS['g_ERRSTRS'][1] = mysqli_error();
+			$GLOBALS['g_ERRSTRS'][1] = mysqli_error($dbh);
 		}
 		
 		return $rValue;
diff --git a/classes/system/user.class.php b/classes/system/user.class.php
index 2ff8a22..e6253ab 100755
--- a/classes/system/user.class.php
+++ b/classes/system/user.class.php
@@ -79,7 +79,7 @@
 				$this->created_at			= $myrow['created_at'];
 			}
 			else {
-				$GLOBALS['g_ERRSTRS'][1] = mysqli_error();
+				$GLOBALS['g_ERRSTRS'][1] = mysqli_error($dbh);
 			}
 		}
 		return $rValue;
diff --git a/html/callback/getStringsforProject.php b/html/callback/getStringsforProject.php
index e20553a..02ef131 100644
--- a/html/callback/getStringsforProject.php
+++ b/html/callback/getStringsforProject.php
@@ -137,7 +137,7 @@
 
 $res = mysqli_query($dbh, $query);
 
-//print mysqli_error();
+//print mysqli_error($dbh);
 
 $stringids = Array();
 $return = Array();