Make code more consistent by making it follow the appdb coding standards. Fix some spaces vs. tabs odd indenting.

This commit is contained in:
Chris Morgan
2006-06-21 01:04:12 +00:00
committed by WineHQ
parent d8a459af17
commit 67550405c3
19 changed files with 544 additions and 556 deletions

View File

@@ -58,14 +58,14 @@ else
if($aClean['thread'] > 0)
{
$result = query_appdb("SELECT * FROM appComments WHERE commentId = ".$aClean['thread']);
$ob = mysql_fetch_object($result);
if($ob)
$hResult = query_appdb("SELECT * FROM appComments WHERE commentId = ".$aClean['thread']);
$oRow = mysql_fetch_object($hResult);
if($oRow)
{
$mesTitle = "<b>Replying To ...</b> $ob->subject\n";
$originator = $ob->userId;
echo html_frame_start($ob->subject,500);
echo htmlify_urls($ob->body), "<br /><br />\n";
$mesTitle = "<b>Replying To ...</b> $oRow->subject\n";
$originator = $oRow->userId;
echo html_frame_start($oRow->subject,500);
echo htmlify_urls($oRow->body), "<br /><br />\n";
echo html_frame_end();
}
}

View File

@@ -64,12 +64,12 @@ $commentIds = query_appdb("SELECT commentId from appComments ORDER BY ".
"appComments.time ASC LIMIT $offset, $ItemsPerPage;");
while ($ob = mysql_fetch_object($commentIds))
{
$qstring = "SELECT from_unixtime(unix_timestamp(time), \"%W %M %D %Y, %k:%i\") as time, ".
$sQuery = "SELECT from_unixtime(unix_timestamp(time), \"%W %M %D %Y, %k:%i\") as time, ".
"commentId, parentId, versionId, userid, subject, body ".
"FROM appComments WHERE commentId = $ob->commentId;";
$result = query_appdb($qstring);
$hResult = query_appdb($sQuery);
/* call view_app_comment to display the comment */
$comment_ob = mysql_fetch_object($result);
$comment_ob = mysql_fetch_object($hResult);
view_app_comment($comment_ob);
}

View File

@@ -30,14 +30,14 @@ if ($aClean['sub'])
if ($aClean['queueId'])
{
//get data
$query = "SELECT queueId, appId, versionId,".
$sQuery = "SELECT queueId, appId, versionId,".
"userId, maintainReason, superMaintainer,".
"UNIX_TIMESTAMP(submitTime) as submitTime ".
"FROM appMaintainerQueue WHERE queueId = ".$aClean['queueId'].";";
$result = query_appdb($query);
$ob = mysql_fetch_object($result);
$oUser = new User($ob->userId);
mysql_free_result($result);
$hResult = query_appdb($sQuery);
$oRow = mysql_fetch_object($hResult);
$oUser = new User($oRow->userId);
mysql_free_result($hResult);
}
else
{
@@ -70,7 +70,7 @@ if ($aClean['sub'])
$firstDisplay = true; /* if false we need to fix up table rows appropriately */
$other_users = getMaintainersUserIdsFromAppIdVersionId($ob->versionId);
$other_users = getMaintainersUserIdsFromAppIdVersionId($oRow->versionId);
if($other_users)
{
$foundMaintainers = true;
@@ -88,7 +88,7 @@ if ($aClean['sub'])
}
}
$other_users = getSuperMaintainersUserIdsFromAppId($ob->appId);
$other_users = getSuperMaintainersUserIdsFromAppId($oRow->appId);
if($other_users)
{
$foundMaintainers = true;
@@ -115,7 +115,7 @@ if ($aClean['sub'])
echo '<tr valign="top"><td class="color0"><b>This user also maintains these apps:</b></td>',"\n";
$firstDisplay = true;
$other_apps = getAppsFromUserId($ob->userId);
$other_apps = getAppsFromUserId($oRow->userId);
if($other_apps)
{
while(list($index, list($appIdOther, $versionIdOther, $superMaintainerOther)) = each($other_apps))
@@ -142,8 +142,8 @@ if ($aClean['sub'])
echo "<td>User maintains no other applications</td></tr>\n";
}
$oApp = new Application($ob->appId);
$oVersion = new Version($ob->versionId);
$oApp = new Application($oRow->appId);
$oVersion = new Version($oRow->versionId);
//app name
echo '<tr valign=top><td class=color0><b>App Name</b></td>',"\n";
@@ -155,7 +155,7 @@ if ($aClean['sub'])
//maintainReason
echo '<tr valign=top><td class=color0><b>Maintainer request reason</b></td>',"\n";
echo '<td><textarea name="maintainReason" rows=10 cols=35>'.$ob->maintainReason.'</textarea></td></tr>',"\n";
echo '<td><textarea name="maintainReason" rows=10 cols=35>'.$oRow->maintainReason.'</textarea></td></tr>',"\n";
//email response
echo '<tr valign=top><td class=color0><b>Email reply</b></td>',"\n";
@@ -183,11 +183,11 @@ if ($aClean['sub'])
else if ($aClean['add'] && $aClean['queueId'])
{
/* create a new user object for the maintainer */
$maintainerUser = new User($ob->userId);
$maintainerUser = new User($oRow->userId);
/* add the user as a maintainer and return the statusMessage */
$statusMessage = $maintainerUser->addAsMaintainer($ob->appId, $ob->versionId,
$ob->superMaintainer,
$statusMessage = $maintainerUser->addAsMaintainer($oRow->appId, $oRow->versionId,
$oRow->superMaintainer,
$aClean['queueId']);
//done
addmsg("<p><b>$statusMessage</b></p>", 'green');
@@ -197,8 +197,8 @@ if ($aClean['sub'])
$sEmail = $oUser->sEmail;
if ($sEmail)
{
$oApp = new Application($ob->appId);
$oVersion = new Version($ob->versionId);
$oApp = new Application($oRow->appId);
$oVersion = new Version($oRow->versionId);
$sSubject = "Application Maintainer Request Report";
$sMsg = "Your application to be the maintainer of ".$oApp->sName." ".$oVersion->sName." was rejected. ";
$sMsg .= $aClean['replyText'];
@@ -209,10 +209,10 @@ if ($aClean['sub'])
}
//delete main item
$query = "DELETE from appMaintainerQueue where queueId = ".$aClean['queueId'].";";
$result = query_appdb($query,"unable to delete selected maintainer application");
$sQuery = "DELETE from appMaintainerQueue where queueId = ".$aClean['queueId'].";";
$hResult = query_appdb($sQuery,"unable to delete selected maintainer application");
echo html_frame_start("Delete maintainer application",400,"",0);
if($result)
if($hResult)
{
//success
echo "<p>Maintainer application was successfully deleted from the Queue.</p>\n";
@@ -232,14 +232,14 @@ if ($aClean['sub'])
echo '<form name="qform" action="adminMaintainerQueue.php" method="post" enctype="multipart/form-data">',"\n";
//get available maintainers
$query = "SELECT queueId, appId, versionId,".
$sQuery = "SELECT queueId, appId, versionId,".
"userId, maintainReason,".
"superMaintainer,".
"submitTime as submitTime ".
"from appMaintainerQueue;";
$result = query_appdb($query);
$hResult = query_appdb($sQuery);
if(!$result || !mysql_num_rows($result))
if(!$hResult || !mysql_num_rows($hResult))
{
//no apps in queue
echo html_frame_start("","90%");
@@ -269,17 +269,17 @@ if ($aClean['sub'])
echo "</tr>\n\n";
$c = 1;
while($ob = mysql_fetch_object($result))
while($oRow = mysql_fetch_object($hResult))
{
$oUser = new User($ob->userId);
$oApp = new Application($ob->appId);
$oVersion = new Version($ob->versionId);
$oUser = new User($oRow->userId);
$oApp = new Application($oRow->appId);
$oVersion = new Version($oRow->versionId);
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
echo "<tr class=$bgcolor>\n";
echo " <td>".print_date(mysqldatetime_to_unixtimestamp($ob->submitTime))." &nbsp;</td>\n";
echo " <td>".print_date(mysqldatetime_to_unixtimestamp($oRow->submitTime))." &nbsp;</td>\n";
echo " <td>".$oApp->sName."</td>\n";
if($ob->superMaintainer)
if($oRow->superMaintainer)
{
echo "<td>N/A</td>\n";
echo "<td>Yes</td>\n";
@@ -290,7 +290,7 @@ if ($aClean['sub'])
}
echo " <td><a href=\"mailto:".$oUser->sEmail."\">".$oUser->sRealname."</a></td>\n";
echo " <td>[<a href=\"adminMaintainerQueue.php?sub=view&queueId=$ob->queueId\">answer</a>]</td>\n";
echo " <td>[<a href=\"adminMaintainerQueue.php?sub=view&queueId=$oRow->queueId\">answer</a>]</td>\n";
echo "</tr>\n\n";
$c++;
}

View File

@@ -67,12 +67,12 @@ else
echo '<table border=0 cellpadding=6 cellspacing=0 width="100%">',"\n";
$i = 0;
$result = query_appdb("SELECT * FROM appData WHERE appId = $oApp->iAppId AND type = 'url' AND versionId = 0");
if($result && mysql_num_rows($result) > 0)
$hResult = query_appdb("SELECT * FROM appData WHERE appId = $oApp->iAppId AND type = 'url' AND versionId = 0");
if($hResult && mysql_num_rows($hResult) > 0)
{
echo '<tr><td class=color1><b>Delete</b></td><td class=color1>',"\n";
echo '<b>Description</b></td><td class=color1><b>URL</b></td></tr>',"\n";
while($ob = mysql_fetch_object($result))
while($oRow = mysql_fetch_object($hResult))
{
$temp0 = "adelete[".$i."]";
$temp1 = "adescription[".$i."]";
@@ -81,11 +81,11 @@ else
$temp4 = "aOldDesc[".$i."]";
$temp5 = "aOldURL[".$i."]";
echo '<tr><td class=color3><input type="checkbox" name="'.$temp0.'"></td>',"\n";
echo '<td class=color3><input size=45% type="text" name="'.$temp1.'" value ="'.stripslashes($ob->description).'"</td>',"\n";
echo '<td class=color3><input size=45% type="text" name="'.$temp2.'" value="'.$ob->url.'"></td></tr>',"\n";
echo '<input type=hidden name="'.$temp3.'" value='.$ob->id.'>';
echo '<input type=hidden name="'.$temp4.'" value="'.stripslashes($ob->description).'">';
echo '<input type=hidden name="'.$temp5.'" value="'.$ob->url.'">',"\n";
echo '<td class=color3><input size=45% type="text" name="'.$temp1.'" value ="'.stripslashes($oRow->description).'"</td>',"\n";
echo '<td class=color3><input size=45% type="text" name="'.$temp2.'" value="'.$oRow->url.'"></td></tr>',"\n";
echo '<input type=hidden name="'.$temp3.'" value='.$oRow->id.'>';
echo '<input type=hidden name="'.$temp4.'" value="'.stripslashes($oRow->description).'">';
echo '<input type=hidden name="'.$temp5.'" value="'.$oRow->url.'">',"\n";
$i++;
}
} else

View File

@@ -59,12 +59,12 @@ if(!empty($aClean['submit']))
echo '<table border=0 cellpadding=6 cellspacing=0 width="100%">',"\n";
$i = 0;
$result = query_appdb("SELECT * FROM appData WHERE versionId = ".$oVersion->iVersionId." AND type = 'url'");
if($result && mysql_num_rows($result) > 0)
$hResult = query_appdb("SELECT * FROM appData WHERE versionId = ".$oVersion->iVersionId." AND type = 'url'");
if($hResult && mysql_num_rows($hResult) > 0)
{
echo '<tr><td class=color1><b>Delete</b></td><td class=color1>',"\n";
echo '<b>Description</b></td><td class=color1><b>URL</b></td></tr>',"\n";
while($ob = mysql_fetch_object($result))
while($oRow = mysql_fetch_object($hResult))
{
$temp0 = "adelete[".$i."]";
$temp1 = "adescription[".$i."]";
@@ -73,11 +73,11 @@ if(!empty($aClean['submit']))
$temp4 = "aOldDesc[".$i."]";
$temp5 = "aOldURL[".$i."]";
echo '<tr><td class=color3><input type="checkbox" name="'.$temp0.'"></td>',"\n";
echo '<td class=color3><input size="45" type="text" name="'.$temp1.'" value ="'.stripslashes($ob->description).'"</td>',"\n";
echo '<td class=color3><input size="45" type="text" name="'.$temp2.'" value="'.$ob->url.'"></td></tr>',"\n";
echo '<input type="hidden" name="'.$temp3.'" value="'.$ob->id.'" />';
echo '<input type="hidden" name="'.$temp4.'" value="'.stripslashes($ob->description).'" />';
echo '<input type="hidden" name="'.$temp5.'" value="'.$ob->url.'" />',"\n";
echo '<td class=color3><input size="45" type="text" name="'.$temp1.'" value ="'.stripslashes($oRow->description).'"</td>',"\n";
echo '<td class=color3><input size="45" type="text" name="'.$temp2.'" value="'.$oRow->url.'"></td></tr>',"\n";
echo '<input type="hidden" name="'.$temp3.'" value="'.$oRow->id.'" />';
echo '<input type="hidden" name="'.$temp4.'" value="'.stripslashes($oRow->description).'" />';
echo '<input type="hidden" name="'.$temp5.'" value="'.$oRow->url.'" />',"\n";
$i++;
}
} else

View File

@@ -11,12 +11,12 @@ if(!$_SESSION['current']->hasPriv("admin"))
function build_app_list()
{
$result = query_appdb("SELECT appId, appName FROM appFamily ORDER BY appName");
$hResult = query_appdb("SELECT appId, appName FROM appFamily ORDER BY appName");
echo "<select name=appId size=5 onChange='this.form.submit()'>\n";
while($ob = mysql_fetch_object($result))
while($oRow = mysql_fetch_object($hResult))
{
echo "<option value=$ob->appId>$ob->appName</option>\n";
echo "<option value=$oRow->appId>$oRow->appName</option>\n";
}
echo "</select>\n";
}
@@ -26,14 +26,14 @@ if($cmd)
{
if($cmd == "delete")
{
$result = query_appdb("DELETE FROM appBundle WHERE appId = $appId AND bundleId = $bundleId");
if($result)
$hResult = query_appdb("DELETE FROM appBundle WHERE appId = $appId AND bundleId = $bundleId");
if($hResult)
addmsg("App deleted from bundle", "green");
}
if($cmd == "add")
{
$result = query_appdb("INSERT INTO appBundle VALUES ($bundleId, $appId)");
if($result)
$hResult = query_appdb("INSERT INTO appBundle VALUES ($bundleId, $appId)");
if($hResult)
addmsg("App $appId added to Bundle $bundleId", "green");
}
redirectref();
@@ -43,10 +43,10 @@ else
{
apidb_header("Edit Application Bundle");
$result = query_appdb("SELECT bundleId, appBundle.appId, appName FROM appBundle, appFamily ".
$hResult = query_appdb("SELECT bundleId, appBundle.appId, appName FROM appBundle, appFamily ".
"WHERE bundleId = $bundleId AND appFamily.appId = appBundle.appId");
if($result && mysql_num_rows($result))
if($hResult && mysql_num_rows($hResult))
{
echo html_frame_start("Apps in this Bundle","300",'',0);
echo "<table width='100%' border=0 cellpadding=3 cellspacing=0>\n\n";
@@ -57,15 +57,15 @@ else
echo "</tr>\n\n";
$c = 1;
while($ob = mysql_fetch_object($result))
while($oRow = mysql_fetch_object($hResult))
{
//set row color
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
$delete_link = "[<a href='editBundle.php?cmd=delete&bundleId=$bundleId&appId=$ob->appId'>delete</a>]";
$delete_link = "[<a href='editBundle.php?cmd=delete&bundleId=$bundleId&appId=$oRow->appId'>delete</a>]";
echo "<tr class=$bgcolor>\n";
echo " <td>$ob->appName &nbsp;</td>\n";
echo " <td>$oRow->appName &nbsp;</td>\n";
echo " <td>$delete_link &nbsp;</td>\n";
echo "</tr>\n\n";
@@ -74,7 +74,6 @@ else
echo "</table>\n\n";
echo html_frame_end();
}
echo "<form method=post action=editBundle.php>\n";

View File

@@ -47,9 +47,9 @@ function display_catpath($catId, $appId, $versionId = '')
function display_bundle($appId)
{
$oApp = new Application($appId);
$result = query_appdb("SELECT appFamily.appId, appName, description FROM appBundle, appFamily ".
$hResult = query_appdb("SELECT appFamily.appId, appName, description FROM appBundle, appFamily ".
"WHERE appFamily.queued='false' AND bundleId = $appId AND appBundle.appId = appFamily.appId");
if(!$result || mysql_num_rows($result) == 0)
if(!$hResult || mysql_num_rows($hResult) == 0)
{
return; // do nothing
}
@@ -63,7 +63,8 @@ function display_bundle($appId)
echo "</tr>\n\n";
$c = 0;
while($ob = mysql_fetch_object($result)) {
while($ob = mysql_fetch_object($hResult))
{
//set row color
$bgcolor = ($c % 2 == 0) ? "color0" : "color1";
@@ -81,7 +82,8 @@ function display_bundle($appId)
}
/* Show note */
function show_note($sType,$oData){
function show_note($sType,$oData)
{
global $oVersion;
switch($sType)

View File

@@ -207,47 +207,47 @@ function forum_lookup_user($iUserId)
}
/**
* display a single comment (in $ob)
* display a single comment (in $oRow)
*/
function view_app_comment($ob)
function view_app_comment($oRow)
{
echo html_frame_start('','98%');
echo '<table width="100%" border="0" cellpadding="2" cellspacing="1">',"\n";
$ob->subject = stripslashes($ob->subject);
$ob->body = stripslashes($ob->body);
$oRow->subject = stripslashes($oRow->subject);
$oRow->body = stripslashes($oRow->body);
// message header
echo "<tr bgcolor=\"#E0E0E0\"><td><a name=Comment-".$ob->commentId."></a>\n";
echo " <b>".$ob->subject."</b><br />\n";
echo " by ".forum_lookup_user($ob->userId)." on ".$ob->time."<br />\n";
echo "<tr bgcolor=\"#E0E0E0\"><td><a name=Comment-".$oRow->commentId."></a>\n";
echo " <b>".$oRow->subject."</b><br />\n";
echo " by ".forum_lookup_user($oRow->userId)." on ".$oRow->time."<br />\n";
echo "</td></tr><tr><td>\n";
// body
echo htmlify_urls($ob->body), "<br /><br />\n";
echo htmlify_urls($oRow->body), "<br /><br />\n";
// only add RE: once
if(eregi("RE:", $ob->subject))
$subject = $ob->subject;
if(eregi("RE:", $oRow->subject))
$subject = $oRow->subject;
else
$subject = "RE: ".$ob->subject;
$subject = "RE: ".$oRow->subject;
// reply post buttons
echo " [<a href=\"addcomment.php?appId=$ob->appId&amp;versionId=$ob->versionId\"><small>post new</small></a>] \n";
echo " [<a href=\"addcomment.php?appId=$ob->appId&amp;versionId=$ob->versionId&amp;subject=".
urlencode("$subject")."&amp;thread=$ob->commentId\"><small>reply to this</small></a>] \n";
echo " [<a href=\"addcomment.php?appId=$oRow->appId&amp;versionId=$oRow->versionId\"><small>post new</small></a>] \n";
echo " [<a href=\"addcomment.php?appId=$oRow->appId&amp;versionId=$oRow->versionId&amp;subject=".
urlencode("$subject")."&amp;thread=$oRow->commentId\"><small>reply to this</small></a>] \n";
echo "</td></tr>\n";
// delete message button, for admins
if ($_SESSION['current']->hasPriv("admin")
|| $_SESSION['current']->isMaintainer($ob->versionId)
|| $_SESSION['current']->isSuperMaintainer($ob->appId))
|| $_SESSION['current']->isMaintainer($oRow->versionId)
|| $_SESSION['current']->isSuperMaintainer($oRow->appId))
{
echo "<tr>";
echo "<td><form method=\"post\" name=\"message\" action=\"".BASE."deletecomment.php\"><input type=\"submit\" value=\"Delete\" class=\"button\">\n";
echo "<input type=\"hidden\" name=\"commentId\" value=\"$ob->commentId\" />";
echo "<input type=\"hidden\" name=\"commentId\" value=\"$oRow->commentId\" />";
echo "</form>\n";
echo "</td></tr>";
}
@@ -273,9 +273,9 @@ function grab_comments($versionId, $parentId = -1)
"FROM appComments, appVersion WHERE appComments.versionId = appVersion.versionId AND appComments.versionId = '$versionId' ".
$extra.
"ORDER BY appComments.time ASC";
$result = query_appdb($qstring);
$hResult = query_appdb($qstring);
return $result;
return $hResult;
}
@@ -283,16 +283,16 @@ function grab_comments($versionId, $parentId = -1)
* display nested comments
* handle is a db result set
*/
function do_display_comments_nested($handle)
function do_display_comments_nested($hResult)
{
while($ob = mysql_fetch_object($handle))
while($oRow = mysql_fetch_object($hResult))
{
view_app_comment($ob);
$result = grab_comments($ob->versionId, $ob->commentId);
if($result && mysql_num_rows($result))
view_app_comment($oRow);
$hResult2 = grab_comments($oRow->versionId, $oRow->commentId);
if($hResult && mysql_num_rows($hResult2))
{
echo "<blockquote>\n";
do_display_comments_nested($result);
do_display_comments_nested($hResult2);
echo "</blockquote>\n";
}
}
@@ -301,9 +301,9 @@ function do_display_comments_nested($handle)
function display_comments_nested($versionId, $threadId)
{
$result = grab_comments($versionId, $threadId);
$hResult = grab_comments($versionId, $threadId);
do_display_comments_nested($result);
do_display_comments_nested($hResult);
}
@@ -311,27 +311,27 @@ function display_comments_nested($versionId, $threadId)
* display threaded comments
* handle is a db result set
*/
function do_display_comments_threaded($handle, $is_main)
function do_display_comments_threaded($hResult, $is_main)
{
if (!$is_main)
echo "<ul>\n";
while ($ob = mysql_fetch_object($handle))
while ($oRow = mysql_fetch_object($hResult))
{
if ($is_main)
{
view_app_comment($ob);
view_app_comment($oRow);
} else
{
echo '<li><a href="commentview.php?appId='.$ob->appId.'&amp;versionId='.$ob->versionId.'&threadId='.$ob->parentId.'"> '.
$ob->subject.' </a> by '.forum_lookup_user($ob->userId).' on '.$ob->time.' </li>'."\n";
echo '<li><a href="commentview.php?appId='.$oRow->appId.'&amp;versionId='.$oRow->versionId.'&threadId='.$oRow->parentId.'"> '.
$oRow->subject.' </a> by '.forum_lookup_user($oRow->userId).' on '.$oRow->time.' </li>'."\n";
}
$result = grab_comments($ob->versionId, $ob->commentId);
if ($result && mysql_num_rows($result))
$hResult2 = grab_comments($oRow->versionId, $oRow->commentId);
if ($hResult2 && mysql_num_rows($hResult2))
{
echo "<blockquote>\n";
do_display_comments_threaded($result, 0);
do_display_comments_threaded($hResult2, 0);
echo "</blockquote>\n";
}
}
@@ -343,9 +343,9 @@ function do_display_comments_threaded($handle, $is_main)
function display_comments_threaded($versionId, $threadId = 0)
{
$result = grab_comments($versionId, $threadId);
$hResult = grab_comments($versionId, $threadId);
do_display_comments_threaded($result, 1);
do_display_comments_threaded($hResult, 1);
}
@@ -354,12 +354,12 @@ function display_comments_threaded($versionId, $threadId = 0)
*/
function display_comments_flat($versionId)
{
$result = grab_comments($versionId);
if ($result)
$hResult = grab_comments($versionId);
if ($hResult)
{
while($ob = mysql_fetch_object($result))
while($oRow = mysql_fetch_object($hResult))
{
view_app_comment($ob);
view_app_comment($oRow);
}
}
}
@@ -374,8 +374,8 @@ function view_app_comments($versionId, $threadId = 0)
$aClean['mode'] = makeSafe($_REQUEST['mode']);
// count posts
$result = query_appdb("SELECT commentId FROM appComments WHERE versionId = $versionId");
$messageCount = mysql_num_rows($result);
$hResult = query_appdb("SELECT commentId FROM appComments WHERE versionId = $versionId");
$messageCount = mysql_num_rows($hResult);
//start comment format table
echo html_frame_start("","98%",'',0);

View File

@@ -385,14 +385,14 @@ class distribution{
/* Make a dropdown list of distributions */
function make_distribution_list($varname, $cvalue)
{
$query = "SELECT name, distributionId FROM distributions ORDER BY name";
$sQuery = "SELECT name, distributionId FROM distributions ORDER BY name";
$result = query_appdb($query);
if(!$result) return;
$hResult = query_appdb($sQuery);
if(!$hResult) return;
echo "<select name='$varname'>\n";
echo "<option value=\"\">Choose ...</option>\n";
while(list($name, $value) = mysql_fetch_row($result))
while(list($name, $value) = mysql_fetch_row($hResult))
{
if($value == $cvalue)
echo "<option value=$value selected>$name\n";
@@ -407,8 +407,8 @@ function getNumberOfDistributions()
$hResult = query_appdb("SELECT count(*) as num_dists FROM distributions");
if($hResult)
{
$row = mysql_fetch_object($hResult);
return $row->num_dists;
$oRow = mysql_fetch_object($hResult);
return $oRow->num_dists;
}
return 0;
}
@@ -419,8 +419,8 @@ function getNumberOfQueuedDistributions()
$hResult = query_appdb("SELECT count(*) as num_dists FROM distributions WHERE queued='true';");
if($hResult)
{
$row = mysql_fetch_object($hResult);
return $row->num_dists;
$oRow = mysql_fetch_object($hResult);
return $oRow->num_dists;
}
return 0;
}

View File

@@ -226,14 +226,14 @@ function addmsg($text, $color = "black")
*/
function dumpmsgbuffer()
{
$result = query_appdb("SELECT * FROM sessionMessages WHERE sessionId = '".session_id()."'");
if(!$result)
$hResult = query_appdb("SELECT * FROM sessionMessages WHERE sessionId = '".session_id()."'");
if(!$hResult)
return;
while($r = mysql_fetch_object($result))
while($oRow = mysql_fetch_object($hResult))
{
echo html_frame_start("","300","",5);
echo "<div align=center> $r->message </div>";
echo "<div align=center> $oRow->message </div>";
echo html_frame_end("&nbsp;");
echo "<br>\n";
}

View File

@@ -9,17 +9,17 @@
function getAppsFromUserId($userId)
{
/* retrieve the list of application and order them by application name */
$result = query_appdb("SELECT appMaintainers.appId, versionId, superMaintainer, appName FROM ".
$hResult = query_appdb("SELECT appMaintainers.appId, versionId, superMaintainer, appName FROM ".
"appFamily, appMaintainers WHERE appFamily.appId = appMaintainers.appId ".
"AND userId = '$userId' ORDER BY appName");
if(!$result || mysql_num_rows($result) == 0)
if(!$hResult || mysql_num_rows($hResult) == 0)
return;
$retval = array();
$c = 0;
while($row = mysql_fetch_object($result))
while($oRow = mysql_fetch_object($hResult))
{
$retval[$c] = array($row->appId, $row->versionId, $row->superMaintainer);
$retval[$c] = array($oRow->appId, $oRow->versionId, $oRow->superMaintainer);
$c++;
}
@@ -37,13 +37,13 @@ function getMaintainersUserIdsFromAppIdVersionId($versionId)
if($versionId == 0)
return $retval;
$query = "SELECT userId FROM ".
$sQuery = "SELECT userId FROM ".
"appMaintainers WHERE versionId = '$versionId';";
$result = query_appdb($query);
$hResult = query_appdb($sQuery);
$c = 0;
while($row = mysql_fetch_object($result))
while($oRow = mysql_fetch_object($hResult))
{
$retval[$c] = $row->userId;
$retval[$c] = $oRow->userId;
$c++;
}
@@ -55,15 +55,15 @@ function getMaintainersUserIdsFromAppIdVersionId($versionId)
*/
function getSuperMaintainersUserIdsFromAppId($appId)
{
$query = "SELECT userId FROM ".
$sQuery = "SELECT userId FROM ".
"appMaintainers WHERE appId = '$appId' " .
"AND superMaintainer = '1';";
$result = query_appdb($query);
$hResult = query_appdb($sQuery);
$retval = array();
$c = 0;
while($row = mysql_fetch_object($result))
while($oRow = mysql_fetch_object($hResult))
{
$retval[$c] = $row->userId;
$retval[$c] = $oRow->userId;
$c++;
}

View File

@@ -19,25 +19,24 @@ class TableVE {
function test($query)
{
$result = query_appdb($query);
$nfields = mysql_num_fields($result);
$nrows = mysql_num_rows($result);
$table = mysql_field_table($result, 0);
$hResult = query_appdb($query);
$nfields = mysql_num_fields($hResult);
$nrows = mysql_num_rows($hResult);
$table = mysql_field_table($hResult, 0);
echo "Table: $table <br> Fields: $nfields <br> Rows: $nrows <br> <br>\n";
$i = 0;
while($i < $nfields)
{
$type = mysql_field_type($result, $i);
$name = mysql_field_name($result, $i);
$len = mysql_field_len($result, $i);
$flags = mysql_field_flags($result, $i);
$type = mysql_field_type($hResult, $i);
$name = mysql_field_name($hResult, $i);
$len = mysql_field_len($hResult, $i);
$flags = mysql_field_flags($hResult, $i);
echo "$type | $name | $len | $flags <br>\n";
$i++;
}
}
/* this is a bit of a hack,
@@ -46,7 +45,7 @@ class TableVE {
*/
function create($query, $table, $idcolumn)
{
$result = query_appdb($query);
$hResult = query_appdb($query);
$id = mysql_insert_id();
$new_query = "SELECT * FROM $table WHERE $idcolumn = $id";
@@ -60,8 +59,8 @@ class TableVE {
$nrows = 0;
$result = query_appdb($query);
$nrows = mysql_num_rows($result);
$hResult = query_appdb($query);
$nrows = mysql_num_rows($hResult);
if(debugging())
{
@@ -70,15 +69,15 @@ class TableVE {
for($i = 0; $i < $nrows; $i++)
{
$this->view_entry($result, $i);
$this->view_entry($hResult, $i);
echo "<br>\n";
}
}
function view_entry($result, $num)
function view_entry($hResult, $num)
{
$nfields = mysql_num_fields($result);
$fields = mysql_fetch_array($result, MYSQL_BOTH);
$nfields = mysql_num_fields($hResult);
$fields = mysql_fetch_array($hResult, MYSQL_BOTH);
$titleValue = $fields[$this->titleField];
$titleText = $this->titleText;
@@ -99,7 +98,7 @@ class TableVE {
for($i = 0; $i < $nfields; $i++)
{
$field = mysql_fetch_field($result, $i);
$field = mysql_fetch_field($hResult, $i);
if(ereg("^impl_(.+)$", $field->table, $arr))
{
@@ -116,20 +115,19 @@ class TableVE {
echo "</table>\n";
echo html_frame_end();
}
function edit($query)
{
$result = query_appdb($query);
$nrows = mysql_num_rows($result);
$hResult = query_appdb($query);
$nrows = mysql_num_rows($hResult);
echo "<form method=post action='".$_SERVER['PHP_SELF']."'>\n";
for($i = 0; $i < $nrows; $i++)
{
$this->edit_entry($result);
$this->edit_entry($hResult);
echo "<br>\n";
}
@@ -141,10 +139,10 @@ class TableVE {
}
function edit_entry($result)
function edit_entry($hResult)
{
$nfields = mysql_num_fields($result);
$fields = mysql_fetch_array($result);
$nfields = mysql_num_fields($hResult);
$fields = mysql_fetch_array($hResult);
echo html_frame_start(ucfirst($this->mode),"80%","",0);
echo "<table border=0 width='100%' cellspacing=0 cellpadding=2>\n";
@@ -153,8 +151,8 @@ class TableVE {
for($i = 0; $i < $nfields; $i++)
{
global $testvar;
$field = mysql_fetch_field($result, $i);
$len = mysql_field_len($result, $i);
$field = mysql_fetch_field($hResult, $i);
$len = mysql_field_len($hResult, $i);
if(ereg("^impl_(.+)$", $field->table, $arr))
{
@@ -175,14 +173,13 @@ class TableVE {
function make_option_list($varname, $cvalue, $table, $idField, $nameField, $where = "")
{
$result = query_appdb("SELECT $idField, $nameField FROM $table $where ORDER BY $nameField");
if(!$result)
$hResult = query_appdb("SELECT $idField, $nameField FROM $table $where ORDER BY $nameField");
if(!$hResult)
return; // Oops
echo "<select name='$varname'>\n";
echo "<option value=0>Choose ...</option>\n";
while(list($id, $name) = mysql_fetch_row($result))
while(list($id, $name) = mysql_fetch_row($hResult))
{
if ($name == "NONAME")
continue;
@@ -190,7 +187,6 @@ class TableVE {
echo "<option value=$id selected>$name\n";
else
echo "<option value=$id>$name\n";
}
echo "</select>\n";
}
@@ -264,8 +260,6 @@ class TableVE {
$this->entry_add_extra($field, $value);
}
function view_entry_output_field($field, $value, $len)
{
if($len > 50)
@@ -293,7 +287,6 @@ class TableVE {
return;
}
switch($field->type)
{
case "string":
@@ -341,7 +334,6 @@ class TableVE {
}
/*
* required field for each table.
* When editing a query this field needs to be present in the query
@@ -380,7 +372,6 @@ class TableVE {
*/
function update($vars)
{
$tables = array();
$fieldnames = array();
$num_entries = 0;
@@ -455,9 +446,6 @@ class TableVE {
}
}
}
}
function set_title_field($newTitleField)
@@ -474,7 +462,6 @@ class TableVE {
{
$this->numberedTitles = 1;
}
};
?>

View File

@@ -342,7 +342,7 @@ class User {
if($sQuery)
{
if($result = query_appdb($sQuery))
if($hResult = query_appdb($sQuery))
return true;
}
@@ -356,31 +356,31 @@ class User {
if(!$this->hasPriv("admin"))
return 0;
$qstring = "SELECT count(*) as queued_apps FROM appFamily WHERE queued='true'";
$result = query_appdb($qstring);
$ob = mysql_fetch_object($result);
return $ob->queued_apps;
$sQuery = "SELECT count(*) as queued_apps FROM appFamily WHERE queued='true'";
$hResult = query_appdb($sQuery);
$oRow = mysql_fetch_object($hResult);
return $oRow->queued_apps;
}
function getQueuedVersionCount()
{
if($this->hasPriv("admin"))
{
$qstring = "SELECT count(*) as queued_versions FROM appVersion WHERE queued='true'";
$sQuery = "SELECT count(*) as queued_versions FROM appVersion WHERE queued='true'";
} else
{
/* find all queued versions of applications that the user is a super maintainer of */
$qstring = "SELECT count(*) as queued_versions FROM appVersion, appMaintainers
$sQuery = "SELECT count(*) as queued_versions FROM appVersion, appMaintainers
WHERE queued='true' AND appMaintainers.superMaintainer ='1'
AND appVersion.appId = appMaintainers.appId
AND appMaintainers.userId ='".$this->iUserId."';";
}
$result = query_appdb($qstring);
$ob = mysql_fetch_object($result);
$hResult = query_appdb($sQuery);
$oRow = mysql_fetch_object($hResult);
/* we don't want to count the versions that are implicit in the applications */
/* that are in the queue */
return $ob->queued_versions - $this->getQueuedAppCount();
return $oRow->queued_versions - $this->getQueuedAppCount();
}
@@ -388,8 +388,8 @@ class User {
function getQueuedAppDataCount()
{
$hResult = $this->getAppDataQuery(0, true, false);
$ob = mysql_fetch_object($hResult);
return $ob->queued_appdata;
$oRow = mysql_fetch_object($hResult);
return $oRow->queued_appdata;
}
function addPriv($sPriv)
@@ -582,20 +582,20 @@ class User {
function getAllRejectedApps()
{
$result = query_appdb("SELECT appVersion.versionId, appFamily.appId
$hResult = query_appdb("SELECT appVersion.versionId, appFamily.appId
FROM appVersion, appFamily
WHERE appFamily.appId = appVersion.appId
AND (appFamily.queued = 'rejected' OR appVersion.queued = 'rejected')
AND appVersion.submitterId = '".$this->iUserId."';");
if(!$result || mysql_num_rows($result) == 0)
if(!$hResult || mysql_num_rows($hResult) == 0)
return;
$retval = array();
$c = 0;
while($row = mysql_fetch_object($result))
while($oRow = mysql_fetch_object($hResult))
{
$retval[$c] = array($row->appId, $row->versionId);
$retval[$c] = array($oRow->appId, $oRow->versionId);
$c++;
}
@@ -1110,9 +1110,9 @@ function get_notify_email_address_list($iAppId = null, $iVersionId = null)
*/
function get_number_of_users()
{
$result = query_appdb("SELECT count(*) as num_users FROM user_list;");
$row = mysql_fetch_object($result);
return $row->num_users;
$hResult = query_appdb("SELECT count(*) as num_users FROM user_list;");
$oRow = mysql_fetch_object($hResult);
return $oRow->num_users;
}
@@ -1121,9 +1121,9 @@ function get_number_of_users()
*/
function get_active_users_within_days($days)
{
$result = query_appdb("SELECT count(*) as num_users FROM user_list WHERE stamp >= DATE_SUB(CURDATE(), interval $days day);");
$row = mysql_fetch_object($result);
return $row->num_users;
$hResult = query_appdb("SELECT count(*) as num_users FROM user_list WHERE stamp >= DATE_SUB(CURDATE(), interval $days day);");
$oRow = mysql_fetch_object($hResult);
return $oRow->num_users;
}
@@ -1146,12 +1146,12 @@ function get_inactive_users_pending_deletion()
*/
function user_exists($sEmail)
{
$result = query_appdb("SELECT userid FROM user_list WHERE email = '$sEmail'");
if(!$result || mysql_num_rows($result) != 1)
$hResult = query_appdb("SELECT userid FROM user_list WHERE email = '$sEmail'");
if(!$hResult || mysql_num_rows($hResult) != 1)
return 0;
else
{
$oRow = mysql_fetch_object($result);
$oRow = mysql_fetch_object($hResult);
return $oRow->userid;
}
}

View File

@@ -119,14 +119,14 @@ function make_bugzilla_version_list($varname, $cvalue)
{
$table = BUGZILLA_DB.".versions";
$where = "WHERE product_id=".BUGZILLA_PRODUCT_ID;
$query = "SELECT value FROM $table $where ORDER BY value";
$sQuery = "SELECT value FROM $table $where ORDER BY value";
$result = query_bugzilladb($query);
if(!$result) return;
$hResult = query_bugzilladb($sQuery);
if(!$hResult) return;
echo "<select name='$varname'>\n";
echo "<option value=\"\">Choose ...</option>\n";
while(list($value) = mysql_fetch_row($result))
while(list($value) = mysql_fetch_row($hResult))
{
if($value == "unspecified")
{
@@ -163,67 +163,67 @@ function make_maintainer_rating_list($varname, $cvalue)
/* get the number of queued maintainers */
function getQueuedMaintainerCount()
{
$qstring = "SELECT count(*) as queued_maintainers FROM appMaintainerQueue";
$result = query_appdb($qstring);
$ob = mysql_fetch_object($result);
return $ob->queued_maintainers;
$sQuery = "SELECT count(*) as queued_maintainers FROM appMaintainerQueue";
$hResult = query_appdb($sQuery);
$oRow = mysql_fetch_object($hResult);
return $oRow->queued_maintainers;
}
/* get the total number of maintainers and applications in the appMaintainers table */
function getMaintainerCount()
{
$qstring = "SELECT count(*) as maintainers FROM appMaintainers";
$result = query_appdb($qstring);
$ob = mysql_fetch_object($result);
return $ob->maintainers;
$sQuery = "SELECT count(*) as maintainers FROM appMaintainers";
$hResult = query_appdb($sQuery);
$oRow = mysql_fetch_object($hResult);
return $oRow->maintainers;
}
/* get the total number of vendors from the vendor table */
function getVendorCount()
{
$qstring = "SELECT count(*) as vendors FROM vendor";
$result = query_appdb($qstring);
$ob = mysql_fetch_object($result);
return $ob->vendors;
$sQuery = "SELECT count(*) as vendors FROM vendor";
$hResult = query_appdb($sQuery);
$oRow = mysql_fetch_object($hResult);
return $oRow->vendors;
}
/* Get the number of users in the database */
function getNumberOfComments()
{
$result = query_appdb("SELECT count(*) as num_comments FROM appComments;");
$row = mysql_fetch_object($result);
return $row->num_comments;
$hResult = query_appdb("SELECT count(*) as num_comments FROM appComments;");
$oRow = mysql_fetch_object($hResult);
return $oRow->num_comments;
}
/* Get the number of versions in the database */
function getNumberOfVersions()
{
$result = query_appdb("SELECT count(versionId) as num_versions FROM appVersion WHERE versionName != 'NONAME';");
$row = mysql_fetch_object($result);
return $row->num_versions;
$hResult = query_appdb("SELECT count(versionId) as num_versions FROM appVersion WHERE versionName != 'NONAME';");
$oRow = mysql_fetch_object($hResult);
return $oRow->num_versions;
}
/* Get the number of maintainers in the database */
function getNumberOfMaintainers()
{
$result = query_appdb("SELECT DISTINCT userId FROM appMaintainers;");
return mysql_num_rows($result);
$hResult = query_appdb("SELECT DISTINCT userId FROM appMaintainers;");
return mysql_num_rows($hResult);
}
/* Get the number of app familes in the database */
function getNumberOfAppFamilies()
{
$result = query_appdb("SELECT count(*) as num_appfamilies FROM appFamily;");
$row = mysql_fetch_object($result);
return $row->num_appfamilies;
$hResult = query_appdb("SELECT count(*) as num_appfamilies FROM appFamily;");
$oRow = mysql_fetch_object($hResult);
return $oRow->num_appfamilies;
}
/* Get the number of images in the database */
function getNumberOfImages()
{
$result = query_appdb("SELECT count(*) as num_images FROM appData WHERE type='image';");
$row = mysql_fetch_object($result);
return $row->num_images;
$hResult = query_appdb("SELECT count(*) as num_images FROM appData WHERE type='image';");
$oRow = mysql_fetch_object($hResult);
return $oRow->num_images;
}
/* Get the number of queued bug links in the database */
@@ -232,8 +232,8 @@ function getNumberOfQueuedBugLinks()
$hResult = query_appdb("SELECT count(*) as num_buglinks FROM buglinks WHERE queued='true';");
if($hResult)
{
$row = mysql_fetch_object($hResult);
return $row->num_buglinks;
$oRow = mysql_fetch_object($hResult);
return $oRow->num_buglinks;
}
return 0;
}
@@ -244,8 +244,8 @@ function getNumberOfBugLinks()
$hResult = query_appdb("SELECT count(*) as num_buglinks FROM buglinks;");
if($hResult)
{
$row = mysql_fetch_object($hResult);
return $row->num_buglinks;
$oRow = mysql_fetch_object($hResult);
return $oRow->num_buglinks;
}
return 0;
}
@@ -521,22 +521,22 @@ function outputSearchTableForhResult($search_words, $hResult)
echo "</tr>\n\n";
$c = 0;
while($ob = mysql_fetch_object($hResult))
while($oRow = mysql_fetch_object($hResult))
{
//skip if a NONAME
if ($ob->appName == "NONAME") { continue; }
if ($oRow->appName == "NONAME") { continue; }
//set row color
$bgcolor = ($c % 2) ? 'color0' : 'color1';
//count versions
$query = query_appdb("SELECT count(*) as versions FROM appVersion WHERE appId = $ob->appId AND versionName != 'NONAME' and queued = 'false'");
$y = mysql_fetch_object($query);
$hResult2 = query_appdb("SELECT count(*) as versions FROM appVersion WHERE appId = $oRow->appId AND versionName != 'NONAME' and queued = 'false'");
$y = mysql_fetch_object($hResult2);
//display row
echo "<tr class=$bgcolor>\n";
echo " <td>".html_ahref($ob->appName,BASE."appview.php?appId=$ob->appId")."</td>\n";
echo " <td>".trim_description($ob->description)."</td>\n";
echo " <td>".html_ahref($oRow->appName,BASE."appview.php?appId=$oRow->appId")."</td>\n";
echo " <td>".trim_description($oRow->description)."</td>\n";
echo " <td>$y->versions &nbsp;</td>\n";
echo "</tr>\n\n";

View File

@@ -142,8 +142,8 @@ function getNumberOfVendors()
$hResult = query_appdb("SELECT count(*) as num_vendors FROM vendor");
if($hResult)
{
$row = mysql_fetch_object($hResult);
return $row->num_vendors;
$oRow = mysql_fetch_object($hResult);
return $oRow->num_vendors;
}
return 0;
}

View File

@@ -17,8 +17,8 @@ function vote_count($appId, $userId = null)
else
return 0;
}
$result = query_appdb("SELECT * FROM appVotes WHERE appId = $appId AND userId = $userId");
return mysql_num_rows($result);
$hResult = query_appdb("SELECT * FROM appVotes WHERE appId = $appId AND userId = $userId");
return mysql_num_rows($hResult);
}
@@ -34,8 +34,8 @@ function vote_count_user_total($userId = null)
else
return 0;
}
$result = query_appdb("SELECT * FROM appVotes WHERE userId = $userId");
return mysql_num_rows($result);
$hResult = query_appdb("SELECT * FROM appVotes WHERE userId = $userId");
return mysql_num_rows($hResult);
}
@@ -44,8 +44,8 @@ function vote_count_user_total($userId = null)
*/
function vote_count_app_total($appId)
{
$result = query_appdb("SELECT * FROM appVotes WHERE appId = $appId");
return mysql_num_rows($result);
$hResult = query_appdb("SELECT * FROM appVotes WHERE appId = $appId");
return mysql_num_rows($hResult);
}
@@ -98,13 +98,13 @@ function vote_get_user_votes($userId = null)
if(!$userId)
return array();
}
$result = query_appdb("SELECT * FROM appVotes WHERE userId = $userId");
if(!$result)
$hResult = query_appdb("SELECT * FROM appVotes WHERE userId = $userId");
if(!$hResult)
return array();
$obs = array();
while($ob = mysql_fetch_object($result))
$obs[$ob->slot] = $ob;
while($oRow = mysql_fetch_object($hResult))
$obs[$oRow->slot] = $oRow;
return $obs;
}

View File

@@ -63,11 +63,11 @@ If you have screenshots or links to contribute, please browse the database and u
"FROM appVotes, appFamily ".
"WHERE appVotes.appId = appFamily.appId ".
"GROUP BY appId ORDER BY count DESC LIMIT 1";
$result = query_appdb($voteQuery);
$ob = mysql_fetch_object($result);
$hResult = query_appdb($voteQuery);
$oRow = mysql_fetch_object($hResult);
$voteAppId = $ob->appId;
$voteAppName = $ob->appName;
$voteAppId = $oRow->appId;
$voteAppName = $oRow->appName;
/* don't mention the top application if there are no votes yet */
if($voteAppId != "")

View File

@@ -54,8 +54,8 @@ if($_SESSION['current']->hasPriv("admin") &&
function build_prefs_list()
{
global $oUser;
$result = query_appdb("SELECT * FROM prefs_list ORDER BY id");
while($result && $r = mysql_fetch_object($result))
$hResult = query_appdb("SELECT * FROM prefs_list ORDER BY id");
while($hResult && $r = mysql_fetch_object($hResult))
{
//skip admin options
//TODO: add a field to prefs_list to flag the user level for the pref

View File

@@ -67,11 +67,11 @@ if($catId != 0)
{
$catQuery = "SELECT appCategory.catName, appCategory.catParent ".
"FROM appCategory WHERE appCategory.catId = '$currentCatId';";
$result = query_appdb($catQuery);
$hResult = query_appdb($catQuery);
if($result)
if($hResult)
{
$row = mysql_fetch_object($result);
$row = mysql_fetch_object($hResult);
$catParent = $row->catParent;
array_push($cat_array, "$currentCatId");
@@ -168,7 +168,7 @@ if(strcasecmp($categoryId, "any") == 0)
ORDER BY count DESC LIMIT $topNumber";
}
if($result = query_appdb($sVoteQuery))
if($hResult = query_appdb($sVoteQuery))
{
echo html_frame_start("", "90%", '', 0);
echo html_table_begin("width='100%' align=center");
@@ -176,7 +176,7 @@ if($result = query_appdb($sVoteQuery))
echo "<td><font color=white>Votes</font></td></tr>\n";
$c = 1;
while($row = mysql_fetch_object($result))
while($row = mysql_fetch_object($hResult))
{
$bgcolor = ($c % 2) ? "color0" : "color1";
$link = "<a href='appview.php?appId=$row->appId'>$row->appName</a>";