)
*/
function checkAppMaintainerInput( $fields )
{
$errors = "";
if ( empty( $fields['maintainReason']) )
{
$errors .= "
Please enter why you would like to be an application maintainer.\n";
}
if ( empty($errors) )
{
return "";
}
else
{
return $errors;
}
}
if(!$_SESSION['current']->isLoggedIn())
{
errorpage("You need to be logged in to apply to be a maintainer.");
exit;
}
$appId = strip_tags($_POST['appId']);
$versionId = strip_tags($_POST['versionId']);
$superMaintainer = strip_tags($_POST['superMaintainer']);
/* if the user is already a maintainer don't add them again */
if($_SESSION['current']->isMaintainer($appId, $versionId))
{
echo "You are already a maintainer of this app!";
exit;
}
/* if this user is a super maintainer they maintain all of the versionIds of this appId */
if($_SESSION['current']->isSuperMaintainer($appId))
{
echo "You are already a supermaintainer of the whole application family!";
exit;
}
if($_REQUEST['maintainReason'])
{
// check the input for empty/invalid fields
$errors = checkAppMaintainerInput($_REQUEST);
if(!empty($errors))
{
errorpage("We found the following errors:","
Please go back and correct them.");
exit;
}
// header
if($superMaintainer)
apidb_header("Submit SuperMaintainer Request");
else
apidb_header("Submit Maintainer Request");
// add to queue
$query = "INSERT INTO appMaintainerQueue VALUES (null, '".
addslashes($_REQUEST['appId'])."', '".
addslashes($_REQUEST['versionId'])."', '".
addslashes($_SESSION['current']->iUserId)."', '".
addslashes($_REQUEST['maintainReason'])."', '".
addslashes($_REQUEST['superMaintainer'])."',".
"NOW()".");";
if (query_appdb($query))
{
echo "Your maintainer request has been submitted for Review. You should hear back\n";
echo "soon about the status of your submission
\n";
}
} else
{
// header
if($versionId)
apidb_header("Request to become an application maintainer of ".lookup_app_name($appId)." ".lookup_version_name($versionId));
else
apidb_header("Request to become an application super maintainer of ".lookup_app_name($appId));
// show add to queue form
echo '";
}
apidb_footer();
?>