Clean up variable naming in query_parameters()

This commit is contained in:
Chris Morgan
2006-07-11 19:25:16 +00:00
committed by WineHQ
parent 069a51fba8
commit ec77d82734

View File

@@ -56,41 +56,41 @@ function query_parameters()
mysql_select_db(APPS_DB, $hAppdbLink); mysql_select_db(APPS_DB, $hAppdbLink);
} }
$data = func_get_args(); $aData = func_get_args();
$query = $data[0]; $sQuery = $aData[0];
$tokens = split("[&?~]", $query); /* NOTE: no need to escape characters inside of [] in regex */ $aTokens = split("[&?~]", $sQuery); /* NOTE: no need to escape characters inside of [] in regex */
$preparedquery = $tokens[0]; $sPreparedquery = $aTokens[0];
$count = strlen($tokens[0]); $iCount = strlen($aTokens[0]);
/* do we have the correct number of tokens to the number of parameters provided? */ /* do we have the correct number of tokens to the number of parameters provided? */
if(count($tokens) != count($data)) if(count($aTokens) != count($aData))
return NULL; /* count mismatch, return NULL */ return NULL; /* count mismatch, return NULL */
for ($i=1; $i < count($tokens); $i++) for ($i=1; $i < count($aTokens); $i++)
{ {
$char = substr($query, $count, 1); $char = substr($sQuery, $iCount, 1);
$count += (strlen($tokens[$i])+1); $iCount += (strlen($aTokens[$i])+1);
if ($char == "&") if ($char == "&")
{ {
$fp = @fopen($data[$i], 'r'); $fp = @fopen($aData[$i], 'r');
$pdata = ""; $pdata = "";
if ($fp) if ($fp)
{ {
while (($buf = fread($fp, 4096)) != false) while (($sBuf = fread($fp, 4096)) != false)
{ {
$pdata .= $buf; $pdata .= $sBuf;
} }
fclose($fp); fclose($fp);
} }
} else } else
{ {
$pdata = &$data[$i]; $pdata = &$aData[$i];
} }
$preparedquery .= ($char != "~" ? mysql_real_escape_string($pdata) : $pdata); $sPreparedquery .= ($char != "~" ? mysql_real_escape_string($pdata) : $pdata);
$preparedquery .= $tokens[$i]; $sPreparedquery .= $aTokens[$i];
} }
return query_appdb($preparedquery); return query_appdb($sPreparedquery);
} }
function query_bugzilladb($sQuery,$sComment="") function query_bugzilladb($sQuery,$sComment="")