You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by jf...@apache.org on 2018/10/29 19:54:34 UTC
[1/5] vcl git commit: VCL-1106 - make PHP code compatible with PHP 7
Repository: vcl
Updated Branches:
refs/heads/develop de9e192f8 -> ce1e6d7fd
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/.ht-inc/xmlrpcWrappers.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/xmlrpcWrappers.php b/web/.ht-inc/xmlrpcWrappers.php
index 0ec5c74..33b1587 100644
--- a/web/.ht-inc/xmlrpcWrappers.php
+++ b/web/.ht-inc/xmlrpcWrappers.php
@@ -430,7 +430,7 @@ function XMLRPCdeployServer($imageid, $start, $end, $admingroup='',
$admingroup = stripslashes($admingroup);
if(preg_match('/@/', $admingroup)) {
$tmp = explode('@', $admingroup);
- $escadmingroup = mysql_real_escape_string($tmp[0]);
+ $escadmingroup = vcl_mysql_escape_string($tmp[0]);
$affilid = getAffiliationID($tmp[1]);
if(is_null($affilid)) {
return array('status' => 'error',
@@ -439,7 +439,7 @@ function XMLRPCdeployServer($imageid, $start, $end, $admingroup='',
}
}
else {
- $escadmingroup = mysql_real_escape_string($admingroup);
+ $escadmingroup = vcl_mysql_escape_string($admingroup);
$affilid = DEFAULT_AFFILID;
}
$admingroupid = getUserGroupID($escadmingroup, $affilid, 1);
@@ -457,7 +457,7 @@ function XMLRPCdeployServer($imageid, $start, $end, $admingroup='',
$logingroup = stripslashes($logingroup);
if(preg_match('/@/', $logingroup)) {
$tmp = explode('@', $logingroup);
- $esclogingroup = mysql_real_escape_string($tmp[0]);
+ $esclogingroup = vcl_mysql_escape_string($tmp[0]);
$affilid = getAffiliationID($tmp[1]);
if(is_null($affilid)) {
return array('status' => 'error',
@@ -466,7 +466,7 @@ function XMLRPCdeployServer($imageid, $start, $end, $admingroup='',
}
}
else {
- $esclogingroup = mysql_real_escape_string($logingroup);
+ $esclogingroup = vcl_mysql_escape_string($logingroup);
$affilid = DEFAULT_AFFILID;
}
$logingroupid = getUserGroupID($esclogingroup, $affilid, 1);
@@ -514,7 +514,7 @@ function XMLRPCdeployServer($imageid, $start, $end, $admingroup='',
. "spaces, dashes(-), underscores(_), and periods(.) "
. "and be up to 255 characters long");
}
- $name = mysql_real_escape_string($name);
+ $name = vcl_mysql_escape_string($name);
# validate $start
if($start != 'now' && ! is_numeric($start)) {
@@ -574,7 +574,7 @@ function XMLRPCdeployServer($imageid, $start, $end, $admingroup='',
if($userdata != '') {
if(get_magic_quotes_gpc())
$userdata = stripslashes($userdata);
- $esc_userdata = mysql_real_escape_string($userdata);
+ $esc_userdata = vcl_mysql_escape_string($userdata);
$query = "INSERT INTO variable "
. "(name, "
. "serialization, "
@@ -1334,7 +1334,7 @@ function XMLRPCautoCapture($requestid) {
}
$query = "SELECT id FROM request WHERE id = $requestid";
$qh = doQuery($query, 101);
- if(! mysql_num_rows($qh)) {
+ if(! mysqli_num_rows($qh)) {
return array('status' => 'error',
'errorcode' => 52,
'errormsg' => 'specified request does not exist');
@@ -1772,13 +1772,13 @@ function XMLRPCnodeExists($nodeName, $parentNode) {
in_array("nodeAdmin", $user["privileges"])) {
if(get_magic_quotes_gpc())
$nodeName = stripslashes($nodeName);
- $nodeName = mysql_real_escape_string($nodeName);
+ $nodeName = vcl_mysql_escape_string($nodeName);
// does a node with this name already exist?
$query = "SELECT id "
. "FROM privnode "
. "WHERE name = '$nodeName' AND parent = $parentNode";
$qh = doQuery($query, 335);
- if(mysql_num_rows($qh))
+ if(mysqli_num_rows($qh))
return array('status' => 'success', 'exists' => TRUE);
else
return array('status' => 'success', 'exists' => FALSE);
@@ -1836,7 +1836,7 @@ function XMLRPCaddNode($nodeName, $parentNode) {
. "FROM privnode "
. "WHERE name = '$nodeName' AND parent = $parentNode";
$qh = doQuery($query);
- if(mysql_num_rows($qh)) {
+ if(mysqli_num_rows($qh)) {
return array('status' => 'error',
'errorcode' => 82,
'errormsg' => 'A node of that name already exists under ' . $nodeInfo['name']);
@@ -1847,7 +1847,7 @@ function XMLRPCaddNode($nodeName, $parentNode) {
. "($parentNode, '$nodeName')";
doQuery($query);
$qh = doQuery("SELECT LAST_INSERT_ID() FROM privnode", 101);
- if(! $row = mysql_fetch_row($qh)) {
+ if(! $row = mysqli_fetch_row($qh)) {
return array('status' => 'error',
'errorcode' => 85,
'errormsg' => 'Could not add node to database');
@@ -2470,7 +2470,7 @@ function XMLRPCgetUserGroupAttributes($name, $affiliation) {
. "LEFT JOIN affiliation euga ON (eug.affiliationid = euga.id) "
. "WHERE ug.id = {$rc['id']}";
$qh = doQuery($query, 101);
- if(! $row = mysql_fetch_assoc($qh)) {
+ if(! $row = mysqli_fetch_assoc($qh)) {
return array('status' => 'error',
'errorcode' => 18,
'errormsg' => 'user group with submitted name and affiliation does not exist');
@@ -2607,7 +2607,7 @@ function XMLRPCeditUserGroup($name, $affiliation, $newName, $newAffiliation,
$newOwner='', $newManagingGroup='',
$newInitialMaxTime='', $newTotalMaxTime='',
$newMaxExtendTime='') {
- global $user, $mysql_link_vcl;
+ global $user, $mysqli_link_vcl;
if(! in_array('groupAdmin', $user['privileges'])) {
return array('status' => 'error',
'errorcode' => 16,
@@ -2650,7 +2650,7 @@ function XMLRPCeditUserGroup($name, $affiliation, $newName, $newAffiliation,
. "FROM usergroup "
. "WHERE id = {$rc['id']}";
$qh = doQuery($query, 101);
- if(! $row = mysql_fetch_assoc($qh)) {
+ if(! $row = mysqli_fetch_assoc($qh)) {
return array('status' => 'error',
'errorcode' => 18,
'errormsg' => 'user group with submitted name and affiliation does not exist');
@@ -2675,7 +2675,7 @@ function XMLRPCeditUserGroup($name, $affiliation, $newName, $newAffiliation,
if(get_magic_quotes_gpc())
$newName = stripslashes($newName);
$validate['name'] = $newName;
- $tmp = mysql_real_escape_string($newName);
+ $tmp = vcl_mysql_escape_string($newName);
$updates[] = "name = '$tmp'";
}
if(! empty($newAffiliation))
@@ -2694,7 +2694,7 @@ function XMLRPCeditUserGroup($name, $affiliation, $newName, $newAffiliation,
if($row['custom']) {
if(! empty($newOwner)) {
- $newownerid = getUserlistID(mysql_real_escape_string($newOwner));
+ $newownerid = getUserlistID(vcl_mysql_escape_string($newOwner));
$updates[] = "ownerid = $newownerid";
}
if(! empty($newManagingGroup))
@@ -2732,7 +2732,7 @@ function XMLRPCeditUserGroup($name, $affiliation, $newName, $newAffiliation,
///
////////////////////////////////////////////////////////////////////////////////
function XMLRPCremoveUserGroup($name, $affiliation) {
- global $user, $mysql_link_vcl;
+ global $user, $mysqli_link_vcl;
if(! in_array('groupAdmin', $user['privileges'])) {
return array('status' => 'error',
'errorcode' => 16,
@@ -2750,7 +2750,7 @@ function XMLRPCremoveUserGroup($name, $affiliation) {
. "FROM usergroup "
. "WHERE id = {$rc['id']}";
$qh = doQuery($query, 101);
- if(! $row = mysql_fetch_assoc($qh)) {
+ if(! $row = mysqli_fetch_assoc($qh)) {
return array('status' => 'error',
'errorcode' => 18,
'errormsg' => 'user group with submitted name and affiliation does not exist');
@@ -2775,7 +2775,7 @@ function XMLRPCremoveUserGroup($name, $affiliation) {
. "WHERE id = {$rc['id']}";
doQuery($query, 101);
# validate something deleted
- if(mysql_affected_rows($mysql_link_vcl) == 0) {
+ if(mysqli_affected_rows($mysqli_link_vcl) == 0) {
return array('status' => 'error',
'errorcode' => 30,
'errormsg' => 'failure while deleting group from database');
@@ -2849,7 +2849,7 @@ function XMLRPCgetUserGroupMembers($name, $affiliation) {
. "FROM usergroup "
. "WHERE id = {$rc['id']}";
$qh = doQuery($query, 101);
- if(! $row = mysql_fetch_assoc($qh)) {
+ if(! $row = mysqli_fetch_assoc($qh)) {
return array('status' => 'error',
'errorcode' => 18,
'errormsg' => 'user group with submitted name and affiliation does not exist');
@@ -2875,7 +2875,7 @@ function XMLRPCgetUserGroupMembers($name, $affiliation) {
. "u.affiliationid = a.id";
$qh = doQuery($query, 101);
$members = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$members[] = $row['member'];
return array('status' => 'success',
'members' => $members);
@@ -2924,7 +2924,7 @@ function XMLRPCaddUsersToGroup($name, $affiliation, $users) {
. "FROM usergroup "
. "WHERE id = {$rc['id']}";
$qh = doQuery($query, 101);
- if(! $row = mysql_fetch_assoc($qh)) {
+ if(! $row = mysqli_fetch_assoc($qh)) {
return array('status' => 'error',
'errorcode' => 18,
'errormsg' => 'user group with submitted name and affiliation does not exist');
@@ -2942,7 +2942,7 @@ function XMLRPCaddUsersToGroup($name, $affiliation, $users) {
continue;
if(get_magic_quotes_gpc())
$_user = stripslashes($_user);
- $esc_user = mysql_real_escape_string($_user);
+ $esc_user = vcl_mysql_escape_string($_user);
if(validateUserid($_user) == 1)
addUserGroupMember($esc_user, $rc['id']);
else
@@ -3006,7 +3006,7 @@ function XMLRPCremoveUsersFromGroup($name, $affiliation, $users) {
. "FROM usergroup "
. "WHERE id = {$rc['id']}";
$qh = doQuery($query, 101);
- if(! $row = mysql_fetch_assoc($qh)) {
+ if(! $row = mysqli_fetch_assoc($qh)) {
return array('status' => 'error',
'errorcode' => 18,
'errormsg' => 'user group with submitted name and affiliation does not exist');
@@ -3024,7 +3024,7 @@ function XMLRPCremoveUsersFromGroup($name, $affiliation, $users) {
continue;
if(get_magic_quotes_gpc())
$_user = stripslashes($_user);
- $esc_user = mysql_real_escape_string($_user);
+ $esc_user = vcl_mysql_escape_string($_user);
# check that affiliation of user can be determined because getUserlistID
# will abort if it cannot find it
$affilok = 0;
@@ -3135,7 +3135,7 @@ function XMLRPCaddResourceGroup($name, $managingGroup, $type) {
'errorcode' => 87,
'errormsg' => 'Name must be between 3 and 30 characters and can only contain letters, numbers, spaces, and these characters: - . _');
}
- $name = mysql_real_escape_string($name);
+ $name = vcl_mysql_escape_string($name);
$data = array('type' => 'resource',
'ownergroup' => $rc['managingGroupID'],
'resourcetypeid' => $typeid,
@@ -3476,7 +3476,7 @@ function XMLRPCprocessBlockTime($blockTimesid, $ignoreprivileges=0) {
. "WHERE bt.blockRequestid = br.id AND "
. "bt.id = $blockTimesid";
$qh = doQuery($query, 101);
- if(! $rqdata = mysql_fetch_assoc($qh)) {
+ if(! $rqdata = mysqli_fetch_assoc($qh)) {
return array('status' => 'error',
'errorcode' => 8,
'errormsg' => 'unknown blockTimesid');
@@ -3526,8 +3526,8 @@ function XMLRPCprocessBlockTime($blockTimesid, $ignoreprivileges=0) {
$blockCompVals = array();
$checkstartbase = $unixstart - $imgLoadTime - 300;
$reloadstartbase = unixToDatetime($checkstartbase);
- $rows = mysql_num_rows($qh);
- while($row = mysql_fetch_assoc($qh)) {
+ $rows = mysqli_num_rows($qh);
+ while($row = mysqli_fetch_assoc($qh)) {
if(array_key_exists($row['reqid'], $donereqids))
continue;
$donereqids[$row['reqid']] = 1;
@@ -3594,7 +3594,7 @@ function XMLRPCprocessBlockTime($blockTimesid, $ignoreprivileges=0) {
. "FROM blockComputers "
. "WHERE blockTimeid = $blockTimesid";
$qh = doQuery($query, 101);
- if(! $row = mysql_fetch_assoc($qh)) {
+ if(! $row = mysqli_fetch_assoc($qh)) {
return array('status' => 'error',
'errorcode' => 15,
'errormsg' => 'failure to communicate with database');
@@ -3772,7 +3772,7 @@ function XMLRPCfinishBaseImageCapture($ownerid, $resourceid, $virtual=1) {
. "r.subid = i.id AND "
. "r.resourcetypeid = 13";
$qh = doQuery($query);
- if(mysql_num_rows($qh) != 1) {
+ if(mysqli_num_rows($qh) != 1) {
return array('status' => 'error',
'errorcode' => 91,
'errormsg' => 'Invalid resourceid submitted');
@@ -3823,7 +3823,7 @@ function XMLRPCcheckCryptSecrets($reservationid) {
# check for existance of $reservationid
$query = "SELECT id FROM reservation WHERE id = $reservationid";
$qh = doQuery($query);
- if(! ($row = mysql_fetch_assoc($qh))) {
+ if(! ($row = mysqli_fetch_assoc($qh))) {
return array('status' => 'error',
'errorcode' => 101,
'errormsg' => 'Specified reservation does not exist');
@@ -3839,7 +3839,7 @@ function XMLRPCcheckCryptSecrets($reservationid) {
. "WHERE rs.id = $reservationid AND "
. "ad.secretid IS NOT NULL";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$secretids[] = $row['secretid'];
$mnid = $row['managementnodeid'];
}
@@ -3853,7 +3853,7 @@ function XMLRPCcheckCryptSecrets($reservationid) {
. "WHERE rs.id = $reservationid AND "
. "vp.secretid IS NOT NULL";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$secretids[] = $row['secretid'];
$mnid = $row['managementnodeid'];
}
@@ -3884,7 +3884,7 @@ function XMLRPCcheckCryptSecrets($reservationid) {
. "ck.hosttype = 'managementnode' AND "
. "cs.id IS NULL";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if($row['mycryptsecret'] == NULL) {
$fails[] = $row['secretid'];
continue;
@@ -3952,7 +3952,7 @@ function XMLRPCgetOneClickParams($oneclickid) {
. "o.userid = {$user['id']}";
$qh = doQuery($query);
//if nothing returned, oneclick does not exist
- if(! $row = mysql_fetch_assoc($qh)) {
+ if(! $row = mysqli_fetch_assoc($qh)) {
return array('status' => 'error',
'errorcode' => 95,
'errormsg' => "The OneClick with ID $oneclickid does not exist.");
@@ -4027,7 +4027,7 @@ function XMLRPCgetOneClicks() {
$result['status'] = 'success';
$result['oneclicks'] = array();
#$allstates = getStates();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
/*if($row['currstateid'] == 14)
$state = $allstates[$row['laststateid']];
elseif(! is_null($row['currstateid']))
@@ -4208,7 +4208,7 @@ function XMLRPCeditOneClick($oneclickid, $name, $imageid, $duration, $autologin)
. "userid = {$user['id']}";
$qh = doQuery($query, 101);
//if nothing returned, oneclick does not exist or belongs to another user
- if(! $row = mysql_fetch_assoc($qh)) {
+ if(! $row = mysqli_fetch_assoc($qh)) {
return array('status' => 'error',
'errorcode' => 95,
'errormsg' => "The OneClick with ID $oneclickid does not exist.");
@@ -4262,7 +4262,7 @@ function XMLRPCdeleteOneClick($oneclickid) {
. "userid = {$user['id']}";
$qh = doQuery($query, 101);
//if nothing returned, oneclick does not exist or belongs to another user
- if(! $row = mysql_fetch_assoc($qh)) {
+ if(! $row = mysqli_fetch_assoc($qh)) {
return array('status' => 'error',
'errorcode' => 95,
'errormsg' => "The OneClick with ID $oneclickid does not exist.");
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/index.php
----------------------------------------------------------------------
diff --git a/web/index.php b/web/index.php
index bbdca0a..6ac26f6 100644
--- a/web/index.php
+++ b/web/index.php
@@ -26,8 +26,8 @@ if(! isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != "on") {
}
$user = '';
-$mysql_link_vcl = '';
-$mysql_link_acct = '';
+$mysqli_link_vcl = '';
+$mysqli_link_acct = '';
$mode = '';
$oldmode = '';
$submitErr = '';
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/shibauth/index.php
----------------------------------------------------------------------
diff --git a/web/shibauth/index.php b/web/shibauth/index.php
index 0ab553d..64c33c5 100644
--- a/web/shibauth/index.php
+++ b/web/shibauth/index.php
@@ -43,7 +43,7 @@ header("Expires: Sat, 1 Jan 2000 00:00:00 GMT");
. "a.shibname = '{$tmp[1]}' AND "
. "u.affiliationid = a.id";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
$_SERVER['sn'] = $row['lastname'];
$_SERVER['givenName'] = $row['firstname'];
}
@@ -103,11 +103,11 @@ if(! $keys['public'])
$tmp = explode(';', $_SERVER['eppn']);
$tmp = explode('@', $tmp[0]);
$username = strtolower($tmp[0]);
-$tmp1 = mysql_escape_string(strtolower($tmp[1]));
+$tmp1 = vcl_mysql_escape_string(strtolower($tmp[1]));
$query = "SELECT name, shibonly FROM affiliation WHERE shibname = '$tmp1'";
$qh = doQuery($query, 101);
# if shib affiliation not already in VCL, create affiliation
-if(! ($row = mysql_fetch_assoc($qh))) {
+if(! ($row = mysqli_fetch_assoc($qh))) {
$affil = strtolower($tmp[1]);
$tmp = explode('.', $affil);
array_pop($tmp);
@@ -120,7 +120,7 @@ if(! ($row = mysql_fetch_assoc($qh))) {
. "ORDER BY name DESC "
. "LIMIT 1";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
if(preg_match("/$affilname([0-9]+)/", $row['name'], $matches)) {
$cnt = $matches[1];
$cnt++;
@@ -160,7 +160,7 @@ if(! ($row = mysql_fetch_assoc($qh))) {
. "shibonly) "
. "VALUES "
. "('$newaffilname', "
- . "'" . mysql_escape_string($affil) . "', "
+ . "'" . vcl_mysql_escape_string($affil) . "', "
. "1)";
doQuery($query, 101, 'vcl', 1);
unset($row);
@@ -210,12 +210,12 @@ $shibdata = array('Shib-Application-ID' => $_SERVER['Shib-Application-ID'],
'unscoped-affiliation' => $_SERVER['unscoped-affiliation'],
'affiliation' => $_SERVER['affiliation'],
);
-$serdata = mysql_escape_string(serialize($shibdata));
+$serdata = vcl_mysql_escape_string(serialize($shibdata));
$query = "SELECT id "
. "FROM shibauth "
. "WHERE sessid = '{$_SERVER['Shib-Session-ID']}'";
$qh = doQuery($query, 101);
-if($row = mysql_fetch_assoc($qh)) {
+if($row = mysqli_fetch_assoc($qh)) {
$shibauthid = $row['id'];
}
else {
@@ -233,7 +233,7 @@ else {
. "'$serdata')";
doQuery($query, 101);
$qh = doQuery("SELECT LAST_INSERT_ID() FROM shibauth", 101);
- if(! $row = mysql_fetch_row($qh)) {
+ if(! $row = mysqli_fetch_row($qh)) {
# todo
}
$shibauthid = $row[0];
[2/5] vcl git commit: VCL-1106 - make PHP code compatible with PHP 7
Posted by jf...@apache.org.
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/.ht-inc/utils.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/utils.php b/web/.ht-inc/utils.php
index d53bb20..2dad962 100644
--- a/web/.ht-inc/utils.php
+++ b/web/.ht-inc/utils.php
@@ -269,7 +269,7 @@ function initGlobals() {
# set up $affilValFunc, $addUserFunc, $updateUserFunc for any shibonly affiliations
$query = "SELECT id FROM affiliation WHERE shibonly = 1";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$id = $row['id'];
if(! array_key_exists($id, $affilValFunc)) {
if(ALLOWADDSHIBUSERS)
@@ -640,13 +640,13 @@ function checkCryptkey() {
$fh = fopen($idfile, 'r');
$id = fread($fh, 50);
fclose($fh);
- $_id = mysql_real_escape_string($id);
+ $_id = vcl_mysql_escape_string($id);
$query = "SELECT id "
. "FROM cryptkey "
. "WHERE id = '$_id'";
$qh = doQuery($query);
- if($row = mysql_fetch_assoc($qh))
+ if($row = mysqli_fetch_assoc($qh))
return;
}
@@ -737,7 +737,7 @@ function maintenanceCheck() {
. "end > NOW()";
$qh = doQuery($query);
$ids = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$ids[] = $row['id'];
if(empty($ids)) {
dbDisconnect();
@@ -1007,7 +1007,7 @@ function main() {
///
////////////////////////////////////////////////////////////////////////////////
function abort($errcode, $query="") {
- global $mysql_link_vcl, $mysql_link_acct, $ERRORS, $user, $mode;
+ global $mysqli_link_vcl, $mysqli_link_acct, $ERRORS, $user, $mode;
global $ENABLE_ITECSAUTH, $requestInfo, $aborting;
if(! isset($aborting))
$aborting = 1;
@@ -1017,11 +1017,11 @@ function abort($errcode, $query="") {
xmlRPCabort($errcode, $query);
if(ONLINEDEBUG && checkUserHasPerm('View Debug Information')) {
if($errcode >= 100 && $errcode < 400) {
- print "<font color=red>" . mysql_error($mysql_link_vcl) . "</font><br>\n";
- error_log(mysql_error($mysql_link_vcl));
+ print "<font color=red>" . mysqli_error($mysqli_link_vcl) . "</font><br>\n";
+ error_log(mysqli_error($mysqli_link_vcl));
if($ENABLE_ITECSAUTH) {
- print "<font color=red>" . mysql_error($mysql_link_acct) . "</font><br>\n";
- error_log(mysql_error($mysql_link_acct));
+ print "<font color=red>" . mysqli_error($mysqli_link_acct) . "</font><br>\n";
+ error_log(mysqli_error($mysqli_link_acct));
}
print "$query<br>\n";
error_log($query);
@@ -1038,9 +1038,9 @@ function abort($errcode, $query="") {
else {
$message = "";
if($errcode >= 100 && $errcode < 400) {
- $message .= mysql_error($mysql_link_vcl) . "\n";
+ $message .= mysqli_error($mysqli_link_vcl) . "\n";
if($ENABLE_ITECSAUTH)
- $message .= mysql_error($mysql_link_acct) . "\n";
+ $message .= mysqli_error($mysqli_link_acct) . "\n";
$message .= $query . "\n";
}
$message .= "ERROR($errcode): " . $ERRORS["$errcode"] . "\n";
@@ -1117,13 +1117,13 @@ function validateUserid($loginid) {
if(empty($affilid))
return 0;
- $escloginid = mysql_real_escape_string($loginid);
+ $escloginid = vcl_mysql_escape_string($loginid);
$query = "SELECT id "
. "FROM user "
. "WHERE unityid = '$escloginid' AND "
. "affiliationid = $affilid";
$qh = doQuery($query, 101);
- if(mysql_num_rows($qh))
+ if(mysqli_num_rows($qh))
return 1;
if($rc == 0 &&
@@ -1133,7 +1133,7 @@ function validateUserid($loginid) {
. "FROM affiliation "
. "WHERE id = " . DEFAULT_AFFILID;
$qh = doQuery($query);
- $row = mysql_fetch_assoc($qh);
+ $row = mysqli_fetch_assoc($qh);
if($row['shibonly'] == 1)
return 0;
}
@@ -1189,11 +1189,12 @@ function getAffilidAndLogin(&$login, &$affilid) {
////////////////////////////////////////////////////////////////////////////////
///
-/// \fn mysql_connect_plus($host, $user, $pwd)
+/// \fn mysql_connect_plus($host, $user, $pwd, $db)
///
/// \param $host - mysql host
/// \param $user - userid to use for connection
/// \param $pwd - password to use for connection
+/// \param $db - database to use after connecting
///
/// \return mysql resource identifier, 0 if failure to connect
///
@@ -1202,12 +1203,12 @@ function getAffilidAndLogin(&$login, &$affilid) {
/// and returns the identifier
///
////////////////////////////////////////////////////////////////////////////////
-function mysql_connect_plus($host, $user, $pwd) {
+function mysql_connect_plus($host, $user, $pwd, $db) {
$timeout = 5; /* timeout in seconds */
if($fp = @fsockopen($host, 3306, $errno, $errstr, $timeout)) {
fclose($fp);
- return $link = mysql_connect($host, $user, $pwd);
+ return $link = mysqli_connect($host, $user, $pwd, $db);
} else {
#print "ERROR: socket timeout<BR>\n";
return 0;
@@ -1219,29 +1220,25 @@ function mysql_connect_plus($host, $user, $pwd) {
/// \fn dbConnect()
///
/// \brief opens connections to database, the resource identifiers are\n
-/// \b $mysql_link_vcl - for vcl database\n
-/// \b $mysql_link_acct - for accounts database\n
+/// \b $mysqli_link_vcl - for vcl database\n
+/// \b $mysqli_link_acct - for accounts database\n
///
////////////////////////////////////////////////////////////////////////////////
function dbConnect() {
- global $vclhost, $vcldb, $vclusername, $vclpassword, $mysql_link_vcl;
- global $accthost, $acctusername, $acctpassword, $mysql_link_acct;
+ global $vclhost, $vcldb, $vclusername, $vclpassword, $mysqli_link_vcl;
+ global $accthost, $acctusername, $acctpassword, $mysqli_link_acct;
global $ENABLE_ITECSAUTH;
if($ENABLE_ITECSAUTH) {
// open a connection to mysql server for accounts
- if($mysql_link_acct = mysql_connect_plus($accthost, $acctusername, $acctpassword))
- mysql_select_db("accounts", $mysql_link_acct);
- else
+ if(! ($mysqli_link_acct = mysql_connect_plus($accthost, $acctusername, $acctpassword, 'accounts')))
$ENABLE_ITECSAUTH = 0;
}
// open a connection to mysql server for vcl
- if(! $mysql_link_vcl = mysql_connect_plus($vclhost, $vclusername, $vclpassword)) {
+ if(! $mysqli_link_vcl = mysql_connect_plus($vclhost, $vclusername, $vclpassword, $vcldb)) {
die("Error connecting to $vclhost.<br>\n");
}
- // select the vcl database
- mysql_select_db($vcldb, $mysql_link_vcl) or abort(104);
}
////////////////////////////////////////////////////////////////////////////////
@@ -1252,10 +1249,10 @@ function dbConnect() {
///
////////////////////////////////////////////////////////////////////////////////
function dbDisconnect() {
- global $mysql_link_vcl, $mysql_link_acct, $ENABLE_ITECSAUTH;
- mysql_close($mysql_link_vcl);
+ global $mysqli_link_vcl, $mysqli_link_acct, $ENABLE_ITECSAUTH;
+ mysqli_close($mysqli_link_vcl);
if($ENABLE_ITECSAUTH)
- mysql_close($mysql_link_acct);
+ mysqli_close($mysqli_link_acct);
}
////////////////////////////////////////////////////////////////////////////////
@@ -1273,7 +1270,7 @@ function dbDisconnect() {
///
////////////////////////////////////////////////////////////////////////////////
function doQuery($query, $errcode=101, $db="vcl", $nolog=0) {
- global $mysql_link_vcl, $mysql_link_acct, $user, $mode, $ENABLE_ITECSAUTH;
+ global $mysqli_link_vcl, $mysqli_link_acct, $user, $mode, $ENABLE_ITECSAUTH;
if($db == "vcl") {
if(QUERYLOGGING != 0 && (! $nolog) &&
preg_match('/^(UPDATE|INSERT|DELETE)/', $query) &&
@@ -1294,10 +1291,10 @@ function doQuery($query, $errcode=101, $db="vcl", $nolog=0) {
. "NOW(), "
. "'$mode', "
. "'$logquery')";
- mysql_query($q, $mysql_link_vcl);
+ mysqli_query($mysqli_link_vcl, $q);
}
- for($i = 0; ! ($qh = mysql_query($query, $mysql_link_vcl)) && $i < 3; $i++) {
- if(mysql_errno() == '1213') # DEADLOCK, sleep and retry
+ for($i = 0; ! ($qh = mysqli_query($mysqli_link_vcl, $query)) && $i < 3; $i++) {
+ if(mysqli_errno() == '1213') # DEADLOCK, sleep and retry
usleep(50);
else
abort($errcode, $query);
@@ -1305,7 +1302,7 @@ function doQuery($query, $errcode=101, $db="vcl", $nolog=0) {
}
elseif($db == "accounts") {
if($ENABLE_ITECSAUTH)
- $qh = mysql_query($query, $mysql_link_acct) or abort($errcode, $query);
+ $qh = mysqli_query($mysqli_link_acct, $query) or abort($errcode, $query);
else
$qh = NULL;
}
@@ -1316,14 +1313,31 @@ function doQuery($query, $errcode=101, $db="vcl", $nolog=0) {
///
/// \fn dbLastInsertID()
///
-/// \return last insert id for $mysql_link_vcl
+/// \return last insert id for $mysqli_link_vcl
///
-/// \brief calls mysql_insert_id for $mysql_link_vcl
+/// \brief calls mysqli_insert_id for $mysqli_link_vcl
///
////////////////////////////////////////////////////////////////////////////////
function dbLastInsertID() {
- global $mysql_link_vcl;
- return mysql_insert_id($mysql_link_vcl);
+ global $mysqli_link_vcl;
+ return mysqli_insert_id($mysqli_link_vcl);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+///
+/// \fn vcl_mysql_escape_string($string) {
+///
+/// \param $string - string to be escaped
+///
+/// \return escaped string
+///
+/// \brief wrapper for mysqli_real_escape_string so that $mysqli_link_vcl global
+/// variable doesn't have to be included in every function needing to call it
+///
+////////////////////////////////////////////////////////////////////////////////
+function vcl_mysql_escape_string($string) {
+ global $mysqli_link_vcl;
+ return mysqli_real_escape_string($mysqli_link_vcl, $string);
}
////////////////////////////////////////////////////////////////////////////////
@@ -1339,7 +1353,7 @@ function getOSList() {
$query = "SELECT id, name, prettyname, type, installtype FROM OS ORDER BY prettyname";
$qh = doQuery($query, "115");
$oslist = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$oslist[$row['id']] = $row;
return $oslist;
}
@@ -1411,7 +1425,7 @@ function getImages($includedeleted=0, $imageid=0) {
. "id "
. "FROM imagemeta";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$allmetadata[$row['id']] = $row;
# get all image revision data
@@ -1435,7 +1449,7 @@ function getImages($includedeleted=0, $imageid=0) {
$query .= "i.deleted = 0 AND ";
$query .= "u.affiliationid = a.id";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$id = $row['imageid'];
unset($row['imageid']);
$allrevisiondata[$id][$row['id']] = $row;
@@ -1490,7 +1504,7 @@ function getImages($includedeleted=0, $imageid=0) {
$query .= "AND i.deleted = 0 ";
$query .= "ORDER BY i.prettyname";
$qh = doQuery($query, 120);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if(is_null($row['maxconcurrent']))
$row['maxconcurrent'] = 0;
$imagelist[$includedeleted][$row["id"]] = $row;
@@ -1517,7 +1531,7 @@ function getImages($includedeleted=0, $imageid=0) {
. "FROM subimages "
. "WHERE imagemetaid = $metaid";
$qh2 = doQuery($query2, 101);
- while($row2 = mysql_fetch_assoc($qh2))
+ while($row2 = mysqli_fetch_assoc($qh2))
$imagelist[$includedeleted][$row["id"]]["subimages"][] = $row2["imageid"];
}
}
@@ -1567,7 +1581,7 @@ function getImages($includedeleted=0, $imageid=0) {
$fixeddata = array();
$query = "SELECT name, value FROM variable WHERE name LIKE 'fixedIPsp%'";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$spid = str_replace('fixedIPsp', '', $row['name']);
$fixeddata[$spid] = Spyc::YAMLLoad($row['value']);
}
@@ -1603,7 +1617,7 @@ function getImages($includedeleted=0, $imageid=0) {
$query .= "ORDER BY name";
$qh = doQuery($query, 101);
$profiles = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$profiles[$row['id']] = $row;
if(isset($fixeddata[$row['id']])) {
$profiles[$row['id']]['netmask'] = $fixeddata[$row['id']]['netmask'];
@@ -1652,7 +1666,7 @@ function getImages($includedeleted=0, $imageid=0) {
. "s.id IN ($inids)";
$qh = doQuery($query, 101);
$profiles = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$profiles[$row['id']] = $row['image'];
$_SESSION['usersessiondata'][$key] = $profiles;
return $profiles;
@@ -1701,7 +1715,7 @@ function getImageRevisions($imageid, $incdeleted=0) {
$query .= " ORDER BY revision";
$qh = doQuery($query, 101);
$return = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$return[$row['id']] = $row;
return $return;
}
@@ -1728,7 +1742,7 @@ function getImageNotes($imageid) {
. "FROM image "
. "WHERE id = $imageid";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh))
+ if($row = mysqli_fetch_assoc($qh))
return $row;
else
return array('description' => '', 'usage' => '');
@@ -1812,7 +1826,7 @@ function getImageConnectMethods($imageid, $revisionid=0, $nostatic=0) {
. "disabled";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if($row['disabled'] &&
isset($allmethods[$row['imageid']][$row['imagerevisionid']][$row['connectmethodid']]))
unset($allmethods[$row['imageid']][$row['imagerevisionid']][$row['connectmethodid']]);
@@ -1849,7 +1863,7 @@ function getImageConnectMethodTexts($imageid, $revisionid=0) {
if(! preg_match('/^en/', $locale)) {
$query = "DESC connectmethod";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if($row['Field'] == "description_$locale")
$descfield = "description_$locale";
if($row['Field'] == "connecttext_$locale")
@@ -1863,7 +1877,7 @@ function getImageConnectMethodTexts($imageid, $revisionid=0) {
. "protocol "
. "FROM connectmethodport";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$row['key'] = "#Port-{$row['protocol']}-{$row['port']}#";
$cmports[$row['connectmethodid']][] = $row;
}
@@ -1888,7 +1902,7 @@ function getImageConnectMethodTexts($imageid, $revisionid=0) {
. "c.`$descfield`";
$methods = array();
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if($row['disabled']) {
if(isset($methods[$row['id']]))
unset($methods[$row['id']]);
@@ -1915,7 +1929,7 @@ function getImageTypes() {
$query = "SELECT id, name FROM imagetype ORDER BY name";
$qh = doQuery($query);
$data = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$data[$row['id']] = $row['name'];
return $data;
}
@@ -1940,14 +1954,14 @@ function checkClearImageMeta($imagemetaid, $imageid, $ignorefield='') {
$query = "DESC imagemeta";
$qh = doQuery($query, 101);
$defaults = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$defaults[$row['Field']] = $row['Default'];
# get imagemeta data
$query = "SELECT * FROM imagemeta WHERE id = $imagemetaid";
$qh = doQuery($query, 101);
- $row = mysql_fetch_assoc($qh);
+ $row = mysqli_fetch_assoc($qh);
$alldefaults = 1;
- if(mysql_num_rows($qh) == 0)
+ if(mysqli_num_rows($qh) == 0)
# it is possible that the imagemeta record could have been deleted before
# this was submitted
return 1;
@@ -1998,7 +2012,7 @@ function getProductionRevisionid($imageid, $nostatic=0) {
. "FROM imagerevision "
. "WHERE production = 1";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$alldata[$row['imageid']] = $row['id'];
return $alldata[$imageid];
}
@@ -2099,7 +2113,7 @@ function getUserResources($userprivs, $resourceprivs=array("available"),
else
$query .= "u.usergroupid = $groupid";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
array_push($startnodes, $row["privnodeid"]);
}
# build data array from userprivtype and userpriv tables to reduce queries
@@ -2114,7 +2128,7 @@ function getUserResources($userprivs, $resourceprivs=array("available"),
. "u.userid = $userid AND "
. "t.name IN ('block','cascade',$inlist)";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$privdataset['user'][$row['privnodeid']][] = $row['name'];
$query = "SELECT t.name, "
. "u.usergroupid, "
@@ -2133,7 +2147,7 @@ function getUserResources($userprivs, $resourceprivs=array("available"),
. "ORDER BY u.privnodeid, "
. "u.usergroupid";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$privdataset['usergroup'][$row['privnodeid']][] = array('name' => $row['name'], 'groupid' => $row['usergroupid']);
# travel up tree looking at privileges granted at parent nodes
@@ -2473,7 +2487,7 @@ function addOwnedResources(&$resources, $includedeleted, $userid) {
if(! $includedeleted && $type == 'managementnode')
$query .= " AND stateid != (SELECT id FROM state WHERE name = 'deleted') ";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if(! isset($resources[$type][$row["id"]]))
$resources[$type][$row["id"]] = $row[$field];
}
@@ -2507,7 +2521,7 @@ function addOwnedResourceGroups(&$resourcegroups, $userid) {
. "WHERE g.resourcetypeid = t.id AND "
. "g.ownerusergroupid IN ($groupids)";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if(! isset($resourcegroups[$row["type"]][$row["id"]]))
$resourcegroups[$row["type"]][$row["id"]] = $row["name"];
}
@@ -2568,7 +2582,7 @@ function getResourcesFromGroups($groups, $type, $includedeleted) {
$query .= "AND test = 0 ";*/
$query .= "ORDER BY t.$field";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$return[$row["id"]] = $row["name"];
}
return $return;
@@ -2649,7 +2663,7 @@ function updateResourcePrivs($group, $node, $adds, $removes) {
else
$groupid = getResourceGroupID($group);
foreach($adds as $type) {
- $type = mysql_real_escape_string($type);
+ $type = vcl_mysql_escape_string($type);
$query = "INSERT IGNORE INTO resourcepriv ("
. "resourcegroupid, "
. "privnodeid, "
@@ -2661,7 +2675,7 @@ function updateResourcePrivs($group, $node, $adds, $removes) {
doQuery($query, 377);
}
foreach($removes as $type) {
- $type = mysql_real_escape_string($type);
+ $type = vcl_mysql_escape_string($type);
$query = "DELETE FROM resourcepriv "
. "WHERE resourcegroupid = $groupid AND "
. "privnodeid = $node AND "
@@ -2804,7 +2818,7 @@ function encryptDBdata($data, $secretid) {
. "WHERE cryptkeyid = $cryptkeyid AND "
. "secretid = $secretid";
$qh = doQuery($query);
- if(! ($row = mysql_fetch_assoc($qh)))
+ if(! ($row = mysqli_fetch_assoc($qh)))
return NULL;
$secret = decryptSecretKey($row['cryptsecret']);
if($secret === NULL)
@@ -2833,7 +2847,7 @@ function encryptSecretKey($secret, $cryptkey) {
. "FROM cryptkey "
. "WHERE id = $cryptkey";
$qh = doQuery($query);
- if(! ($row = mysql_fetch_assoc($qh)))
+ if(! ($row = mysqli_fetch_assoc($qh)))
return NULL;
$cryptkey = $row['pubkey'];
if($row['algorithmoption'] == 'OAEP' || 1) # OAEP only currently supported option
@@ -2901,7 +2915,7 @@ function decryptSecretKey($encsecret) {
function getSecretKeyID($table, $field, $recordid) {
$query = "SELECT $field FROM $table WHERE id = $recordid";
$qh = doQuery($query);
- if(($row = mysql_fetch_row($qh)) && $row[0] != 0)
+ if(($row = mysqli_fetch_row($qh)) && $row[0] != 0)
return $row[0];
# generate secret key
@@ -2940,7 +2954,7 @@ function getSecretKeyID($table, $field, $recordid) {
return NULL;
$query = "SELECT secretid FROM cryptsecret WHERE id = $id";
$qh = doQuery($query);
- if(! ($row = mysql_fetch_assoc($qh)))
+ if(! ($row = mysqli_fetch_assoc($qh)))
return NULL;
# encrypt with all other public keys and write to cryptsecret
encryptWebSecretKeys($key, $row['secretid'], $cryptkeyid);
@@ -2993,13 +3007,13 @@ function getCryptKeyID() {
$fh = fopen($idfile, 'r');
$id = fread($fh, 50);
fclose($fh);
- $_id = mysql_real_escape_string($id);
+ $_id = vcl_mysql_escape_string($id);
$query = "SELECT id "
. "FROM cryptkey "
. "WHERE id = '$_id'";
$qh = doQuery($query);
- if($row = mysql_fetch_assoc($qh))
+ if($row = mysqli_fetch_assoc($qh))
return $row['id'];
if($create) {
@@ -3031,7 +3045,7 @@ function encryptWebSecretKeys($secret, $secretid, $skipkeyid=0) {
. "hosttype = 'web'";
$qh = doQuery($query);
$values = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$cryptsecret = encryptSecretKey($secret, $row['pubkey']);
if($cryptsecret === NULL)
continue;
@@ -3078,7 +3092,7 @@ function checkMissingWebSecretKeys() {
. "cs.secretid IS NULL AND "
. "ck.id != $mycryptkeyid";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$secret = decryptSecretKey($row['mycryptsecret']);
$encsecret = encryptSecretKey($secret, $row['cryptkey']);
$values[] = "({$row['cryptkeyid']}, {$row['secretid']}, '$encsecret', '"
@@ -3121,7 +3135,7 @@ function checkCryptSecrets($requestid) {
. "WHERE rs.requestid = $requestid AND "
. "ad.secretid IS NOT NULL";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$secretids[$row['managementnodeid']][$row['secretid']] = 1;
# determine any secretids needed from vmprofile
$query = "SELECT vp.secretid, "
@@ -3133,7 +3147,7 @@ function checkCryptSecrets($requestid) {
. "WHERE rs.requestid = $requestid AND "
. "vp.secretid IS NOT NULL";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$secretids[$row['managementnodeid']][$row['secretid']] = 1;
$mycryptkeyid = getCryptKeyID();
@@ -3190,7 +3204,7 @@ function getMNcryptkeyUpdates($secretidset, $cryptkeyid) {
. "s.id in ($allsecretids) AND "
. "cs.secretid IS NULL";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$secret = decryptSecretKey($row['mycryptsecret']);
$encsecret = encryptSecretKey($secret, $row['cryptkey']);
$values[] = "({$row['cryptkeyid']}, {$row['secretid']}, '$encsecret', '"
@@ -3354,7 +3368,7 @@ function getUserGroups($groupType=0, $affiliationid=0) {
$query .= "AND ug.affiliationid = $affiliationid ";
$query .= "ORDER BY name";
$qh = doQuery($query, 280);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if(! empty($row["owner"]) && ! empty($row['affiliation']))
$row['owner'] = "{$row['owner']}@{$row['affiliation']}";
if($user['showallgroups'] || $affiliationid == 0)
@@ -3403,7 +3417,7 @@ function getUserEditGroups($id) {
}
$qh = doQuery($query, 101);
$groups = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$groups[$row['id']] = $row['name'];
}
return $groups;
@@ -3443,7 +3457,7 @@ function getUserGroupPrivs($groupid='') {
$query .= "ORDER BY ug.name, "
. "ugpt.name";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$data[] = $row;
return $data;
}
@@ -3465,7 +3479,7 @@ function getUserGroupPrivTypes() {
$data = array();
$query = "SELECT id, name, help FROM usergroupprivtype ORDER BY name";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$data[$row['id']] = $row;
return $data;
}
@@ -3510,7 +3524,7 @@ function getResourceGroups($type='', $id='') {
$query .= "ORDER BY t.name, g.name";
$qh = doQuery($query, 281);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if(empty($type))
$return[$row["id"]]["name"] = $row["type"] . "/" . $row["name"];
else
@@ -3554,7 +3568,7 @@ function getResourceGroupMemberships($type="all") {
. "gm.resourceid = r.id AND "
. "r.resourcetypeid = t.id";
$qh = doQuery($query, 282);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$return[$type][$row["id"]][] = $row["groupid"];
}
return $return;
@@ -3658,7 +3672,7 @@ function getResourceGroupMembers($type="all") {
. "rgm.resourcegroupid, "
. $orders;
$qh = doQuery($query, 282);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if(isset($row['deleted']) && $row['deleted'] == 1)
continue;
if(isset($row['deleted2']) && $row['deleted2'] == 1)
@@ -3695,7 +3709,7 @@ function getUserGroupMembers($groupid) {
. "u.affiliationid = a.id "
. "ORDER BY u.unityid";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$return[$row["id"]] = $row['user'];
}
return $return;
@@ -3772,8 +3786,8 @@ function getUserlistID($loginid, $noadd=0) {
. "WHERE unityid = '$loginid' AND "
. "affiliationid = $affilid";
$qh = doQuery($query, 140);
- if(mysql_num_rows($qh)) {
- $row = mysql_fetch_row($qh);
+ if(mysqli_num_rows($qh)) {
+ $row = mysqli_fetch_row($qh);
return $row[0];
}
if($noadd)
@@ -3800,7 +3814,7 @@ function getUsersLastImage($userid) {
. "ORDER BY id DESC "
. "LIMIT 1";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh))
+ if($row = mysqli_fetch_assoc($qh))
return $row['imageid'];
return NULL;
}
@@ -3819,7 +3833,7 @@ function getAffiliations() {
$query = "SELECT id, name FROM affiliation ORDER BY name";
$qh = doQuery($query, 101);
$return = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$return[$row['id']] = $row['name'];
return $return;
}
@@ -3843,8 +3857,8 @@ function getUserUnityID($userid) {
return $cache['unityids'][$userid];
$query = "SELECT unityid FROM user WHERE id = $userid";
$qh = doQuery($query, 101);
- if(mysql_num_rows($qh)) {
- $row = mysql_fetch_row($qh);
+ if(mysqli_num_rows($qh)) {
+ $row = mysqli_fetch_row($qh);
$cache['unityids'][$userid] = $row[0];
return $row[0];
}
@@ -3863,11 +3877,11 @@ function getUserUnityID($userid) {
///
////////////////////////////////////////////////////////////////////////////////
function getAffiliationID($affil) {
- $affil = mysql_real_escape_string($affil);
+ $affil = vcl_mysql_escape_string($affil);
$query = "SELECT id FROM affiliation WHERE name = '$affil'";
$qh = doQuery($query, 101);
- if(mysql_num_rows($qh)) {
- $row = mysql_fetch_row($qh);
+ if(mysqli_num_rows($qh)) {
+ $row = mysqli_fetch_row($qh);
return $row[0];
}
return NULL;
@@ -3887,8 +3901,8 @@ function getAffiliationID($affil) {
function getAffiliationName($affilid) {
$query = "SELECT name FROM affiliation WHERE id = $affilid";
$qh = doQuery($query, 101);
- if(mysql_num_rows($qh)) {
- $row = mysql_fetch_row($qh);
+ if(mysqli_num_rows($qh)) {
+ $row = mysqli_fetch_row($qh);
return $row[0];
}
return NULL;
@@ -3912,7 +3926,7 @@ function getAffiliationDataUpdateText($affilid=0) {
if($affilid)
$query .= " WHERE id = $affilid";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$return[$row['id']] = $row['dataUpdateText'];
return $return;
}
@@ -3940,7 +3954,7 @@ function getAffiliationTheme($affilid) {
. "a2.name = 'Global'";
}
$qh = doQuery($query);
- if(($row = mysql_fetch_assoc($qh)) && ! empty($row['theme']))
+ if(($row = mysqli_fetch_assoc($qh)) && ! empty($row['theme']))
return $row['theme'];
else
return DEFAULTTHEME;
@@ -4170,7 +4184,7 @@ function processInputData($data, $type, $addslashes=0, $defaultvalue=NULL) {
if(! is_string($value))
$return[$index] = $defaultvalue;
elseif($addslashes)
- $return[$index] = mysql_real_escape_string($value);
+ $return[$index] = vcl_mysql_escape_string($value);
}
return $return;
}
@@ -4179,7 +4193,7 @@ function processInputData($data, $type, $addslashes=0, $defaultvalue=NULL) {
if(strlen($return) == 0)
$return = $defaultvalue;
elseif($addslashes)
- $return = mysql_real_escape_string($return);
+ $return = vcl_mysql_escape_string($return);
}
return $return;
@@ -4272,7 +4286,7 @@ function getUserInfo($id, $noupdate=0, $numeric=0) {
$query .= "u.unityid = '$id' AND af.id = $affilid";
$qh = doQuery($query, "105");
- if($user = mysql_fetch_assoc($qh)) {
+ if($user = mysqli_fetch_assoc($qh)) {
$user['sshpublickeys'] = htmlspecialchars($user['sshpublickeys']);
if((datetimeToUnix($user["lastupdated"]) > time() - SECINDAY) ||
$user['unityid'] == 'vclreload' ||
@@ -4348,7 +4362,7 @@ function getUsersGroups($userid, $includeowned=0, $includeaffil=0) {
}
$qh = doQuery($query, "101");
$groups = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$groups[$row["usergroupid"]] = $row["name"];
}
if($includeowned) {
@@ -4367,7 +4381,7 @@ function getUsersGroups($userid, $includeowned=0, $includeaffil=0) {
. "WHERE ownerid = $userid";
}
$qh = doQuery($query, "101");
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$groups[$row["usergroupid"]] = $row["name"];
}
}
@@ -4403,7 +4417,7 @@ function getUsersGroupPerms($usergroupids) {
. "ORDER BY t.name";
$perms = array();
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$perms[$row['id']] = $row['name'];
return $perms;
}
@@ -4473,7 +4487,7 @@ function updateUserData($id, $type="loginid", $affilid=DEFAULT_AFFILID) {
. "FROM user "
. "WHERE id = $id";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
$id = $row['unityid'];
$type = 'loginid';
$affilid = $row['affiliationid'];
@@ -4535,9 +4549,9 @@ function addUser($loginid) {
////////////////////////////////////////////////////////////////////////////////
function updateUserPrefs($userid, $preferredname, $width, $height, $bpp, $audio,
$mapdrives, $mapprinters, $mapserial, $rdpport) {
- global $mysql_link_vcl;
- $preferredname = mysql_real_escape_string($preferredname);
- $audio = mysql_real_escape_string($audio);
+ global $mysqli_link_vcl;
+ $preferredname = vcl_mysql_escape_string($preferredname);
+ $audio = vcl_mysql_escape_string($audio);
if($rdpport == 3389)
$rdpport = 'NULL';
$query = "UPDATE user SET "
@@ -4552,7 +4566,7 @@ function updateUserPrefs($userid, $preferredname, $width, $height, $bpp, $audio,
. "rdpport = $rdpport "
. "WHERE id = $userid";
doQuery($query, 270);
- return mysql_affected_rows($mysql_link_vcl);
+ return mysqli_affected_rows($mysqli_link_vcl);
}
////////////////////////////////////////////////////////////////////////////////
@@ -4583,7 +4597,7 @@ function getOverallUserPrivs($userid) {
. "WHERE ownerid = $userid))";
$qh = doQuery($query, 107);
$privileges = array();
- while($row = mysql_fetch_row($qh))
+ while($row = mysqli_fetch_row($qh))
$privileges[] = $row[0];
if(in_array("mgmtNodeAdmin", $privileges))
$privileges[] = 'managementnodeAdmin';
@@ -4618,7 +4632,7 @@ function getBlockAllocationIDs($user) {
. "r.groupid IN ($inids)";
$ids = array();
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$ids[] = $row['id'];
return $ids;
}
@@ -4739,7 +4753,7 @@ function isAvailable($images, $imageid, $imagerevisionid, $start, $end,
$query .= "AND rq.id != $requestid ";
$query .= "LIMIT 1";
$qh = doQuery($query, 101);
- if(mysql_num_rows($qh)) {
+ if(mysqli_num_rows($qh)) {
return debugIsAvailable(-3, 2, $start, $end, $imagerevisionid);
}
@@ -4749,7 +4763,7 @@ function isAvailable($images, $imageid, $imagerevisionid, $start, $end,
. "WHERE IPaddress = '$ip' AND "
. "stateid != 1";
$qh = doQuery($query, 101);
- if(mysql_num_rows($qh)) {
+ if(mysqli_num_rows($qh)) {
return debugIsAvailable(-4, 16, $start, $end, $imagerevisionid);
}
}
@@ -4790,7 +4804,7 @@ function isAvailable($images, $imageid, $imagerevisionid, $start, $end,
. "rq.stateid NOT IN (1,5,11,12,16,17) AND "
. "rq.userid != $reloadid";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$compids[] = $row['computerid'];
if($row['reqid'] == $requestid)
$decforedit = 1;
@@ -4812,7 +4826,7 @@ function isAvailable($images, $imageid, $imagerevisionid, $start, $end,
. "bt.skip != 1 AND "
. "br.status != 'deleted'";
$qh = doQuery($query);
- if(! $row = mysql_fetch_assoc($qh)) {
+ if(! $row = mysqli_fetch_assoc($qh)) {
cleanSemaphore();
return debugIsAvailable(0, 3, $start, $end, $imagerevisionid);
}
@@ -4882,7 +4896,7 @@ function isAvailable($images, $imageid, $imagerevisionid, $start, $end,
. "FROM computer "
. "WHERE id = $compid";
$qh = doQuery($query, 128);
- $row = mysql_fetch_row($qh);
+ $row = mysqli_fetch_row($qh);
if(! in_array($row[0], $scheduleids)) {
cleanSemaphore();
return debugIsAvailable(0, 7, $start, $end, $imagerevisionid, $computerids, $currentids, $blockids);
@@ -4898,7 +4912,7 @@ function isAvailable($images, $imageid, $imagerevisionid, $start, $end,
. "LEFT JOIN OS ON (i.OSid = OS.id) "
. "WHERE i.id = $imageid";
$qh = doQuery($query, 101);
- if(! ($row = mysql_fetch_assoc($qh))) {
+ if(! ($row = mysqli_fetch_assoc($qh))) {
cleanSemaphore();
return debugIsAvailable(0, 8, $start, $end, $imagerevisionid, $computerids, $currentids, $blockids);
}
@@ -4957,7 +4971,7 @@ function isAvailable($images, $imageid, $imagerevisionid, $start, $end,
. "network";
$qh = doQuery($query, 129);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
array_push($computerids, $row['id']);
if($row['currentimageid'] == $imageid &&
$row['imagerevisionid'] == $requestInfo['imagerevisions'][$key]) {
@@ -4986,7 +5000,7 @@ function isAvailable($images, $imageid, $imagerevisionid, $start, $end,
. "rq.stateid NOT IN (5, 12, 19) AND " # failed, complete, reload
. "(rq.stateid != 14 OR rq.laststateid != 19)"; # pending/reload
$qh = doQuery($query, 130);
- while($row = mysql_fetch_row($qh)) {
+ while($row = mysqli_fetch_row($qh)) {
array_push($usedComputerids, $row[0]);
}
@@ -5061,7 +5075,7 @@ function isAvailable($images, $imageid, $imagerevisionid, $start, $end,
. "c.network";
$qh = doQuery($query, 101);
$newcompids = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$newcompids[] = $row['id'];
$computerids = $newcompids;
}
@@ -5083,7 +5097,7 @@ function isAvailable($images, $imageid, $imagerevisionid, $start, $end,
. "(type != 'virtualmachine' OR "
. "vmhostid IS NOT NULL)";
$qh = doQuery($query);
- if(mysql_num_rows($qh)) {
+ if(mysqli_num_rows($qh)) {
if($now)
return debugIsAvailable(-4, 18, $start, $end, $imagerevisionid, $computerids, $currentids, $blockids, array(), $virtual);
$requestInfo['ipwarning'] = 1;
@@ -5095,14 +5109,14 @@ function isAvailable($images, $imageid, $imagerevisionid, $start, $end,
if($requestid)
$query .= " AND id != $compid"; # TODO test this
$qh = doQuery($query);
- $cnt = mysql_num_rows($qh);
+ $cnt = mysqli_num_rows($qh);
if($cnt > 1) {
if($now)
return debugIsAvailable(-4, 22, $start, $end, $imagerevisionid, $computerids, $currentids, $blockids, array(), $virtual);
$requestInfo['ipwarning'] = 1;
}
elseif($cnt == 1) {
- $row = mysql_fetch_assoc($qh);
+ $row = mysqli_fetch_assoc($qh);
$computerids = array($row['id']);
$blockids = array();
}
@@ -5307,7 +5321,7 @@ function getAvailableSchedules($start, $end) {
$scheduleids = array();
$qh = doQuery($query, 127);
- while($row = mysql_fetch_row($qh)) {
+ while($row = mysqli_fetch_row($qh)) {
array_push($scheduleids, $row[0]);
}
return $scheduleids;
@@ -5327,7 +5341,7 @@ function getAvailableSchedules($start, $end) {
function getImagePlatform($imageid) {
$query = "SELECT platformid FROM image WHERE id = $imageid";
$qh = doQuery($query, 125);
- if(! $row = mysql_fetch_assoc($qh))
+ if(! $row = mysqli_fetch_assoc($qh))
return NULL;
return $row['platformid'];
}
@@ -5355,7 +5369,7 @@ function schCheckMaintenance($start, $end) {
. "(('$startdt' > (start - INTERVAL 30 MINUTE)) AND ('$startdt' < end))) AND "
. "end > NOW()";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_row($qh))
+ if($row = mysqli_fetch_row($qh))
return true;
return false;
}
@@ -5458,7 +5472,7 @@ function allocComputer($blockids, $currentids, $computerids, $start, $end,
////////////////////////////////////////////////////////////////////////////////
function getSemaphore($imageid, $imagerevisionid, $mgmtnodeid, $compid, $start,
$end, $requestid=0) {
- global $mysql_link_vcl, $uniqid;
+ global $mysqli_link_vcl, $uniqid;
$query = "INSERT INTO semaphore "
. "SELECT c.id, "
. "$imageid, "
@@ -5472,7 +5486,7 @@ function getSemaphore($imageid, $imagerevisionid, $mgmtnodeid, $compid, $start,
. "(s.expires IS NULL OR s.expires < NOW()) "
. "LIMIT 1";
doQuery($query);
- $rc = mysql_affected_rows($mysql_link_vcl);
+ $rc = mysqli_affected_rows($mysqli_link_vcl);
# check to see if another process allocated this one
if($rc) {
@@ -5488,7 +5502,7 @@ function getSemaphore($imageid, $imagerevisionid, $mgmtnodeid, $compid, $start,
if($requestid)
$query .= " AND rq.id != $requestid";
$qh = doQuery($query);
- $rc2 = mysql_num_rows($qh);
+ $rc2 = mysqli_num_rows($qh);
if($rc2) {
$query = "DELETE FROM semaphore "
. "WHERE computerid = $compid AND "
@@ -5566,7 +5580,7 @@ function getPossibleRecentFailures($userid, $imageid) {
. "l.wasavailable = 1 AND "
. "l.ending != 'failed'";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$comps[] = $row['computerid'];
return $comps;
}
@@ -5597,7 +5611,7 @@ function getMappedResources($resourcesubid, $resourcetype1, $resourcetype2) {
. "WHERE subid = $resourcesubid AND "
. "resourcetypeid = $resourcetype1";
$qh = doQuery($query, 101);
- $row = mysql_fetch_row($qh);
+ $row = mysqli_fetch_row($qh);
$resourceid = $row[0];
# get groups $resourceid is in
@@ -5606,7 +5620,7 @@ function getMappedResources($resourcesubid, $resourcetype1, $resourcetype2) {
. "FROM resourcegroupmembers "
. "WHERE resourceid = $resourceid";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_row($qh)) {
+ while($row = mysqli_fetch_row($qh)) {
array_push($resourcegroupids, $row[0]);
}
@@ -5624,7 +5638,7 @@ function getMappedResources($resourcesubid, $resourcetype1, $resourcetype2) {
. "resourcetypeid1 = $resourcetype1 AND "
. "resourcetypeid2 = $resourcetype2";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_row($qh)) {
+ while($row = mysqli_fetch_row($qh)) {
array_push($type2groupids, $row[0]);
}
@@ -5636,7 +5650,7 @@ function getMappedResources($resourcesubid, $resourcetype1, $resourcetype2) {
. "resourcetypeid2 = $resourcetype1 AND "
. "resourcetypeid1 = $resourcetype2";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_row($qh)) {
+ while($row = mysqli_fetch_row($qh)) {
array_push($type2groupids, $row[0]);
}
@@ -5651,7 +5665,7 @@ function getMappedResources($resourcesubid, $resourcetype1, $resourcetype2) {
. "WHERE m.resourcegroupid IN ($inlist) AND "
. "m.resourceid = r.id";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_row($qh)) {
+ while($row = mysqli_fetch_row($qh)) {
array_push($mappedresources, $row[0]);
}
return $mappedresources;
@@ -5738,7 +5752,7 @@ function editRequestBlockCheck($compid, $imageid, $start, $end) {
. "r.imageid != $imageid) AND "
. "r.status = 'accepted'";
$qh = doQuery($query, 101);
- return(mysql_num_rows($qh));
+ return(mysqli_num_rows($qh));
}
////////////////////////////////////////////////////////////////////////////////
@@ -5789,7 +5803,7 @@ function getMaxOverlap($userid) {
. "ORDER BY u.overlapResCount DESC "
. "LIMIT 1";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh))
+ if($row = mysqli_fetch_assoc($qh))
return $row['overlapResCount'];
else
return 1;
@@ -5811,7 +5825,7 @@ function getMaxOverlap($userid) {
///
////////////////////////////////////////////////////////////////////////////////
function addRequest($forimaging=0, $revisionid=array(), $checkuser=1) {
- global $requestInfo, $user, $uniqid, $mysql_link_vcl;
+ global $requestInfo, $user, $uniqid, $mysqli_link_vcl;
$startstamp = unixToDatetime($requestInfo["start"]);
$endstamp = unixToDatetime($requestInfo["end"]);
$now = time();
@@ -5828,7 +5842,7 @@ function addRequest($forimaging=0, $revisionid=array(), $checkuser=1) {
addLogEntry($nowfuture, $start, $endstamp, 1, $requestInfo["imageid"]);
$qh = doQuery("SELECT LAST_INSERT_ID() FROM log", 131);
- if(! $row = mysql_fetch_row($qh)) {
+ if(! $row = mysqli_fetch_row($qh)) {
abort(132);
}
$logid = $row[0];
@@ -5857,7 +5871,7 @@ function addRequest($forimaging=0, $revisionid=array(), $checkuser=1) {
$qh = doQuery($query, 136);
$qh = doQuery("SELECT LAST_INSERT_ID() FROM request", 134);
- if(! $row = mysql_fetch_row($qh)) {
+ if(! $row = mysqli_fetch_row($qh)) {
abort(135);
}
$requestid = $row[0];
@@ -5904,7 +5918,7 @@ function addRequest($forimaging=0, $revisionid=array(), $checkuser=1) {
. "WHERE expires > NOW() AND "
. "procid = '$uniqid'";
doQuery($query);
- $cnt = mysql_affected_rows($mysql_link_vcl);
+ $cnt = mysqli_affected_rows($mysqli_link_vcl);
if($cnt == 0) {
# reached this point SEMTIMEOUT seconds after getting semaphore, clean up and abort
$query = "DELETE FROM request WHERE id = $requestid";
@@ -6041,7 +6055,7 @@ function findManagementNode($compid, $start, $nowfuture) {
. "GROUP BY rs.managementnodeid "
. "ORDER BY count";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$mgmtnodecnt[$row["mnid"]] = $row["count"];
}
uasort($mgmtnodecnt, "sortKeepIndex");
@@ -6118,7 +6132,7 @@ function getRequestInfo($id, $returnNULL=0) {
. "FROM request "
. "WHERE id = $id";
$qh = doQuery($query, 165);
- if(! ($data = mysql_fetch_assoc($qh))) {
+ if(! ($data = mysqli_fetch_assoc($qh))) {
if($returnNULL)
return NULL;
# FIXME handle XMLRPC cases
@@ -6168,7 +6182,7 @@ function getRequestInfo($id, $returnNULL=0) {
$data["reservations"] = array();
$data['passwds'] = array();
$resids = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
array_push($data["reservations"], $row);
$resids[] = $row['reservationid'];
$data['passwds'][$row['reservationid']][$data['userid']] = $row['password'];
@@ -6182,7 +6196,7 @@ function getRequestInfo($id, $returnNULL=0) {
. "FROM serverrequest "
. "WHERE requestid = $id";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
$data['serverrequest'] = 1;
$data['servername'] = $row['name'];
$data['admingroupid'] = $row['admingroupid'];
@@ -6196,7 +6210,7 @@ function getRequestInfo($id, $returnNULL=0) {
. "FROM reservationaccounts "
. "WHERE reservationid IN ($inids)";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$data['passwds'][$row['reservationid']][$row['userid']] = $row['password'];
}
else
@@ -6221,7 +6235,7 @@ function updateRequest($requestid, $nowfuture="now") {
$query = "SELECT logid FROM request WHERE id = $requestid";
$qh = doQuery($query, 146);
- if(! $row = mysql_fetch_row($qh)) {
+ if(! $row = mysqli_fetch_row($qh)) {
abort(148);
}
$logid = $row[0];
@@ -6348,7 +6362,7 @@ function deleteRequest($request) {
if($request['serverrequest']) {
$query = "SELECT id FROM serverrequest WHERE requestid = {$request['id']}";
$qh = doQuery($query);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
$query = "DELETE FROM serverrequest WHERE requestid = {$request['id']}";
doQuery($query, 152);
deleteVariable("fixedIPsr{$row['id']}");
@@ -6399,7 +6413,7 @@ function moveReservationsOffComputer($compid=0, $count=0) {
. "ORDER BY reservations "
. "LIMIT 1";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh))
+ if($row = mysqli_fetch_assoc($qh))
$compid = $row["computerid"];
else
return -1;
@@ -6423,7 +6437,7 @@ function moveReservationsOffComputer($compid=0, $count=0) {
if($count)
$query .= " LIMIT $count";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$resInfo[$row["id"]] = $row;
}
if(! count($resInfo))
@@ -6505,7 +6519,7 @@ function moveReservationsOffVMs($compid, $sem=0) {
. "WHERE v.computerid = $compid AND "
. "vm.vmhostid = v.id";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$rc = moveReservationsOffComputer($row['id']);
if($rc != 0)
# lock computer so that reservations on other VMs on this host do not get moved to it
@@ -6540,7 +6554,7 @@ function getCompFinalReservationTime($compid, $extraskipstate=0) {
. "ORDER BY rq.end DESC "
. "LIMIT 1";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh))
+ if($row = mysqli_fetch_assoc($qh))
$end = $row['end'];
$query = "SELECT UNIX_TIMESTAMP(t.end) as end "
. "FROM blockComputers c, "
@@ -6551,7 +6565,7 @@ function getCompFinalReservationTime($compid, $extraskipstate=0) {
. "ORDER BY t.end DESC "
. "LIMIT 1";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh))
+ if($row = mysqli_fetch_assoc($qh))
if($row['end'] > $end)
$end = $row['end'];
return $end;
@@ -6577,7 +6591,7 @@ function getCompFinalReservationTime($compid, $extraskipstate=0) {
////////////////////////////////////////////////////////////////////////////////
function getCompFinalVMReservationTime($hostid, $addsemaphores=0,
$notomaintenance=0) {
- global $uniqid, $mysql_link_vcl;
+ global $uniqid, $mysqli_link_vcl;
if($addsemaphores) {
$query = "SELECT vm.id "
. "FROM computer vm, "
@@ -6586,7 +6600,7 @@ function getCompFinalVMReservationTime($hostid, $addsemaphores=0,
. "vm.vmhostid = v.id";
$qh = doQuery($query);
$compids = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$compids[] = $row['id'];
if(empty($compids))
return 0;
@@ -6609,7 +6623,7 @@ function getCompFinalVMReservationTime($hostid, $addsemaphores=0,
. "(s.expires IS NULL OR s.expires < NOW()) "
. "GROUP BY c.id";
doQuery($query);
- $cnt = mysql_affected_rows($mysql_link_vcl);
+ $cnt = mysqli_affected_rows($mysqli_link_vcl);
if($cnt != count($compids))
return -1;
}
@@ -6631,7 +6645,7 @@ function getCompFinalVMReservationTime($hostid, $addsemaphores=0,
. "ORDER BY rq.end DESC "
. "LIMIT 1";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh))
+ if($row = mysqli_fetch_assoc($qh))
$end = $row['end'];
$query = "SELECT UNIX_TIMESTAMP(t.end) as end "
. "FROM blockComputers c, "
@@ -6646,7 +6660,7 @@ function getCompFinalVMReservationTime($hostid, $addsemaphores=0,
. "ORDER BY t.end DESC "
. "LIMIT 1";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh))
+ if($row = mysqli_fetch_assoc($qh))
if($row['end'] > $end)
$end = $row['end'];
return $end;
@@ -6676,7 +6690,7 @@ function getExistingChangeStateStartTime($compid, $stateid) {
. "ORDER BY rq.start "
. "LIMIT 1";
$qh = doQuery($query);
- if($row = mysql_fetch_assoc($qh))
+ if($row = mysqli_fetch_assoc($qh))
return datetimeToUnix($row['start']);
return 0;
}
@@ -6861,7 +6875,7 @@ function getUserRequests($type, $id=0) {
$data = array();
$foundids = array();
$lastreqid = 0;
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if($row['id'] != $lastreqid) {
$lastreqid = $row['id'];
$count++;
@@ -6988,7 +7002,7 @@ function datetimeToUnix($datetime) {
$tmp = explode(' ', $datetime);
list($year, $month, $day) = explode('-', $tmp[0]);
list($hour, $min, $sec) = explode(':', $tmp[1]);
- return mktime($hour, $min, $sec, $month, $day, $year, -1);
+ return mktime($hour, $min, $sec, $month, $day, $year);
}
////////////////////////////////////////////////////////////////////////////////
@@ -7175,7 +7189,7 @@ function hour24to12($hour) {
function getDepartmentName($id) {
$query = "SELECT name FROM department WHERE id = '$id'";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_row($qh)) {
+ if($row = mysqli_fetch_row($qh)) {
return $row[0];
}
else {
@@ -7197,7 +7211,7 @@ function getDepartmentName($id) {
////////////////////////////////////////////////////////////////////////////////
function getImageId($image) {
$qh = doQuery("SELECT id FROM image WHERE name = '$image'", 170);
- if($row = mysql_fetch_row($qh)) {
+ if($row = mysqli_fetch_row($qh)) {
return $row[0];
}
return 0;
@@ -7216,7 +7230,7 @@ function getImageId($image) {
////////////////////////////////////////////////////////////////////////////////
function getOSId($os) {
$qh = doQuery("SELECT id FROM OS WHERE name = '$os'", 175);
- if($row = mysql_fetch_row($qh)) {
+ if($row = mysqli_fetch_row($qh)) {
return $row[0];
}
return 0;
@@ -7234,7 +7248,7 @@ function getOSId($os) {
function getStates() {
$qh = doQuery("SELECT id, name FROM state", 176);
$states = array();
- while($row = mysql_fetch_row($qh)) {
+ while($row = mysqli_fetch_row($qh)) {
$states[$row[0]] = $row[1];
}
return $states;
@@ -7252,7 +7266,7 @@ function getStates() {
function getPlatforms() {
$qh = doQuery("SELECT id, name FROM platform", 178);
$platforms = array();
- while($row = mysql_fetch_row($qh)) {
+ while($row = mysqli_fetch_row($qh)) {
$platforms[$row[0]] = $row[1];
}
return $platforms;
@@ -7280,7 +7294,7 @@ function getProvisioning() {
. "ORDER BY p.prettyname";
$qh = doQuery($query, 101);
$provisioning = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$provisioning[$row['id']] = $row;
return $provisioning;
}
@@ -7304,7 +7318,7 @@ function getProvisioning() {
function getProvisioningTypes() {
$query = "SELECT id, prettyname FROM provisioning WHERE name = 'none'";
$qh = doQuery($query);
- $none = mysql_fetch_assoc($qh);
+ $none = mysqli_fetch_assoc($qh);
$query = "SELECT p.id, "
. "p.prettyname, "
. "o.name AS `type` "
@@ -7318,7 +7332,7 @@ function getProvisioningTypes() {
$types = array('blade' => array($none['id'] => $none['prettyname']),
'lab' => array(),
'virtualmachine' => array());
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if($row['type'] == 'kickstart' || $row['type'] == 'partimage')
$types['blade'][$row['id']] = $row['prettyname'];
elseif($row['type'] == 'none')
@@ -7363,7 +7377,7 @@ function getSchedules() {
. "ORDER BY s.name";
$qh = doQuery($query, 179);
$schedules = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$schedules[$row["id"]] = $row;
$schedules[$row["id"]]["times"] = array();
}
@@ -7374,7 +7388,7 @@ function getSchedules() {
. "ORDER BY scheduleid, "
. "start";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
array_push($schedules[$row["scheduleid"]]["times"],
array("start" => $row["start"], "end" => $row["end"]));
}
@@ -7498,7 +7512,7 @@ function getManagementNodes($alive="neither", $includedeleted=0, $id=0) {
}
$qh = doQuery($query, 101);
$return = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if(is_null($row['natpublicIPaddress'])) {
$row['nathostenabled'] = 0;
$row['natpublicIPaddress'] = '';
@@ -7556,7 +7570,7 @@ function getMnsFromImage($imageid) {
. "c.id in ($inlist)";
$qh = doQuery($query);
$compgroups = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$compgroups[] = $row['resourcegroupid'];
$mngrps = array();
foreach($compgroups as $grpid) {
@@ -7649,7 +7663,7 @@ function getPredictiveModules() {
. "WHERE perlpackage LIKE 'VCL::Module::Predictive::%'";
$qh = doQuery($query, 101);
$modules = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$modules[$row['id']] = $row;
return $modules;
}
@@ -7721,7 +7735,7 @@ function getTimeSlots($compids, $end=0, $start=0) {
. "AND platformid IN ($platinlist)";
}
$qh = doQuery($query, 155);
- while($row = mysql_fetch_row($qh)) {
+ while($row = mysqli_fetch_row($qh)) {
array_push($computerids, $row[0]);
$times[$row[0]] = array();
$scheduleids[$row[0]] = $row[1];
@@ -7769,7 +7783,7 @@ function getTimeSlots($compids, $end=0, $start=0) {
$qh = doQuery($query, 156);
$id = "";
- while($row = mysql_fetch_row($qh)) {
+ while($row = mysqli_fetch_row($qh)) {
if($row[3] == $requestid) {
continue;
}
@@ -7933,8 +7947,7 @@ function unixFloor15($timestamp=0) {
0,
$timeval["mon"],
$timeval["mday"],
- $timeval["year"],
- -1);
+ $timeval["year"]);
}
////////////////////////////////////////////////////////////////////////////////
@@ -8015,11 +8028,11 @@ function showTimeTable($links) {
$usercomputerids = array_keys($resources["computer"]);
# get list of computers' platformids
$qh = doQuery("SELECT platformid FROM image WHERE id = $imageid", 110);
- $row = mysql_fetch_row($qh);
+ $row = mysqli_fetch_row($qh);
$platformid = $row[0];
$computer_platformids = array();
$qh = doQuery("SELECT id, platformid FROM computer", 111);
- while($row = mysql_fetch_row($qh)) {
+ while($row = mysqli_fetch_row($qh)) {
$computer_platformids[$row[0]] = $row[1];
}
$mappedcomputers = getMappedResources($imageid, "image", "computer");
@@ -8404,7 +8417,7 @@ function findAvailableTimes($start, $end, $imageid, $userid, $usedaysahead,
. "(c.procspeed * c.procnumber), "
. "network";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$row['duration'] = $reqduration;
$row['startts'] = $start;
$row['start'] = $startdt;
@@ -8458,7 +8471,7 @@ function findAvailableTimes($start, $end, $imageid, $userid, $usedaysahead,
. "GROUP BY rq1.id ";
$query .= "ORDER BY rs1.computerid, rq1.start, rq1.end";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$row['startts'] = datetimeToUnix($row['start']);
if($row['startts'] % 900) {
$row['startts'] = $row['startts'] - ($row['startts'] % 900) + 900;
@@ -8517,7 +8530,7 @@ function findAvailableTimes($start, $end, $imageid, $userid, $usedaysahead,
$query .= "(c.type != 'virtualmachine' OR c.vmhostid IS NOT NULL) "
. "GROUP BY rs.computerid";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if($row['endts'] % 900) {
$row['endts'] = $row['endts'] - ($row['endts'] % 900);
$row['duration'] -= 900;
@@ -8573,7 +8586,7 @@ function findAvailableTimes($start, $end, $imageid, $userid, $usedaysahead,
if($extendonly)
$query .= " HAVING start = '$startdt'";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if($usedaysahead && $row['startts'] > $daysahead)
continue;
if($row['startts'] % 900) {
@@ -8610,7 +8623,7 @@ function findAvailableTimes($start, $end, $imageid, $userid, $usedaysahead,
. "br.imageid != $imageid) AND ";
$query .= "bc.computerid IN ($newincompids)";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if(isset($slots[$row['compid']]))
fATremoveOverlaps($slots, $row['compid'], $row['start'], $row['end'], 0);
}
@@ -8639,7 +8652,7 @@ function findAvailableTimes($start, $end, $imageid, $userid, $usedaysahead,
elseif(! empty($mac))
$query .= "s.fixedIP = '$mac'";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if(isset($slots[$row['compid']]))
fATremoveOverlaps($slots, $row['compid'], $row['start'], $row['end'], 0);
}
@@ -8653,7 +8666,7 @@ function findAvailableTimes($start, $end, $imageid, $userid, $usedaysahead,
. "WHERE start < '$maxenddt' AND "
. "end > '$minstartdt'";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
foreach(array_keys($slots) AS $compid)
fATremoveOverlaps($slots, $compid, $row['start'], $row['end'],
$row['allowreservations']);
@@ -8809,7 +8822,7 @@ function fATconcurrentOverlap($start, $length, $imageid, $maxoverlap,
if($extendonly)
$query .= " AND rq.id != $reqid";
$qh = doQuery($query);
- if(mysql_num_rows($qh) >= $maxoverlap)
+ if(mysqli_num_rows($qh) >= $maxoverlap)
return 1;
return 0;
}
@@ -8962,7 +8975,7 @@ function getComputers($sort=0, $includedeleted=0, $compid="") {
$query .= "AND c.id = $compid ";
$query .= "ORDER BY c.hostname";
$qh = doQuery($query, 180);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if(is_null($row['nathostid'])) {
$row['natenabled'] = 0;
$row['nathost'] = '';
@@ -9053,13 +9066,13 @@ function getCompStateFlow($compid) {
# need this information
$query = "SELECT id FROM computerloadstate WHERE loadstatename = 'repeat'";
$qh = doQuery($query, 101);
- if(! $row = mysql_fetch_assoc($qh))
+ if(! $row = mysqli_fetch_assoc($qh))
return array();
$loadstates['repeatid'] = $row['id'];
$query = "SELECT `type` FROM computer WHERE id = $compid";
$qh = doQuery($query, 101);
- if(! $row = mysql_fetch_assoc($qh))
+ if(! $row = mysqli_fetch_assoc($qh))
return array();
$type = $row['type'];
@@ -9078,7 +9091,7 @@ function getCompStateFlow($compid) {
. "(SELECT nextstateid FROM computerloadflow WHERE `type` = '$type' "
. "AND nextstateid IS NOT NULL)";
$qh = doQuery($query2, 101);
- if(! $row = mysql_fetch_assoc($qh))
+ if(! $row = mysqli_fetch_assoc($qh))
return array();
$loadstates['data'][$row['stateid']] = $row;
$loadstates['stateids'] = array($row['stateid']);
@@ -9088,7 +9101,7 @@ function getCompStateFlow($compid) {
$query2 = $query . "AND cf.computerloadstateid = {$row['nextstateid']} "
. "AND `type` = '$type'";
$qh = doQuery($query2, 101);
- if(! $row = mysql_fetch_assoc($qh)) {
+ if(! $row = mysqli_fetch_assoc($qh)) {
$_SESSION['compstateflow'][$key] = $loadstates;
return $loadstates;
}
@@ -9133,7 +9146,7 @@ function getCompLoadLog($resid) {
. "rs.requestid = rq.id "
. "LIMIT 1";
$qh = doQuery($query, 101);
- if(! $row = mysql_fetch_assoc($qh))
+ if(! $row = mysqli_fetch_assoc($qh))
abort(113);
if($row['start'] < $row['reqtime']) {
# now
@@ -9156,7 +9169,7 @@ function getCompLoadLog($resid) {
$qh = doQuery($query, 101);
$last = array();
$data = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$data[$row['id']] = $row;
if(empty($last)) {
if($future)
@@ -9196,7 +9209,7 @@ function getImageLoadEstimate($imageid) {
. "start > (NOW() - INTERVAL 12 MONTH) AND "
. "UNIX_TIMESTAMP(loaded) - UNIX_TIMESTAMP(start) < 1800";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
if(! empty($row['avgloadtime']))
return (int)$row['avgloadtime'];
else
@@ -9222,7 +9235,7 @@ function getComputerCounts(&$computers) {
. "FROM sublog "
. "WHERE computerid = $compid";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_row($qh))
+ if($row = mysqli_fetch_row($qh))
$computers[$compid]["counts"] = $row[0];
else
$computers[$compid]["counts"] = 0;
@@ -9349,7 +9362,7 @@ function getAvailableBlockComputerids($imageid, $start, $end, $allocatedcompids)
. "c2.id NOT IN ($alloccompids) "
. "ORDER BY s.name";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$data['compids'][] = $row['computerid'];
$data[$row['computerid']] = $row;
}
@@ -9380,7 +9393,7 @@ function getUsedBlockComputerids($start, $end) {
. "t.start < '$enddt' AND "
. "c.blockTimeid = t.id";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
array_push($compids, $row['computerid']);
}
return $compids;
@@ -9416,7 +9429,7 @@ function getNAThosts($id=0, $sort=0) {
if($id)
$query .= " WHERE n.id = $id";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$nathosts[$row['id']] = $row;
if($sort)
uasort($nathosts, "sortKeepIndex");
@@ -9454,7 +9467,7 @@ function getNATports($resid) {
. "WHERE n.connectmethodportid = c.id AND "
. "n.reservationid = $resid";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$ports[$row['connectmethodid']]["#Port-{$row['protocol']}-{$row['privateport']}#"] = $row;
return $ports;
}
@@ -9504,7 +9517,7 @@ function getADdomains($addomainid=0) {
$qh = doQuery($query);
$addomainlist = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$addomainlist[$row['id']] = $row;
return $addomainlist;
}
@@ -9567,7 +9580,7 @@ function getBlockTimeData($start="", $end="") {
$query .= " AND t.end > '" . unixToDatetime($start) . "'";
$query .= " ORDER BY t.start, t.end";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$return[$row['timeid']] = $row;
$return[$row['timeid']]['unixstart'] = datetimeToUnix($row['start']);
$return[$row['timeid']]['unixend'] = datetimeToUnix($row['end']);
@@ -9576,7 +9589,7 @@ function getBlockTimeData($start="", $end="") {
. "FROM blockComputers "
. "WHERE blockTimeid = {$row['timeid']}";
$qh2 = doQuery($query2, 101);
- while($row2 = mysql_fetch_assoc($qh2))
+ while($row2 = mysqli_fetch_assoc($qh2))
array_push($return[$row['timeid']]['computerids'], $row2['computerid']);
}
return $return;
@@ -9630,7 +9643,7 @@ function isImageBlockTimeActive($imageid) {
. "bt.end > '$nowdt' AND "
. "br.imageid = $imageid";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh))
+ if($row = mysqli_fetch_assoc($qh))
return 1;
return 0;
}
@@ -10233,7 +10246,7 @@ function updateGroups($newusergroups, $userid) {
. "u.courseroll = 0";
$qh = doQuery($query, 305);
$oldusergroups = array();
- while($row = mysql_fetch_row($qh)) {
+ while($row = mysqli_fetch_row($qh)) {
array_push($oldusergroups, $row[0]);
}
if(count(array_diff($oldusergroups, $newusergroups)) ||
@@ -10281,7 +10294,7 @@ function getUserGroupID($name, $affilid=DEFAULT_AFFILID, $noadd=0) {
. "WHERE name = '$name' AND "
. "affiliationid = $affilid";
$qh = doQuery($query, 300);
- if($row = mysql_fetch_row($qh))
+ if($row = mysqli_fetch_row($qh))
return $row[0];
elseif($noadd)
return NULL;
@@ -10297,7 +10310,7 @@ function getUserGroupID($name, $affilid=DEFAULT_AFFILID, $noadd=0) {
. "0)";
doQuery($query, 301);
$qh = doQuery("SELECT LAST_INSERT_ID() FROM usergroup", 302);
- if(! $row = mysql_fetch_row($qh)) {
+ if(! $row = mysqli_fetch_row($qh)) {
abort(303);
}
return $row[0];
@@ -10330,7 +10343,7 @@ function getUserGroupName($id, $incAffil=0) {
. "WHERE id = $id";
}
$qh = doQuery($query, 101);
- if($row = mysql_fetch_row($qh))
+ if($row = mysqli_fetch_row($qh))
return $row[0];
return 0;
}
@@ -10407,7 +10420,7 @@ function getMaintItems($id=0) {
$query .= "ORDER BY m.start";
$qh = doQuery($query, 101);
$data = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$data[$row['id']] = $row;
$_SESSION['usersessiondata'][$key] = $data;
return $data;
@@ -10442,7 +10455,7 @@ function getMaintItemsForTimeTable($start, $end) {
. "ORDER BY start";
$qh = doQuery($query, 101);
$data = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$data[] = $row;
$_SESSION['usersessiondata'][$key] = $data;
return $data;
@@ -10661,13 +10674,13 @@ function addChangeLogEntry($logid, $remoteIP, $end=NULL, $start=NULL,
. "FROM log "
. "WHERE id = $logid";
$qh = doQuery($query, 265);
- if(! $log = mysql_fetch_assoc($qh)) {
+ if(! $log = mysqli_fetch_assoc($qh)) {
abort(30);
}
$log["computerid"] = array();
$query = "SELECT computerid FROM sublog WHERE logid = $logid";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
array_push($log["computerid"], $row["computerid"]);
}
$changed = 0;
@@ -10769,7 +10782,7 @@ function addChangeLogEntry($logid, $remoteIP, $end=NULL, $start=NULL,
///
////////////////////////////////////////////////////////////////////////////////
function addChangeLogEntryOther($logid, $data) {
- $data = mysql_real_escape_string($data);
+ $data = vcl_mysql_escape_string($data);
$query = "INSERT INTO changelog "
. "(logid, "
. "timestamp, "
@@ -10805,7 +10818,7 @@ function addSublogEntry($logid, $imageid, $imagerevisionid, $computerid,
. "FROM computer "
. "WHERE id = $computerid";
$qh = doQuery($query, 101);
- $row = mysql_fetch_assoc($qh);
+ $row = mysqli_fetch_assoc($qh);
$predictiveid = $row['predictivemoduleid'];
$query = "SELECT c.type, "
. "v.computerid AS hostid "
@@ -10813,7 +10826,7 @@ function addSublogEntry($logid, $imageid, $imagerevisionid, $computerid,
. "LEFT JOIN vmhost v ON (c.vmhostid = v.id) "
. "WHERE c.id = $computerid";
$qh = doQuery($query, 101);
- $row = mysql_fetch_assoc($qh);
+ $row = mysqli_fetch_assoc($qh);
if($row['type'] == 'virtualmachine')
$hostcomputerid = $row['hostid'];
else
@@ -10865,7 +10878,7 @@ function getTypes($subtype="both") {
if($subtype == "users" || $subtype == "both") {
$query = "SELECT id, name FROM userprivtype WHERE name NOT IN ('configAdmin', 'serverProfileAdmin')";
$qh = doQuery($query, 365);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if($row["name"] == "block" || $row["name"] == "cascade")
continue;
$types["users"][$row["id"]] = $row["name"];
@@ -10874,7 +10887,7 @@ function getTypes($subtype="both") {
if($subtype == "resources" || $subtype == "both") {
$query = "SELECT id, name FROM resourcetype";
$qh = doQuery($query, 366);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$types["resources"][$row["id"]] = $row["name"];
}
return $types;
@@ -10894,7 +10907,7 @@ function getTypes($subtype="both") {
function getUserPrivTypeID($type) {
$query = "SELECT id FROM userprivtype WHERE name = '$type'";
$qh = doQuery($query, 370);
- if($row = mysql_fetch_row($qh))
+ if($row = mysqli_fetch_row($qh))
return $row[0];
else
return NULL;
@@ -11066,8 +11079,8 @@ function getReservationLengthCeiling($length) {
////////////////////////////////////////////////////////////////////////////////
function getResourceGroupID($groupname) {
list($type, $name) = explode('/', $groupname);
- $type = mysql_real_escape_string($type);
- $name = mysql_real_escape_string($name);
+ $type = vcl_mysql_escape_string($type);
+ $name = vcl_mysql_escape_string($name);
$query = "SELECT g.id "
. "FROM resourcegroup g, "
. "resourcetype t "
@@ -11075,7 +11088,7 @@ function getResourceGroupID($groupname) {
. "t.name = '$type' AND "
. "g.resourcetypeid = t.id";
$qh = doQuery($query, 371);
- if($row = mysql_fetch_row($qh))
+ if($row = mysqli_fetch_row($qh))
return $row[0];
else
return NULL;
@@ -11098,7 +11111,7 @@ function getResourceGroupName($groupid) {
. "FROM resourcegroup "
. "WHERE id = $groupid";
$qh = doQuery($query);
- if($row = mysql_fetch_assoc($qh))
+ if($row = mysqli_fetch_assoc($qh))
return $row['name'];
else
return NULL;
@@ -11116,12 +11129,12 @@ function getResourceGroupName($groupid) {
///
////////////////////////////////////////////////////////////////////////////////
function getResourceTypeID($name) {
- $name = mysql_real_escape_string($name);
+ $name = vcl_mysql_escape_string($name);
$query = "SELECT id "
. "FROM resourcetype "
. "WHERE name = '$name'";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_row($qh))
+ if($row = mysqli_fetch_row($qh))
return $row[0];
else
return NULL;
@@ -11140,7 +11153,7 @@ function getResourceTypeID($name) {
function getResourcePrivs() {
$query = "show columns from resourcepriv where field = 'type'";
$qh = doQuery($query, 101);
- $row = mysql_fetch_assoc($qh);
+ $row = mysqli_fetch_assoc($qh);
preg_match("/^enum\(([a-zA-Z0-9,']+)\)$/", $row['Type'], $matches);
$tmp = str_replace("'", '', $matches[1]);
return explode(',', $tmp);
@@ -11160,7 +11173,7 @@ function getConfigTypes() {
$query = "SELECT id, prettyname FROM configtype ORDER BY name";
$qh = doQuery($query);
$types = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$types[$row['id']] = $row['prettyname'];
return $types;
}
@@ -11179,7 +11192,7 @@ function getConfigDataTypes() {
$query = "SELECT id, name FROM datatype ORDER BY name";
$qh = doQuery($query);
$types = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$types[$row['id']] = $row['name'];
return $types;
}
@@ -11204,7 +11217,7 @@ function getConfigMapTypes($skipreservation=0) {
$query .= "ORDER BY prettyname";
$qh = doQuery($query);
$types = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$types[$row['id']] = $row['prettyname'];
return $types;
}
@@ -11270,7 +11283,7 @@ function getMappedConfigs($imageid) {
$qh = doQuery($query);
$configs = array();
$configids = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$row['configmapid'] = $row['id'];
if(is_null($row['subimageid']))
$configids[] = $row['configid'];
@@ -11381,7 +11394,7 @@ function getMappedSubConfigs($mode, $arg1, $arg2, $rec=0) {
$qh = doQuery($query);
$configs = array();
$configids = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$row['configmapid'] = $row['id'];
if(is_null($row['subimageid']))
$configids[] = $row['configid'];
@@ -11451,7 +11464,7 @@ function getImageConfigVariables($configs) {
. "ORDER BY cv.configid";
$data = array();
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$row['required'] = (int)$row['required'];
$row['ask'] = (int)$row['ask'];
#$row['defaultvalue'] = htmlspecialchars($row['defaultvalue']);
@@ -11524,7 +11537,7 @@ function getConfigClusters($imageid, $flat=0) {
$qh = doQuery($query);
$clusters = array();
$subimageids = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$children = getConfigClustersRec($row['configsubimageid'], $flat);
if(! empty($children)) {
if($flat)
@@ -11587,7 +11600,7 @@ function getConfigClustersRec($subimageid, $flat, $rec=0) {
. "a.name = 'Global')";
$qh = doQuery($query);
$clusters = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if($rec < 20)
$children = getConfigClustersRec($row['configsubimageid'], $flat, ++$rec);
if($rec < 20 && ! empty($children)) {
@@ -11615,7 +11628,7 @@ function getOStypes() {
$query = "SELECT id, name FROM OStype ORDER BY name";
$qh = doQuery($query);
$types = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$types[$row['id']] = $row['name'];
return $types;
}
@@ -11648,7 +11661,7 @@ function getConfigSubimages($configs) {
. "c.id IN ($inlist)";
$configs = array();
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$configs[$row['id']] = $row['name'];
return $configs;
}
@@ -11671,7 +11684,7 @@ function getNodeInfo($nodeid) {
if(isset($cache['nodes'][$nodeid]))
return $cache['nodes'][$nodeid];
$qh = doQuery("SELECT id, parent, name FROM privnode", 330);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$cache['nodes'][$row['id']] = $row;
if(isset($cache['nodes'][$nodeid]))
return $cache['nodes'][$nodeid];
@@ -11848,7 +11861,7 @@ function getResourceMapping($resourcetype1, $resourcetype2,
if(! empty($resource2inlist))
$query .= "AND resourcegroupid2 IN ($resource2inlist) ";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if($resourcetype1 == $row['resourcetypeid1']) {
if(array_key_exists($row["resourcegroupid1"], $return))
array_push($return[$row["resourcegroupid1"]], $row["resourcegroupid2"]);
@@ -11900,7 +11913,7 @@ function getConnectMethods($imageid) {
. "ORDER BY c.description";
$methods = array();
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$methods[$row['id']] = $row;
$_SESSION['usersessiondata'][$key] = $methods;
return $methods;
@@ -11938,7 +11951,7 @@ function timeToNextReservation($request) {
. "ORDER BY start "
. "LIMIT 1";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
$end = datetimeToUnix($request["end"]);
$start = datetimeToUnix($row["start"]);
return ($start - $end) / 60;
@@ -11983,8 +11996,8 @@ function weekOfYear($ts) {
///
////////////////////////////////////////////////////////////////////////////////
function cleanSemaphore() {
- global $mysql_link_vcl, $uniqid;
- if(! is_resource($mysql_link_vcl) || ! get_resource_type($mysql_link_vcl) == 'mysql link')
+ global $mysqli_link_vcl, $uniqid;
+ if(! is_resource($mysqli_link_vcl) || ! get_resource_type($mysqli_link_vcl) == 'mysql link')
return;
$query = "DELETE FROM semaphore "
. "WHERE procid = '$uniqid'";
@@ -12092,7 +12105,7 @@ function getVMProfiles($id="") {
$query .= " AND vp.id = $id";
$qh = doQuery($query, 101);
$ret = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$ret[$row['id']] = $row;
return $ret;
}
@@ -12112,7 +12125,7 @@ function getVMProfiles($id="") {
function getENUMvalues($table, $field) {
$query = "DESC $table";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if($row['Field'] == "$field") {
$data = preg_replace(array('/^enum\(/', "/'/", '/\)$/'), array('', '', ''), $row['Type']);
$types = explode(',', $data);
@@ -12161,7 +12174,7 @@ function addContinuationsEntry($nextmode, $data=array(), $duration=SECINWEEK,
$contid = md5($mode . $nextmode . $serdata . $user['id'] . $_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT']);
else
$contid = md5($mode . $nextmode . $serdata . $user['id'] . $_SERVER['REMOTE_ADDR']);
- $serdata = mysql_real_escape_string($serdata);
+ $serdata = vcl_mysql_escape_string($serdata);
$expiretime = unixToDatetime(time() + $duration);
$query = "SELECT id, "
. "parentid "
@@ -12169,7 +12182,7 @@ function addContinuationsEntry($nextmode, $data=array(), $duration=SECINWEEK,
. "WHERE id = '$contid' AND "
. "userid = {$user['id']}";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
# update expiretime
$query = "UPDATE continuations "
. "SET expiretime = '$expiretime' "
@@ -12192,7 +12205,7 @@ function addContinuationsEntry($nextmode, $data=array(), $duration=SECINWEEK,
. "WHERE id = '$continuationid' AND "
. "userid = {$user['id']}";
$qh = doQuery($query, 101);
- if(! $row = mysql_fetch_assoc($qh))
+ if(! $row = mysqli_fetch_assoc($qh))
abort(108);
$deletefromid = $row['deletefromid'];
}
@@ -12276,7 +12289,7 @@ function getContinuationsData($data) {
$qh = doQuery($query, 101);
# return error if it is not there
- if(! ($row = mysql_fetch_assoc($qh)))
+ if(! ($row = mysqli_fetch_assoc($qh)))
return array('error' => 'continuation does not exist');
# return error if it is expired
@@ -12382,7 +12395,7 @@ function getShibauthData($id) {
. "FROM shibauth "
. "WHERE id = $id";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
$data = unserialize($row['data']);
unset($row['data']);
$data2 = array_merge($row, $data);
@@ -12421,7 +12434,7 @@ function getVariable($key, $default=NULL, $incparams=0) {
$query .= "FROM variable "
. "WHERE name = '$key'";
$qh = doQuery($query);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
if($incparams) {
switch($row['serialization']) {
case 'yaml':
@@ -12472,7 +12485,7 @@ function getVariablesRegex($pattern) {
. "WHERE name REGEXP '$pattern'";
$qh = doQuery($query);
$ret = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
switch($row['serialization']) {
case 'none':
$ret[$row['name']] = $row['value'];
@@ -12508,7 +12521,7 @@ function setVariable($key, $data, $serialization='') {
$update = 0;
$query = "SELECT serialization FROM variable WHERE name = '$key'";
$qh = doQuery($query);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
if($serialization == '')
$serialization = $row['serialization'];
$update = 1;
@@ -12518,14 +12531,14 @@ function setVariable($key, $data, $serialization='') {
$_SESSION['variables'][$key] = $data;
switch($serialization) {
case 'none':
- $qdata = mysql_real_escape_string($data);
+ $qdata = vcl_mysql_escape_string($data);
break;
case 'yaml':
$yaml = Spyc::YAMLDump($data);
- $qdata = mysql_real_escape_string($yaml);
+ $qdata = vcl_mysql_escape_string($yaml);
break;
case 'phpserialize':
- $qdata = mysql_real_escape_string(serialize($data));
+ $qdata = vcl_mysql_escape_string(serialize($data));
break;
}
if($update)
@@ -12736,7 +12749,7 @@ function xmlRPChandler($function, $args, $blah) {
$keyid = $user['id'];
if(function_exists($function)) {
if(! defined('XMLRPCLOGGING') || XMLRPCLOGGING != 0) {
- $saveargs = mysql_real_escape_string(serialize($args));
+ $saveargs = vcl_mysql_escape_string(serialize($args));
$query = "INSERT INTO xmlrpcLog "
. "(xmlrpcKeyid, "
. "timestamp, "
@@ -12777,13 +12790,13 @@ function xmlRPChandler($function, $args, $blah) {
///
////////////////////////////////////////////////////////////////////////////////
function xmlRPCabort($errcode, $query='') {
- global $mysql_link_vcl, $mysql_link_acct, $ERRORS, $user, $mode;
+ global $mysqli_link_vcl, $mysqli_link_acct, $ERRORS, $user, $mode;
global $XMLRPCERRORS;
if(ONLINEDEBUG && checkUserHasPerm('View Debug Information')) {
$msg = '';
if($errcode >= 100 && $errcode < 400) {
- $msg .= "ERROR (" . mysql_errno($mysql_link_vcl) . ") - ";
- $msg .= mysql_error($mysql_link_vcl) . " $query ";
+ $msg .= "ERROR (" . mysqli_errno($mysqli_link_vcl) . ") - ";
+ $msg .= mysqli_error($mysqli_link_vcl) . " $query ";
}
$msg .= $ERRORS["$errcode"];
$XMLRPCERRORS[100] = $msg;
@@ -12792,8 +12805,8 @@ function xmlRPCabort($errcode, $query='') {
else {
$message = "";
if($errcode >= 100 && $errcode < 400) {
- $message .= mysql_error($mysql_link_vcl) . "\n";
- $message .= mysql_error($mysql_link_acct) . "\n";
+ $message .= mysqli_error($mysqli_link_vcl) . "\n";
+ $message .= mysqli_error($mysqli_link_acct) . "\n";
$message .= $query . "\n";
}
$message .= "ERROR($errcode): " . $ERRORS["$errcode"] . "\n";
@@ -12943,7 +12956,7 @@ function validateAPIgroupInput($items, $exists) {
'errormsg' => 'existing user group with submitted name and affiliation');
}
elseif($exists && $doesexist) {
- $esc_name = mysql_real_escape_string($items['name']);
+ $esc_name = vcl_mysql_escape_string($items['name']);
$items['id'] = getUserGroupID($esc_name, $affilid);
}
}
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/.ht-inc/vm.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/vm.php b/web/.ht-inc/vm.php
index 0616d9b..90c96a5 100644
--- a/web/.ht-inc/vm.php
+++ b/web/.ht-inc/vm.php
@@ -380,7 +380,7 @@ function vmhostdata() {
$currvms = array();
$noaccess = array();
$freevms = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if($row['vmhostid'] == $vmhostid) {
$ids[$row['id']] = $row['hostname'];
if(array_key_exists($row['id'], $computers))
@@ -423,7 +423,7 @@ function vmhostdata() {
. "rq.laststateid = 18) AND "
. "rq.start > NOW()";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$movevms[] = array('id' => $row['id'],
'time' => strtolower($row['start']) . ' ' . date('T'),
'hostname' => $currvms[$row['computerid']]['name']);
@@ -480,7 +480,7 @@ function getVMHostData($id='') {
$query .= " AND vh.id = $id";
$qh = doQuery($query, 101);
$ret = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$ret[$row['id']] = $row;
foreach($profiles[$row['vmprofileid']] AS $key => $value) {
if(is_null($value))
@@ -524,7 +524,7 @@ function AJvmToHost() {
. "WHERE id in ($vmlistids)";
$qh = doQuery($query, 101);
$vmdata = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if(! array_key_exists($row['id'], $resources['computer'])) {
$fails[] = array('id' => $row['id'], 'name' => $row['hostname'], 'reason' => 'noaccess');
unset_by_val($row['id'], $vmids);
@@ -537,7 +537,7 @@ function AJvmToHost() {
$query = "SELECT id FROM vmhost";
$vmhosts = array();
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$vmhosts[$row['id']] = 1;
# check to see if there any submitted vms have a hostid of an existing vm host
@@ -616,7 +616,7 @@ function AJvmFromHost() {
. "ORDER BY end DESC "
. "LIMIT 1";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
$checks[] = array('id' => $compid,
'hostname' => $compdata[$compid]['hostname'],
'end' => strtolower($row['end']) . ' ' . date('T'),
@@ -840,11 +840,11 @@ function AJupdateVMprofileItem() {
else {
if(get_magic_quotes_gpc())
$newvalue = stripslashes($newvalue);
- $newvalue2 = mysql_real_escape_string($newvalue);
+ $newvalue2 = vcl_mysql_escape_string($newvalue);
$newvalue2 = "'$newvalue2'";
}
- $item = mysql_real_escape_string($item);
+ $item = vcl_mysql_escape_string($item);
$profile = getVMProfiles($profileid);
if($item == 'password') {
$pwdlen = strlen($newvalue);
@@ -878,7 +878,7 @@ function AJupdateVMprofileItem() {
. "WHERE cryptkeyid = $cryptkeyid AND "
. "secretid = $secretid";
$qh = doQuery($query);
- if(! ($row = mysql_fetch_assoc($qh))) {
+ if(! ($row = mysqli_fetch_assoc($qh))) {
# generate a new secret
$newsecretid = getSecretKeyID('vmprofile', 'secretid', 0);
$delids = array($secretid);
@@ -895,7 +895,7 @@ function AJupdateVMprofileItem() {
. "WHERE cs.secretid = $secretid AND "
. "ck.hosttype = 'managementnode'";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$secretidset[$row['mnid']][$newsecretid] = 1;
$values = getMNcryptkeyUpdates($secretidset, $cryptkeyid);
addCryptSecretKeyUpdates($values);
@@ -946,11 +946,11 @@ function AJnewProfile() {
$newprofile = processInputVar('newname', ARG_STRING);
if(get_magic_quotes_gpc()) {
$newprofile = stripslashes($newprofile);
- $newprofile = mysql_real_escape_string($newprofile);
+ $newprofile = vcl_mysql_escape_string($newprofile);
}
$query = "SELECT id FROM vmprofile WHERE profilename = '$newprofile'";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
sendJSON(array('failed' => 'exists'));
return;
}
@@ -994,7 +994,7 @@ function AJdelProfile() {
. "s.name IN ('vmhostinuse', 'tovmhostinuse') AND "
. "vh.vmprofileid = $profileid";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
sendJSON(array('failed' => 'inuse'));
return;
}
[3/5] vcl git commit: VCL-1106 - make PHP code compatible with PHP 7
Posted by jf...@apache.org.
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/.ht-inc/oneclick.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/oneclick.php b/web/.ht-inc/oneclick.php
index e478fcd..d8b62c9 100755
--- a/web/.ht-inc/oneclick.php
+++ b/web/.ht-inc/oneclick.php
@@ -57,7 +57,7 @@ function newOneClick() {
. "o.userid = {$user['id']}";
$oneclicks = array();
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$oneclicks[$row['id']] = $row;
print "<H2>" . i("VCL go Configurator") . "</H2>\n";
@@ -322,7 +322,7 @@ function editOneClick() {
$qh = doQuery($query, 101);
print "<form action=\"" . BASEURL . SCRIPT . "\" method=\"post\" style=\"display: inline;\" onsubmit=\"return validateForm(this);\">\n";
- if(! ($row = mysql_fetch_assoc($qh))) {
+ if(! ($row = mysqli_fetch_assoc($qh))) {
print i("VCL go not found") . "\n";
return NULL;
}
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/.ht-inc/privileges.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/privileges.php b/web/.ht-inc/privileges.php
index 92f6ee3..165e14b 100644
--- a/web/.ht-inc/privileges.php
+++ b/web/.ht-inc/privileges.php
@@ -256,7 +256,7 @@ function viewNodes() {
. "ORDER BY name";
$qh = doQuery($query);
$orderedgroups = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$orderedgroups[] = $row['id'];
foreach($orderedgroups as $id) {
printUserPrivRow($id, $i, $privs["usergroups"], $usertypes["users"],
@@ -965,7 +965,7 @@ function selectNode() {
. "ORDER BY name";
$qh = doQuery($query);
$orderedgroups = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$orderedgroups[] = $row['id'];
foreach($orderedgroups as $id) {
$tmpArr = getUserPrivRowHTML($id, $i, $privs["usergroups"],
@@ -1125,7 +1125,7 @@ function nodeDropData() {
$query = "SELECT id, parent FROM privnode WHERE id > " . DEFAULT_PRIVNODE;
$qh = doQuery($query);
$data = 'nodedropdata = {';
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
if(checkUserHasPriv('nodeAdmin', $user['id'], $row['id']) &&
($row['parent'] == DEFAULT_PRIVNODE || checkUserHasPriv('nodeAdmin', $user['id'], $row['parent'])))
$data .= "{$row['id']}: '1',";
@@ -1183,7 +1183,7 @@ function AJsubmitAddChildNode() {
. "WHERE name = '$newnode' AND "
. "parent = $parent";
$qh = doQuery($query, 335);
- if(mysql_num_rows($qh)) {
+ if(mysqli_num_rows($qh)) {
$text = "A node of that name already exists "
. "under " . $nodeInfo["name"];
print "dojo.byId('addChildNodeStatus').innerHTML = '$text';";
@@ -1198,7 +1198,7 @@ function AJsubmitAddChildNode() {
doQuery($query, 336);
$qh = doQuery("SELECT LAST_INSERT_ID() FROM privnode", 101);
- if(! $row = mysql_fetch_row($qh))
+ if(! $row = mysqli_fetch_row($qh))
abort(101);
$nodeid = $row[0];
@@ -1228,7 +1228,7 @@ function AJsubmitAddChildNode() {
function nodeExists($node) {
$query = "SELECT id FROM privnode WHERE id = $node";
$qh = doQuery($query, 101);
- if(mysql_num_rows($qh))
+ if(mysqli_num_rows($qh))
return 1;
else
return 0;
@@ -1313,13 +1313,13 @@ function AJsubmitRenameNode() {
return;
}
# check if node matching new name already exists at parent
- $_newname = mysql_real_escape_string($newname);
+ $_newname = vcl_mysql_escape_string($newname);
$query = "SELECT id "
. "FROM privnode "
. "WHERE parent = (SELECT parent FROM privnode WHERE id = $activeNode) AND "
. "name = '$_newname'";
$qh = doQuery($query, 101);
- if(mysql_num_rows($qh)) {
+ if(mysqli_num_rows($qh)) {
$msg = i("A sibling node of that name currently exists");
$arr = array('error' => 2, 'message' => $msg);
sendJSON($arr);
@@ -1372,7 +1372,7 @@ function AJmoveNode() {
. "p2.parent = $newparentid AND "
. "p2.name = p1.name";
$qh = doQuery($query);
- if($row = mysql_num_rows($qh)) {
+ if($row = mysqli_num_rows($qh)) {
$arr = array('status' => 'collision',
'moveid' => $moveid,
'oldparentid' => $oldparentid,
@@ -1494,7 +1494,7 @@ function userLookup() {
print "<INPUT type=hidden name=continuation value=\"$cont\">\n";
print "</FORM><br>\n";
if(! empty($userid)) {
- $esc_userid = mysql_real_escape_string($userid);
+ $esc_userid = vcl_mysql_escape_string($userid);
if(preg_match('/,/', $userid)) {
$mode = 'name';
$force = 0;
@@ -1517,8 +1517,8 @@ function userLookup() {
}
else {
$tmp = explode(',', $userid);
- $last = mysql_real_escape_string(trim($tmp[0]));
- $first = mysql_real_escape_string(trim($tmp[1]));
+ $last = vcl_mysql_escape_string(trim($tmp[0]));
+ $first = vcl_mysql_escape_string(trim($tmp[1]));
$query = "SELECT CONCAT(u.unityid, '@', a.name) AS unityid "
. "FROM user u, "
. "affiliation a "
@@ -1528,7 +1528,7 @@ function userLookup() {
. "a.id = $affilid";
}
$qh = doQuery($query, 101);
- if(! mysql_num_rows($qh)) {
+ if(! mysqli_num_rows($qh)) {
if($mode == 'name') {
print "<font color=red>User not found</font><br>\n";
return;
@@ -1538,13 +1538,13 @@ function userLookup() {
}
elseif($force) {
$_SESSION['userresources'] = array();
- $row = mysql_fetch_assoc($qh);
+ $row = mysqli_fetch_assoc($qh);
$newtime = unixToDatetime(time() - SECINDAY - 5);
$query = "UPDATE user SET lastupdated = '$newtime' WHERE id = {$row['id']}";
doQuery($query, 101);
}
elseif($mode == 'name') {
- $row = mysql_fetch_assoc($qh);
+ $row = mysqli_fetch_assoc($qh);
$userid = $row['unityid'];
$esc_userid = $row['unityid'];
}
@@ -1659,11 +1659,11 @@ function userLookup() {
. "ORDER BY p.name, "
. "upt.name";
$qh = doQuery($query, 101);
- if(mysql_num_rows($qh)) {
+ if(mysqli_num_rows($qh)) {
print "Nodes where user is granted privileges:<br>\n";
print "<TABLE>\n";
$privnodeid = 0;
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if($privnodeid != $row['privnodeid']) {
if($privnodeid) {
print " </TD>\n";
@@ -1699,11 +1699,11 @@ function userLookup() {
. "ORDER BY p.name, "
. "upt.name";
$qh = doQuery($query, 101);
- if(mysql_num_rows($qh)) {
+ if(mysqli_num_rows($qh)) {
print "Nodes where user's groups are granted privileges:<br>\n";
print "<TABLE>\n";
$privnodeid = 0;
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if($privnodeid != $row['privnodeid']) {
if($privnodeid) {
print " </TD>\n";
@@ -1749,7 +1749,7 @@ function userLookup() {
. "LIMIT 8";
$logins = array();
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$logins[] = $row;
if(count($logins)) {
$logins = array_reverse($logins);
@@ -1814,7 +1814,7 @@ function userLookup() {
. "ORDER BY l.start DESC "
. "LIMIT 5";
$qh = doQuery($query, 290);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
array_push($requests, $row);
$requests = array_reverse($requests);
if(! empty($requests)) {
@@ -1924,7 +1924,7 @@ function userLookup() {
. "GROUP BY rq.id "
. "ORDER BY rq.start";
$qh = doQuery($query, 290);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
array_push($requests, $row);
$requests = array_reverse($requests);
if(! empty($requests)) {
@@ -2054,7 +2054,7 @@ function userLookup() {
. "GROUP BY rq.id "
. "ORDER BY rq.start";
$qh = doQuery($query, 290);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
array_push($requests, $row);
$requests = array_reverse($requests);
if(! empty($requests)) {
@@ -2156,7 +2156,7 @@ function userLookup() {
function recurseGetChildren($node) {
$children = array();
$qh = doQuery("SELECT id FROM privnode WHERE parent = $node", 340);
- while($row = mysql_fetch_row($qh)) {
+ while($row = mysqli_fetch_row($qh)) {
array_push($children, $row[0]);
$children = array_merge($children, recurseGetChildren($row[0]));
}
@@ -2444,7 +2444,7 @@ function jsonGetUserGroupMembers() {
. "LEFT JOIN usergroup g2 ON (g.editusergroupid = g2.id) "
. "WHERE g.id = $usergrpid";
$qh = doQuery($query, 101);
- if(! ($grpdata = mysql_fetch_assoc($qh))) {
+ if(! ($grpdata = mysqli_fetch_assoc($qh))) {
# problem getting group members
$msg = 'failed to fetch group members';
$arr = array('members' => $msg, 'domid' => $domid);
@@ -2620,7 +2620,7 @@ function jsonGetResourceGroupMembers() {
. "WHERE rg.id = $resgrpid AND "
. "rg.resourcetypeid = rt.id";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
$type = $row['name'];
if($type == 'computer' || $type == 'managementnode')
$field = 'hostname';
@@ -2639,7 +2639,7 @@ function jsonGetResourceGroupMembers() {
$query .= " AND t.deleted = 0";
$qh = doQuery($query, 101);
$members = '';
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$members .= "{$row['item']}<br>";
if($members == '')
$members = '(empty group)';
@@ -2719,7 +2719,7 @@ function getNodePrivileges($node, $type="all", $privs=0) {
. "g.resourcetypeid = t.id "
. "ORDER BY p.privnodeid";
$qh = doQuery($query, 350);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$resourcedata[$row['privnodeid']][] = $row;
}
}
@@ -2746,7 +2746,7 @@ function getNodePrivileges($node, $type="all", $privs=0) {
. "u.affiliationid = a.id "
. "ORDER BY u.unityid";
$qh = doQuery($query, 351);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$privs['users'][$row['unityid']][$row['name']] = 1;
}
if($type == "usergroups" || $type == "all") {
@@ -2766,7 +2766,7 @@ function getNodePrivileges($node, $type="all", $privs=0) {
. "up.usergroupid IS NOT NULL "
. "ORDER BY g.name";
$qh = doQuery($query, 352);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if(isset($privs["usergroups"][$row["id"]]))
$privs["usergroups"][$row["id"]]['privs'][$row['priv']] = 1;
else
@@ -2849,7 +2849,7 @@ function getNodeCascadePrivileges($node, $type="all", $privs=0) {
. "g.resourcetypeid = t.id AND "
. "p.type = 'block'";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if(! isset($allblockdata[$row['privnodeid']]))
$allblockdata[$row['privnodeid']] = array();
# TODO adding the id at the end will fix the bug where blocking cascaded resource
@@ -2888,7 +2888,7 @@ function getNodeCascadePrivileges($node, $type="all", $privs=0) {
. "p.privnodeid = p2.privnodeid AND "
. "p2.type = 'cascade'";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if(! isset($allcascadedata[$row['privnodeid']]))
$allcascadedata[$row['privnodeid']] = array();
$allcascadedata[$row['privnodeid']][] =
@@ -2939,7 +2939,7 @@ function getNodeCascadePrivileges($node, $type="all", $privs=0) {
. "t.name = 'block' AND "
. "u.affiliationid = a.id";
$qh = doQuery($query, 355);
- while($row = mysql_fetch_row($qh))
+ while($row = mysqli_fetch_row($qh))
$nodeuserblock[$row[0]][$row[1]] = 1;
}
static $nodeusercasade;
@@ -2967,7 +2967,7 @@ function getNodeCascadePrivileges($node, $type="all", $privs=0) {
. "up.userid = Cup.userid "
. "ORDER BY up.privnodeid, u.unityid, t.name";
$qh = doQuery($query, 356);
- while($row = mysql_fetch_row($qh))
+ while($row = mysqli_fetch_row($qh))
$nodeusercascade[$row[0]][$row[1]][$row[2]] = 1;
}
$mynodelist = $nodelist;
@@ -3005,7 +3005,7 @@ function getNodeCascadePrivileges($node, $type="all", $privs=0) {
. "up.usergroupid IS NOT NULL AND "
. "t.name = 'block'";
$qh = doQuery($query, 357);
- while($row = mysql_fetch_row($qh))
+ while($row = mysqli_fetch_row($qh))
$nodegroupblock[$row[0]][$row[1]] = 1;
}
static $nodegroupcascade;
@@ -3035,7 +3035,7 @@ function getNodeCascadePrivileges($node, $type="all", $privs=0) {
. "up.usergroupid = Cup.usergroupid "
. "ORDER BY up.privnodeid, g.id, t.name";
$qh = doQuery($query, 356);
- while($row = mysql_fetch_row($qh)) {
+ while($row = mysqli_fetch_row($qh)) {
if(! isset($nodegroupcascade[$row[0]][$row[1]])) {
$nodegroupcascade[$row[0]][$row[1]] = array('id' => $row[1],
'name' => $row[2],
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/.ht-inc/requests.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/requests.php b/web/.ht-inc/requests.php
index b163c42..ab13923 100644
--- a/web/.ht-inc/requests.php
+++ b/web/.ht-inc/requests.php
@@ -385,7 +385,7 @@ function viewRequests() {
. "WHERE v.id = {$requests[$i]['vmhostid']} AND "
. "v.computerid = c.id";
$qh = doQuery($query, 101);
- $row = mysql_fetch_assoc($qh);
+ $row = mysqli_fetch_assoc($qh);
$vmhost = $row['hostname'];
}
$text .= " <TD align=center><a id=\"req{$requests[$i]['id']}\" ";
@@ -2410,7 +2410,7 @@ function AJnewRequest() {
}
else {
$fields[] = 'name';
- $name = mysql_real_escape_string($data['name']);
+ $name = vcl_mysql_escape_string($data['name']);
$values[] = "'$name'";
}
if($data['ipaddr'] != '') {
@@ -2472,7 +2472,7 @@ function saveRequestConfigs($reqid, $imageid, $configs, $vars) {
. "ORDER BY id";
$qh = doQuery($query);
$resids = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if(! array_key_exists($row['imageid'], $resids))
$resids[$row['imageid']] = array();
$resids[$row['imageid']][] = $row['id'];
@@ -2528,7 +2528,7 @@ function saveRequestConfigs($reqid, $imageid, $configs, $vars) {
if(array_key_exists("$cfgsubimgid/$mapid", $vars)) {
$sets = array();
foreach($vars["$cfgsubimgid/$mapid"] as $varid => $varval) {
- $_val = mysql_real_escape_string($varval['value']);
+ $_val = vcl_mysql_escape_string($varval['value']);
$sets[] = "($instid, $varid, '$_val')";
}
$query = $qbase2 . implode(',', $sets);
@@ -2781,7 +2781,7 @@ function detailStatusHTML($reqid) {
. "reservationid = {$request['resid']} AND "
. "timestamp = '" . unixToDatetime($data['ts']) . "'";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
$reason = $row['additionalinfo'];
$text .= "<br>" . i("retrying at state") . " \"$reason\"";
}
@@ -2865,7 +2865,7 @@ function detailStatusHTML($reqid) {
. "ORDER BY id "
. "LIMIT 1";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
$reason = $row['additionalInfo'];
if(! empty($data))
$currtime = $row['ts'] - $data['ts'];
@@ -3732,7 +3732,7 @@ function AJsubmitEditRequest() {
return;
}
if($servername != $request['servername']) {
- $servername = mysql_real_escape_string($servername);
+ $servername = vcl_mysql_escape_string($servername);
$updateservername = 1;
}
}
@@ -4132,7 +4132,7 @@ function AJsubmitRemoveRequest() {
if($request['serverrequest']) {
$query = "SELECT id FROM serverrequest WHERE requestid = $requestid";
$qh = doQuery($query);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
$query = "DELETE FROM serverrequest WHERE requestid = $requestid";
doQuery($query, 152);
deleteVariable("fixedIPsr{$row['id']}");
@@ -4955,7 +4955,7 @@ function getReservationNextTimeout($resid) {
. "ORDER BY cll.timestamp DESC "
. "LIMIT 1";
$qh = doQuery($query);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
if(! is_numeric($row['timestamp']))
return NULL;
if($row['loadstatename'] == 'acknowledgetimeout')
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/.ht-inc/resource.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/resource.php b/web/.ht-inc/resource.php
index cecd2bb..cc55d09 100644
--- a/web/.ht-inc/resource.php
+++ b/web/.ht-inc/resource.php
@@ -574,7 +574,7 @@ class Resource {
. "FROM `{$this->restype}` "
. "WHERE id = $rscid";
$qh = doQuery($query);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
$newval = (int)(! (int)$row['deleted']);
$query = "UPDATE {$this->restype} "
. "SET deleted = $newval "
@@ -1628,7 +1628,7 @@ class Resource {
if($id)
$query .= " AND id != $id";
$qh = doQuery($query);
- if(mysql_num_rows($qh))
+ if(mysqli_num_rows($qh))
return 1;
return 0;
}
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/.ht-inc/schedule.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/schedule.php b/web/.ht-inc/schedule.php
index 57da520..d0760e8 100644
--- a/web/.ht-inc/schedule.php
+++ b/web/.ht-inc/schedule.php
@@ -188,7 +188,7 @@ class Schedule extends Resource {
. "deleted = 0";
$qh = doQuery($query);
$comps = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$comps[] = $row['hostname'];
if(count($comps))
$msg = "This schedule cannot be deleted because the following <strong>computers</strong> have it selected as their schedule:<br><br>\n" . implode("<br>\n", $comps);
@@ -445,7 +445,7 @@ class Schedule extends Resource {
if(! empty($id))
$query .= " AND id != $id";
$qh = doQuery($query, 101);
- if(mysql_num_rows($qh))
+ if(mysqli_num_rows($qh))
return 1;
return 0;
}
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/.ht-inc/serverprofiles.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/serverprofiles.php b/web/.ht-inc/serverprofiles.php
index 951789e..2de4826 100644
--- a/web/.ht-inc/serverprofiles.php
+++ b/web/.ht-inc/serverprofiles.php
@@ -523,10 +523,10 @@ function AJsaveServerProfile() {
sendJSON($data);
return;
}
- $name = mysql_real_escape_string($data['name']);
- $desc = mysql_real_escape_string($data['desc']);
- $fixedIP = mysql_real_escape_string($data['fixedIP']);
- $fixedMAC = mysql_real_escape_string($data['fixedMAC']);
+ $name = vcl_mysql_escape_string($data['name']);
+ $desc = vcl_mysql_escape_string($data['desc']);
+ $fixedIP = vcl_mysql_escape_string($data['fixedIP']);
+ $fixedMAC = vcl_mysql_escape_string($data['fixedMAC']);
$ret = array();
if($data['profileid'] == 70000) {
$query = "INSERT INTO serverprofile "
@@ -626,7 +626,7 @@ function AJdelServerProfile() {
}
$query = "DELETE FROM serverprofile WHERE id = $profileid";
doQuery($query, 101);
- $rows = mysql_affected_rows();
+ $rows = mysqli_affected_rows();
if($rows == 0) {
$data = array('error' => 1,
'msg' => 'Failed to delete selected server profile');
@@ -864,7 +864,7 @@ function getServerProfileGroups($userid, $type) {
}
$qh = doQuery($query, 101);
$groups = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$groups[$row['id']] = $row['name'];
$_SESSION['usersessiondata'][$key] = $groups;
return $groups;
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/.ht-inc/siteconfig.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/siteconfig.php b/web/.ht-inc/siteconfig.php
index 96aedda..a8f5d39 100644
--- a/web/.ht-inc/siteconfig.php
+++ b/web/.ht-inc/siteconfig.php
@@ -1292,7 +1292,7 @@ class AffilHelpAddress extends AffilTextVariable {
$this->values = array();
$query = "SELECT id, helpaddress FROM affiliation ORDER BY name";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$this->values[$row['id']] = $row['helpaddress'];
}
@@ -1310,18 +1310,18 @@ class AffilHelpAddress extends AffilTextVariable {
///
/////////////////////////////////////////////////////////////////////////////
function setValue($affilid, $value) {
- global $mysql_link_vcl;
+ global $mysqli_link_vcl;
if($value === NULL)
$newval = 'NULL';
else {
- $esc_value = mysql_real_escape_string($value);
+ $esc_value = vcl_mysql_escape_string($value);
$newval = "'$esc_value'";
}
$query = "UPDATE affiliation "
. "SET helpaddress = $newval "
. "WHERE id = $affilid";
doQuery($query);
- $rc = mysql_affected_rows($mysql_link_vcl);
+ $rc = mysqli_affected_rows($mysqli_link_vcl);
if($rc == 1)
return 1;
return 0;
@@ -1339,12 +1339,12 @@ class AffilHelpAddress extends AffilTextVariable {
///
/////////////////////////////////////////////////////////////////////////////
function deleteValue($affilid) {
- global $mysql_link_vcl;
+ global $mysqli_link_vcl;
$query = "UPDATE affiliation "
. "SET helpaddress = NULL "
. "WHERE id = $affilid";
doQuery($query);
- $rc = mysql_affected_rows($mysql_link_vcl);
+ $rc = mysqli_affected_rows($mysqli_link_vcl);
if($rc == 1)
return 1;
return 0;
@@ -1391,7 +1391,7 @@ class AffilWebAddress extends AffilTextVariable {
$this->values = array();
$query = "SELECT id, sitewwwaddress FROM affiliation ORDER BY name";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$this->values[$row['id']] = $row['sitewwwaddress'];
}
@@ -1409,18 +1409,18 @@ class AffilWebAddress extends AffilTextVariable {
///
/////////////////////////////////////////////////////////////////////////////
function setValue($affilid, $value) {
- global $mysql_link_vcl;
+ global $mysqli_link_vcl;
if($value === NULL)
$newval = 'NULL';
else {
- $esc_value = mysql_real_escape_string($value);
+ $esc_value = vcl_mysql_escape_string($value);
$newval = "'$esc_value'";
}
$query = "UPDATE affiliation "
. "SET sitewwwaddress = $newval "
. "WHERE id = $affilid";
doQuery($query);
- $rc = mysql_affected_rows($mysql_link_vcl);
+ $rc = mysqli_affected_rows($mysqli_link_vcl);
if($rc == 1)
return 1;
return 0;
@@ -1438,12 +1438,12 @@ class AffilWebAddress extends AffilTextVariable {
///
/////////////////////////////////////////////////////////////////////////////
function deleteValue($affilid) {
- global $mysql_link_vcl;
+ global $mysqli_link_vcl;
$query = "UPDATE affiliation "
. "SET sitewwwaddress = NULL "
. "WHERE id = $affilid";
doQuery($query);
- $rc = mysql_affected_rows($mysql_link_vcl);
+ $rc = mysqli_affected_rows($mysqli_link_vcl);
if($rc == 1)
return 1;
return 0;
@@ -1498,7 +1498,7 @@ class AffilKMSserver extends AffilTextVariable {
. "LEFT JOIN winKMS k ON (k.affiliationid = a.id) "
. "ORDER BY a.id";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if(is_null($row['address']) && is_null($row['port'])) {
$this->values[$row['id']] = NULL;
continue;
@@ -1529,7 +1529,7 @@ class AffilKMSserver extends AffilTextVariable {
///
/////////////////////////////////////////////////////////////////////////////
function setValue($affilid, $value) {
- global $mysql_link_vcl;
+ global $mysqli_link_vcl;
$this->getValues();
$values = explode(',', $value);
# create datastructure of newly submitted hosts
@@ -1588,7 +1588,7 @@ class AffilKMSserver extends AffilTextVariable {
# insert new hosts
$values = array();
foreach($adds as $host => $port) {
- $esc_host = mysql_real_escape_string($host);
+ $esc_host = vcl_mysql_escape_string($host);
$values[] = "($affilid, '$esc_host', $port)";
}
$rc1 = 1;
@@ -1597,25 +1597,25 @@ class AffilKMSserver extends AffilTextVariable {
. "(affiliationid, address, port) "
. "VALUES " . implode(',', $values);
doQuery($query);
- $rc1 = mysql_affected_rows($mysql_link_vcl);
+ $rc1 = mysqli_affected_rows($mysqli_link_vcl);
}
# make changes
$rc2 = 1;
foreach($changes as $host => $port) {
- $esc_host = mysql_real_escape_string($host);
+ $esc_host = vcl_mysql_escape_string($host);
$query = "UPDATE winKMS "
. "SET port = $port "
. "WHERE address = '$esc_host' AND "
. "affiliationid = $affilid";
doQuery($query);
- $tmp = mysql_affected_rows($mysql_link_vcl);
+ $tmp = mysqli_affected_rows($mysqli_link_vcl);
if($rc2)
$rc2 = $tmp;
}
# delete old hosts
$values = array();
foreach($rems as $host => $port) {
- $esc_host = mysql_real_escape_string($host);
+ $esc_host = vcl_mysql_escape_string($host);
$values[] = "(affiliationid = $affilid AND "
. "address = '$esc_host' AND "
. "port = $port)";
@@ -1625,7 +1625,7 @@ class AffilKMSserver extends AffilTextVariable {
$query = "DELETE FROM winKMS "
. "WHERE " . implode(' OR ', $values);
doQuery($query);
- $rc3 = mysql_affected_rows($mysql_link_vcl);
+ $rc3 = mysqli_affected_rows($mysqli_link_vcl);
}
if($rc1 == 0 || $rc2 == 0 || $rc3 == 0)
return 0;
@@ -1644,11 +1644,11 @@ class AffilKMSserver extends AffilTextVariable {
///
/////////////////////////////////////////////////////////////////////////////
function deleteValue($affilid) {
- global $mysql_link_vcl;
+ global $mysqli_link_vcl;
$query = "DELETE FROM winKMS "
. "WHERE affiliationid = $affilid";
doQuery($query);
- $rc = mysql_affected_rows($mysql_link_vcl);
+ $rc = mysqli_affected_rows($mysqli_link_vcl);
if($rc == 1)
return 1;
return 0;
@@ -1715,7 +1715,7 @@ class AffilTheme extends AffilTextVariable {
$this->values = array();
$query = "SELECT id, theme FROM affiliation ORDER BY name";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$this->values[$row['id']] = $row['theme'];
}
@@ -1733,13 +1733,13 @@ class AffilTheme extends AffilTextVariable {
///
/////////////////////////////////////////////////////////////////////////////
function setValue($affilid, $value) {
- global $mysql_link_vcl;
- $esc_value = mysql_real_escape_string($value);
+ global $mysqli_link_vcl;
+ $esc_value = vcl_mysql_escape_string($value);
$query = "UPDATE affiliation "
. "SET theme = '$esc_value' "
. "WHERE id = $affilid";
doQuery($query);
- $rc = mysql_affected_rows($mysql_link_vcl);
+ $rc = mysqli_affected_rows($mysqli_link_vcl);
if($rc == 1)
return 1;
return 0;
@@ -1757,12 +1757,12 @@ class AffilTheme extends AffilTextVariable {
///
/////////////////////////////////////////////////////////////////////////////
function deleteValue($affilid) {
- global $mysql_link_vcl;
+ global $mysqli_link_vcl;
$query = "UPDATE affiliation "
. "SET theme = NULL "
. "WHERE id = $affilid";
doQuery($query);
- $rc = mysql_affected_rows($mysql_link_vcl);
+ $rc = mysqli_affected_rows($mysqli_link_vcl);
if($rc == 1)
return 1;
return 0;
@@ -1834,7 +1834,7 @@ class AffilShibOnly extends AffilTextVariable {
. "WHERE name NOT IN ('Global', 'Local') "
. "ORDER BY name";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$this->values[$row['id']] = (int)(! $row['shibonly']);
}
@@ -1852,13 +1852,13 @@ class AffilShibOnly extends AffilTextVariable {
///
/////////////////////////////////////////////////////////////////////////////
function setValue($affilid, $value) {
- global $mysql_link_vcl;
+ global $mysqli_link_vcl;
$value = (int)(! $value);
$query = "UPDATE affiliation "
. "SET shibonly = $value "
. "WHERE id = $affilid";
doQuery($query);
- $rc = mysql_affected_rows($mysql_link_vcl);
+ $rc = mysqli_affected_rows($mysqli_link_vcl);
if($rc == 1)
return 1;
return 0;
@@ -1944,7 +1944,7 @@ class AffilShibName extends AffilTextVariable {
. "WHERE name NOT IN ('Global', 'Local') "
. "ORDER BY name";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$this->values[$row['id']] = $row['shibname'];
}
@@ -1962,18 +1962,18 @@ class AffilShibName extends AffilTextVariable {
///
/////////////////////////////////////////////////////////////////////////////
function setValue($affilid, $value) {
- global $mysql_link_vcl;
+ global $mysqli_link_vcl;
if($value === NULL)
$newval = 'NULL';
else {
- $esc_value = mysql_real_escape_string($value);
+ $esc_value = vcl_mysql_escape_string($value);
$newval = "'$esc_value'";
}
$query = "UPDATE affiliation "
. "SET shibname = $newval "
. "WHERE id = $affilid";
doQuery($query);
- $rc = mysql_affected_rows($mysql_link_vcl);
+ $rc = mysqli_affected_rows($mysqli_link_vcl);
if($rc == 1)
return 1;
return 0;
@@ -1991,12 +1991,12 @@ class AffilShibName extends AffilTextVariable {
///
/////////////////////////////////////////////////////////////////////////////
function deleteValue($affilid) {
- global $mysql_link_vcl;
+ global $mysqli_link_vcl;
$query = "UPDATE affiliation "
. "SET shibname = NULL "
. "WHERE id = $affilid";
doQuery($query);
- $rc = mysql_affected_rows($mysql_link_vcl);
+ $rc = mysqli_affected_rows($mysqli_link_vcl);
if($rc == 1)
return 1;
return 0;
@@ -2973,7 +2973,7 @@ class Affiliations extends GlobalMultiVariable {
sendJSON($arr);
return;
}
- $_newval = mysql_real_escape_string($newval);
+ $_newval = vcl_mysql_escape_string($newval);
$query = "INSERT INTO affiliation (name) VALUES ('$_newval')";
doQuery($query);
$arr = array('status' => 'success',
@@ -2998,7 +2998,7 @@ class Affiliations extends GlobalMultiVariable {
foreach($tables as $table) {
$query = "SELECT affiliationid FROM $table WHERE affiliationid = $key LIMIT 1";
$qh = doQuery($query);
- if(mysql_num_rows($qh)) {
+ if(mysqli_num_rows($qh)) {
$used = 1;
break;
}
@@ -3052,7 +3052,7 @@ class Affiliations extends GlobalMultiVariable {
function updateValue($key, $val) {
$tmp = explode('|', $key);
$key = $tmp[1];
- $_val = mysql_real_escape_string($val);
+ $_val = vcl_mysql_escape_string($val);
$query = "UPDATE affiliation SET name = '$_val' WHERE id = $key";
doQuery($query);
}
@@ -3395,7 +3395,7 @@ class Messages {
. "value LIKE '%invalidfields%'";
$qh = doQuery($query);
$invalids = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$data = Spyc::YAMLLoad($row['value']);
if(array_key_exists('invalidfields', $data)) {
$invalids[$row['name']] = $data['invalidfields'];
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/.ht-inc/sitemaintenance.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/sitemaintenance.php b/web/.ht-inc/sitemaintenance.php
index 6dad773..fe833dc 100644
--- a/web/.ht-inc/sitemaintenance.php
+++ b/web/.ht-inc/sitemaintenance.php
@@ -279,8 +279,8 @@ function AJcreateSiteMaintenance() {
return;
}
- $reason = mysql_real_escape_string($data['reason']);
- $usermessage = mysql_real_escape_string($data['usermessage']);
+ $reason = vcl_mysql_escape_string($data['reason']);
+ $usermessage = vcl_mysql_escape_string($data['usermessage']);
$query = "INSERT INTO sitemaintenance "
. "(start, "
. "end, "
@@ -413,8 +413,8 @@ function AJeditSiteMaintenance() {
return;
}
- $reason = mysql_real_escape_string($data['reason']);
- $usermessage = mysql_real_escape_string($data['usermessage']);
+ $reason = vcl_mysql_escape_string($data['reason']);
+ $usermessage = vcl_mysql_escape_string($data['usermessage']);
$query = "UPDATE sitemaintenance "
. "SET start = '{$data['startdt']}', "
. "end = '{$data['enddt']}', "
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/.ht-inc/statistics.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/statistics.php b/web/.ht-inc/statistics.php
index ca81b8b..4127fe1 100644
--- a/web/.ht-inc/statistics.php
+++ b/web/.ht-inc/statistics.php
@@ -110,7 +110,7 @@ function selectStatistics() {
. "ORDER BY prettyname";
$qh = doQuery($query);
$provs = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$provs[$row['id']] = $row['prettyname'];
$cdata = array('mode' => 'provisioning',
'provs' => $provs);
@@ -292,7 +292,7 @@ function viewStatistics() {
"10hrsplus" => 0);
$totalhours = 0;
$osusers = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if(! array_key_exists($row["prettyname"], $imageload2less))
$imageload2less[$row["prettyname"]] = 0;
if(! array_key_exists($row["prettyname"], $imageload2to6))
@@ -685,7 +685,7 @@ function getStatGraphDayData($start, $end, $affilid, $mode, $provid) {
. "statdate <= '$end' AND "
. "provisioningid = $provid";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$cachepts[$row['statdate']] = $row['value'];
for($i = $startunix; $i < $endunix; $i += SECINDAY) {
$cnt++;
@@ -735,7 +735,7 @@ function getStatGraphDayData($start, $end, $affilid, $mode, $provid) {
}
}
$qh = doQuery($query, 295);
- if($row = mysql_fetch_row($qh))
+ if($row = mysqli_fetch_row($qh))
$value = $row[0];
else
$value = 0;
@@ -843,7 +843,7 @@ function getStatGraphHourData($start, $end, $affilid, $mode, $provid) {
}
}
$qh = doQuery($query, 296);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$startmin = ($row['shour'] * 60) + $row['smin'];
$endmin = ($row['ehour'] * 60) + $row['emin'];
@@ -951,7 +951,7 @@ function getStatGraphDayConUsersData($start, $end, $affilid, $mode, $provid) {
. "statdate <= '$end' AND "
. "provisioningid = $provid";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$cachepts[$row['statdate']] = $row['value'];
if((count($cachepts) + 31) < $daycnt) {
$data = array('nodata' => i('(too much computational time required to generate this graph)'));
@@ -1008,7 +1008,7 @@ function getStatGraphDayConUsersData($start, $end, $affilid, $mode, $provid) {
}
}
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$unixstart = $row["start"];
$unixend = $row["end"];
for($binstart = $daystart, $binend = $daystart + 3600, $binindex = 0;
@@ -1095,7 +1095,7 @@ function getStatGraphConBladeUserData($start, $end, $affilid, $mode, $provid) {
. "statdate <= '$end' AND "
. "provisioningid = $provid";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$cachepts[$row['statdate']] = $row['value'];
if((count($cachepts) + 31) < $daycnt) {
$data = array('nodata' => i('(too much computational time required to generate this graph)'));
@@ -1180,7 +1180,7 @@ function getStatGraphConBladeUserData($start, $end, $affilid, $mode, $provid) {
}
$qh = doQuery($query, 101);
$comps = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$unixstart = datetimeToUnix($row["start"]);
$unixend = datetimeToUnix($row["end"]);
for($binstart = $daystart, $binend = $daystart + 3600, $binindex = 0;
@@ -1273,7 +1273,7 @@ function getStatGraphConVMUserData($start, $end, $affilid, $mode, $provid) {
. "statdate <= '$end' AND "
. "provisioningid = $provid";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$cachepts[$row['statdate']] = $row['value'];
if((count($cachepts) + 31) < $daycnt) {
$data = array('nodata' => i('(too much computational time required to generate this graph)'));
@@ -1348,7 +1348,7 @@ function getStatGraphConVMUserData($start, $end, $affilid, $mode, $provid) {
}
}
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$unixstart = datetimeToUnix($row["start"]);
$unixend = datetimeToUnix($row["end"]);
for($binstart = $daystart, $binend = $daystart + 3600, $binindex = 0;
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/.ht-inc/userpreferences.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/userpreferences.php b/web/.ht-inc/userpreferences.php
index 3838c99..fcdc6f7 100644
--- a/web/.ht-inc/userpreferences.php
+++ b/web/.ht-inc/userpreferences.php
@@ -490,7 +490,7 @@ function submitUserPrefs() {
. "WHERE u.id = '{$user['id']}' AND "
. "l.userid = u.id";
$qh = doQuery($query, 101);
- if(! ($row = mysql_fetch_assoc($qh)))
+ if(! ($row = mysqli_fetch_assoc($qh)))
abort();
$passhash = sha1("{$data['newpassword']}{$row['salt']}");
$query = "UPDATE localauth "
@@ -564,7 +564,7 @@ function submitGeneralPreferences() {
if($pubkeyauth == 2 && preg_match('|^[-a-zA-Z0-9\+/ @=\.\n\r]*$|', $pubkeys)) {
if(get_magic_quotes_gpc())
$pubkeys = stripslashes($pubkeys);
- $_pubkeys = mysql_real_escape_string($pubkeys);
+ $_pubkeys = vcl_mysql_escape_string($pubkeys);
$query = "UPDATE user SET sshpublickeys = '$_pubkeys' WHERE id = {$user['id']}";
doQuery($query);
$_SESSION['user']['sshpublickeys'] = htmlspecialchars($pubkeys);
[4/5] vcl git commit: VCL-1106 - make PHP code compatible with PHP 7
Posted by jf...@apache.org.
VCL-1106 - make PHP code compatible with PHP 7
making changes that allow code to run under PHP7 - vast majority of
changes are related to switching from mysql_* functions to mysqli_*
functions
files modified:
addomain.php authentication.php authmethods/itecsauth.php authmethods/ldapauth.php authmethods/shibauth.php blockallocations.php computer.php config.php dashboard.php groups.php help.php image.php managementnode.php oneclick.php privileges.php requests.php resource.php schedule.php serverprofiles.php siteconfig.php sitemaintenance.php statistics.php userpreferences.php utils.php vm.php xmlrpcWrappers.php index.php shibauth/index.php
additional changes in utils.php:
-modified mysql_connect_plus: accept a database argument because the database is passed to mysqli_connect
-modified dbConnect: removed calls to mysql_select_db and added database argument to calls to mysql_connect_plus
-added vcl_mysql_escape_string: mysqli_real_escape_string requires the database handle to be passed; having a wrapper function prevents having to reference the database handle global variable in every function needing to escape database data
-modified datetimeToUnix: removed '-1' argument to mktime as it is removed in php7
-modified unixFlor15: removed '-1' argument to mktime as it is removed in php7
Project: http://git-wip-us.apache.org/repos/asf/vcl/repo
Commit: http://git-wip-us.apache.org/repos/asf/vcl/commit/e5058500
Tree: http://git-wip-us.apache.org/repos/asf/vcl/tree/e5058500
Diff: http://git-wip-us.apache.org/repos/asf/vcl/diff/e5058500
Branch: refs/heads/develop
Commit: e50585005773d6e33a9f475e5843633ae95f221f
Parents: 4e9e37c
Author: Josh Thompson <jf...@ncsu.edu>
Authored: Mon Oct 29 15:43:26 2018 -0400
Committer: Josh Thompson <jf...@ncsu.edu>
Committed: Mon Oct 29 15:43:26 2018 -0400
----------------------------------------------------------------------
web/.ht-inc/addomain.php | 6 +-
web/.ht-inc/authentication.php | 22 +-
web/.ht-inc/authmethods/itecsauth.php | 36 +-
web/.ht-inc/authmethods/ldapauth.php | 32 +-
web/.ht-inc/authmethods/shibauth.php | 36 +-
web/.ht-inc/blockallocations.php | 106 +++---
web/.ht-inc/computer.php | 72 ++--
web/.ht-inc/config.php | 44 +--
web/.ht-inc/dashboard.php | 32 +-
web/.ht-inc/groups.php | 28 +-
web/.ht-inc/help.php | 2 +-
web/.ht-inc/image.php | 78 ++---
web/.ht-inc/managementnode.php | 18 +-
web/.ht-inc/oneclick.php | 4 +-
web/.ht-inc/privileges.php | 72 ++--
web/.ht-inc/requests.php | 18 +-
web/.ht-inc/resource.php | 4 +-
web/.ht-inc/schedule.php | 4 +-
web/.ht-inc/serverprofiles.php | 12 +-
web/.ht-inc/siteconfig.php | 82 ++---
web/.ht-inc/sitemaintenance.php | 8 +-
web/.ht-inc/statistics.php | 22 +-
web/.ht-inc/userpreferences.php | 4 +-
web/.ht-inc/utils.php | 537 +++++++++++++++--------------
web/.ht-inc/vm.php | 26 +-
web/.ht-inc/xmlrpcWrappers.php | 78 ++---
web/index.php | 4 +-
web/shibauth/index.php | 16 +-
28 files changed, 708 insertions(+), 695 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/.ht-inc/addomain.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/addomain.php b/web/.ht-inc/addomain.php
index e75639d..a7259d5 100644
--- a/web/.ht-inc/addomain.php
+++ b/web/.ht-inc/addomain.php
@@ -204,7 +204,7 @@ class ADdomain extends Resource {
. "WHERE cryptkeyid = $cryptkeyid AND "
. "secretid = $oldsecretid";
$qh = doQuery($query);
- if(! ($row = mysql_fetch_assoc($qh))) {
+ if(! ($row = mysqli_fetch_assoc($qh))) {
# generate a new secret
$newsecretid = getSecretKeyID('addomain', 'secretid', 0);
$delids = array($oldsecretid);
@@ -221,7 +221,7 @@ class ADdomain extends Resource {
. "WHERE cs.secretid = $oldsecretid AND "
. "ck.hosttype = 'managementnode'";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$secretidset[$row['mnid']][$newsecretid] = 1;
$values = getMNcryptkeyUpdates($secretidset, $cryptkeyid);
addCryptSecretKeyUpdates($values);
@@ -586,7 +586,7 @@ class ADdomain extends Resource {
. "ia.imageid = i.id";
$qh = doQuery($query);
$images = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$images[] = $row['prettyname'];
if(count($images))
$msg = "This AD Domain cannot be deleted because the following <strong>images</strong> are using it:<br><br>\n" . implode("<br>\n", $images);
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/.ht-inc/authentication.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/authentication.php b/web/.ht-inc/authentication.php
index 5c933aa..7a93cc0 100644
--- a/web/.ht-inc/authentication.php
+++ b/web/.ht-inc/authentication.php
@@ -91,7 +91,7 @@ function readAuthCookie() {
# check to see if shibauth entry still exists for $shibauthed
$query = "SELECT ts FROM shibauth WHERE id = $shibauthed";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
$shibstart = $row['ts'];
# TODO if $shibstart is too old, expire the login session
}
@@ -363,7 +363,7 @@ function submitLogin() {
////////////////////////////////////////////////////////////////////////////////
function ldapLogin($authtype, $userid, $passwd) {
global $HTMLheader, $printedHTMLheader, $authMechs, $phpVer;
- $esc_userid = mysql_real_escape_string($userid);
+ $esc_userid = vcl_mysql_escape_string($userid);
if(! $fh = fsockopen($authMechs[$authtype]['server'], 636, $errno, $errstr, 5)) {
printLoginPageWithSkin($authtype, 1);
return;
@@ -435,7 +435,7 @@ function ldapLogin($authtype, $userid, $passwd) {
. "WHERE unityid = '$esc_userid' AND "
. "affiliationid = {$authMechs[$authtype]['affiliationid']}";
$qh = doQuery($query, 101);
- if(! mysql_num_rows($qh)) {
+ if(! mysqli_num_rows($qh)) {
// if not, add user
$newid = updateLDAPUser($authtype, $userid);
if(is_null($newid))
@@ -514,7 +514,7 @@ function localLogin($userid, $passwd, $authtype) {
///
////////////////////////////////////////////////////////////////////////////////
function validateLocalAccount($user, $pass) {
- $user = mysql_real_escape_string($user);
+ $user = vcl_mysql_escape_string($user);
$query = "SELECT l.salt "
. "FROM localauth l, "
. "user u, "
@@ -524,8 +524,8 @@ function validateLocalAccount($user, $pass) {
. "a.name = 'Local' AND "
. "l.userid = u.id";
$qh = doQuery($query, 101);
- if(mysql_num_rows($qh) != 1 ||
- (! ($row = mysql_fetch_assoc($qh))))
+ if(mysqli_num_rows($qh) != 1 ||
+ (! ($row = mysqli_fetch_assoc($qh))))
return 0;
$passhash = sha1("$pass{$row['salt']}");
@@ -539,7 +539,7 @@ function validateLocalAccount($user, $pass) {
. "u.affiliationid = a.id AND "
. "a.name = 'Local'";
$qh = doQuery($query, 101);
- if(mysql_num_rows($qh) == 1)
+ if(mysqli_num_rows($qh) == 1)
return 1;
else
return 0;
@@ -559,8 +559,8 @@ function validateLocalAccount($user, $pass) {
///
////////////////////////////////////////////////////////////////////////////////
function addLoginLog($login, $mech, $affiliationid, $passfail, $code='none') {
- $login = mysql_real_escape_string($login);
- $mech = mysql_real_escape_string($mech);
+ $login = vcl_mysql_escape_string($login);
+ $mech = vcl_mysql_escape_string($mech);
$query = "INSERT INTO loginlog "
. "(user, "
. "authmech, "
@@ -613,8 +613,8 @@ function checkExpiredDemoUser($userid, $groups=0) {
. "LIMIT 3";
$qh = doQuery($query, 101);
$expire = time() - (SECINDAY * 3);
- $rows = mysql_num_rows($qh);
- if($row = mysql_fetch_assoc($qh)) {
+ $rows = mysqli_num_rows($qh);
+ if($row = mysqli_fetch_assoc($qh)) {
if($rows >= 3 || datetimeToUnix($row['start']) < $expire) {
if(in_array($mode, $noHTMLwrappers))
# do a redirect and handle removal on next page load so user can
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/.ht-inc/authmethods/itecsauth.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/authmethods/itecsauth.php b/web/.ht-inc/authmethods/itecsauth.php
index ccdb9a4..be9b537 100644
--- a/web/.ht-inc/authmethods/itecsauth.php
+++ b/web/.ht-inc/authmethods/itecsauth.php
@@ -35,10 +35,10 @@
///
////////////////////////////////////////////////////////////////////////////////
function addITECSUser($loginid) {
- global $mysql_link_vcl, $ENABLE_ITECSAUTH;
+ global $mysqli_link_vcl, $ENABLE_ITECSAUTH;
if(! $ENABLE_ITECSAUTH)
return NULL;
- $esc_loginid = mysql_real_escape_string($loginid);
+ $esc_loginid = vcl_mysql_escape_string($loginid);
$query = "SELECT id AS uid, "
. "first, "
. "last, "
@@ -49,13 +49,13 @@ function addITECSUser($loginid) {
. "FROM user "
. "WHERE email = '$esc_loginid'";
$qh = doQuery($query, 101, "accounts");
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
// FIXME test replacing ''s
// FIXME do we care if the account is active?
- $first = mysql_real_escape_string($row['first']);
- $last = mysql_real_escape_string($row['last']);
- $loweruser = mysql_real_escape_string(strtolower($row['email']));
- $email = mysql_real_escape_string($row['email']);
+ $first = vcl_mysql_escape_string($row['first']);
+ $last = vcl_mysql_escape_string($row['last']);
+ $loweruser = vcl_mysql_escape_string(strtolower($row['email']));
+ $email = vcl_mysql_escape_string($row['email']);
$query = "INSERT INTO user ("
. "uid, "
. "unityid, "
@@ -79,9 +79,9 @@ function addITECSUser($loginid) {
// FIXME might want this logged
doQuery($query, 101, 'vcl', 1);
}
- if(mysql_affected_rows($mysql_link_vcl)) {
+ if(mysqli_affected_rows($mysqli_link_vcl)) {
$qh = doQuery("SELECT LAST_INSERT_ID() FROM user", 101);
- if(! $row = mysql_fetch_row($qh)) {
+ if(! $row = mysqli_fetch_row($qh)) {
abort(101);
}
return $row[0];
@@ -104,14 +104,14 @@ function validateITECSUser($loginid) {
global $ENABLE_ITECSAUTH;
if(! $ENABLE_ITECSAUTH)
return 0;
- $loginid = mysql_real_escape_string($loginid);
+ $loginid = vcl_mysql_escape_string($loginid);
$query = "SELECT email "
. "FROM user "
. "WHERE email = '$loginid' AND "
. "(active = 1 OR "
. "activated = 0)";
$qh = doQuery($query, 101, "accounts");
- if(mysql_num_rows($qh))
+ if(mysqli_num_rows($qh))
return 1;
return 0;
}
@@ -160,7 +160,7 @@ function updateITECSUser($userid) {
. "FROM user "
. "WHERE email = '$userid'";
$qh = doQuery($query, 101, "accounts");
- if(! ($userData = mysql_fetch_assoc($qh)))
+ if(! ($userData = mysqli_fetch_assoc($qh)))
return NULL;
$now = unixToDatetime(time());
@@ -191,11 +191,11 @@ function updateITECSUser($userid) {
// if get a row
// update db
// update results from select
- $esc_userid = mysql_real_escape_string($userid);
- $first = mysql_real_escape_string($userData['first']);
- $last = mysql_real_escape_string($userData['last']);
- $email = mysql_real_escape_string($userData['email']);
- if($user = mysql_fetch_assoc($qh)) {
+ $esc_userid = vcl_mysql_escape_string($userid);
+ $first = vcl_mysql_escape_string($userData['first']);
+ $last = vcl_mysql_escape_string($userData['last']);
+ $email = vcl_mysql_escape_string($userData['email']);
+ if($user = mysqli_fetch_assoc($qh)) {
$user["unityid"] = $userid;
$user["firstname"] = $userData['first'];
$user["lastname"] = $userData["last"];
@@ -240,7 +240,7 @@ function updateITECSUser($userid) {
. "WHERE u.affiliationid = af.id AND "
. "u.id = $id";
$qh = doQuery($query, 101);
- $user = mysql_fetch_assoc($qh);
+ $user = mysqli_fetch_assoc($qh);
# add account to demo group
#$demoid = getUserGroupID('demo', getAffiliationID('ITECS'));
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/.ht-inc/authmethods/ldapauth.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/authmethods/ldapauth.php b/web/.ht-inc/authmethods/ldapauth.php
index cf415c3..8aa53c6 100644
--- a/web/.ht-inc/authmethods/ldapauth.php
+++ b/web/.ht-inc/authmethods/ldapauth.php
@@ -34,13 +34,13 @@
///
////////////////////////////////////////////////////////////////////////////////
function addLDAPUser($authtype, $userid) {
- global $authMechs, $mysql_link_vcl;
+ global $authMechs, $mysqli_link_vcl;
$data = getLDAPUserData($authtype, $userid);
if(is_null($data))
return NULL;
$loweruserid = strtolower($userid);
- $loweruserid = mysql_real_escape_string($loweruserid);
+ $loweruserid = vcl_mysql_escape_string($loweruserid);
# check for existance of an expired user if a numericid exists
if(array_key_exists('numericid', $data)) {
@@ -53,7 +53,7 @@ function addLDAPUser($authtype, $userid) {
. "unityid != '$loweruserid'";
#. "affiliationid = {$authMechs[$authtype]['affiliationid']}";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
# find the authtype for this user
foreach($authMechs as $index => $auth) {
if($auth['affiliationid'] == $row['affiliationid'] &&
@@ -95,9 +95,9 @@ function addLDAPUser($authtype, $userid) {
. "'{$data['emailnotices']}', "
. "NOW())";
doQuery($query, 101, 'vcl', 1);
- if(mysql_affected_rows($mysql_link_vcl)) {
+ if(mysqli_affected_rows($mysqli_link_vcl)) {
$qh = doQuery("SELECT LAST_INSERT_ID() FROM user", 101);
- if(! $row = mysql_fetch_row($qh)) {
+ if(! $row = mysqli_fetch_row($qh)) {
abort(101);
}
return $row[0];
@@ -171,7 +171,7 @@ function validateLDAPUser($type, $loginid) {
////////////////////////////////////////////////////////////////////////////////
function updateLDAPUser($authtype, $userid) {
global $authMechs;
- $esc_userid = mysql_real_escape_string($userid);
+ $esc_userid = vcl_mysql_escape_string($userid);
$userData = getLDAPUserData($authtype, $userid);
if(is_null($userData))
return NULL;
@@ -213,7 +213,7 @@ function updateLDAPUser($authtype, $userid) {
# check to see if there is a matching entry where uid is NULL but unityid and affiliationid match
if(array_key_exists('numericid', $userData) &&
is_numeric($userData['numericid']) &&
- ! mysql_num_rows($qh)) {
+ ! mysqli_num_rows($qh)) {
$updateuid = 1;
$query = $qbase . "u.unityid = '$esc_userid' AND "
. "u.affiliationid = $affilid";
@@ -222,7 +222,7 @@ function updateLDAPUser($authtype, $userid) {
// if get a row
// update db
// update results from select
- if($user = mysql_fetch_assoc($qh)) {
+ if($user = mysqli_fetch_assoc($qh)) {
$user["unityid"] = $userid;
$user["firstname"] = $userData['first'];
$user["lastname"] = $userData["last"];
@@ -277,7 +277,7 @@ function updateLDAPUser($authtype, $userid) {
. "WHERE u.affiliationid = af.id AND "
. "u.id = $id";
$qh = doQuery($query, 101);
- if(! $user = mysql_fetch_assoc($qh))
+ if(! $user = mysqli_fetch_assoc($qh))
return NULL;
$user['sshpublickeys'] = htmlspecialchars($user['sshpublickeys']);
}
@@ -305,9 +305,9 @@ function updateLDAPUser($authtype, $userid) {
/// \param $userid - a userid without the affiliation part
///
/// \return an array of user information with the following keys:\n
-/// \b first - first name of user (escaped with mysql_real_escape_string)\n
-/// \b last - last name of user (escaped with mysql_real_escape_string)\n
-/// \b email - email address of user (escaped with mysql_real_escape_string)\n
+/// \b first - first name of user (escaped with vcl_mysql_escape_string)\n
+/// \b last - last name of user (escaped with vcl_mysql_escape_string)\n
+/// \b email - email address of user (escaped with vcl_mysql_escape_string)\n
/// \b emailnotices - 0 or 1, whether or not emails should be sent to user\n
/// \b numericid - numeric id of user if $authtype is configured to include it
///
@@ -315,7 +315,7 @@ function updateLDAPUser($authtype, $userid) {
///
////////////////////////////////////////////////////////////////////////////////
function getLDAPUserData($authtype, $userid) {
- global $authMechs, $mysql_link_vcl;
+ global $authMechs, $mysqli_link_vcl;
$auth = $authMechs[$authtype];
$donumericid = 0;
if(array_key_exists('numericid', $auth))
@@ -392,16 +392,16 @@ function getLDAPUserData($authtype, $userid) {
}
if(array_key_exists(strtolower($auth['firstname']), $data))
- $return['first'] = mysql_real_escape_string($data[strtolower($auth['firstname'])]);
+ $return['first'] = vcl_mysql_escape_string($data[strtolower($auth['firstname'])]);
else
$return['first'] = '';
if(array_key_exists(strtolower($auth['lastname']), $data))
- $return['last'] = mysql_real_escape_string($data[strtolower($auth['lastname'])]);
+ $return['last'] = vcl_mysql_escape_string($data[strtolower($auth['lastname'])]);
else
$return['last'] = '';
if($donumericid && is_numeric($data[strtolower($auth['numericid'])]))
$return['numericid'] = $data[strtolower($auth['numericid'])];
- $return['email'] = mysql_real_escape_string($data[strtolower($auth['email'])]);
+ $return['email'] = vcl_mysql_escape_string($data[strtolower($auth['email'])]);
return $return;
}
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/.ht-inc/authmethods/shibauth.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/authmethods/shibauth.php b/web/.ht-inc/authmethods/shibauth.php
index c814925..33d7b5d 100644
--- a/web/.ht-inc/authmethods/shibauth.php
+++ b/web/.ht-inc/authmethods/shibauth.php
@@ -39,7 +39,7 @@
///
////////////////////////////////////////////////////////////////////////////////
function updateShibUser($userid) {
- global $mysql_link_vcl;
+ global $mysqli_link_vcl;
$rc = getAffilidAndLogin($userid, $affilid);
if($rc == -1)
return NULL;
@@ -83,7 +83,7 @@ function updateShibUser($userid) {
. "WHERE unityid = '$userid' AND "
. "affiliationid = $affilid";
$qh = doQuery($query, 101);
- if(! $row = mysql_fetch_assoc($qh)) {
+ if(! $row = mysqli_fetch_assoc($qh)) {
# add user to our db
$user['id'] = addShibUser($user);
return $user;
@@ -91,13 +91,13 @@ function updateShibUser($userid) {
# update user's data in db
$user['id'] = $row['id'];
- $first = mysql_real_escape_string($user['firstname']);
- $last = mysql_real_escape_string($user['lastname']);
+ $first = vcl_mysql_escape_string($user['firstname']);
+ $last = vcl_mysql_escape_string($user['lastname']);
$query = "UPDATE user "
. "SET firstname = '$first', "
. "lastname = '$last', ";
if(array_key_exists('email', $user)) {
- $email = mysql_real_escape_string($user['email']);
+ $email = vcl_mysql_escape_string($user['email']);
$query .= "email = '$email', ";
}
$query .= "lastupdated = NOW(), "
@@ -124,10 +124,10 @@ function updateShibUser($userid) {
///
////////////////////////////////////////////////////////////////////////////////
function addShibUser($user) {
- global $mysql_link_vcl;
- $unityid = mysql_real_escape_string($user['unityid']);
- $first = mysql_real_escape_string($user['firstname']);
- $last = mysql_real_escape_string($user['lastname']);
+ global $mysqli_link_vcl;
+ $unityid = vcl_mysql_escape_string($user['unityid']);
+ $first = vcl_mysql_escape_string($user['firstname']);
+ $last = vcl_mysql_escape_string($user['lastname']);
$query = "INSERT INTO user "
. "(unityid, "
. "affiliationid, "
@@ -143,14 +143,14 @@ function addShibUser($user) {
. "'$first', "
. "'$last', ";
if(array_key_exists('email', $user)) {
- $email = mysql_real_escape_string($user['email']);
+ $email = vcl_mysql_escape_string($user['email']);
$query .= "'$email', ";
}
$query .= "0, "
. "NOW())";
doQuery($query, 101, 'vcl', 1);
- if(mysql_affected_rows($mysql_link_vcl)) {
- $user['id'] = mysql_insert_id($mysql_link_vcl);
+ if(mysqli_affected_rows($mysqli_link_vcl)) {
+ $user['id'] = mysqli_insert_id($mysqli_link_vcl);
return $user['id'];
}
else
@@ -188,18 +188,18 @@ function updateShibGroups($usernid, $groups) {
# get id for the group's affiliation
$query = "SELECT id FROM affiliation WHERE shibname = '$shibaffil'";
$qh = doQuery($query, 101);
- $row = mysql_fetch_assoc($qh);
+ $row = mysqli_fetch_assoc($qh);
$affilid = $row['id'];
# prepend shib- and escape it for mysql
- $grp = mysql_real_escape_string("shib-" . $name);
+ $grp = vcl_mysql_escape_string("shib-" . $name);
array_push($newusergroups, getUserGroupID($grp, $affilid));
}
$query = "SELECT id, name FROM affiliation WHERE shibname = '$shibaffil'";
$qh = doQuery($query, 101);
- $row = mysql_fetch_assoc($qh);
+ $row = mysqli_fetch_assoc($qh);
$affilid = $row['id'];
- $grp = mysql_real_escape_string("All {$row['name']} Users");
+ $grp = vcl_mysql_escape_string("All {$row['name']} Users");
array_push($newusergroups, getUserGroupID($grp, $affilid));
$newusergroups = array_unique($newusergroups);
@@ -224,7 +224,7 @@ function updateShibGroups($usernid, $groups) {
///
////////////////////////////////////////////////////////////////////////////////
function addShibUserStub($affilid, $userid) {
- global $mysql_link_vcl;
+ global $mysqli_link_vcl;
$query = "INSERT INTO user "
. "(unityid, "
. "affiliationid, "
@@ -238,7 +238,7 @@ function addShibUserStub($affilid, $userid) {
. "0, "
. "0)";
doQuery($query);
- if(mysql_affected_rows($mysql_link_vcl))
+ if(mysqli_affected_rows($mysqli_link_vcl))
return dbLastInsertID();
else
return NULL;
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/.ht-inc/blockallocations.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/blockallocations.php b/web/.ht-inc/blockallocations.php
index 9e7f7f2..9bf25e2 100644
--- a/web/.ht-inc/blockallocations.php
+++ b/web/.ht-inc/blockallocations.php
@@ -75,7 +75,7 @@ function blockAllocations() {
. "WHERE id in ($inids) AND "
. "status = 'accepted'";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$blocks[$row['id']] = $row['name'];
print "<hr>\n";
print "<h2>" . i("Your Active Block Allocations") . "</h2>\n";
@@ -606,7 +606,7 @@ function AJblockAllocationSubmit() {
return;
}
$mnid = array_rand($managementnodes);
- $escname = mysql_real_escape_string($data['name']);
+ $escname = vcl_mysql_escape_string($data['name']);
$query = "INSERT INTO blockRequest "
. "(name, "
. "imageid, "
@@ -644,7 +644,7 @@ function AJblockAllocationSubmit() {
. "end > NOW() AND "
. "blockRequestid = $blockreqid";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
$checkCurBlockTime = 1;
$curBlockTime = $row;
}
@@ -660,7 +660,7 @@ function AJblockAllocationSubmit() {
$query = "DELETE FROM blockWebTime WHERE blockRequestid = $blockreqid";
doQuery($query, 101);
- $escname = mysql_real_escape_string($data['name']);
+ $escname = vcl_mysql_escape_string($data['name']);
$query = "UPDATE blockRequest "
. "SET name = '$escname', "
. "imageid = {$data['imageid']}, "
@@ -673,7 +673,7 @@ function AJblockAllocationSubmit() {
doQuery($query, 101);
}
elseif($method == 'request') {
- $esccomments = mysql_real_escape_string($data['comments']);
+ $esccomments = vcl_mysql_escape_string($data['comments']);
$query = "INSERT INTO blockRequest "
. "(name, "
. "imageid, "
@@ -811,7 +811,7 @@ function AJblockAllocationSubmit() {
. "blockRequestid = $blockreqid AND "
. "id != {$curBlockTime['id']}";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
if($curBlockTime['end'] != $row['end']) {
# update old end time
$query = "UPDATE blockTimes "
@@ -1093,7 +1093,7 @@ function getBlockNotifyUsers($affiliationid) {
. "u.email != ''";
$qh = doQuery($query);
$addrs = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$addrs[] = $row['email'];
return implode(',', $addrs);
}
@@ -1119,7 +1119,7 @@ function deleteBlockSkipDuplicates($blockid) {
$qh = doQuery($query, 101);
$skips = array();
$noskips = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$key = "{$row['start']}:{$row['end']}";
if($row['skip'])
$skips[$key] = $row['id'];
@@ -1181,11 +1181,11 @@ function getCurrentBlockHTML($listonly=0) {
. "ORDER BY b.name";
$allblockids = array();
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if($row['group'] == '') {
$query3 = "SELECT name FROM usergroup WHERE id = {$row['usergroupid']}";
$qh3 = doQuery($query3, 101);
- if($row3 = mysql_fetch_assoc($qh3))
+ if($row3 = mysqli_fetch_assoc($qh3))
$row['group'] = $row3['name'];
}
$allblockids[] = $row['id'];
@@ -1200,7 +1200,7 @@ function getCurrentBlockHTML($listonly=0) {
. "ORDER BY start "
. "LIMIT 1";
$qh2 = doQuery($query2, 101);
- if($row2 = mysql_fetch_assoc($qh2)) {
+ if($row2 = mysqli_fetch_assoc($qh2)) {
if(array_key_exists('tzoffset', $_SESSION['persistdata'])) {
$tmp = date('n/j/y+g:i=A=T', $row2['unixstart']);
$blocks[$row['id']]['nextstart'] = str_replace(array('+', '='), array('<br>', ' '), $tmp);
@@ -1229,7 +1229,7 @@ function getCurrentBlockHTML($listonly=0) {
. "FROM blockWebDate "
. "WHERE blockRequestid = $id";
$qh = doQuery($query, 101);
- if(! $row = mysql_fetch_assoc($qh))
+ if(! $row = mysqli_fetch_assoc($qh))
abort(101);
$blocks[$id] = array_merge($request, $row);
$wdays = array();
@@ -1250,7 +1250,7 @@ function getCurrentBlockHTML($listonly=0) {
. "WHERE blockRequestid = {$request['id']} "
. "ORDER BY startmeridian, starthour, startminute";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$blocks[$id]['swhour'][$row['order']] = $row['starthour'];
$blocks[$id]['swminute'][$row['order']] = $row['startminute'];
$blocks[$id]['swmeridian'][$row['order']] = $row['startmeridian'];
@@ -1267,7 +1267,7 @@ function getCurrentBlockHTML($listonly=0) {
. "FROM blockWebDate "
. "WHERE blockRequestid = $id";
$qh = doQuery($query, 101);
- if(! $row = mysql_fetch_assoc($qh))
+ if(! $row = mysqli_fetch_assoc($qh))
abort(101);
$blocks[$id] = array_merge($request, $row);
$query = "SELECT starthour, "
@@ -1281,7 +1281,7 @@ function getCurrentBlockHTML($listonly=0) {
. "WHERE blockRequestid = {$request['id']} "
. "ORDER BY startmeridian, starthour, startminute";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$blocks[$id]['smhour'][$row['order']] = $row['starthour'];
$blocks[$id]['smminute'][$row['order']] = $row['startminute'];
$blocks[$id]['smmeridian'][$row['order']] = $row['startmeridian'];
@@ -1297,7 +1297,7 @@ function getCurrentBlockHTML($listonly=0) {
. "WHERE blockRequestid = $id "
. "ORDER BY start";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if($row['date'] == '00/00/00')
$blocks[$id]['date'][$row['order']] = '';
else
@@ -1313,7 +1313,7 @@ function getCurrentBlockHTML($listonly=0) {
. "FROM blockWebTime "
. "WHERE blockRequestid = {$request['id']}";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$blocks[$id]['slhour'][$row['order']] = $row['starthour'];
$blocks[$id]['slminute'][$row['order']] = $row['startminute'];
$blocks[$id]['slmeridian'][$row['order']] = $row['startmeridian'];
@@ -1528,7 +1528,7 @@ function getUserCurrentBlockHTML($listonly=0) {
. "ORDER BY b.name";
$qh = doQuery($query, 101);
$blocks = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$blocks[$row['id']] = $row;
if(empty($blocks))
return;
@@ -1543,7 +1543,7 @@ function getUserCurrentBlockHTML($listonly=0) {
. "FROM blockWebDate "
. "WHERE blockRequestid = $id";
$qh = doQuery($query, 101);
- if(! $row = mysql_fetch_assoc($qh))
+ if(! $row = mysqli_fetch_assoc($qh))
abort(101);
$blocks[$id] = array_merge($request, $row);
$wdays = array();
@@ -1564,7 +1564,7 @@ function getUserCurrentBlockHTML($listonly=0) {
. "WHERE blockRequestid = {$request['id']} "
. "ORDER BY startmeridian, starthour, startminute";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$blocks[$id]['swhour'][$row['order']] = $row['starthour'];
$blocks[$id]['swminute'][$row['order']] = $row['startminute'];
$blocks[$id]['swmeridian'][$row['order']] = $row['startmeridian'];
@@ -1581,7 +1581,7 @@ function getUserCurrentBlockHTML($listonly=0) {
. "FROM blockWebDate "
. "WHERE blockRequestid = $id";
$qh = doQuery($query, 101);
- if(! $row = mysql_fetch_assoc($qh))
+ if(! $row = mysqli_fetch_assoc($qh))
abort(101);
$blocks[$id] = array_merge($request, $row);
$query = "SELECT starthour, "
@@ -1595,7 +1595,7 @@ function getUserCurrentBlockHTML($listonly=0) {
. "WHERE blockRequestid = {$request['id']} "
. "ORDER BY startmeridian, starthour, startminute";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$blocks[$id]['smhour'][$row['order']] = $row['starthour'];
$blocks[$id]['smminute'][$row['order']] = $row['startminute'];
$blocks[$id]['smmeridian'][$row['order']] = $row['startmeridian'];
@@ -1611,7 +1611,7 @@ function getUserCurrentBlockHTML($listonly=0) {
. "WHERE blockRequestid = $id "
. "ORDER BY start";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if($row['date'] == '00/00/00')
$blocks[$id]['date'][$row['order']] = '';
else
@@ -1627,7 +1627,7 @@ function getUserCurrentBlockHTML($listonly=0) {
. "FROM blockWebTime "
. "WHERE blockRequestid = {$request['id']}";
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$blocks[$id]['slhour'][$row['order']] = $row['starthour'];
$blocks[$id]['slminute'][$row['order']] = $row['startminute'];
$blocks[$id]['slmeridian'][$row['order']] = $row['startmeridian'];
@@ -1823,7 +1823,7 @@ function getPendingBlockHTML($listonly=0) {
$h .= " </tr>\n";
$d = '';
$groups = getUserGroups(0, $user['affiliationid']);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if($row['repeating'] == 'weekly') {
$query2 = "SELECT DATE_FORMAT(start, '%m/%d/%y') AS swdate, "
. "DATE_FORMAT(end, '%m/%d/%y')AS ewdate, "
@@ -1833,7 +1833,7 @@ function getPendingBlockHTML($listonly=0) {
. "FROM blockWebDate "
. "WHERE blockRequestid = {$row['id']}";
$qh2 = doQuery($query2, 101);
- if(! $row2 = mysql_fetch_assoc($qh2))
+ if(! $row2 = mysqli_fetch_assoc($qh2))
abort(101);
$row = array_merge($row, $row2);
$wdays = array();
@@ -1854,7 +1854,7 @@ function getPendingBlockHTML($listonly=0) {
. "ORDER BY startmeridian, starthour, startminute";
$qh2 = doQuery($query2, 101);
$row['times'] = array();
- while($row2 = mysql_fetch_assoc($qh2)) {
+ while($row2 = mysqli_fetch_assoc($qh2)) {
$row['swhour'][$row2['order']] = $row2['starthour'];
$row['swminute'][$row2['order']] = $row2['startminute'];
$row['swmeridian'][$row2['order']] = $row2['startmeridian'];
@@ -1878,7 +1878,7 @@ function getPendingBlockHTML($listonly=0) {
. "FROM blockWebDate "
. "WHERE blockRequestid = {$row['id']}";
$qh2 = doQuery($query2, 101);
- if(! $row2 = mysql_fetch_assoc($qh2))
+ if(! $row2 = mysqli_fetch_assoc($qh2))
abort(101);
$row = array_merge($row, $row2);
$query2 = "SELECT starthour, "
@@ -1893,7 +1893,7 @@ function getPendingBlockHTML($listonly=0) {
. "ORDER BY startmeridian, starthour, startminute";
$qh2 = doQuery($query2, 101);
$row['times'] = array();
- while($row2 = mysql_fetch_assoc($qh2)) {
+ while($row2 = mysqli_fetch_assoc($qh2)) {
$row['smhour'][$row2['order']] = $row2['starthour'];
$row['smminute'][$row2['order']] = $row2['startminute'];
$row['smmeridian'][$row2['order']] = $row2['startmeridian'];
@@ -1916,7 +1916,7 @@ function getPendingBlockHTML($listonly=0) {
. "WHERE blockRequestid = {$row['id']} "
. "ORDER BY start";
$qh2 = doQuery($query2, 101);
- while($row2 = mysql_fetch_assoc($qh2)) {
+ while($row2 = mysqli_fetch_assoc($qh2)) {
if($row2['date'] == '00/00/00')
$row['date'][$row2['order']] = '';
else
@@ -1934,7 +1934,7 @@ function getPendingBlockHTML($listonly=0) {
. "WHERE blockRequestid = {$row['id']}";
$qh2 = doQuery($query2, 101);
$row['slots'] = array(); # yyyy-mm-dd|hh:mm|hh:mm
- while($row2 = mysql_fetch_assoc($qh2)) {
+ while($row2 = mysqli_fetch_assoc($qh2)) {
$row['slhour'][$row2['order']] = $row2['starthour'];
$row['slminute'][$row2['order']] = $row2['startminute'];
$row['slmeridian'][$row2['order']] = $row2['startmeridian'];
@@ -2467,7 +2467,7 @@ function AJacceptBlockAllocationConfirm() {
///
////////////////////////////////////////////////////////////////////////////////
function AJacceptBlockAllocationSubmit() {
- global $mysql_link_vcl, $user;
+ global $mysqli_link_vcl, $user;
$blockid = getContinuationVar('blockid');
$comments = getContinuationVar('comments');
$validemail = getContinuationVar('validemail');
@@ -2523,9 +2523,9 @@ function AJacceptBlockAllocationSubmit() {
if(! $err) {
# update values for block allocation
if($validemail)
- $esccomments = mysql_real_escape_string("COMMENTS: $comments|EMAIL: $emailtext");
+ $esccomments = vcl_mysql_escape_string("COMMENTS: $comments|EMAIL: $emailtext");
else
- $esccomments = mysql_real_escape_string("COMMENTS: $comments|USER NOT EMAILED");
+ $esccomments = vcl_mysql_escape_string("COMMENTS: $comments|USER NOT EMAILED");
$query = "UPDATE blockRequest "
. "SET name = '$name', ";
if($setusergroup)
@@ -2535,7 +2535,7 @@ function AJacceptBlockAllocationSubmit() {
. "managementnodeid = '$mnid' "
. "WHERE id = $blockid";
doQuery($query, 101);
- if(! mysql_affected_rows($mysql_link_vcl)) {
+ if(! mysqli_affected_rows($mysqli_link_vcl)) {
$errmsg = i("Error encountered while updating status of block allocation.");
$err = 1;
}
@@ -2694,7 +2694,7 @@ function AJrejectBlockAllocationConfirm() {
///
////////////////////////////////////////////////////////////////////////////////
function AJrejectBlockAllocationSubmit() {
- global $mysql_link_vcl;
+ global $mysqli_link_vcl;
$blockid = getContinuationVar('blockid');
$comments = getContinuationVar('comments');
$validemail = getContinuationVar('validemail');
@@ -2727,16 +2727,16 @@ function AJrejectBlockAllocationSubmit() {
if(! $err) {
# update values for block allocation
if($validemail)
- $esccomments = mysql_real_escape_string("COMMENTS: $comments|EMAIL: $emailtext");
+ $esccomments = vcl_mysql_escape_string("COMMENTS: $comments|EMAIL: $emailtext");
else
- $esccomments = mysql_real_escape_string("COMMENTS: $comments|REJECTREASON: $emailtext");
+ $esccomments = vcl_mysql_escape_string("COMMENTS: $comments|REJECTREASON: $emailtext");
$query = "UPDATE blockRequest "
. "SET name = 'rejected', "
. "status = 'rejected', "
. "comments = '$esccomments' "
. "WHERE id = $blockid";
doQuery($query, 101);
- if(! mysql_affected_rows($mysql_link_vcl)) {
+ if(! mysqli_affected_rows($mysqli_link_vcl)) {
$errmsg = i("Error encountered while updating status of block allocation.");
$err = 1;
}
@@ -2785,7 +2785,7 @@ function AJviewBlockAllocationTimes() {
$qh = doQuery($query, 101);
$data = array();
$items = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$items[] = $row;
$cont = addContinuationsEntry('AJtoggleBlockTime', array('blockid' => $blockid));
$data['cont'] = $cont;
@@ -2809,7 +2809,7 @@ function AJtoggleBlockTime() {
. "FROM blockTimes "
. "WHERE id = $timeid";
$qh = doQuery($query, 101);
- if(! ($row = mysql_fetch_assoc($qh)) || $row['blockRequestid'] != $blockid) {
+ if(! ($row = mysqli_fetch_assoc($qh)) || $row['blockRequestid'] != $blockid) {
$data['error'] = i("Invalid block time submitted");
sendJSON($data);
return;
@@ -3347,7 +3347,7 @@ function getBlockAllocationStatus($id) {
. "ORDER BY t.start "
. "LIMIT 1";
$qh = doQuery($query, 101);
- if($data = mysql_fetch_assoc($qh)) {
+ if($data = mysqli_fetch_assoc($qh)) {
if(! is_numeric($data['subimages']))
$data['subimages'] = 0;
$query = "SELECT c.id, "
@@ -3370,7 +3370,7 @@ function getBlockAllocationStatus($id) {
. "c.stateid = s.id";
$qh = doQuery($query, 101);
$data['comps'] = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$data['comps'][$row['id']] = $row;
return $data;
}
@@ -3454,7 +3454,7 @@ function getBlockAllocationData($blockid) {
. "WHERE b.id = d.blockRequestid AND "
. "b.id = $blockid";
$qh = doQuery($query, 101);
- $row = mysql_fetch_assoc($qh);
+ $row = mysqli_fetch_assoc($qh);
if(empty($row))
return $rt;
$row['wdayschecked'] = $rt['wdayschecked'];
@@ -3505,7 +3505,7 @@ function AJpopulateBlockStore() {
$blockid = getContinuationVar('blockid');
$query = "SELECT repeating FROM blockRequest WHERE id = $blockid";
$qh = doQuery($query, 101);
- if(! ($row = mysql_fetch_assoc($qh))) {
+ if(! ($row = mysqli_fetch_assoc($qh))) {
sendJSON(array('error' => i("Error: Failed to fetch start/end times for block allocation.")));
return;
}
@@ -3524,7 +3524,7 @@ function AJpopulateBlockStore() {
$startms = array();
$endhs = array();
$endms = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$starth = hour12to24($row['starthour'], $row['startmeridian']);
$endh = hour12to24($row['endhour'], $row['endmeridian']);
$starths[] = $starth;
@@ -3550,7 +3550,7 @@ function AJpopulateBlockStore() {
. "WHERE blockRequestid = $blockid";
$qh = doQuery($query, 101);
$data = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$data[$row['order']] = $row;
$query = "SELECT MONTH(start) AS month, "
. "DAY(start) AS day, "
@@ -3566,7 +3566,7 @@ function AJpopulateBlockStore() {
$startms = array();
$endhs = array();
$endms = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$id = $row['days'];
$months[] = $row['month'];
$days[] = $row['day'];
@@ -3696,7 +3696,7 @@ function AJgetBlockAllocatedMachineData() {
. "WHERE stateid IN (2, 3, 6, 8, 11) AND "
. "type = 'blade'";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_row($qh))
+ if($row = mysqli_fetch_row($qh))
$data['total'] = $row[0];
}
else
@@ -3743,7 +3743,7 @@ function AJgetBlockAllocatedMachineData() {
. "u.affiliationid = {$user['affiliationid']}";
}
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
for($binstart = $start, $binend = $start + 900, $binindex = 0;
$binend <= $end;
$binstart += 900, $binend += 900, $binindex++) {
@@ -3770,7 +3770,7 @@ function AJgetBlockAllocatedMachineData() {
. "WHERE stateid IN (2, 3, 6, 8, 11) AND "
. "type = 'virtualmachine'";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_row($qh))
+ if($row = mysqli_fetch_row($qh))
$data['total'] = $row[0];
}
else
@@ -3817,7 +3817,7 @@ function AJgetBlockAllocatedMachineData() {
. "u.affiliationid = {$user['affiliationid']}";
}
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
for($binstart = $start, $binend = $start + 900, $binindex = 0;
$binend <= $end;
$binstart += 900, $binend += 900, $binindex++) {
@@ -3869,7 +3869,7 @@ function AJviewBlockAllocationUsage() {
$first = 1;
$firststart = '';
$laststart = '';
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if(is_null($row['blockStart']))
continue;
if($first) {
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/.ht-inc/computer.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/computer.php b/web/.ht-inc/computer.php
index 6c6668d..3a9e117 100644
--- a/web/.ht-inc/computer.php
+++ b/web/.ht-inc/computer.php
@@ -821,7 +821,7 @@ class Computer extends Resource {
. "ORDER BY rq.start "
. "LIMIT 1";
$qh = doQuery($query);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
$cdata = $this->basecdata;
$cdata['compid'] = $rscid;
$cont = addContinuationsEntry('AJcanceltovmhostinuse', $cdata, 300, 1, 0);
@@ -973,7 +973,7 @@ class Computer extends Resource {
. "vm.stateid = 10";
$qh = doQuery($query);
$vmids = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$vmids[] = $row['id'];
$allids = implode(',', $vmids);
if($data['provisioning'] != 'none') {
@@ -1235,7 +1235,7 @@ class Computer extends Resource {
. "vm.vmhostid = v.id";
$qh = doQuery($query);
$fail = 0;
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if(! simpleAddRequest($row['id'], $imageid, $revid, $startdt,
$enddt, 18, $vclreloadid)) {
$fail = 1;
@@ -1357,7 +1357,7 @@ class Computer extends Resource {
. "vm.vmhostid = v.id";
$qh = doQuery($query);
$fails = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if(! simpleAddRequest($row['id'], $imageid, $revid, $startdt,
$enddt, 18, $vclreloadid)) {
$fails[] = $row['id'];
@@ -1451,7 +1451,7 @@ class Computer extends Resource {
$qh = doQuery($query);
$fails = array();
$cnt = 0;
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$cnt++;
if(! simpleAddRequest($row['id'], $imageid, $revid, $startdt,
$enddt, 18, $vclreloadid)) {
@@ -1781,7 +1781,7 @@ class Computer extends Resource {
. "deleted = 0";
$qh = doQuery($query);
$exists = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$exists[] = $row['hostname'];
if(count($exists)) {
$hosts = implode(', ', $exists);
@@ -2049,7 +2049,7 @@ class Computer extends Resource {
. "rq.laststateid NOT IN (1,5,11,12) AND "
. "rq.userid != $vclreloadid";
$qh = doQuery($query);
- if(mysql_num_rows($qh)) {
+ if(mysqli_num_rows($qh)) {
$return['error'] = 1;
$errormsg[] = "This computer has an active reservation. NAT settings cannot be changed for computers having<br>active reservations.";
}
@@ -2099,7 +2099,7 @@ class Computer extends Resource {
. "rq.laststateid NOT IN (1,5,11,12) AND "
. "rq.userid != $vclreloadid";
$qh = doQuery($query);
- if(mysql_num_rows($qh)) {
+ if(mysqli_num_rows($qh)) {
$return['error'] = 1;
$errormsg[] = "This computer is the NAT host for other computers that have active reservations. NAT host<br>settings cannot be changed while providing NAT for active reservations.";
}
@@ -2140,7 +2140,7 @@ class Computer extends Resource {
if(! empty($compid))
$query .= " AND id != $compid";
$qh = doQuery($query);
- if(mysql_num_rows($qh))
+ if(mysqli_num_rows($qh))
return 1;
return 0;
}
@@ -2170,7 +2170,7 @@ class Computer extends Resource {
if(! empty($compid))
$query .= " AND id != $compid";
$qh = doQuery($query);
- if(mysql_num_rows($qh))
+ if(mysqli_num_rows($qh))
return 1;
return 0;
}
@@ -2199,7 +2199,7 @@ class Computer extends Resource {
if(! empty($compid))
$query .= " AND id != $compid";
$qh = doQuery($query);
- if(mysql_num_rows($qh))
+ if(mysqli_num_rows($qh))
return 1;
return 0;
}
@@ -2377,7 +2377,7 @@ class Computer extends Resource {
///
////////////////////////////////////////////////////////////////////////////////
function AJcanceltovmhostinuse() {
- global $mysql_link_vcl;
+ global $mysqli_link_vcl;
$compid = getContinuationVar('compid');
$type = 'none';
$query = "DELETE FROM request "
@@ -2387,7 +2387,7 @@ class Computer extends Resource {
. "FROM reservation "
. "WHERE computerid = $compid)";
doQuery($query);
- if(mysql_affected_rows($mysql_link_vcl))
+ if(mysqli_affected_rows($mysqli_link_vcl))
$type = 'future';
$query = "UPDATE request rq, "
. "reservation rs, "
@@ -2399,7 +2399,7 @@ class Computer extends Resource {
. "rq.laststateid = ls.id AND "
. "ls.name = 'tovmhostinuse'";
doQuery($query);
- if(mysql_affected_rows($mysql_link_vcl))
+ if(mysqli_affected_rows($mysqli_link_vcl))
$type = 'current';
$query = "SELECT rq.start "
. "FROM request rq, "
@@ -2415,7 +2415,7 @@ class Computer extends Resource {
. "rq.end > NOW() "
. "ORDER BY rq.start";
$qh = doQuery($query);
- if(mysql_num_rows($qh))
+ if(mysqli_num_rows($qh))
$arr = array('status' => 'failed');
else {
if($type == 'now')
@@ -2477,7 +2477,7 @@ class Computer extends Resource {
. "ORDER BY rq.start "
. "LIMIT 1";
$qh = doQuery($query);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
if(! retryGetSemaphore($imageid, $revid, $mnid, $compid, $startdt, $enddt, $row['id']))
return 0;
# update existing reservation
@@ -2720,7 +2720,7 @@ class Computer extends Resource {
. "vm.vmhostid = v.id";
$qh = doQuery($query);
$fail = 0;
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if(! simpleAddRequest($row['id'], $imageid, $revid, $startdt,
$enddt, 18, $vclreloadid)) {
$fail = 1;
@@ -2811,7 +2811,7 @@ class Computer extends Resource {
. "WHERE v.computerid = $compid AND "
. "vm.vmhostid = v.id";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$checkstart = getExistingChangeStateStartTime($row['id'], 18);
if($checkstart) {
if($checkstart > $start)
@@ -3069,7 +3069,7 @@ class Computer extends Resource {
. "rq.end > '$startstamp' AND "
. "s.name NOT IN ('complete', 'deleted', 'failed', 'timeout')";
$qh = doQuery($query);
- if(! mysql_num_rows($qh))
+ if(! mysqli_num_rows($qh))
$reloadnow[] = $compid;
else
$reloadasap[] = $compid;
@@ -3160,7 +3160,7 @@ class Computer extends Resource {
. "s.name NOT IN ('deleted', 'failed', 'complete') AND "
. "rq.end > NOW()";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$skipcompids[] = $row['computerid'];
$query = "SELECT DISTINCT bc.computerid "
. "FROM blockTimes bt, "
@@ -3173,7 +3173,7 @@ class Computer extends Resource {
. "bt.skip = 0 AND "
. "br.status = 'accepted'";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$skipcompids[] = $row['computerid'];
$delids = array_diff($compids, $skipcompids);
$msg = '';
@@ -3254,7 +3254,7 @@ class Computer extends Resource {
. "s.name NOT IN ('deleted', 'failed', 'complete') AND "
. "rq.end > NOW()";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$fails[] = $row['computerid'];
$delids = array_diff($compids, $fails);
@@ -3429,7 +3429,7 @@ class Computer extends Resource {
. "rq.stateid NOT IN (1, 5, 11, 12) AND " # TODO might not want 11 (timeout)
. "rs.computerid IN ($allids)";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$inusecompids[$row['computerid']] = 1;
# check initial conditions
@@ -3491,7 +3491,7 @@ class Computer extends Resource {
. "WHERE h.id IN ($ids) "
. "GROUP BY vh.computerid";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if($row['count'])
$fails['hasvms'][] = $row['id'];
else
@@ -3507,7 +3507,7 @@ class Computer extends Resource {
. "LEFT JOIN computer h ON (vh.computerid = h.id) "
. "WHERE vm.id IN ($ids)";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if($row['stateid'] != 20)
$fails['hostfail'][] = $row['id'];
else
@@ -3578,7 +3578,7 @@ class Computer extends Resource {
$notes = processInputVar('notes', ARG_STRING);
if(get_magic_quotes_gpc())
$notes = stripslashes($notes);
- $notes = mysql_real_escape_string($notes);
+ $notes = vcl_mysql_escape_string($notes);
$notes = $user["unityid"] . " " . unixToDatetime(time()) . "@"
. $notes;
}
@@ -3634,7 +3634,7 @@ class Computer extends Resource {
. "vm.vmhostid = v.id";
$qh = doQuery($query);
$setnoteids = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$checkstart = getExistingChangeStateStartTime($row['id'], 18);
if($checkstart) {
if($checkstart > $reloadstart)
@@ -3865,7 +3865,7 @@ class Computer extends Resource {
. "WHERE v.computerid IN ($allids) AND "
. "vm.vmhostid = v.id";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if(! array_key_exists($row['compid'], $maintvmids))
$maintvmids[$row['compid']] = array();
if($row['vmstateid'] == 10 &&
@@ -4000,8 +4000,8 @@ class Computer extends Resource {
. "GROUP BY rs.computerid "
. "ORDER BY start";
$qh = doQuery($query);
- if(mysql_num_rows($qh) == count($allvmids)) {
- while($row = mysql_fetch_assoc($qh)) {
+ if(mysqli_num_rows($qh) == count($allvmids)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$times[$row['start']] = 1;
$reqids[] = $row['id'];
}
@@ -4022,7 +4022,7 @@ class Computer extends Resource {
. "rs.imageid = '{$profiles[$profileid]['imageid']}' AND "
. "rq.stateid = 21";
$qh = doQuery($query);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
# node was previously scheduled to be reloaded for vmhostinuse
if($times[0] > $start) {
# update existing reservations
@@ -4286,7 +4286,7 @@ class Computer extends Resource {
. "rq.start <= '$startcheckdt' AND "
. "rq.end > NOW()";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$fails[] = $row['computerid'];
$nowids = array_diff($compids, $fails);
@@ -4454,7 +4454,7 @@ class Computer extends Resource {
. "rq.laststateid NOT IN (1,5,11,12) AND "
. "rq.userid != $vclreloadid";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$inusecompids[] = $row['computerid'];
$tmp = getUserResources(array($this->restype . "Admin"), array("administer"), 0, 1);
@@ -4799,7 +4799,7 @@ class Computer extends Resource {
. "s.name NOT IN ('timedout','deleted','complete')";
$qh = doQuery($query);
$data = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$msg = "<strong>{$row['hostname']}</strong><br>";
if($row['start'] == '') {
$msg .= "(No reservations)<br><hr>";
@@ -4888,7 +4888,7 @@ class Computer extends Resource {
. "l.start DESC";
$qh = doQuery($query);
$data = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if(! is_numeric($row['end']))
continue;
$msg = "<strong>{$row['hostname']}</strong><br>";
@@ -5076,7 +5076,7 @@ class Computer extends Resource {
. "eth1macaddress IN ('$ineth1s')";
$qh = doQuery($query);
$errmsg = '';
- if(mysql_num_rows($qh)) {
+ if(mysqli_num_rows($qh)) {
$errmsg .= "The specified starting MAC address combined with the number ";
$errmsg .= "of computers entered will result in a MAC address already ";
$errmsg .= "assigned to another computer.";
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/.ht-inc/config.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/config.php b/web/.ht-inc/config.php
index 3ed2cb2..531424d 100644
--- a/web/.ht-inc/config.php
+++ b/web/.ht-inc/config.php
@@ -65,7 +65,7 @@ class Config extends Resource {
$query .= "ORDER BY cv.configid, cv.name";
$variables = array();
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$variables[$row['configid']][$row['id']] = $row;
# config subimages
@@ -85,7 +85,7 @@ class Config extends Resource {
$query .= "AND configid = $id ";
$query .= "ORDER BY s.configid, i.prettyname";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$variables[$row['configid']][$row['id']] = $row;
# configs
@@ -121,7 +121,7 @@ class Config extends Resource {
$query .= " AND c.deleted = 0";
$qh = doQuery($query);
$configs = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if(array_key_exists($row['id'], $variables))
$row['variables'] = $variables[$row['id']];
else
@@ -166,7 +166,7 @@ class Config extends Resource {
. "c.configtypeid = ct.id AND "
. "c.deleted = 0";
$qh = doQuery($query);
- if($row = mysql_fetch_assoc($qh))
+ if($row = mysqli_fetch_assoc($qh))
return $row;
else
return NULL;
@@ -245,11 +245,11 @@ class Config extends Resource {
}
$sets = array();
if($curdata['name'] != $vars['name']) {
- $name = mysql_real_escape_string($vars['name']);
+ $name = vcl_mysql_escape_string($vars['name']);
$sets[] = "name = '$name'";
}
if($curdata['data'] != $vars['data']) {
- $data = mysql_real_escape_string($vars['data']);
+ $data = vcl_mysql_escape_string($vars['data']);
$sets[] = "data = '$data'";
}
if($curdata['ownerid'] != $vars['ownerid'])
@@ -319,11 +319,11 @@ class Config extends Resource {
}
$sets = array();
if($vardata['name'] != $newvars[$id]['name']) {
- $name = mysql_real_escape_string($newvars[$id]['name']);
+ $name = vcl_mysql_escape_string($newvars[$id]['name']);
$sets[] = "name = '$name'";
}
if($vardata['identifier'] != $newvars[$id]['identifier']) {
- $identifier = mysql_real_escape_string($newvars[$id]['identifier']);
+ $identifier = vcl_mysql_escape_string($newvars[$id]['identifier']);
$sets[] = "identifier = '$identifier'";
}
if($vardata['datatypeid'] != $newvars[$id]['datatypeid']) {
@@ -332,7 +332,7 @@ class Config extends Resource {
$sets[] = "datatypeid = '{$newvars[$id]['datatypeid']}'";
}
if($vardata['defaultvalue'] != $newvars[$id]['defaultvalue']) {
- $defaultvalue = mysql_real_escape_string($newvars[$id]['defaultvalue']);
+ $defaultvalue = vcl_mysql_escape_string($newvars[$id]['defaultvalue']);
$sets[] = "defaultvalue = '$defaultvalue'";
}
if($vardata['required'] != $newvars[$id]['required']) {
@@ -377,9 +377,9 @@ class Config extends Resource {
$inserts = array();
$datatypes = getConfigDataTypes();
foreach($newvars as $var) {
- $name = mysql_real_escape_string($var['name']);
- $identifier = mysql_real_escape_string($var['identifier']);
- $defaultvalue = mysql_real_escape_string($var['defaultvalue']);
+ $name = vcl_mysql_escape_string($var['name']);
+ $identifier = vcl_mysql_escape_string($var['identifier']);
+ $defaultvalue = vcl_mysql_escape_string($var['defaultvalue']);
if(! array_key_exists($var['datatypeid'], $datatypes))
$var['datatypeid'] = $this->findDataTypeID($var['defaultvalue'], $datatypes);
$inserts[] = "('$name', "
@@ -407,7 +407,7 @@ class Config extends Resource {
///
////////////////////////////////////////////////////////////////////////////////
function addResource($vars) {
- $name = mysql_real_escape_string($vars['name']);
+ $name = vcl_mysql_escape_string($vars['name']);
if($vars['type'] == 'Cluster') {
$query = "INSERT INTO config "
. "(name, "
@@ -436,7 +436,7 @@ class Config extends Resource {
doQuery($query);
}
else {
- $data = mysql_real_escape_string($vars['data']);
+ $data = vcl_mysql_escape_string($vars['data']);
$query = "INSERT INTO config "
. "(name, "
. "configtypeid, "
@@ -501,10 +501,10 @@ class Config extends Resource {
return 0;
}
# check for existance of name
- $name = mysql_real_escape_string($return['name']);
+ $name = vcl_mysql_escape_string($return['name']);
$query = "SELECT id FROM config WHERE name = '$name' AND id != $configid";
$qh = doQuery($query);
- if(mysql_num_rows($qh)) {
+ if(mysqli_num_rows($qh)) {
$this->errmsg = "Another config with this name already exists.";
return 0;
}
@@ -1152,7 +1152,7 @@ class Config extends Resource {
. "c.deleted = 0";
$configmaps = array();
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
switch($row['configmaptype']) {
case "Image":
$row['mapto'] = $row['image'];
@@ -1478,7 +1478,7 @@ class Config extends Resource {
. "configstageid = {$return['stageid']} AND "
. "id != $configmapid";
$qh = doQuery($query);
- if(mysql_num_rows($qh)) {
+ if(mysqli_num_rows($qh)) {
$this->errmsg = "The specified mapping already exists.";
return 0;
}
@@ -1526,7 +1526,7 @@ class Config extends Resource {
. "c.id in ($inlist)";
$configs = array();
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$configs[$row['id']] = $row['name'];
return $configs;
}
@@ -1542,7 +1542,7 @@ class Config extends Resource {
$query = "SELECT id, name FROM configstage ORDER BY name";
$stages = array();
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$stages[$row['id']] = $row['name'];
return $stages;
}
@@ -1597,7 +1597,7 @@ class Config extends Resource {
. "ct.prettyname = 'Config' AND "
. "cm.configid = c.id";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if($row['subid'] == $configid)
return $row['config'];
if($reccnt < 20) {
@@ -1624,7 +1624,7 @@ class Config extends Resource {
. "ct.prettyname = 'Subimage' AND "
. "cm.configid = c.id";
$qh = doQuery($query);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if($row['configid'] == $configid)
return $row['config'];
if($reccnt < 20) {
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/.ht-inc/dashboard.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/dashboard.php b/web/.ht-inc/dashboard.php
index 78e469c..3c2df3f 100644
--- a/web/.ht-inc/dashboard.php
+++ b/web/.ht-inc/dashboard.php
@@ -193,22 +193,22 @@ function getStatusData() {
. "rq.end > NOW()";
}
$qh = doQuery($query, 101);
- if($row = mysql_fetch_row($qh))
+ if($row = mysqli_fetch_row($qh))
$data[0]['val'] = $row[0];
$query = "SELECT COUNT(id) FROM computer WHERE stateid IN (2, 3, 6, 8, 11)";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_row($qh))
+ if($row = mysqli_fetch_row($qh))
$data[1]['val'] = $row[0];
$query = "SELECT COUNT(id) FROM computer WHERE stateid = 8";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_row($qh))
+ if($row = mysqli_fetch_row($qh))
$data[2]['val'] = $row[0];
$query = "SELECT COUNT(id) FROM computer WHERE stateid = 5";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_row($qh))
+ if($row = mysqli_fetch_row($qh))
$data[3]['val'] = $row[0];
return $data;
}
@@ -259,7 +259,7 @@ function getTopImageData() {
}
$data = array();
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$data[] = $row;
return $data;
}
@@ -310,7 +310,7 @@ function getTopLongImageData() {
}
$data = array();
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$data[] = $row;
return $data;
}
@@ -360,7 +360,7 @@ function getTopPastImageData() {
}
$data = array();
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$data[] = $row;
return $data;
}
@@ -407,7 +407,7 @@ function getTopFailedData() {
}
$data = array();
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$data[] = $row;
return $data;
}
@@ -458,7 +458,7 @@ function getTopFailedComputersData() {
}
$data = array();
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$data[] = $row;
return $data;
}
@@ -522,7 +522,7 @@ function getActiveResChartData() {
. "l.userid != $reloadid";
}
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if($row['stateid'] == 14)
$row['stateid'] = $row['laststateid'];
if($row['end'] > time() &&
@@ -583,7 +583,7 @@ function getBlockAllocationData() {
. "bt.end > NOW()";
}
$qh = doQuery($query, 101);
- $row = mysql_fetch_row($qh);
+ $row = mysqli_fetch_row($qh);
$blockcount = $row[0];
# computers in blockComputers for active allocations
if($affilid == 0) {
@@ -612,7 +612,7 @@ function getBlockAllocationData() {
$qh = doQuery($query, 101);
$total = 0;
$used = 0;
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$total++;
if($row['stateid'] == 3 || $row['stateid'] == 8)
$used++;
@@ -642,7 +642,7 @@ function getBlockAllocationData() {
}
$alloc = 0;
$qh = doQuery($query, 101);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$alloc += $row['numMachines'];
if($alloc)
$failed = sprintf('%d / %d (%0.2f %%)', ($alloc - $total), $alloc, (($alloc - $total) / $alloc * 100));
@@ -700,7 +700,7 @@ function getNewReservationData() {
$query .= "ORDER BY rq.start";
$qh = doQuery($query, 101);
$data = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$tmp = explode('.', $row['computer']);
$row['computer'] = $tmp[0];
$row['start'] = date('D h:i', $row['start']);
@@ -758,7 +758,7 @@ function getFailedImagingData() {
$query .= "ORDER BY rq.start";
$qh = doQuery($query, 101);
$data = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
if(is_null($row['revisioncomments']))
$row['revisioncomments'] = '(none)';
$tmp = explode('.', $row['computer']);
@@ -816,7 +816,7 @@ function getManagementNodeData() {
$current = array();
$old = array();
$never = array();
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
$tmp = explode('.', $row['hostname']);
$row['hostname'] = $tmp[0];
if($row['checkin'] < 0)
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/.ht-inc/groups.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/groups.php b/web/.ht-inc/groups.php
index 29ae0f4..306395e 100644
--- a/web/.ht-inc/groups.php
+++ b/web/.ht-inc/groups.php
@@ -1102,7 +1102,7 @@ function processGroupInput($checks=1) {
///
////////////////////////////////////////////////////////////////////////////////
function checkForGroupName($name, $type, $id, $extraid) {
- $name = mysql_real_escape_string($name);
+ $name = vcl_mysql_escape_string($name);
if($type == "user")
$query = "SELECT id FROM usergroup "
. "WHERE name = '$name' AND "
@@ -1114,7 +1114,7 @@ function checkForGroupName($name, $type, $id, $extraid) {
if(! empty($id))
$query .= " AND id != $id";
$qh = doQuery($query, 101);
- if(mysql_num_rows($qh))
+ if(mysqli_num_rows($qh))
return 1;
return 0;
}
@@ -1162,7 +1162,7 @@ function updateGroup($data) {
. "WHERE id = {$data['groupid']}";
}
doQuery($query, 300);
- return mysql_affected_rows($GLOBALS['mysql_link_vcl']);
+ return mysqli_affected_rows($GLOBALS['mysqli_link_vcl']);
}
////////////////////////////////////////////////////////////////////////////////
@@ -1221,7 +1221,7 @@ function addGroup($data) {
}
$qh = doQuery($query, 305);
clearPrivCache();
- return mysql_affected_rows($GLOBALS['mysql_link_vcl']);
+ return mysqli_affected_rows($GLOBALS['mysqli_link_vcl']);
}
////////////////////////////////////////////////////////////////////////////////
@@ -1254,7 +1254,7 @@ function checkForGroupUsage($groupid, $type, &$msg='') {
. "rg.resourcetypeid = rt.id";
$usedby = array();
$qh = doQuery($query, 310);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$usedby[] = $row['name'];
if(count($usedby)) {
$msgs[] = "<h3>Owning User Group for Resource Groups</h3>\n"
@@ -1269,7 +1269,7 @@ function checkForGroupUsage($groupid, $type, &$msg='') {
. "ug.affiliationid = a.id";
$usedby = array();
$qh = doQuery($query, 313);
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$usedby[] = $row['name'];
if(count($usedby)) {
$msgs[] = "<h3>'Editable by' Group for User Groups</h3>\n"
@@ -1281,7 +1281,7 @@ function checkForGroupUsage($groupid, $type, &$msg='') {
. "WHERE usergroupid = $groupid";
$qh = doQuery($query);
$usedby = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$usedby[] = getNodePath($row['privnodeid']);
if(count($usedby)) {
$msgs[] = "<h3>Assigned at Privilege Nodes</h3>\n"
@@ -1294,7 +1294,7 @@ function checkForGroupUsage($groupid, $type, &$msg='') {
. "AND status IN ('requested', 'accepted')";
$qh = doQuery($query, 311);
$usedby = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$usedby[] = $row['name'];
if(count($usedby)) {
$msgs[] = "<h3>Assigned for Block Allocations</h3>\n"
@@ -1304,7 +1304,7 @@ function checkForGroupUsage($groupid, $type, &$msg='') {
$query = "SELECT name FROM serverprofile WHERE admingroupid = $groupid";
$qh = doQuery($query);
$usedby = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$usedby[] = $row['name'];
if(count($usedby)) {
$msgs[] = "<h3>Admin User Group for Server Profiles</h3>\n"
@@ -1314,7 +1314,7 @@ function checkForGroupUsage($groupid, $type, &$msg='') {
$query = "SELECT name FROM serverprofile WHERE logingroupid = $groupid";
$qh = doQuery($query);
$usedby = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$usedby[] = $row['name'];
if(count($usedby)) {
$msgs[] = "<h3>Access User Group for Server Profiles</h3>\n"
@@ -1328,7 +1328,7 @@ function checkForGroupUsage($groupid, $type, &$msg='') {
. "s.requestid = rq.id";
$qh = doQuery($query);
$usedby = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$usedby[] = $row['name'];
if(count($usedby)) {
$msgs[] = "<h3>Admin User Group for Server Requests</h3>\n"
@@ -1342,7 +1342,7 @@ function checkForGroupUsage($groupid, $type, &$msg='') {
. "s.requestid = rq.id";
$qh = doQuery($query);
$usedby = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$usedby[] = $row['name'];
if(count($usedby)) {
$msgs[] = "<h3>Access User Group for Server Requests</h3>\n"
@@ -1366,7 +1366,7 @@ function checkForGroupUsage($groupid, $type, &$msg='') {
$query = "SELECT hostname FROM managementnode WHERE imagelibgroupid = $groupid";
$qh = doQuery($query);
$usedby = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$usedby[] = $row['hostname'];
if(count($usedby)) {
$msgs[] = "<h3>Management Node Image Library Group</h3>\n"
@@ -1376,7 +1376,7 @@ function checkForGroupUsage($groupid, $type, &$msg='') {
$query = "SELECT DISTINCT privnodeid FROM resourcepriv WHERE resourcegroupid = $groupid";
$qh = doQuery($query);
$usedby = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$usedby[] = getNodePath($row['privnodeid']);
if(count($usedby)) {
$msgs[] = "<h3>Assigned at Privilege Nodes</h3>\n"
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/.ht-inc/help.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/help.php b/web/.ht-inc/help.php
index dd73adb..f632f6b 100644
--- a/web/.ht-inc/help.php
+++ b/web/.ht-inc/help.php
@@ -168,7 +168,7 @@ function submitHelpForm() {
. "ORDER BY l.finalend DESC "
. "LIMIT 5";
$qh = doQuery($query, 290);
- while($row = mysql_fetch_assoc($qh)) {
+ while($row = mysqli_fetch_assoc($qh)) {
# only include 1 computer from cluster reservations
if(array_key_exists($row['id'], $requests))
continue;
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/.ht-inc/image.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/image.php b/web/.ht-inc/image.php
index 9447aea..4e07dcd 100644
--- a/web/.ht-inc/image.php
+++ b/web/.ht-inc/image.php
@@ -187,7 +187,7 @@ class Image extends Resource {
. "ORDER BY rq.end DESC "
. "LIMIT 1";
$qh = doQuery($query);
- if($row = mysql_fetch_assoc($qh))
+ if($row = mysqli_fetch_assoc($qh))
$msgs[] = sprintf(i("There is at least one <strong>reservation</strong> for this image. The latest end time is %s."), prettyDatetime($row['end'], 1));;
# check blockComputers
@@ -205,7 +205,7 @@ class Image extends Resource {
. "ORDER BY bt.end DESC "
. "LIMIT 1";
$qh = doQuery($query);
- if($row = mysql_fetch_assoc($qh))
+ if($row = mysqli_fetch_assoc($qh))
$msgs[] = sprintf(i("There is at least one <strong>Block Allocation</strong> with computers currently allocated with this image. Block Allocation %s has the latest end time which is %s."), $row['name'], prettyDatetime($row['end'], 1));
# check blockRequest
@@ -221,7 +221,7 @@ class Image extends Resource {
. "ORDER BY bt.end DESC "
. "LIMIT 1";
$qh = doQuery($query);
- if($row = mysql_fetch_assoc($qh))
+ if($row = mysqli_fetch_assoc($qh))
$msgs[] = sprintf(i("There is at least one <strong>Block Allocation</strong> configured to use this image. Block Allocation %s has the latest end time which is %s."), $row['name'], prettyDatetime($row['end'], 1));
# check serverprofile
@@ -230,7 +230,7 @@ class Image extends Resource {
. "WHERE imageid = $rscid";
$qh = doQuery($query);
$profiles = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$profiles[] = $row['name'];
if(count($profiles))
$msgs[] = i("The following <strong>Server Profiles</strong> are configured to use this image:") . "<br><br>\n" . implode("<br>\n", $profiles);
@@ -245,7 +245,7 @@ class Image extends Resource {
. "s.imagemetaid = im.id AND "
. "s.imageid = $rscid";
$images = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$images[] = $row['prettyname'];
if(count($images))
$msgs[] = i("The following <strong>images</strong> have the selected image assigned as a <strong>subimage</strong>:") . "<br><br>\n" . implode("<br>\n", $images);
@@ -255,7 +255,7 @@ class Image extends Resource {
. "FROM vmprofile "
. "WHERE imageid = $rscid";
$profiles = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$profiles[] = $row['profilename'];
if(count($profiles))
$msgs[] = i("The following <strong>VM Host Profiles</strong> have the this image selected:") . "<br><br>\n" . implode("<br>\n", $profiles);
@@ -801,12 +801,12 @@ class Image extends Resource {
$updates[] = "forcheckout = {$data['checkout']}";
# description
if($data['desc'] != $olddata['description']) {
- $escdesc = mysql_real_escape_string($data['desc']);
+ $escdesc = vcl_mysql_escape_string($data['desc']);
$updates[] = "description = '$escdesc'";
}
# usage
if($data['usage'] != $olddata['usage']) {
- $escusage = mysql_real_escape_string($data['usage']);
+ $escusage = vcl_mysql_escape_string($data['usage']);
$updates[] = "`usage` = '$escusage'";
}
@@ -821,7 +821,7 @@ class Image extends Resource {
if($olddata['ostype'] == 'windows') {
if($data['adauthenabled'] != $olddata['adauthenabled']) {
if($data['adauthenabled']) {
- $esc_baseou = mysql_real_escape_string($data['baseou']);
+ $esc_baseou = vcl_mysql_escape_string($data['baseou']);
$query = "INSERT INTO imageaddomain "
. "(imageid, "
. "addomainid, "
@@ -841,7 +841,7 @@ class Image extends Resource {
elseif($data['adauthenabled'] &&
($data['addomainid'] != $olddata['addomainid'] ||
$data['baseou'] != $olddata['baseOU'])) {
- $esc_baseou = mysql_real_escape_string($data['baseou']);
+ $esc_baseou = vcl_mysql_escape_string($data['baseou']);
$query = "UPDATE imageaddomain "
. "SET addomainid = {$data['addomainid']}, "
. "baseOU = '$esc_baseou' "
@@ -868,7 +868,7 @@ class Image extends Resource {
. "{$data['sethostname']})";
doQuery($query, 101);
$qh = doQuery("SELECT LAST_INSERT_ID() FROM imagemeta", 101);
- if(! $row = mysql_fetch_row($qh))
+ if(! $row = mysqli_fetch_row($qh))
abort(101);
$imagemetaid = $row[0];
$query = "UPDATE image "
@@ -979,7 +979,7 @@ class Image extends Resource {
. "rq.id = rs.requestid";
doQuery($query, 101);
- $agree = mysql_real_escape_string(getContinuationVar('agree'));
+ $agree = vcl_mysql_escape_string(getContinuationVar('agree'));
$query = "INSERT INTO clickThroughs "
. "(userid, "
. "imageid, "
@@ -1095,10 +1095,10 @@ class Image extends Resource {
. "ORDER BY revision DESC "
. "LIMIT 1";
$qh = doQuery($query, 101);
- $row = mysql_fetch_assoc($qh);
+ $row = mysqli_fetch_assoc($qh);
$newrevision = $row['revision'] + 1;
$newname = preg_replace("/{$row['revision']}$/", $newrevision, $row['imagename']);
- $comments = mysql_real_escape_string($comments);
+ $comments = vcl_mysql_escape_string($comments);
$query = "INSERT INTO imagerevision "
. "(imageid, "
. "revision, "
@@ -1155,7 +1155,7 @@ class Image extends Resource {
if($autocaptured)
return 1;
- $agree = mysql_real_escape_string(getContinuationVar('agree'));
+ $agree = vcl_mysql_escape_string(getContinuationVar('agree'));
$query = "INSERT INTO clickThroughs "
. "(userid, "
. "imageid, "
@@ -1188,9 +1188,9 @@ class Image extends Resource {
/////////////////////////////////////////////////////////////////////////////
function addResource($data) {
global $user;
- $data['desc'] = mysql_real_escape_string($data['desc']);
- $data['usage'] = mysql_real_escape_string($data['usage']);
- $data['comments'] = mysql_real_escape_string($data['comments']);
+ $data['desc'] = vcl_mysql_escape_string($data['desc']);
+ $data['usage'] = vcl_mysql_escape_string($data['usage']);
+ $data['comments'] = vcl_mysql_escape_string($data['comments']);
# get architecture of base image
$query = "SELECT i.architecture "
@@ -1199,7 +1199,7 @@ class Image extends Resource {
. "WHERE ir.imageid = i.id AND "
. "ir.id = {$data['basedoffrevisionid']}";
$qh = doQuery($query);
- $row = mysql_fetch_assoc($qh);
+ $row = mysqli_fetch_assoc($qh);
$arch = $row['architecture'];
$ownerdata = getUserInfo($data['owner'], 1);
@@ -1244,7 +1244,7 @@ class Image extends Resource {
# ad authentication
if($data['adauthenabled']) {
- $esc_baseou = mysql_real_escape_string($data['baseou']);
+ $esc_baseou = vcl_mysql_escape_string($data['baseou']);
$query = "INSERT INTO imageaddomain "
. "(imageid, "
. "addomainid, "
@@ -1554,7 +1554,7 @@ class Image extends Resource {
. "FROM subimages "
. "WHERE imagemetaid = $imagemetaid";
$qh = doQuery($query, 101);
- $row = mysql_fetch_row($qh);
+ $row = mysqli_fetch_row($qh);
if($row[0] == 0) {
$rc = checkClearImageMeta($imagemetaid, $imageid, 'subimages');
if($rc)
@@ -1570,7 +1570,7 @@ class Image extends Resource {
$query = "SELECT imageid FROM subimages WHERE imagemetaid = $imagemetaid";
$qh = doQuery($query, 101);
$subimages = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$subimages[] = $row['imageid'];
}
@@ -1827,7 +1827,7 @@ class Image extends Resource {
if(! empty($id))
$query .= " AND id != $id";
$qh = doQuery($query, 101);
- if(mysql_num_rows($qh))
+ if(mysqli_num_rows($qh))
return 1;
return 0;
}
@@ -1857,7 +1857,7 @@ class Image extends Resource {
. "WHERE name = '$nodename' AND "
. "parent = 3";
$qh = doQuery($query, 101);
- if(! $row = mysql_fetch_assoc($qh)) {
+ if(! $row = mysqli_fetch_assoc($qh)) {
$query2 = "INSERT INTO privnode "
. "(parent, "
. "name) "
@@ -1866,7 +1866,7 @@ class Image extends Resource {
. "'$nodename')";
doQuery($query2, 101);
$qh = doQuery($query, 101);
- $row = mysql_fetch_assoc($qh);
+ $row = mysqli_fetch_assoc($qh);
}
$parent = $row['id'];
$query = "SELECT id "
@@ -1874,7 +1874,7 @@ class Image extends Resource {
. "WHERE name = '{$ownerdata['login']}-$ownerid' AND "
. "parent = $parent";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh))
+ if($row = mysqli_fetch_assoc($qh))
$newnode = $row['id'];
else {
$query = "INSERT INTO privnode "
@@ -1882,7 +1882,7 @@ class Image extends Resource {
. "VALUES ($parent, '{$ownerdata['login']}-$ownerid')";
doQuery($query, 101);
$qh = doQuery("SELECT LAST_INSERT_ID() FROM privnode", 101);
- $row = mysql_fetch_row($qh);
+ $row = mysqli_fetch_row($qh);
$newnode = $row[0];
}
@@ -1895,7 +1895,7 @@ class Image extends Resource {
. "FROM usergroup "
. "WHERE name = 'manageNewImages'";
$qh = doQuery($query, 101);
- $row = mysql_fetch_assoc($qh);
+ $row = mysqli_fetch_assoc($qh);
$ownergroupid = $row['id'];
if($virtual)
$prefix = 'newvmimages';
@@ -1907,7 +1907,7 @@ class Image extends Resource {
. "ownerusergroupid = $ownergroupid AND "
. "resourcetypeid = 13";
$qh = doQuery($query, 101);
- if($row = mysql_fetch_assoc($qh))
+ if($row = mysqli_fetch_assoc($qh))
$resourcegroupid = $row['id'];
else {
$query = "INSERT INTO resourcegroup "
@@ -1919,7 +1919,7 @@ class Image extends Resource {
. "13)";
doQuery($query, 305);
$qh = doQuery("SELECT LAST_INSERT_ID() FROM resourcegroup", 101);
- $row = mysql_fetch_row($qh);
+ $row = mysqli_fetch_row($qh);
$resourcegroupid = $row[0];
// map group to newimages/newvmimages comp group
@@ -1932,7 +1932,7 @@ class Image extends Resource {
. "WHERE name = '$rgroupname' AND "
. "resourcetypeid = 12";
$qh = doQuery($query, 101);
- $row = mysql_fetch_assoc($qh);
+ $row = mysqli_fetch_assoc($qh);
$compResGrpid = $row['id'];
$query = "INSERT INTO resourcemap "
. "(resourcegroupid1, "
@@ -1980,7 +1980,7 @@ class Image extends Resource {
. "WHERE resourcetypeid = 13 AND "
. "subid = $imageid";
$qh = doQuery($query);
- if(! ($row = mysql_fetch_assoc($qh)))
+ if(! ($row = mysqli_fetch_assoc($qh)))
return;
$resid = $row['id'];
$olduserdata = getUserInfo($oldownerid, 1, 1);
@@ -1994,7 +1994,7 @@ class Image extends Resource {
. "rgm.resourcegroupid = rg.id AND "
. "rg.name IN ($oldgroups)";
$qh = doQuery($query);
- if(! ($row = mysql_fetch_assoc($qh)))
+ if(! ($row = mysqli_fetch_assoc($qh)))
return;
$oldgroup = $row['name'];
$oldgroupid = $row['id'];
@@ -2108,7 +2108,7 @@ class Image extends Resource {
. "(cm.OStypeid = ot.id OR "
. "cm.OSid = o.id)";
$qh = doQuery($query, 101);
- if(! (mysql_num_rows($qh))) {
+ if(! (mysqli_num_rows($qh))) {
# not enabled, add entry for method and image revision
$query = "INSERT INTO connectmethodmap "
. "(connectmethodid, "
@@ -2157,7 +2157,7 @@ class Image extends Resource {
$methods = getContinuationVar('methods');
$revids = getContinuationVar('revids');
$curmethods = getImageConnectMethods($imageid);
- $remidlist = mysql_real_escape_string(processInputVar('ids', ARG_STRING));
+ $remidlist = vcl_mysql_escape_string(processInputVar('ids', ARG_STRING));
$remids = explode(',', $remidlist);
$revid = processInputVar('revid', ARG_NUMERIC);
$newimage = getContinuationVar('newimage');
@@ -2199,7 +2199,7 @@ class Image extends Resource {
. "(cm.OStypeid = ot.id OR "
. "cm.OSid = o.id)";
$qh = doQuery($query, 101);
- if(mysql_num_rows($qh))
+ if(mysqli_num_rows($qh))
# if so, add disabled entry for image revision and method
$insvals[] = "($id, $revid, 1)";
}
@@ -2246,7 +2246,7 @@ class Image extends Resource {
$comments = htmlspecialchars($comments);
if(get_magic_quotes_gpc())
$comments = stripslashes($comments);
- $comments = mysql_real_escape_string($comments);
+ $comments = vcl_mysql_escape_string($comments);
$query = "UPDATE imagerevision "
. "SET comments = '$comments' "
. "WHERE id = $revisionid";
@@ -2306,9 +2306,9 @@ class Image extends Resource {
. "rs.imagerevisionid IN ($checkedids) AND "
. "rq.stateid NOT IN (1, 5, 11, 12)";
$qh = doQuery($query);
- if(mysql_num_rows($qh)) {
+ if(mysqli_num_rows($qh)) {
$inuseids = array();
- while($row = mysql_fetch_assoc($qh))
+ while($row = mysqli_fetch_assoc($qh))
$inuseids[] = $row['revision'];
$inuseids = implode(',', $inuseids);
$rc = array('status' => 'error',
http://git-wip-us.apache.org/repos/asf/vcl/blob/e5058500/web/.ht-inc/managementnode.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/managementnode.php b/web/.ht-inc/managementnode.php
index 2b5b08e..dd49e2c 100644
--- a/web/.ht-inc/managementnode.php
+++ b/web/.ht-inc/managementnode.php
@@ -203,7 +203,7 @@ class ManagementNode extends Resource {
. "ORDER BY rq.end DESC "
. "LIMIT 1";
$qh = doQuery($query);
- if($row = mysql_fetch_assoc($qh))
+ if($row = mysqli_fetch_assoc($qh))
$msgs[] = "There is at least one <strong>reservation</strong> being processed by this management node. The latest end time is " . prettyDatetime($row['end'], 1) . '.';
# check blockRequest
@@ -219,7 +219,7 @@ class ManagementNode extends Resource {
. "ORDER BY bt.end DESC "
. "LIMIT 1";
$qh = doQuery($query);
- if($row = mysql_fetch_assoc($qh))
+ if($row = mysqli_fetch_assoc($qh))
$msgs[] = "There is at least one <strong>Block Allocation</strong> being handled by this management node. Block Allocation \"{$row['name']}\" has the latest end time which is " . prettyDatetime($row['end'], 1) . '.';
@@ -246,7 +246,7 @@ class ManagementNode extends Resource {
function toggleDeleteResource($rscid) {
$query = "SELECT stateid FROM managementnode WHERE id = $rscid";
$qh = doQuery($query);
- if($row = mysql_fetch_assoc($qh)) {
+ if($row = mysqli_fetch_assoc($qh)) {
if($row['stateid'] == 1)
$query = "UPDATE managementnode SET stateid = 10 WHERE id = $rscid";
else
@@ -514,8 +514,8 @@ class ManagementNode extends Resource {
}
}
else {
- $esc = array('sysadminemail' => mysql_real_escape_string($data['sysadminemail']),
- 'sharedmailbox' => mysql_real_escape_string($data['sharedmailbox']));
+ $esc = array('sysadminemail' => vcl_mysql_escape_string($data['sysadminemail']),
+ 'sharedmailbox' => vcl_mysql_escape_string($data['sharedmailbox']));
$olddata = getContinuationVar('olddata');
$updates = array();
@@ -992,7 +992,7 @@ class ManagementNode extends Resource {
. "rq.laststateid NOT IN (1,5,11,12) AND "
. "rq.userid != $vclreloadid";
$qh = doQuery($query);
- if(mysql_num_rows($qh)) {
+ if(mysqli_num_rows($qh)) {
$return['error'] = 1;
$errormsg[] = "This management node is the NAT host for computers that have active reservations. NAT host<br>settings cannot be changed while providing NAT for active reservations.";
}
@@ -1020,8 +1020,8 @@ class ManagementNode extends Resource {
function addResource($data) {
global $user;
$ownerid = getUserlistID($data['owner']);
- $esc = array('sysadminemail' => mysql_real_escape_string($data['sysadminemail']),
- 'sharedmailbox' => mysql_real_escape_string($data['sharedmailbox']));
+ $esc = array('sysadminemail' => vcl_mysql_escape_string($data['sysadminemail']),
+ 'sharedmailbox' => vcl_mysql_escape_string($data['sharedmailbox']));
$keys = array('IPaddress', 'hostname',
'ownerid', 'stateid',
'checkininterval', 'installpath',
@@ -1116,7 +1116,7 @@ class ManagementNode extends Resource {
if($id != 0)
$query .= " AND id != $id";
$qh = doQuery($query);
- return mysql_num_rows($qh);
+ return mysqli_num_rows($qh);
}
}
?>
[5/5] vcl git commit: Merge branch 'VCL-1106_updates_for_php7' into
develop
Posted by jf...@apache.org.
Merge branch 'VCL-1106_updates_for_php7' into develop
Project: http://git-wip-us.apache.org/repos/asf/vcl/repo
Commit: http://git-wip-us.apache.org/repos/asf/vcl/commit/ce1e6d7f
Tree: http://git-wip-us.apache.org/repos/asf/vcl/tree/ce1e6d7f
Diff: http://git-wip-us.apache.org/repos/asf/vcl/diff/ce1e6d7f
Branch: refs/heads/develop
Commit: ce1e6d7fd0b0373b2e75ecc002ccb3511926f0cd
Parents: de9e192 e505850
Author: Josh Thompson <jf...@ncsu.edu>
Authored: Mon Oct 29 15:51:03 2018 -0400
Committer: Josh Thompson <jf...@ncsu.edu>
Committed: Mon Oct 29 15:51:03 2018 -0400
----------------------------------------------------------------------
web/.ht-inc/addomain.php | 6 +-
web/.ht-inc/authentication.php | 22 +-
web/.ht-inc/authmethods/itecsauth.php | 36 +-
web/.ht-inc/authmethods/ldapauth.php | 32 +-
web/.ht-inc/authmethods/shibauth.php | 36 +-
web/.ht-inc/blockallocations.php | 106 +++---
web/.ht-inc/computer.php | 72 ++--
web/.ht-inc/config.php | 44 +--
web/.ht-inc/dashboard.php | 32 +-
web/.ht-inc/groups.php | 28 +-
web/.ht-inc/help.php | 2 +-
web/.ht-inc/image.php | 78 ++---
web/.ht-inc/managementnode.php | 18 +-
web/.ht-inc/oneclick.php | 4 +-
web/.ht-inc/privileges.php | 72 ++--
web/.ht-inc/requests.php | 18 +-
web/.ht-inc/resource.php | 4 +-
web/.ht-inc/schedule.php | 4 +-
web/.ht-inc/serverprofiles.php | 12 +-
web/.ht-inc/siteconfig.php | 82 ++---
web/.ht-inc/sitemaintenance.php | 8 +-
web/.ht-inc/statistics.php | 22 +-
web/.ht-inc/userpreferences.php | 4 +-
web/.ht-inc/utils.php | 537 +++++++++++++++--------------
web/.ht-inc/vm.php | 26 +-
web/.ht-inc/xmlrpcWrappers.php | 78 ++---
web/index.php | 4 +-
web/shibauth/index.php | 16 +-
28 files changed, 708 insertions(+), 695 deletions(-)
----------------------------------------------------------------------