Remove unnecessary exit calls after redirect() and util_show_error_page() calls

This commit is contained in:
Jonathan Ernst
2006-07-06 17:59:52 +00:00
committed by WineHQ
parent 735a2bc65f
commit 54c484de8c
36 changed files with 17 additions and 153 deletions

View File

@@ -59,11 +59,9 @@ function do_account($sCmd = null)
$_SESSION['current']->logout();
redirect(apidb_fullurl("index.php"));
exit;
}
//not valid command, display error page
util_show_error_page("Internal Error","This module was called with incorrect parameters");
exit;
}
/**

View File

@@ -27,10 +27,7 @@ if(!$_SESSION['current']->isLoggedIn())
}
if( !is_numeric($aClean['iVersionId']) )
{
util_show_error_page('Internal Database Access Error');
exit;
}
if(!is_numeric($aClean['iThread']))
{

View File

@@ -27,7 +27,6 @@ if(!$_SESSION['current']->hasPriv("admin") &&
!$_SESSION['current']->isSuperMaintainer($aClean['iAppId']))
{
util_show_error_page("Insufficient Privileges!");
exit;
}
//set link for version
@@ -45,7 +44,6 @@ if($aClean['sSub'] == "Submit")
{
$oNote->create();
redirect(apidb_fullurl("appview.php?".$sVersionLink));
exit;
}
else if($aClean['sSub'] == 'Preview' OR empty($aClean['sSubmit']))
{

View File

@@ -12,10 +12,8 @@ $aClean['iParentId'] = makeSafe($_REQUEST['iParentId']);
$aClean['sSubmit'] = makeSafe($_REQUEST['sSubmit']);
if(!$_SESSION['current']->hasPriv("admin"))
{
util_show_error_page();
exit;
}
$oCat = new Category($aClean['iCatId']);
if($aClean['sSubmit'])
{

View File

@@ -20,10 +20,7 @@ $aClean['sReject'] = makeSafe($_REQUEST['sReject']);
// deny access if not admin or at least some kind of maintainer
if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->isMaintainer())
{
util_show_error_page("Insufficient privileges.");
exit;
}
// shows the list of appdata in queue
if (!$aClean['iId'])

View File

@@ -132,10 +132,8 @@ function display_move_test_to_versions_table($aVersionsIds,$icurrentVersionId)
//deny access if not logged in or not a super maintainer of any applications
if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->isSuperMaintainer())
{
util_show_error_page("Insufficient privileges.");
exit;
}
$oTest = new testData($aClean['iTestingId']);
if ($aClean['sSub'])
@@ -144,10 +142,7 @@ if ($aClean['sSub'])
{
/* make sure the user is authorized to view this application request */
if(!$_SESSION['current']->hasPriv("admin"))
{
util_show_error_page("Insufficient privileges.");
exit;
}
$oApp = new Application($aClean['iAppId']);
@@ -164,10 +159,8 @@ if ($aClean['sSub'])
/* make sure the user has permission to view this version */
$oVersion = new Version($aClean['iVersionId']);
if(!$_SESSION['current']->hasAppVersionModifyPermission($oVersion))
{
util_show_error_page("Insufficient privileges.");
exit;
}
} else
{
//error no Id!

View File

@@ -22,10 +22,7 @@ $aClean['iPage'] = makeSafe($_REQUEST['iPage']);
// deny access if not logged in
if(!$_SESSION['current']->hasPriv("admin"))
{
util_show_error_page("Insufficient privileges.");
exit;
}
if ($aClean['sSub'])
{
@@ -40,7 +37,6 @@ if ($aClean['sSub'])
$oBuglink->unqueue();
}
redirect($_SERVER['PHP_SELF']."?iItemsPerPage=".$aClean['iItemsPerPage']."&sQueuedOnly=".$aClean['sQueuedOnly']."&ipage=".$aClean['iPage']);
exit;
}
{

View File

@@ -20,10 +20,8 @@ $aClean['sReject'] = makeSafe( $_REQUEST['sReject'] );
$aClean['sReplyText'] = makeSafe( $_REQUEST['sReplyText'] );
if(!$_SESSION['current']->hasPriv("admin"))
{
util_show_error_page("Insufficient privileges.");
exit;
}
if ($aClean['sSub'])
{

View File

@@ -16,10 +16,7 @@ $aClean['iMaintainerId'] = makeSafe($_REQUEST['iMaintainerId']);
// deny access if not logged in
if(!$_SESSION['current']->hasPriv("admin"))
{
util_show_error_page("Insufficient privileges.");
exit;
}
apidb_header("Admin Maintainers");
echo '<form name="sQform" action="adminMaintainers.php" method="post" enctype="multipart/form-data">',"\n";

View File

@@ -21,10 +21,8 @@ $aClean['iVersionId'] = makeSafe($_REQUEST['iVersionId']);
// deny access if not admin
if(!$_SESSION['current']->hasPriv("admin"))
{
util_show_error_page("Insufficient privileges.");
exit;
}
/*
* We issued a delete command.
*/
@@ -40,8 +38,6 @@ if($aClean['sCmd'])
redirect($_SERVER['PHP_SELF'].
"?iItemsPerPage=".$aClean['iItemsPerPage'].
"&iPage=".$aClean['iPage']);
exit;
}

View File

@@ -21,10 +21,7 @@ if ($aClean['sSub'])
$oTest = new testData($aClean['iTestingId']);
$oVersion = new Version($oTest->iVersionId);
if(!($_SESSION['current']->hasAppVersionModifyPermission($oVersion)))
{
util_show_error_page("Insufficient privileges.");
exit;
}
if(($aClean['sSub'] == 'Submit') || ($aClean['sSub'] == 'Save') ||
($aClean['sSub'] == 'Reject') || ($aClean['sSub'] == 'Delete'))

View File

@@ -18,10 +18,8 @@ $aClean['sSubmit'] = makeSafe($_REQUEST['sSubmit']);
apidb_header("Admin Users Management");
if(!$_SESSION['current']->hasPriv("admin"))
{
util_show_error_page("Insufficient privileges.");
exit;
}
// we want to delete a user
if($aClean['sAction'] == "delete" && is_numeric($aClean['iUserId']))

View File

@@ -16,16 +16,10 @@ $aClean['iAppId'] = makeSafe($_REQUEST['iAppId']);
$aClean['sSubmit'] = makeSafe($_REQUEST['sSubmit']);
if(!is_numeric($aClean['iAppId']))
{
util_show_error_page("Wrong ID");
exit;
}
if(!($_SESSION['current']->hasPriv("admin") || $_SESSION['current']->isSuperMaintainer($aClean['iAppId'])))
{
util_show_error_page("Insufficient Privileges!");
exit;
}
if(!empty($aClean['sSubmit']))
{

View File

@@ -16,20 +16,14 @@ $aClean['sSubmit'] = makeSafe($_REQUEST['sSubmit']);
$aClean['sPreview'] = makeSafe($_REQUEST['sPreview']);
if(!is_numeric($aClean['iNoteId']))
{
util_show_error_page('Wrong note ID');
exit;
}
/* Get note data */
$oNote = new Note($aClean['iNoteId']);
/* Check for privs */
if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->isMaintainer($oNote->iVersionId) && !$_SESSION['current']->isSuperMaintainer($oNote->iAppId))
{
util_show_error_page("Insufficient Privileges!");
exit;
}
if(!empty($aClean['sSub']))
{

View File

@@ -12,17 +12,11 @@ $aClean['iVersionId'] = makeSafe($_REQUEST['iVersionId']);
$aClean['sSubmit'] = makeSafe($_REQUEST['sSubmit']);
if(!is_numeric($aClean['iAppId']) OR !is_numeric($aClean['iVersionId']))
{
util_show_error_page("Wrong ID");
exit;
}
/* Check for admin privs */
if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->isMaintainer($aClean['iVersionId']) && !$_SESSION['current']->isSuperMaintainer($aClean['iAppId']))
{
util_show_error_page("Insufficient Privileges!");
exit;
}
/* process the changes the user entered into the web form */
if(!empty($aClean['sSubmit']))

View File

@@ -4,10 +4,7 @@ include("path.php");
include(BASE."include/"."incl.php");
if(!$_SESSION['current']->hasPriv("admin"))
{
util_show_error_page();
exit;
}
function build_app_list()
{

View File

@@ -9,10 +9,7 @@ $aClean['iDistributionId'] = makeSafe($_REQUEST['iDistributionId']);
$aClean['sSubmit'] = makeSafe($_REQUEST['sSubmit']);
if(!$_SESSION['current']->hasPriv("admin"))
{
util_show_error_page("Insufficient privileges.");
exit;
}
$oDistribution = new distribution($aClean['iDistributionId']);
@@ -28,7 +25,6 @@ if($aClean['sSubmit'])
}
redirect(apidb_fullurl("distributionView.php"));
exit;
}
else
{

View File

@@ -10,10 +10,7 @@ $aClean['sName'] = makeSafe($_REQUEST['sName']);
$aClean['sWebpage'] = makeSafe($_REQUEST['sWebpage']);
if(!$_SESSION['current']->hasPriv("admin"))
{
util_show_error_page();
exit;
}
$oVendor = new Vendor($aClean['iVendorId']);
if($aClean['sSubmit'])

View File

@@ -12,17 +12,11 @@ $aClean['iVersionId'] = makeSafe($_REQUEST['iVersionId']);
$aClean['sAction'] = makeSafe($_REQUEST['sAction']);
if(!is_numeric($aClean['iAppId']) OR !is_numeric($aClean['iVersionId']))
{
util_show_error_page("Wrong ID");
exit;
}
/* Check for admin privs */
if(!$_SESSION['current']->hasPriv("admin"))
{
util_show_error_page("Insufficient Privileges!");
exit;
}
if(!empty($aClean['sAction']))
{

View File

@@ -31,10 +31,7 @@ if( empty( $aClean['iCatId'] ) )
}
if(!is_numeric($aClean['iCatId']))
{
util_show_error_page("Something went wrong with the category ID");
exit;
}
// list sub categories
$cat = new Category($aClean['iCatId']);

View File

@@ -20,19 +20,14 @@ header("Pragma: ");
/* if the user isn't supposed to be viewing this image */
/* display an error message and exit */
if(!$_SESSION['current']->canViewImage($aClean['iId']))
{
util_show_error_page("Insufficient privileges.");
exit;
}
if ($aClean['sREQUEST_METHOD']='HEAD')
{
/* WARNING! optimization of logic in include/screenshots.php */
if (sscanf($aClean['iId'],"%d", &$iId) < 1)
{
util_show_error_page("Bad parameter");
exit;
}
$hResult = query_parameters("SELECT id, url FROM appData
WHERE id = '?'
AND type = 'image' LIMIT 1", $iId);

View File

@@ -66,11 +66,7 @@ function newSubmition($errors)
}
//deny access if not logged on
if(!$_SESSION['current']->isLoggedIn())
{
util_show_error_page("Insufficient privileges to create application. Are you sure you are logged in?");
exit;
}
if ($aClean['sSub'])
{
@@ -93,9 +89,7 @@ if ($aClean['sSub'])
!$_SESSION['current']->isVersionSubmitter($oApp->AppId))
{
util_show_error_page("Insufficient privileges.");
exit;
}
$oVersion = new Version($oRow->versionId);
} else
{
@@ -113,7 +107,6 @@ if ($aClean['sSub'])
!$_SESSION['current']->isVersionSubmitter($oVersion->versionId))
{
util_show_error_page("Insufficient privileges.");
exit;
}
}
else

View File

@@ -83,10 +83,7 @@ function display_bundle($iAppId)
}
if(!is_numeric($aClean['iAppId']) && !is_numeric($aClean['iVersionId']))
{
util_show_error_page("Something went wrong with the application or version id");
exit;
}
if ($aClean['sSub'])
{
@@ -99,7 +96,6 @@ if ($aClean['sSub'])
$oBuglink = new bug($aClean['iBuglinkId']);
$oBuglink->delete();
redirect(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
exit;
}
}
@@ -112,7 +108,6 @@ if ($aClean['sSub'])
$oBuglink = new bug($aClean['iBuglinkId']);
$oBuglink->unqueue();
redirect(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
exit;
}
}
@@ -121,14 +116,12 @@ if ($aClean['sSub'])
$oBuglink = new bug();
$oBuglink->create($aClean['iVersionId'],$aClean['iBuglinkId']);
redirect(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
exit;
}
if($aClean['sSub'] == 'StartMonitoring')
{
$oMonitor = new Monitor();
$oMonitor->create($_SESSION['current']->iUserId,$aClean['iAppId'],$aClean['iVersionId']);
redirect(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
exit;
}
if($aClean['sSub'] == 'StopMonitoring')
{
@@ -139,7 +132,6 @@ if ($aClean['sSub'])
$oMonitor->delete();
}
redirect(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
exit;
}
}
@@ -159,7 +151,6 @@ if($aClean['iAppId'])
{
// Oops! Called with no params, bad llamah!
util_show_error_page('Page Called with No Params!');
exit;
}
apidb_footer();

View File

@@ -22,10 +22,7 @@ apidb_header("Comments");
if(!is_numeric($aClean['iAppId']) OR !is_numeric($aClean['iVersionId']) OR (!empty($aClean['iThreadId']) AND !is_numeric($aClean['iThreadId'])))
{
util_show_error_page("Wrong IDs");
exit;
}
view_app_comments($aClean['iVersionId'], $aClean['iThreadId']);

View File

@@ -26,7 +26,6 @@ if (!$_SESSION['current']->hasPriv("admin")
&& !$_SESSION['current']->isSuperMaintainer($oComment->iAppId))
{
util_show_error_page("You don't have sufficient privileges to delete this comment.");
exit;
}
if($_SESSION['current']->getPref("confirm_comment_deletion") != "no" && !isset($aClean['iDeleteIt']))

View File

@@ -20,10 +20,7 @@ $aClean['iDistributionId'] = makeSafe( $_REQUEST['iDistributionId']);
if ($aClean['sSub'])
{
if(!$_SESSION['current']->hasPriv("admin"))
{
util_show_error_page("Insufficient privileges.");
exit;
}
if($aClean['sSub'] == 'delete')
{

View File

@@ -519,10 +519,7 @@ class Application {
/* is this user supposed to view this version? */
if(!$_SESSION['current']->canViewApplication($this))
{
util_show_error_page("Something went wrong with the application or version id");
exit;
}
// show Vote Menu
if($_SESSION['current']->isLoggedIn())

View File

@@ -12,6 +12,7 @@ function util_show_error_page($text = null, $message = null)
echo "<div align=center><font color=red><b>$text</b></font></div>\n";
echo "<p>$message</p>\n";
apidb_footer();
exit;
}
function makeSafe($var)

View File

@@ -622,25 +622,17 @@ class Version {
/* is this user supposed to view this version? */
if(!$_SESSION['current']->canViewVersion($this))
{
util_show_error_page("Something went wrong with the application or version id");
exit;
}
$oApp = new Application($this->iAppId);
if(!$oApp->iAppId)
{
// Oops! application not found or other error. do something
util_show_error_page('Internal Database Access Error. No App found.');
exit;
}
if(!$this->iVersionId)
{
// Oops! application not found or other error. do something
if(!$oApp->iAppId)
util_show_error_page('Internal Database Access Error. No App found.');
// Oops! Version not found or other error. do something
if(!$this->iVersionId)
util_show_error_page('Internal Database Access Error. No Version Found.');
exit;
}
// header
apidb_header("Viewing App- ".$oApp->sName." Version - ".$this->sName);

View File

@@ -151,10 +151,7 @@ function vote_menu()
function vote_update($vars)
{
if(!$_SESSION['current']->isLoggedIn())
{
util_show_error_page("You must be logged in to vote");
return;
}
if( !is_numeric($vars['iAppId']) OR !is_numeric($vars['iSlot']))
{

View File

@@ -19,10 +19,7 @@ $aClean['iConfirmed'] = makeSafe($_POST['iConfirmed']);
$aClean['iSuperMaintainer'] = makeSafe($_POST['iSuperMaintainer']);
if(!$_SESSION['current']->isLoggedIn())
{
util_show_error_page("You need to be logged in to resign from being a maintainer.");
exit;
}
if($aClean['iConfirmed'])

View File

@@ -44,11 +44,7 @@ function checkAppMaintainerInput( $maintainReason )
if(!$_SESSION['current']->isLoggedIn())
{
util_show_error_page("You need to be logged in to apply to be a maintainer.");
exit;
}
/* if we have a versionId to check against see if */
/* the user is already a maintainer */
@@ -70,10 +66,7 @@ if( $aClean['sMaintainReason'] )
// check the input for empty/invalid fields
$errors = checkAppMaintainerInput($aClean['sMaintainReason']);
if(!empty($errors))
{
util_show_error_page("We found the following errors:","<ul>$errors</ul><br />Please go back and correct them.");
exit;
}
// header
if($aClean['iSuperMaintainer'])

View File

@@ -32,10 +32,7 @@ while(list($key, $value) = each($_REQUEST))
if(!$_SESSION['current']->isLoggedIn())
{
util_show_error_page("You must be logged in to edit preferences");
exit;
}
// we come from the administration to edit an user
if($_SESSION['current']->hasPriv("admin") &&

View File

@@ -82,7 +82,6 @@ if ($aClean['sSub'])
!(($_SESSION['current']->iUserId == $oTest->iSubmitterId) && !($oTest->sQueued == 'false')))
{
util_show_error_page("Insufficient privileges.");
exit;
} else
$oVersion = new version($oTest->iVersionId);
} else

View File

@@ -20,10 +20,7 @@ $oVendor = new Vendor($aClean['iVendorId']);
if ($aClean['sSub'])
{
if(!$_SESSION['current']->hasPriv("admin"))
{
util_show_error_page("Insufficient privileges.");
exit;
}
if($aClean['sSub'] == 'delete')
{

View File

@@ -13,11 +13,8 @@ $aClean['iBugId'] = makeSafe($_REQUEST['iBugId']);
/* code to View versions affected by a Bug */
if(!is_numeric($aClean['iBugId']))
{
util_show_error_page("Something went wrong with the bug ID");
exit;
}
{
apidb_header("Applications affected by Bug #".$aClean['iBugId']);
echo '<form method=post action="viewbugs.php?iBugId='.$aClean['iBugId'].'">',"\n";
@@ -76,5 +73,4 @@ if( !is_numeric($aClean['iBugId']))
echo '</table>',"\n";
apidb_footer();
}
?>