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,13 +11,13 @@ 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))
{
echo "<option value=$ob->appId>$ob->appName</option>\n";
}
while($oRow = mysql_fetch_object($hResult))
{
echo "<option value=$oRow->appId>$oRow->appName</option>\n";
}
echo "</select>\n";
}
@@ -25,17 +25,17 @@ function build_app_list()
if($cmd)
{
if($cmd == "delete")
{
$result = query_appdb("DELETE FROM appBundle WHERE appId = $appId AND bundleId = $bundleId");
if($result)
addmsg("App deleted from bundle", "green");
}
{
$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)
addmsg("App $appId added to Bundle $bundleId", "green");
}
{
$hResult = query_appdb("INSERT INTO appBundle VALUES ($bundleId, $appId)");
if($hResult)
addmsg("App $appId added to Bundle $bundleId", "green");
}
redirectref();
exit;
}
@@ -43,39 +43,38 @@ else
{
apidb_header("Edit Application Bundle");
$result = query_appdb("SELECT bundleId, appBundle.appId, appName FROM appBundle, appFamily ".
"WHERE bundleId = $bundleId AND appFamily.appId = appBundle.appId");
$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))
{
echo html_frame_start("Apps in this Bundle","300",'',0);
echo "<table width='100%' border=0 cellpadding=3 cellspacing=0>\n\n";
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";
echo "<tr class=color4>\n";
echo " <td><font color=white> Application Name </font></td>\n";
echo " <td><font color=white> Delete </font></td>\n";
echo "</tr>\n\n";
echo "<tr class=color4>\n";
echo " <td><font color=white> Application Name </font></td>\n";
echo " <td><font color=white> Delete </font></td>\n";
echo "</tr>\n\n";
$c = 1;
while($ob = mysql_fetch_object($result))
{
//set row color
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
$c = 1;
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>$delete_link &nbsp;</td>\n";
echo "</tr>\n\n";
echo "<tr class=$bgcolor>\n";
echo " <td>$oRow->appName &nbsp;</td>\n";
echo " <td>$delete_link &nbsp;</td>\n";
echo "</tr>\n\n";
$c++;
}
$c++;
}
echo "</table>\n\n";
echo html_frame_end();
}
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

@@ -11,33 +11,32 @@ class TableVE {
*/
function TableVE($mode)
{
$this->mode = $mode;
$this->titleField = "";
$this->titleText = "";
$this->numberedTitles = 0;
$this->mode = $mode;
$this->titleField = "";
$this->titleText = "";
$this->numberedTitles = 0;
}
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";
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);
echo "$type | $name | $len | $flags <br>\n";
$i++;
}
$i = 0;
while($i < $nfields)
{
$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,60 +45,60 @@ class TableVE {
*/
function create($query, $table, $idcolumn)
{
$result = query_appdb($query);
$id = mysql_insert_id();
$hResult = query_appdb($query);
$id = mysql_insert_id();
$new_query = "SELECT * FROM $table WHERE $idcolumn = $id";
$this->edit($new_query);
$new_query = "SELECT * FROM $table WHERE $idcolumn = $id";
$this->edit($new_query);
}
function view($query)
{
//$this->test($query);
//$this->test($query);
$nrows = 0;
$nrows = 0;
$result = query_appdb($query);
$nrows = mysql_num_rows($result);
$hResult = query_appdb($query);
$nrows = mysql_num_rows($hResult);
if(debugging())
{
echo "Query returns $nrows rows.";
echo "Query returns $nrows rows.";
}
for($i = 0; $i < $nrows; $i++)
{
$this->view_entry($result, $i);
echo "<br>\n";
}
for($i = 0; $i < $nrows; $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;
if($this->numberedTitles)
{
// don't want zero-based.
$num++;
$titleText .= " # $num";
}
$titleValue = $fields[$this->titleField];
$titleText = $this->titleText;
if($this->numberedTitles)
{
// don't want zero-based.
$num++;
$titleText .= " # $num";
}
//echo "<table border=1 bordercolor=black width='80%' cellpadding=0 cellspacing=0>\n";
//echo "<th class='box-title' colspan='2'></th></tr>\n";
//echo "<tr><td>\n";
echo html_frame_start("Viewing $titleValue $titleText","80%","",0);
echo "<table border=0 width='100%' cellspacing=0 cellpadding=2>\n";
echo html_frame_start("Viewing $titleValue $titleText","80%","",0);
echo "<table border=0 width='100%' cellspacing=0 cellpadding=2>\n";
for($i = 0; $i < $nfields; $i++)
{
$field = mysql_fetch_field($result, $i);
for($i = 0; $i < $nfields; $i++)
{
$field = mysql_fetch_field($hResult, $i);
if(ereg("^impl_(.+)$", $field->table, $arr))
{
@@ -108,214 +107,208 @@ class TableVE {
$cur_impl = $arr[1];
}
echo "<tr><td width='15%' class='box-label'><b> $field->name </b></td>";
echo "<td class='box-body'>";
$this->view_entry_output_field($field, $fields[$i], 0);
echo "</td></tr>\n";
}
echo "<tr><td width='15%' class='box-label'><b> $field->name </b></td>";
echo "<td class='box-body'>";
$this->view_entry_output_field($field, $fields[$i], 0);
echo "</td></tr>\n";
}
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);
echo "<br>\n";
}
{
$this->edit_entry($hResult);
echo "<br>\n";
}
echo html_frame_start("Update Database",100);
echo "<input type=submit value='Update Database'>\n";
echo html_frame_end();
echo html_frame_end();
echo "</form>\n";
echo "</form>\n";
}
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";
echo html_frame_start(ucfirst($this->mode),"80%","",0);
echo "<table border=0 width='100%' cellspacing=0 cellpadding=2>\n";
$cur_impl = null;
$cur_impl = null;
for($i = 0; $i < $nfields; $i++)
{
global $testvar;
$field = mysql_fetch_field($hResult, $i);
$len = mysql_field_len($hResult, $i);
if(ereg("^impl_(.+)$", $field->table, $arr))
{
global $testvar;
$field = mysql_fetch_field($result, $i);
$len = mysql_field_len($result, $i);
if(ereg("^impl_(.+)$", $field->table, $arr))
{
if($cur_impl != $arr[1])
echo "<tr><th class='box-label' colspan=2> ".ucfirst($arr[1])." Implementation </th></tr>\n";
$cur_impl = $arr[1];
}
echo "<tr><td width='15%' class='box-label'><b> $field->name &nbsp; </b></td>";
echo "<td class='box-body'>&nbsp;";
$this->edit_entry_output_field($field, $fields[$i], $len);
echo "</td></tr>\n";
if($cur_impl != $arr[1])
echo "<tr><th class='box-label' colspan=2> ".ucfirst($arr[1])." Implementation </th></tr>\n";
$cur_impl = $arr[1];
}
echo "<tr><td width='15%' class='box-label'><b> $field->name &nbsp; </b></td>";
echo "<td class='box-body'>&nbsp;";
$this->edit_entry_output_field($field, $fields[$i], $len);
echo "</td></tr>\n";
}
echo "</table>\n";
echo html_frame_end();
echo html_frame_end();
}
function make_option_list($varname, $cvalue, $table, $idField, $nameField, $where = "")
{
$result = query_appdb("SELECT $idField, $nameField FROM $table $where ORDER BY $nameField");
if(!$result)
return; // Oops
$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))
{
if ($name == "NONAME")
continue;
if($id == $cvalue)
echo "<option value=$id selected>$name\n";
else
echo "<option value=$id>$name\n";
}
echo "</select>\n";
echo "<select name='$varname'>\n";
echo "<option value=0>Choose ...</option>\n";
while(list($id, $name) = mysql_fetch_row($hResult))
{
if ($name == "NONAME")
continue;
if($id == $cvalue)
echo "<option value=$id selected>$name\n";
else
echo "<option value=$id>$name\n";
}
echo "</select>\n";
}
function edit_entry_output_field($field, $value, $len)
{
static $idx = 0;
static $idx = 0;
$idx++;
if($len > 50)
$len = 50;
$idx++;
if($len > 50)
$len = 50;
$varname = "FIELD_".$field->table."___".$field->name."[]";
echo "<input type=hidden name='TYPE_$varname' value='$field->type'>\n";
$varname = "FIELD_".$field->table."___".$field->name."[]";
echo "<input type=hidden name='TYPE_$varname' value='$field->type'>\n";
if($field->name == "appId" && $field->table != "appFamily")
{
$this->make_option_list($varname, $value, "appFamily", "appId", "appName");
return;
}
if($field->name == "appId" && $field->table != "appFamily")
{
$this->make_option_list($varname, $value, "appFamily", "appId", "appName");
return;
}
if($field->name == "vendorId" && $field->table != "vendor")
{
$this->make_option_list($varname, $value, "vendor", "vendorId", "vendorName");
return;
}
if($field->name == "vendorId" && $field->table != "vendor")
{
$this->make_option_list($varname, $value, "vendor", "vendorId", "vendorName");
return;
}
if($field->name == "catId" && $field->table != "appCategory")
{
$this->make_option_list($varname, $value, "appCategory", "catId", "catName");
return;
}
if($field->name == "catId" && $field->table != "appCategory")
{
$this->make_option_list($varname, $value, "appCategory", "catId", "catName");
return;
}
if($field->name == "catParent")
{
$this->make_option_list($varname, $value, "appCategory", "catId", "catName");
return;
}
if($field->name == "catParent")
{
$this->make_option_list($varname, $value, "appCategory", "catId", "catName");
return;
}
if($field->name == "keywords")
{
echo "<textarea cols=$len rows=3 name='$varname'>".stripslashes($value)."</textarea>\n";
return;
}
if($field->name == "keywords")
{
echo "<textarea cols=$len rows=3 name='$varname'>".stripslashes($value)."</textarea>\n";
return;
}
switch($field->type)
{
case "string":
case "enum":
case "int":
case "text":
echo "<input type=text size=$len name='$varname' value='".stripslashes($value)."'>\n";
break;
case "blob":
echo "<textarea cols=$len rows=10 name='$varname'>".stripslashes($value)."</textarea>\n";
break;
case "timestamp":
$time = mysqltimestamp_to_unixtimestamp($value);
echo print_date($time);
break;
case "datetime":
$time = mysqldatetime_to_unixtimestamp($value);
echo print_date($time);
break;
default:
echo "$value &nbsp;\n";
break;
}
switch($field->type)
{
case "string":
case "enum":
case "int":
case "text":
echo "<input type=text size=$len name='$varname' value='".stripslashes($value)."'>\n";
break;
case "blob":
echo "<textarea cols=$len rows=10 name='$varname'>".stripslashes($value)."</textarea>\n";
break;
case "timestamp":
$time = mysqltimestamp_to_unixtimestamp($value);
echo print_date($time);
break;
case "datetime":
$time = mysqldatetime_to_unixtimestamp($value);
echo print_date($time);
break;
default:
echo "$value &nbsp;\n";
break;
}
$this->entry_add_extra($field, $value);
$this->entry_add_extra($field, $value);
}
function view_entry_output_field($field, $value, $len)
{
if($len > 50)
$len = 50;
//FIXME: need a better way for special cases
if(!$value && $field->name == "comments")
{
echo "none";
return;
}
if(!$value && ($field->name == "location" || $field->name == "quality"))
{
echo "unknown";
return;
}
//FIXME: need a better way for special cases
if(!$value && $field->name == "comments")
{
echo "none";
return;
}
if(!$value && ($field->name == "location" || $field->name == "quality"))
{
echo "unknown";
return;
}
if($field->name == "lastmodby")
{
$user = new user();
$name = $user->lookup_realname($value);
if(!$name)
$name = "system";
echo "$name ($value)";
return;
}
{
$user = new user();
$name = $user->lookup_realname($value);
if(!$name)
$name = "system";
echo "$name ($value)";
return;
}
switch($field->type)
{
case "string":
case "enum":
case "int":
case "blob":
echo "$value &nbsp;\n";
break;
case "timestamp":
$time = mysqltimestamp_to_unixtimestamp($value);
echo print_date($time);
break;
case "datetime":
$time = mysqldatetime_to_unixtimestamp($value);
echo print_date($time);
break;
default:
echo "$value &nbsp;\n";
break;
}
{
case "string":
case "enum":
case "int":
case "blob":
echo "$value &nbsp;\n";
break;
case "timestamp":
$time = mysqltimestamp_to_unixtimestamp($value);
echo print_date($time);
break;
case "datetime":
$time = mysqldatetime_to_unixtimestamp($value);
echo print_date($time);
break;
default:
echo "$value &nbsp;\n";
break;
}
$this->entry_add_extra($field, $value);
$this->entry_add_extra($field, $value);
}
@@ -324,22 +317,21 @@ class TableVE {
*/
function entry_add_extra($field, $value)
{
/*
/*
* add extra stuff to certain fields
*/
if($field->name == "mslink" && $value)
{
echo html_imagebutton("Go!", $value);
}
if($field->name == "apiname")
{
echo html_imagebutton("Wine LXR", "http://twine.codeweavers.com/lxr/ident?i=$value");
echo html_imagebutton("Wine API", "http://www.winehq.com/WineAPI/$value.html");
}
}
{
echo html_imagebutton("Go!", $value);
}
if($field->name == "apiname")
{
echo html_imagebutton("Wine LXR", "http://twine.codeweavers.com/lxr/ident?i=$value");
echo html_imagebutton("Wine API", "http://www.winehq.com/WineAPI/$value.html");
}
}
/*
@@ -359,18 +351,18 @@ class TableVE {
function get_id($name)
{
reset($this->table_ids);
while(list($table, $id) = each($this->table_ids))
{
$r = "^$table$";
//echo "Checking $r against $name <br>\n";
if(ereg($r, $name))
{
//echo "ID for $name -> $id <br>\n";
return $id;
}
}
return null;
reset($this->table_ids);
while(list($table, $id) = each($this->table_ids))
{
$r = "^$table$";
//echo "Checking $r against $name <br>\n";
if(ereg($r, $name))
{
//echo "ID for $name -> $id <br>\n";
return $id;
}
}
return null;
}
/**
@@ -380,101 +372,96 @@ class TableVE {
*/
function update($vars)
{
$tables = array();
$fieldnames = array();
$num_entries = 0;
$tables = array();
$fieldnames = array();
$num_entries = 0;
while(list($varname, $arr) = each($vars))
{
if(!ereg("^FIELD_([a-zA-Z_]+)___(.+)$", $varname, $regs))
continue;
while(list($varname, $arr) = each($vars))
{
if(!ereg("^FIELD_([a-zA-Z_]+)___(.+)$", $varname, $regs))
continue;
$tables[$regs[1]][] = $regs[2];
$fieldnames[$regs[2]] = $arr;
$num_entries = sizeof($arr);
}
$tables[$regs[1]][] = $regs[2];
$fieldnames[$regs[2]] = $arr;
$num_entries = sizeof($arr);
}
while(list($table, $fields) = each($tables))
{
echo "<b> $table (".$this->get_id($table).") </b>";
while(list($table, $fields) = each($tables))
{
echo "<b> $table (".$this->get_id($table).") </b>";
if($fieldnames[$this->get_id($table)])
echo "OK!";
if($fieldnames[$this->get_id($table)])
echo "OK!";
echo "<br>\n";
echo "<br>\n";
for($i = 0; $i < sizeof($fields); $i++)
echo "- $fields[$i] <br>\n";
for($i = 0; $i < sizeof($fields); $i++)
echo "- $fields[$i] <br>\n";
echo "<br>\n";
}
echo "<br>\n";
}
for($i = 0; $i < $num_entries; $i++)
{
reset($tables);
while(list($table, $fields) = each($tables))
{
$update = "UPDATE $table SET ";
$count = sizeof($fields);
reset($fields);
while(list($idx, $field) = each($fields))
{
$count--;
for($i = 0; $i < $num_entries; $i++)
{
reset($tables);
while(list($table, $fields) = each($tables))
{
$update = "UPDATE $table SET ";
$count = sizeof($fields);
reset($fields);
while(list($idx, $field) = each($fields))
{
$count--;
if($this->table_ids[$table] == $field)
{
continue;
}
$key = "FIELD_".$table."___".$field;
$type = $vars["TYPE_$key"][$i];
if($this->table_ids[$table] == $field)
{
continue;
}
$key = "FIELD_".$table."___".$field;
$type = $vars["TYPE_$key"][$i];
if($type == "int")
$update .= "$field = ".$vars[$key][$i];
else
$update .= "$field = '".addslashes($vars[$key][$i])."'";
if($type == "int")
$update .= "$field = ".$vars[$key][$i];
else
$update .= "$field = '".addslashes($vars[$key][$i])."'";
if($count)
$update .= ", ";
}
if($count)
$update .= ", ";
}
$value = $fieldnames[$this->get_id($table)][$i];
$value = $fieldnames[$this->get_id($table)][$i];
$update .= " WHERE ".$this->get_id($table)." = $value";
$update .= " WHERE ".$this->get_id($table)." = $value";
if(query_appdb($update))
{
addmsg("Database Operation Complete!","green");
}
if(ereg("^impl_.+$", $table))
{
$value = $fieldnames["apiid"][$i];
query_appdb("UPDATE $table SET lastmodby = ".$_SESSION['current']->userid." WHERE apiid = $value");
}
}
}
if(query_appdb($update))
{
addmsg("Database Operation Complete!","green");
}
if(ereg("^impl_.+$", $table))
{
$value = $fieldnames["apiid"][$i];
query_appdb("UPDATE $table SET lastmodby = ".$_SESSION['current']->userid." WHERE apiid = $value");
}
}
}
}
function set_title_field($newTitleField)
{
$this->titleField = $newTitleField;
$this->titleField = $newTitleField;
}
function set_title_text($newTitleText)
{
$this->titleText = $newTitleText;
$this->titleText = $newTitleText;
}
function set_numbered_titles()
{
$this->numberedTitles = 1;
$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

@@ -71,9 +71,9 @@ function get_remote()
global $REMOTE_HOST, $REMOTE_ADDR;
if($REMOTE_HOST)
$ip = $REMOTE_HOST;
$ip = $REMOTE_HOST;
else
$ip = $REMOTE_ADDR;
$ip = $REMOTE_ADDR;
return $ip;
}
@@ -101,12 +101,12 @@ function get_xml_tag ($file, $mode = null)
if ($mode and file_exists($file))
{
$fp = @fopen($file, "r");
$data = fread($fp, filesize($file));
@fclose($fp);
if (eregi("<" . $mode . ">(.*)</" . $mode . ">", $data, $out))
{
return $out[1];
}
$data = fread($fp, filesize($file));
@fclose($fp);
if (eregi("<" . $mode . ">(.*)</" . $mode . ">", $data, $out))
{
return $out[1];
}
}
else
{
@@ -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,11 +176,11 @@ 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";
$bgcolor = ($c % 2) ? "color0" : "color1";
$link = "<a href='appview.php?appId=$row->appId'>$row->appName</a>";
echo "<tr class=$bgcolor><td width='90%'>$c. $link </td> <td> $row->count </td></tr>\n";
echo "<tr class=$bgcolor><td width='90%'>$c. $link </td> <td> $row->count </td></tr>\n";
$c++;
}