mysql_connect() deprecated

Change-Id: I2d5dbb72bdf4b25b5481e61adab4b0f3f3e196cb
diff --git a/addons/babel.eclipse.org/backend_functions.php b/addons/babel.eclipse.org/backend_functions.php
index 07defba..9074eb9 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($dbh);
+                $GLOBALS['g_ERRSTRS'][1] = mysqli_error();
             }
         } else {
             // username failed
-            $GLOBALS['g_ERRSTRS'][1] = mysqli_error($dbh);
+            $GLOBALS['g_ERRSTRS'][1] = mysqli_error();
         }
     }
 
diff --git a/classes/database_versioning/abstractschemachecker.class.php b/classes/database_versioning/abstractschemachecker.class.php
index 349af1d..4d00ca1 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($dbh)) > 0 ) {
+			if( strlen(mysqli_error()) > 0 ) {
 				if( $context->devmode
 				 || $context->testmode
 				 || $databasename == 'myfoundation' ) {
@@ -69,7 +69,7 @@
 						return false;
 					}
 				} else {
-//				print mysqli_error($dbh);
+//				print mysqli_error();
 					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 23d448a..17d9863 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($dbh);
+		echo mysqli_error();
 		
 		# 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 0dd332f..4b7b2b9 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);
 
-	$dbc->disconnect($dbh);
+	$dbh = $dbc->disconnect();
 
 	/*
 	 * 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 9eb7ca8..04695f9 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);
 
-	$dbc->disconnect($dbh);
+	$dbh = $dbc->disconnect();
 	echo "Completed  language packs for: $train_id\n";
 }
 
diff --git a/classes/export/syncup.php b/classes/export/syncup.php
index 1224165..6c07f90 100644
--- a/classes/export/syncup.php
+++ b/classes/export/syncup.php
@@ -34,9 +34,9 @@
 
 $User = getSyncupUser();
 
-// $dbc = new DBConnection();
-// global $dbh;
-// $dbh = $dbc->connect();
+$dbc = new DBConnection();
+global $dbh;
+$dbh = $dbc->connect();
 
 echo "Connection established. Ready to begin. The syncup user id is: $User->userid\n";
 
@@ -45,7 +45,7 @@
  * @param string $untranslated_value
  * @return string
  */
-function possible_translation($dbh, $untranslated_value) {
+function possible_translation($untranslated_value) {
 	global $language_id;
 	#candidate may not be found if new line is there.
 	$untranslated_value = rtrim($untranslated_value, "\n\r");
@@ -97,7 +97,7 @@
 		 * The if statement requires to be sorted by strings.value
 		 */
 		if ($untranslated_value !== $prev_value) {
-			$translation = possible_translation($dbh, $untranslated_value);
+			$translation = possible_translation($untranslated_value);
 			$prev_value  = $untranslated_value;
 		}
 
diff --git a/classes/file/file.class.php b/classes/file/file.class.php
index 8ea76f9..940ee9f 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($dbh);
+				$GLOBALS['g_ERRSTRS'][1] = mysqli_error();
 			}
 		}
 		else {
diff --git a/classes/heal/fix_deactivated_translations.php b/classes/heal/fix_deactivated_translations.php
index 99bd10a..99782be 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($dbh);
+			print mysqli_error();
 			
 		}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($dbh);
+			print mysqli_error();
 			
 			$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($dbh);
+			print mysqli_error();
 			
 		}
 	}
diff --git a/classes/string/string.class.php b/classes/string/string.class.php
index 378b913..eb0e855 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($dbh);
+					$GLOBALS['g_ERRSTRS'][1] = mysqli_error();
 				}
 			}
 			else {
@@ -108,7 +108,7 @@
 					$rValue = true;
 				}
 				else {
-					$GLOBALS['g_ERRSTRS'][1] = mysqli_error($dbh);
+					$GLOBALS['g_ERRSTRS'][1] = mysqli_error();
 				}
 			}
 			else {
diff --git a/classes/system/dbconnection.class.php b/classes/system/dbconnection.class.php
index 0350d00..ab55823 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($dbh));
+				errorLog("Failed attempt to open database: $database - aborting \n\t" . mysqli_error());
 				exitTo("/error.php?errNo=101303","error: 101303 - unknown database name");
 			}
 		}
@@ -39,8 +39,8 @@
 		return $dbh;
 	}
 
-	function disconnect($dbh) {
-		mysqli_close($dbh);
+	function disconnect() {
+		mysqli_close();
 	}
 }
 ?>
\ No newline at end of file
diff --git a/classes/system/event_log.class.php b/classes/system/event_log.class.php
index 42caa2e..d0f1480 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($dbh) != "") {
+			if(mysqli_error() != "") {
 				echo "An unknown database error has occurred while logging information.  Please contact the System Administrator.";
-				echo mysqli_error($dbh);
-				$rValue = "MYSQL: " . mysqli_error($dbh);
+				echo mysqli_error();
+				$rValue = "MYSQL: " . mysqli_error();
 			}
 		}
 		else {
diff --git a/classes/system/session.class.php b/classes/system/session.class.php
index a16c6b6..764b59e 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($dbh);
+			$GLOBALS['g_ERRSTRS'][1] = mysqli_error();
 		}
 		
 		return $rValue;
diff --git a/classes/system/user.class.php b/classes/system/user.class.php
index e6253ab..2ff8a22 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($dbh);
+				$GLOBALS['g_ERRSTRS'][1] = mysqli_error();
 			}
 		}
 		return $rValue;
diff --git a/html/callback/getStringsforProject.php b/html/callback/getStringsforProject.php
index 02ef131..e20553a 100644
--- a/html/callback/getStringsforProject.php
+++ b/html/callback/getStringsforProject.php
@@ -137,7 +137,7 @@
 
 $res = mysqli_query($dbh, $query);
 
-//print mysqli_error($dbh);
+//print mysqli_error();
 
 $stringids = Array();
 $return = Array();