Fix "be a (super)maintainer" which was leading to a fatal error

This commit is contained in:
Jonathan Ernst
2005-02-07 04:31:26 +00:00
committed by WineHQ
parent 5f9d5c5c54
commit fa98124783
4 changed files with 53 additions and 32 deletions

View File

@@ -8,6 +8,7 @@ require(BASE."include/incl.php");
require(BASE."include/tableve.php");
require(BASE."include/category.php");
require(BASE."include/maintainer.php");
require(BASE."include/application.php");
require(BASE."include/mail.php");
if(!$_SESSION['current']->hasPriv("admin"))
@@ -111,37 +112,42 @@ if ($_REQUEST['sub'])
{
while(list($index, list($appIdOther, $versionIdOther, $superMaintainerOther)) = each($other_apps))
{
$oApp = new Application($appIdOther);
$oVersion = new Application($versionIdOther);
if($firstDisplay)
{
$firstDisplay = false;
if($superMaintainerOther)
echo "<td>".lookup_app_name($appIdOther)."*</td></tr>\n";
echo "<td>".$oApp->sName."*</td></tr>\n";
else
echo "<td>".lookup_app_name($appIdOther).lookup_version_name($versionIdOther)."</td></tr>\n";
echo "<td>".$oApp->sName." ".$oVersion->sName."</td></tr>\n";
} else
{
if($superMaintainerOther)
echo "<td class=color0></td><td>".lookup_app_name($appIdOther)."*</td></tr>\n";
echo "<td class=color0></td><td>".$oApp->sName."*</td></tr>\n";
else
echo "<td class=color0></td><td>".lookup_app_name($appIdOther).lookup_version_name($versionIdOther)."</td></tr>\n";
echo "<td class=color0></td><td>".$oApp->sName." ".$oVersion->sName."</td></tr>\n";
}
}
} else
{
echo "<td>User maintains no other applications</td></tr>\n";
}
$oApp = new Application($ob->appId);
$oVersion = new Application($ob->versionId);
//app name
echo '<tr valign=top><td class=color0><b>App Name</b></td>',"\n";
echo "<td>".lookup_app_name($ob->appId)."</td></tr>\n";
echo "<td>".$oApp->sName."</td></tr>\n";
//version
echo '<tr valign=top><td class=color0><b>App Version</b></td>',"\n";
echo "<td>".lookup_version_name($ob->versionId)."</td></tr>\n";
echo "<td>".$oVersion->sName."</td></tr>\n";
//maintainReason
echo '<tr valign=top><td class=color0><b>Maintainer request reason</b></td>',"\n";
echo '<td><textarea name="maintainReason" rows=10 cols=35>'.stripslashes($ob->maintainReason).'</textarea></td></tr>',"\n";
echo '<td><textarea name="maintainReason" rows=10 cols=35>'.$ob->maintainReason.'</textarea></td></tr>',"\n";
//email response
echo '<tr valign=top><td class=color0><b>Email reply</b></td>',"\n";
@@ -182,13 +188,14 @@ if ($_REQUEST['sub'])
//delete the item from the queue
query_appdb("DELETE from appMaintainerQueue where queueId = ".$_REQUEST['queueId'].";");
$oApp = new Application($ob->appId);
$oVersion = new Version($ob->versionId);
//Send Status Email
$sEmail = $oUser->sEmail;
if ($sEmail)
{
$sSubject = "Application Maintainer Request Report";
$sMsg = "Your application to be the maintainer of ".lookup_app_name($ob->appId).lookup_version_name($ob->versionId)." has been accepted. ";
$sMsg = "Your application to be the maintainer of ".$oApp->sName." ".$oVersion->sName." has been accepted. ";
$sMsg .= $_REQUEST['replyText'];
$sMsg .= "We appreciate your help in making the Application Database better for all users.\n\n";
@@ -204,8 +211,10 @@ if ($_REQUEST['sub'])
$sEmail = $oUser->sEmail;
if ($sEmail)
{
$oApp = new Application($ob->appId);
$oVersion = new Application($ob->versionId);
$sSubject = "Application Maintainer Request Report";
$sMsg = "Your application to be the maintainer of ".lookup_app_name($ob->appId).lookup_version_name($ob->versionId)." was rejected. ";
$sMsg = "Your application to be the maintainer of ".$oApp->sName." ".$oVersion->sName." was rejected. ";
$sMsg .= $_REQUEST['replyText'];
$sMsg .= "";
$sMsg .= "-The AppDB admins\n";
@@ -279,12 +288,14 @@ if ($_REQUEST['sub'])
while($ob = mysql_fetch_object($result))
{
$oUser = new User($ob->userId);
$oApp = new Application($ob->appId);
$oVersion = new Version($ob->versionId);
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
echo "<tr class=$bgcolor>\n";
echo " <td>".date("Y-n-t h:i:sa", $ob->submitTime)." &nbsp;</td>\n";
echo " <td><a href='adminMaintainerQueue.php?sub=view&queueId=$ob->queueId'>$ob->queueId</a></td>\n";
echo " <td>".$oUser->sRealName."</td>\n";
echo " <td>".lookup_app_name($ob->appId)."</td>\n";
echo " <td>".$oApp->sName."</td>\n";
if($ob->superMaintainer)
{
@@ -292,7 +303,7 @@ if ($_REQUEST['sub'])
echo "<td>Yes</td>\n";
} else
{
echo "<td>".lookup_version_name($ob->versionId)." &nbsp;</td>\n";
echo "<td>".$oVersion->sName." &nbsp;</td>\n";
echo "<td>No</td>\n";
}

View File

@@ -369,7 +369,7 @@ function get_screenshots($iAppId = null, $iVersionId = null)
FROM appData, appVersion
WHERE appVersion.versionId = appData.versionId
AND type = 'image'
AND appId = ".$iAppId;
AND appData.appId = ".$iAppId;
}
/*
* We want all screenshots for this version.

View File

@@ -7,9 +7,10 @@
* application environment
*/
include("path.php");
require(BASE."include/"."incl.php");
require(BASE."include/"."tableve.php");
require(BASE."include/"."category.php");
require(BASE."include/incl.php");
require(BASE."include/tableve.php");
require(BASE."include/category.php");
require(BASE."include/application.php");
if(!$_SESSION['current']->isLoggedIn())
{
@@ -24,33 +25,34 @@ $superMaintainer = strip_tags($_POST['superMaintainer']);
if($confirmed)
{
$oApp = new Application($appId);
if($superMaintainer)
{
apidb_header("You have resigned as supermaintainer of ".lookup_app_name($appId));
$query = "DELETE FROM appMaintainers WHERE userId = ".$_SESSION['current']->userid.
" AND appId = ".$appId." AND superMaintainer = ".$superMaintainer.";";
apidb_header("You have resigned as supermaintainer of ".$oApp->sName);
$query = "DELETE FROM appMaintainers WHERE userId = ".$_SESSION['current']->iUserId.
" AND appId = ".$oApp->iAppId." AND superMaintainer = ".$superMaintainer.";";
} else
{
apidb_header("You have resigned as maintainer of ".lookup_app_name($appId));
$query = "DELETE FROM appMaintainers WHERE userId = ".$_SESSION['current']->userid.
" AND appId = ".$appId." AND versionId = ".$versionId." AND superMaintainer = ".$superMaintainer.";";
$oVersion = new Version($versionId);
apidb_header("You have resigned as maintainer of ".$oApp->sName." ".$oVersion->sName);
$query = "DELETE FROM appMaintainers WHERE userId = ".$_SESSION['current']->iUserId.
" AND appId = ".$oApp->iAppId." AND versionId = ".$oVersion->iVersionId." AND superMaintainer = ".$superMaintainer.";";
}
/* echo html_frame_start("Removing",400,"",0);
*/
if($result = query_appdb($query))
{
if($superMaintainer)
echo "You were removed as a supermaintainer of ".lookup_app_name($appId);
echo "You were removed as a supermaintainer of ".$oApp->sName;
else
echo "You were removed as a maintainer of ".lookup_app_name($appId).lookup_version_name($versionId);
echo "You were removed as a maintainer of ".$oApp->sName." ".$oVersion->sName;
}
} else
{
if($superMaintainer)
apidb_header("Confirm supermaintainer resignation of ".lookup_app_name($appId));
apidb_header("Confirm supermaintainer resignation of ".$oApp->sName);
else
apidb_header("Confirm maintainer resignation of ".lookup_app_name($appId).lookup_version_name ($versionId));
apidb_header("Confirm maintainer resignation of ".$oApp->sName." ".$oVersion->sName);
echo '<form name="deleteMaintainer" action="maintainerdelete.php" method="post" enctype="multipart/form-data">',"\n";

View File

@@ -10,6 +10,7 @@ include("path.php");
require(BASE."include/incl.php");
require(BASE."include/tableve.php");
require(BASE."include/category.php");
require(BASE."include/application.php");
/**
* Check the input of a submitted form. And output with a list
@@ -93,9 +94,16 @@ if($_REQUEST['maintainReason'])
{
// header
if($versionId)
apidb_header("Request to become an application maintainer of ".lookup_app_name($appId)." ".lookup_version_name($versionId));
{
$oVersion = new Version($versionId);
$oApp = new Application($oVersion->iAppId);
apidb_header("Request to become an application maintainer of ".$oApp->sName." ".$oVersion->sName);
}
else
apidb_header("Request to become an application super maintainer of ".lookup_app_name($appId));
{
$oApp = new Application($appId);
apidb_header("Request to become an application super maintainer of ".$oApp->sName);
}
// show add to queue form
@@ -138,12 +146,12 @@ if($_REQUEST['maintainReason'])
echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
echo "<tr valign=top><td class=color0>";
echo '<b>Application</b></td><td>'.lookup_app_name($appId);
echo '<b>Application</b></td><td>'.$oApp->sName;
echo '</td></tr>',"\n";
if($versionId)
{
echo "<tr valign=top><td class=color0>";
echo '<b>Version</b></td><td>'.lookup_version_name($versionId);
echo '<b>Version</b></td><td>'.$oVersion->sName;
echo '</td></tr>',"\n";
}
echo "<input type=hidden name='appId' value=$appId>";