4 Commits

Author SHA1 Message Date
Graham Eades
083a6a5cea Fixed new login with empty records 2017-05-27 14:50:05 +01:00
Graham Eades
a2a216f9c9 Check for NULL in value 2017-05-27 14:36:17 +01:00
Graham Eades
3df61ed87a Fixed POG 2017-05-27 11:24:07 +01:00
Graham Eades
63f5452107 Updated to use mysqli 2017-05-20 10:47:53 +01:00
5 changed files with 46 additions and 43 deletions

View File

@@ -409,7 +409,11 @@ error_log("message");
$recordStats["updateDate"] = $record->update_date; $recordStats["updateDate"] = $record->update_date;
$recordsStats[$record->reference] = $recordStats; $recordsStats[$record->reference] = $recordStats;
} }
$result["recordsStats"] = $recordsStats; if ( isset( $recordsStats ) ) {
$result["recordsStats"] = $recordsStats;
} else {
$result["recordsStats"] = NULL;
}
$result["statistics"] = $user->statistics; $result["statistics"] = $user->statistics;
$result["version"] = $user->version; $result["version"] = $user->version;
@@ -543,7 +547,11 @@ error_log("message");
$user->Save(); $user->Save();
$recordToDeleteReferenceList = $parameters["parameters"]["records"]["deleted"]; if (isset( $parameters["parameters"]["records"]["deleted"] ) ) {
$recordToDeleteReferenceList = $parameters["parameters"]["records"]["deleted"];
} else {
$recordToDeleteReferenceList = NULL;
}
$recordList = array(); $recordList = array();
$c = count($recordToDeleteReferenceList); $c = count($recordToDeleteReferenceList);
for ($i=0; $i<$c; $i++) { for ($i=0; $i<$c; $i++) {

View File

@@ -17,17 +17,10 @@
$databaseUser = $GLOBALS['configuration']['user']; $databaseUser = $GLOBALS['configuration']['user'];
$databasePassword = $GLOBALS['configuration']['pass']; $databasePassword = $GLOBALS['configuration']['pass'];
$databasePort = $GLOBALS['configuration']['port']; $databasePort = $GLOBALS['configuration']['port'];
$this->connection = mysql_connect ($serverName.":".$databasePort, $databaseUser, $databasePassword); $this->connection = mysqli_connect ($serverName, $databaseUser, $databasePassword , $databaseName, $databasePort);
if ($this->connection) if (!$this->connection)
{ {
if (!mysql_select_db ($databaseName)) throw new Exception('I cannot find the specified database "'.$databaseName.'". Please edit configuration.php.');
{
throw new Exception('I cannot find the specified database "'.$databaseName.'". Please edit configuration.php.');
}
}
else
{
throw new Exception('I cannot connect to the database. Please edit configuration.php with your database configuration.');
} }
} }
@@ -43,19 +36,19 @@
public static function Reader($query, $connection) public static function Reader($query, $connection)
{ {
$cursor = mysql_query($query, $connection); $cursor = mysqli_query($connection, $query);
return $cursor; return $cursor;
} }
public static function Read($cursor) public static function Read($cursor)
{ {
return mysql_fetch_assoc($cursor); return mysqli_fetch_assoc($cursor);
} }
public static function NonQuery($query, $connection) public static function NonQuery($query, $connection)
{ {
mysql_query($query, $connection); mysqli_query($connection, $query);
$result = mysql_affected_rows($connection); $result = mysqli_affected_rows($connection);
if ($result == -1) if ($result == -1)
{ {
return false; return false;
@@ -66,14 +59,14 @@
public static function Query($query, $connection) public static function Query($query, $connection)
{ {
$result = mysql_query($query, $connection); $result = mysqli_query($connection, $query);
return mysql_num_rows($result); return mysqli_num_rows($result);
} }
public static function InsertOrUpdate($query, $connection) public static function InsertOrUpdate($query, $connection)
{ {
$result = mysql_query($query, $connection); $result = mysqli_query($connection, $query);
return intval(mysql_insert_id($connection)); return intval(mysqli_insert_id($connection));
} }
} }
?> ?>

View File

@@ -92,10 +92,10 @@ class POG_Base
return $objectList; return $objectList;
} }
private function CreateObjects($mysql_result, $objectClass, $lazyLoad = true) private function CreateObjects($mysqli_result, $objectClass, $lazyLoad = true)
{ {
$objectList = array(); $objectList = array();
while ($row = mysql_fetch_assoc($mysql_result)) while ($row = mysqli_fetch_assoc($mysqli_result))
{ {
$pog_object = new $objectClass(); $pog_object = new $objectClass();
$this->PopulateObjectAttributes($row, $pog_object); $this->PopulateObjectAttributes($row, $pog_object);
@@ -140,4 +140,4 @@ class POG_Base
return false; return false;
} }
} }
?> ?>

View File

@@ -164,24 +164,26 @@ if(count($_POST) > 0 && $_SESSION['diagnosticsSuccessful']==false)
if ($errors == 0) if ($errors == 0)
{ {
AddTrace('File Structure....OK!'); AddTrace('File Structure....OK!');
if (!mysql_connect ($GLOBALS['configuration']['host'].":".$GLOBALS['configuration']['port'], $GLOBALS['configuration']['user'], $GLOBALS['configuration']['pass'])) #if (!mysql_connect ($GLOBALS['configuration']['host'].":".$GLOBALS['configuration']['port'], $GLOBALS['configuration']['user'], $GLOBALS['configuration']['pass']))
if (!mysqli_connect ($GLOBALS['configuration']['host'], $GLOBALS['configuration']['user'], $GLOBALS['configuration']['pass'],$GLOBALS['configuration']['db'], $GLOBALS['configuration']['port']))
{ {
$errors++; $errors++;
AddError('Cannot connect to the specified database server. Edit configuration.php'); AddError('Cannot connect to the specified database server. Edit configuration.php');
AddError('Cannot find the specified database "'.$GLOBALS['configuration']['db'].'". Edit configuration.php');
} }
if (isset($GLOBALS['configuration']['db_encoding']) && $GLOBALS['configuration']['db_encoding'] == 1 && !Base64::IsBase64FunctionInstalled()) if (isset($GLOBALS['configuration']['db_encoding']) && $GLOBALS['configuration']['db_encoding'] == 1 && !Base64::IsBase64FunctionInstalled())
{ {
$errors++; $errors++;
AddError('$configuration[db_encoding] needs to be set to 0 until you install the base64 plugin. Set db_encoding to 0 by editing configuration.php, run setup again and go to the "Manage Plugins" tab. Install the base64 plugin. Then you can set db_encoding = 1'); AddError('$configuration[db_encoding] needs to be set to 0 until you install the base64 plugin. Set db_encoding to 0 by editing configuration.php, run setup again and go to the "Manage Plugins" tab. Install the base64 plugin. Then you can set db_encoding = 1');
} }
if ($errors == 0) # if ($errors == 0)
{ # {
if (!@mysql_select_db ($GLOBALS['configuration']['db'])) # if (!@mysql_select_db ($GLOBALS['configuration']['db']))
{ # {
$errors++; # $errors++;
AddError('Cannot find the specified database "'.$GLOBALS['configuration']['db'].'". Edit configuration.php'); # AddError('Cannot find the specified database "'.$GLOBALS['configuration']['db'].'". Edit configuration.php');
} # }
} # }
} }
/** /**

View File

@@ -276,10 +276,10 @@
{ {
$link = ''; $link = '';
$content = file_get_contents($objectFilePath); $content = file_get_contents($objectFilePath);
$contentParts = split("<b>",$content); $contentParts = explode("<b>",$content);
if (isset($contentParts[1])) if (isset($contentParts[1]))
{ {
$contentParts2 = split("</b>",$contentParts[1]); $contentParts2 = explode("</b>",$contentParts[1]);
} }
if (isset($contentParts2[0])) if (isset($contentParts2[0]))
{ {
@@ -287,8 +287,8 @@
} }
if (isset($className)) if (isset($className))
{ {
$linkParts1 = split("\*\/", $contentParts[1]); $linkParts1 = explode("\*\/", $contentParts[1]);
$linkParts2 = split("\@link", $linkParts1[0]); $linkParts2 = explode("\@link", $linkParts1[0]);
if (isset($linkParts2[1])) if (isset($linkParts2[1]))
{ {
$link = $linkParts2[1]; $link = $linkParts2[1];
@@ -313,10 +313,10 @@
function GetObjectName($objectFilePath) function GetObjectName($objectFilePath)
{ {
$content = file_get_contents($objectFilePath); $content = file_get_contents($objectFilePath);
$contentParts = split("<b>",$content); $contentParts = explode("<b>",$content);
if (isset($contentParts[1])) if (isset($contentParts[1]))
{ {
$contentParts2 = split("</b>",$contentParts[1]); $contentParts2 = explode("</b>",$contentParts[1]);
} }
if (isset($contentParts2[0])) if (isset($contentParts2[0]))
{ {
@@ -593,10 +593,10 @@
//extract sql //extract sql
$content = file_get_contents($objectFilePath); $content = file_get_contents($objectFilePath);
$contentParts = split("<b>",$content); $contentParts = explode("<b>",$content);
if (isset($contentParts[1])) if (isset($contentParts[1]))
{ {
$contentParts2 = split("</b>",$contentParts[1]); $contentParts2 = explode("</b>",$contentParts[1]);
} }
if (isset($contentParts2[0])) if (isset($contentParts2[0]))
{ {
@@ -604,8 +604,8 @@
} }
if (isset($className)) if (isset($className))
{ {
$sqlParts = split(";",$contentParts[0]); $sqlParts = explode(";",$contentParts[0]);
$sqlPart = split("CREATE",$sqlParts[0]); $sqlPart = explode("CREATE",$sqlParts[0]);
$sql = "CREATE ".$sqlPart[1].";"; $sql = "CREATE ".$sqlPart[1].";";
//execute sql //execute sql
@@ -2354,4 +2354,4 @@
} }
return 0; return 0;
} }
?> ?>