Rename util_show_error_page() to util_show_error_page_and_exit() and redirect() to util_redirect_and_exit()

so it is explicit that we exit in those functions that so we know it isn't necessary to put an exit after
we call them
This commit is contained in:
Jonathan Ernst
2006-07-06 18:44:56 +00:00
committed by WineHQ
parent a34058b924
commit 3096e63828
41 changed files with 119 additions and 120 deletions

View File

@@ -67,10 +67,10 @@ function do_account($sCmd = null)
if($_SESSION['current'])
$_SESSION['current']->logout();
redirect(apidb_fullurl("index.php"));
util_redirect_and_exit(apidb_fullurl("index.php"));
}
// not valid command, display error page
util_show_error_page("Internal Error","This module was called with incorrect parameters");
util_show_error_page_and_exit("Internal Error","This module was called with incorrect parameters");
}
/**
@@ -129,7 +129,7 @@ function cmd_do_new()
$oUser->login($aClean['sUserEmail'], $aClean['sUserPassword']);
addmsg("Account created! (".$aClean['sUserEmail'].")", "green");
redirect(apidb_fullurl());
util_redirect_and_exit(apidb_fullurl());
}
else if($iResult == USER_CREATE_EXISTS)
{
@@ -162,7 +162,7 @@ function cmd_send_passwd()
{
addmsg("Please enter your email address in the 'E-mail' field and re-request a new password",
"green");
redirect(apidb_fullurl("account.php?cmd=login"));
util_redirect_and_exit(apidb_fullurl("account.php?cmd=login"));
}
$shNote = '(<b>Note</b>: accounts for <b>appdb</b>.winehq.org and <b>bugs</b>.winehq.org '
@@ -202,7 +202,7 @@ function cmd_send_passwd()
.$shNote, "red");
}
redirect(apidb_fullurl("account.php?sCmd=login"));
util_redirect_and_exit(apidb_fullurl("account.php?sCmd=login"));
}
/**
@@ -221,7 +221,7 @@ function cmd_do_login()
if($iResult == SUCCESS)
{
addmsg("You are successfully logged in as '$oUser->sRealname'.", "green");
redirect(apidb_fullurl("index.php"));
util_redirect_and_exit(apidb_fullurl("index.php"));
} else
{
retry("login","Login failed ".$shNote);

View File

@@ -33,7 +33,7 @@ if(!$_SESSION['current']->isLoggedIn())
}
if( !is_numeric($aClean['iVersionId']) )
util_show_error_page('Internal Database Access Error');
util_show_error_page_and_exit('Internal Database Access Error');
if(!is_numeric($aClean['iThread']))
{
@@ -45,7 +45,7 @@ if(!empty($aClean['sBody']))
{
$oComment = new Comment();
$oComment->create($aClean['sSubject'], $aClean['sBody'], $aClean['iThread'], $aClean['iVersionId']);
redirect(apidb_fullurl("appview.php?iVersionId=".$oComment->iVersionId));
util_redirect_and_exit(apidb_fullurl("appview.php?iVersionId=".$oComment->iVersionId));
// let's show the comment form
} else
{

View File

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

View File

@@ -12,13 +12,13 @@ $aClean['iParentId'] = makeSafe($_REQUEST['iParentId']);
$aClean['sSubmit'] = makeSafe($_REQUEST['sSubmit']);
if(!$_SESSION['current']->hasPriv("admin"))
util_show_error_page();
util_show_error_page_and_exit();
$oCat = new Category($aClean['iCatId']);
if($aClean['sSubmit'])
{
$oCat->update($aClean['sName'],$aClean['sDescription'],$aClean['iParentId']);
redirect(apidb_fullurl("appbrowse.php?iCatId=".$oCat->iCatId));
util_redirect_and_exit(apidb_fullurl("appbrowse.php?iCatId=".$oCat->iCatId));
}
else
{

View File

@@ -20,7 +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.");
util_show_error_page_and_exit("Insufficient privileges.");
// shows the list of appdata in queue
if (!$aClean['iId'])
@@ -190,7 +190,7 @@ if (!$aClean['iId'])
}
}
}
redirect(apidb_fullurl("admin/adminAppDataQueue.php"));
util_redirect_and_exit(apidb_fullurl("admin/adminAppDataQueue.php"));
} elseif ($aClean['sReject'])
{
if($obj_row->type == "image")
@@ -216,7 +216,7 @@ if (!$aClean['iId'])
echo "<p>Application data was successfully deleted from the Queue.</p>\n";
}
}
redirect(apidb_fullurl("admin/adminAppDataQueue.php"));
util_redirect_and_exit(apidb_fullurl("admin/adminAppDataQueue.php"));
}
}
echo html_frame_end("&nbsp;");

View File

@@ -132,7 +132,7 @@ 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.");
util_show_error_page_and_exit("Insufficient privileges.");
$oTest = new testData($aClean['iTestingId']);
@@ -142,7 +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.");
util_show_error_page_and_exit("Insufficient privileges.");
$oApp = new Application($aClean['iAppId']);
@@ -159,13 +159,13 @@ 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.");
util_show_error_page_and_exit("Insufficient privileges.");
} else
{
//error no Id!
addmsg("Application Not Found!", "red");
redirect(apidb_fullurl("admin/adminAppQueue.php"));
util_redirect_and_exit(apidb_fullurl("admin/adminAppQueue.php"));
}
// Get the Testing results if they exist
@@ -205,7 +205,7 @@ if ($aClean['sSub'])
$oVersion->unQueue();
$oTest->update(true);
$oTest->unQueue();
redirect($_SERVER['PHP_SELF']);
util_redirect_and_exit($_SERVER['PHP_SELF']);
}
else if ($aClean['sSub'] == 'duplicate')
{
@@ -222,7 +222,7 @@ if ($aClean['sSub'])
}
/* redirect back to the main page */
redirect(apidb_fullurl("admin/adminAppQueue.php"));
util_redirect_and_exit(apidb_fullurl("admin/adminAppQueue.php"));
}
else if ($aClean['sSub'] == 'movetest')
{
@@ -239,7 +239,7 @@ if ($aClean['sSub'])
}
// redirect back to the main page
redirect(apidb_fullurl("admin/adminAppQueue.php"));
util_redirect_and_exit(apidb_fullurl("admin/adminAppQueue.php"));
}
else if ($aClean['sSub'] == 'Delete')
{
@@ -258,7 +258,7 @@ if ($aClean['sSub'])
$oVersion->delete();
}
redirect(apidb_fullurl("admin/adminAppQueue.php"));
util_redirect_and_exit(apidb_fullurl("admin/adminAppQueue.php"));
}
else if ($aClean['sSub'] == 'Reject')
{
@@ -277,7 +277,7 @@ if ($aClean['sSub'])
$oVersion->reject();
$oTest->update(true);
$oTest->reject();
redirect($_SERVER['PHP_SELF']);
util_redirect_and_exit($_SERVER['PHP_SELF']);
}
//process according to sub flag
@@ -422,7 +422,7 @@ if ($aClean['sSub'])
{
//error no sub!
addmsg("Internal Routine Not Found!!", "red");
redirect(apidb_fullurl("admin/adminAppQueue.php"));
util_redirect_and_exit(apidb_fullurl("admin/adminAppQueue.php"));
}
}
else /* if ($aClean['sSub']) is not defined, display the main app queue page */

View File

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

View File

@@ -20,7 +20,7 @@ $aClean['sReject'] = makeSafe( $_REQUEST['sReject'] );
$aClean['sReplyText'] = makeSafe( $_REQUEST['sReplyText'] );
if(!$_SESSION['current']->hasPriv("admin"))
util_show_error_page("Insufficient privileges.");
util_show_error_page_and_exit("Insufficient privileges.");
if ($aClean['sSub'])
@@ -40,7 +40,7 @@ if ($aClean['sSub'])
else
{
//error no Id!
util_show_error_page("<p><b>QueueId Not Found!</b></p>");
util_show_error_page_and_exit("<p><b>QueueId Not Found!</b></p>");
}
//process according to which request was submitted and optionally the sub flag

View File

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

View File

@@ -21,7 +21,7 @@ $aClean['iVersionId'] = makeSafe($_REQUEST['iVersionId']);
// deny access if not admin
if(!$_SESSION['current']->hasPriv("admin"))
util_show_error_page("Insufficient privileges.");
util_show_error_page_and_exit("Insufficient privileges.");
/*
* We issued a delete command.
@@ -35,7 +35,7 @@ if($aClean['sCmd'])
$oScreenshot->delete();
$oScreenshot->free();
}
redirect($_SERVER['PHP_SELF'].
util_redirect_and_exit($_SERVER['PHP_SELF'].
"?iItemsPerPage=".$aClean['iItemsPerPage'].
"&iPage=".$aClean['iPage']);
}

View File

@@ -21,7 +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.");
util_show_error_page_and_exit("Insufficient privileges.");
if(($aClean['sSub'] == 'Submit') || ($aClean['sSub'] == 'Save') ||
($aClean['sSub'] == 'Reject') || ($aClean['sSub'] == 'Delete'))
@@ -47,7 +47,7 @@ if ($aClean['sSub'])
$oTest->delete();
}
redirect($_SERVER['PHP_SELF']);
util_redirect_and_exit($_SERVER['PHP_SELF']);
}
}
@@ -138,7 +138,7 @@ if ($aClean['sSub'])
{
// error no sub!
addmsg("Internal Routine Not Found!!", "red");
redirect($_SERVER['PHP_SELF']);
util_redirect_and_exit($_SERVER['PHP_SELF']);
}
}
else // if ($aClean['sSub']) is not defined, display the Testing results queue page

View File

@@ -18,7 +18,7 @@ $aClean['sSubmit'] = makeSafe($_REQUEST['sSubmit']);
apidb_header("Admin Users Management");
if(!$_SESSION['current']->hasPriv("admin"))
util_show_error_page("Insufficient privileges.");
util_show_error_page_and_exit("Insufficient privileges.");
// we want to delete a user

View File

@@ -29,7 +29,7 @@ if($aClean['sConfirmed'] != "yes")
//
// perhaps we can do this with some javascript, popup
util_show_error_page("Not confirmed");
util_show_error_page_and_exit("Not confirmed");
}
if($aClean['sWhat'])
@@ -40,24 +40,24 @@ if($aClean['sWhat'])
// delete category and the apps in it
$oCategory = new Category($aClean['iCatId']);
if(!$oCategory->delete())
util_show_error_page();
util_show_error_page_and_exit();
else
redirect(BASE."appbrowse.php");
util_redirect_and_exit(BASE."appbrowse.php");
break;
case "appFamily":
// delete app family & all its versions
$oApp = new Application($aClean['iAppId']);
if(!$oApp->delete())
util_show_error_page();
util_show_error_page_and_exit();
else
redirect(BASE."appbrowse.php");
util_redirect_and_exit(BASE."appbrowse.php");
break;
case "appVersion":
$oVersion = new Version($aClean['iVersionId']);
if(!$oVersion->delete())
util_show_error_page();
util_show_error_page_and_exit();
else
redirect(BASE."appview.php?iAppId=".$aClean['iAppId']);
util_redirect_and_exit(BASE."appview.php?iAppId=".$aClean['iAppId']);
break;
}
}

View File

@@ -16,15 +16,15 @@ $aClean['iAppId'] = makeSafe($_REQUEST['iAppId']);
$aClean['sSubmit'] = makeSafe($_REQUEST['sSubmit']);
if(!is_numeric($aClean['iAppId']))
util_show_error_page("Wrong ID");
util_show_error_page_and_exit("Wrong ID");
if(!($_SESSION['current']->hasPriv("admin") || $_SESSION['current']->isSuperMaintainer($aClean['iAppId'])))
util_show_error_page("Insufficient Privileges!");
util_show_error_page_and_exit("Insufficient Privileges!");
if(!empty($aClean['sSubmit']))
{
process_app_version_changes(false);
redirect(apidb_fullurl("appview.php?iAppId={$aClean['iAppId']}"));
util_redirect_and_exit(apidb_fullurl("appview.php?iAppId={$aClean['iAppId']}"));
}
else
// Show the form for editing the Application Family
@@ -36,7 +36,7 @@ else
if(!$oApp)
{
util_show_error_page('Application does not exist');
util_show_error_page_and_exit('Application does not exist');
}
if($_SESSION['current']->showDebuggingInfos()) { echo "<p align=center><b>appName:</b> $oApp->sName </p>"; }

View File

@@ -16,14 +16,14 @@ $aClean['sSubmit'] = makeSafe($_REQUEST['sSubmit']);
$aClean['sPreview'] = makeSafe($_REQUEST['sPreview']);
if(!is_numeric($aClean['iNoteId']))
util_show_error_page('Wrong note ID');
util_show_error_page_and_exit('Wrong note ID');
/* 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!");
util_show_error_page_and_exit("Insufficient Privileges!");
if(!empty($aClean['sSub']))
{
@@ -37,7 +37,7 @@ if(!empty($aClean['sSub']))
{
$oNote->update();
}
redirect(apidb_fullurl("appview.php?iVersionId={$oNote->iVersionId}"));
util_redirect_and_exit(apidb_fullurl("appview.php?iVersionId={$oNote->iVersionId}"));
} else /* display note */
{
// show form

View File

@@ -12,17 +12,17 @@ $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");
util_show_error_page_and_exit("Wrong ID");
/* 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!");
util_show_error_page_and_exit("Insufficient Privileges!");
/* process the changes the user entered into the web form */
if(!empty($aClean['sSubmit']))
{
process_app_version_changes(true);
redirect(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
util_redirect_and_exit(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
} else /* or display the webform for making changes */
{

View File

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

View File

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

View File

@@ -10,13 +10,13 @@ $aClean['sName'] = makeSafe($_REQUEST['sName']);
$aClean['sWebpage'] = makeSafe($_REQUEST['sWebpage']);
if(!$_SESSION['current']->hasPriv("admin"))
util_show_error_page();
util_show_error_page_and_exit();
$oVendor = new Vendor($aClean['iVendorId']);
if($aClean['sSubmit'])
{
$oVendor->update($aClean['sName'],$aClean['sWebpage']);
redirect(apidb_fullurl("vendorview.php"));
util_redirect_and_exit(apidb_fullurl("vendorview.php"));
}
else
{

View File

@@ -12,11 +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");
util_show_error_page_and_exit("Wrong ID");
/* Check for admin privs */
if(!$_SESSION['current']->hasPriv("admin"))
util_show_error_page("Insufficient Privileges!");
util_show_error_page_and_exit("Insufficient Privileges!");
if(!empty($aClean['sAction']))
{
@@ -25,7 +25,7 @@ if(!empty($aClean['sAction']))
$oVersion->update(null, null, null, null, $aClean['iAppId']);
/* redirect to the application we just moved this version to */
redirect(apidb_fullurl("appview.php?iAppId=".$aClean['iAppId']));
util_redirect_and_exit(apidb_fullurl("appview.php?iAppId=".$aClean['iAppId']));
} else /* or display the webform for making changes */
{
?>

View File

@@ -7,7 +7,7 @@ include("path.php");
require_once(BASE."include/incl.php");
redirect(BASE."appsubmit.php");
util_redirect_and_exit(BASE."appsubmit.php");
?>

View File

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

View File

@@ -32,13 +32,13 @@ header("Pragma: ");
// is the user supposed to be viewing this image ?
if(!$_SESSION['current']->canViewImage($aClean['iId']))
util_show_error_page("Insufficient privileges.");
util_show_error_page_and_exit("Insufficient privileges.");
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");
util_show_error_page_and_exit("Bad parameter");
$hResult = query_parameters("SELECT id, url FROM appData
WHERE id = '?'

View File

@@ -66,7 +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?");
util_show_error_page_and_exit("Insufficient privileges to create application. Are you sure you are logged in?");
if ($aClean['sSub'])
{
@@ -88,7 +88,7 @@ if ($aClean['sSub'])
(($oApp->queued=="false")?true:false) &&
!$_SESSION['current']->isVersionSubmitter($oApp->AppId))
{
util_show_error_page("Insufficient privileges.");
util_show_error_page_and_exit("Insufficient privileges.");
}
$oVersion = new Version($oRow->versionId);
} else
@@ -106,14 +106,14 @@ if ($aClean['sSub'])
(($oVersion->queued=="false")?true:false) &&
!$_SESSION['current']->isVersionSubmitter($oVersion->versionId))
{
util_show_error_page("Insufficient privileges.");
util_show_error_page_and_exit("Insufficient privileges.");
}
}
else
{
//error no Id!
addmsg("Application Not Found!", "red");
redirect($_SERVER['PHP_SELF']);
util_redirect_and_exit($_SERVER['PHP_SELF']);
}
// Get the Testing results if they exist
@@ -207,7 +207,7 @@ if ($aClean['sSub'])
{
$oTest->create();
}
redirect($_SERVER['PHP_SELF']);
util_redirect_and_exit($_SERVER['PHP_SELF']);
}
}
if ($aClean['sSub'] == 'Delete')
@@ -236,7 +236,7 @@ if ($aClean['sSub'])
$oVersion->delete();
}
redirect($_SERVER['PHP_SELF']);
util_redirect_and_exit($_SERVER['PHP_SELF']);
}
if ($aClean['sSub'] == 'view')
{
@@ -388,7 +388,7 @@ if ($aClean['sSub'])
{
// error no sub!
addmsg("Internal Routine Not Found!!", "red");
redirect($_SERVER['PHP_SELF']);
util_redirect_and_exit($_SERVER['PHP_SELF']);
}
}
else // if ($aClean['sSub']) is not defined, display the main app queue page

View File

@@ -95,7 +95,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");
util_show_error_page_and_exit("Something went wrong with the application or version id");
if ($aClean['sSub'])
{
@@ -107,7 +107,7 @@ if ($aClean['sSub'])
{
$oBuglink = new bug($aClean['iBuglinkId']);
$oBuglink->delete();
redirect(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
util_redirect_and_exit(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
}
}
@@ -119,7 +119,7 @@ if ($aClean['sSub'])
{
$oBuglink = new bug($aClean['iBuglinkId']);
$oBuglink->unqueue();
redirect(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
util_redirect_and_exit(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
}
}
@@ -127,13 +127,13 @@ if ($aClean['sSub'])
{
$oBuglink = new bug();
$oBuglink->create($aClean['iVersionId'],$aClean['iBuglinkId']);
redirect(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
util_redirect_and_exit(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
}
if($aClean['sSub'] == 'StartMonitoring')
{
$oMonitor = new Monitor();
$oMonitor->create($_SESSION['current']->iUserId,$aClean['iAppId'],$aClean['iVersionId']);
redirect(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
util_redirect_and_exit(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
}
if($aClean['sSub'] == 'StopMonitoring')
{
@@ -143,7 +143,7 @@ if ($aClean['sSub'])
{
$oMonitor->delete();
}
redirect(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
util_redirect_and_exit(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
}
}
@@ -162,7 +162,7 @@ if($aClean['iAppId'])
} else
{
// Oops! Called with no params, bad llamah!
util_show_error_page('Page Called with No Params!');
util_show_error_page_and_exit('Page Called with No Params!');
}
apidb_footer();

View File

@@ -22,7 +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");
util_show_error_page_and_exit("Wrong IDs");
view_app_comments($aClean['iVersionId'], $aClean['iThreadId']);

View File

@@ -32,7 +32,7 @@ if (!$_SESSION['current']->hasPriv("admin")
&& !$_SESSION['current']->isMaintainer($oComment->iVersionId)
&& !$_SESSION['current']->isSuperMaintainer($oComment->iAppId))
{
util_show_error_page("You don't have sufficient privileges to delete this comment.");
util_show_error_page_and_exit("You don't have sufficient privileges to delete this comment.");
}
// let's show the deletion form if the user want's to explain why he deleted the comment
@@ -62,6 +62,6 @@ if($_SESSION['current']->getPref("confirm_comment_deletion") != "no" && !isset($
} else
{
$oComment->delete($aClean['sWhy']);
redirect(apidb_fullurl("appview.php?iVersionId=".$oComment->iVersionId));
util_redirect_and_exit(apidb_fullurl("appview.php?iVersionId=".$oComment->iVersionId));
}
?>

View File

@@ -20,13 +20,13 @@ $aClean['iDistributionId'] = makeSafe( $_REQUEST['iDistributionId']);
if ($aClean['sSub'])
{
if(!$_SESSION['current']->hasPriv("admin"))
util_show_error_page("Insufficient privileges.");
util_show_error_page_and_exit("Insufficient privileges.");
if($aClean['sSub'] == 'delete')
{
$oDistribution = new distribution($aClean['iDistributionId']);
$oDistribution->delete();
redirect($_SERVER['PHP_SELF']);
util_redirect_and_exit($_SERVER['PHP_SELF']);
}
}
$oDistribution = new distribution($aClean['iDistributionId']);

View File

@@ -519,7 +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");
util_show_error_page_and_exit("Something went wrong with the application or version id");
// show Vote Menu
if($_SESSION['current']->isLoggedIn())

View File

@@ -18,13 +18,13 @@ function filter_gpc()
if(is_numeric($_REQUEST[$aKeys[$i]]))
$aClean[$aKeys[$i]] = $_REQUEST[$aKeys[$i]];
else
util_show_error_page("Fatal error: ".$aKeys[$i]." should be a numeric value.");
util_show_error_page_and_exit("Fatal error: ".$aKeys[$i]." should be a numeric value.");
break;
case "b": // boolean
if($_REQUEST[$aKeys[$i]]=="true" || $_REQUEST[$aKeys[$i]]=="false")
$aClean[$aKeys[$i]] = $_REQUEST[$aKeys[$i]];
else
util_show_error_page("Fatal error: ".$aKeys[$i]." should be a boolean value.");
util_show_error_page_and_exit("Fatal error: ".$aKeys[$i]." should be a boolean value.");
break;
case "s": // string
switch($aKeys[$i][1])
@@ -39,11 +39,11 @@ function filter_gpc()
break;
case "a": // array
if(!is_array($_REQUEST[$aKeys[$i]]))
util_show_error_page("Fatal error: ".$aKeys[$i]." should be an array.");
util_show_error_page_and_exit("Fatal error: ".$aKeys[$i]." should be an array.");
break;
default:
if($aKeys[$i]!="whq_appdb" && $aKeys[$i]!="MAX_FILE_SIZE") // whq_appdb is the name of the session cookie
util_show_error_page("Fatal error: type of variable ".$aKeys[$i]." is not recognized.");
util_show_error_page_and_exit("Fatal error: type of variable ".$aKeys[$i]." is not recognized.");
break;
}
}

View File

@@ -164,16 +164,6 @@ function apidb_image($name)
}
/**
* redirect to $url
*/
function redirect($url)
{
header("Location: ".$url);
exit;
}
/**
* format a date as required for HTTP by RFC 2068 sec 3.3.1
*/

View File

@@ -2,7 +2,7 @@
/**
* display an error page
*/
function util_show_error_page($text = null, $message = null)
function util_show_error_page_and_exit($text = null, $message = null)
{
if (!$text) {
$text = "You must be logged in to perform that operation.";
@@ -15,6 +15,15 @@ function util_show_error_page($text = null, $message = null)
exit;
}
/**
* redirect to $url
*/
function util_redirect_and_exit($url)
{
header("Location: ".$url);
exit;
}
function makeSafe($var)
{
/* Disable addslashes() until we can use more finely grained filtering on user input */

View File

@@ -622,17 +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");
util_show_error_page_and_exit("Something went wrong with the application or version id");
$oApp = new Application($this->iAppId);
// Oops! application not found or other error. do something
if(!$oApp->iAppId)
util_show_error_page('Internal Database Access Error. No App found.');
util_show_error_page_and_exit('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.');
util_show_error_page_and_exit('Internal Database Access Error. No Version Found.');
// header
apidb_header("Viewing App- ".$oApp->sName." Version - ".$this->sName);

View File

@@ -151,14 +151,14 @@ function vote_menu()
function vote_update($vars)
{
if(!$_SESSION['current']->isLoggedIn())
util_show_error_page("You must be logged in to vote");
util_show_error_page_and_exit("You must be logged in to vote");
if( !is_numeric($vars['iAppId']) OR !is_numeric($vars['iSlot']))
{
if(is_numeric($vars['iAppId']))
redirect(apidb_fullurl("appview.php?iAppId=".$vars["iAppId"]));
util_redirect_and_exit(apidb_fullurl("appview.php?iAppId=".$vars["iAppId"]));
else
redirect(apidb_fullurl("index.php"));
util_redirect_and_exit(apidb_fullurl("index.php"));
return;
}
@@ -178,7 +178,7 @@ function vote_update($vars)
}
}
redirect(apidb_fullurl("appview.php?iAppId=".$vars["iAppId"]));
util_redirect_and_exit(apidb_fullurl("appview.php?iAppId=".$vars["iAppId"]));
}
// tell us if there is a vote in a given slot so we don't

View File

@@ -31,7 +31,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.");
util_show_error_page_and_exit("You need to be logged in to resign from being a maintainer.");
if($aClean['iConfirmed'])

View File

@@ -54,7 +54,7 @@ function checkAppMaintainerInput( $maintainReason )
if(!$_SESSION['current']->isLoggedIn())
util_show_error_page("You need to be logged in to apply to be a maintainer.");
util_show_error_page_and_exit("You need to be logged in to apply to be a maintainer.");
/* if we have a versionId to check against see if */
/* the user is already a maintainer */
@@ -76,7 +76,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.");
util_show_error_page_and_exit("We found the following errors:","<ul>$errors</ul><br />Please go back and correct them.");
// header
if($aClean['iSuperMaintainer'])

View File

@@ -48,7 +48,7 @@ while(list($key, $value) = each($_REQUEST))
if(!$_SESSION['current']->isLoggedIn())
util_show_error_page("You must be logged in to edit preferences");
util_show_error_page_and_exit("You must be logged in to edit preferences");
// we come from the administration to edit an user
if($_SESSION['current']->hasPriv("admin") &&
@@ -155,7 +155,7 @@ if($_POST)
$oUser->addPriv("admin");
else
$oUser->delPriv("admin");
redirect(BASE."admin/adminUsers.php?iUserId=".$oUser->iUserId."&sSearch=".$aClean['sSearch']."&iLimit=".$aClean['iLimit']."&sOrderBy=".$aClean['sOrderBy']."&sSubmit=true");
util_redirect_and_exit(BASE."admin/adminUsers.php?iUserId=".$oUser->iUserId."&sSearch=".$aClean['sSearch']."&iLimit=".$aClean['iLimit']."&sOrderBy=".$aClean['sOrderBy']."&sSubmit=true");
}
}
else

View File

@@ -54,7 +54,7 @@ if($aClean['sCmd'])
$oScreenshot->delete();
$oScreenshot->free();
}
redirect(apidb_fullurl("screenshots.php?iAppId=".$aClean['iAppId']."&iVersionId=".$aClean['iVersionId']));
util_redirect_and_exit(apidb_fullurl("screenshots.php?iAppId=".$aClean['iAppId']."&iVersionId=".$aClean['iVersionId']));
}

View File

@@ -53,7 +53,7 @@ if ($aClean['sSub'])
$oTest->update(true);
$oTest->ReQueue();
}
redirect($_SERVER['PHP_SELF']);
util_redirect_and_exit($_SERVER['PHP_SELF']);
} else
{
$aClean['sSub'] = 'view';
@@ -69,7 +69,7 @@ if ($aClean['sSub'])
$oTest->delete();
}
redirect($_SERVER['PHP_SELF']);
util_redirect_and_exit($_SERVER['PHP_SELF']);
}
// is this an old test?
@@ -81,7 +81,7 @@ if ($aClean['sSub'])
!$_SESSION['current']->hasAppVersionModifyPermission($oVersion)&&
!(($_SESSION['current']->iUserId == $oTest->iSubmitterId) && !($oTest->sQueued == 'false')))
{
util_show_error_page("Insufficient privileges.");
util_show_error_page_and_exit("Insufficient privileges.");
} else
$oVersion = new version($oTest->iVersionId);
} else
@@ -161,7 +161,7 @@ if ($aClean['sSub'])
{
// error no sub!
addmsg("Internal Routine Not Found!!", "red");
redirect($_SERVER['PHP_SELF']);
util_redirect_and_exit($_SERVER['PHP_SELF']);
}
}
else // if ($aClean['sSub']) is not defined, display the Testing results queue page

View File

@@ -20,12 +20,12 @@ $oVendor = new Vendor($aClean['iVendorId']);
if ($aClean['sSub'])
{
if(!$_SESSION['current']->hasPriv("admin"))
util_show_error_page("Insufficient privileges.");
util_show_error_page_and_exit("Insufficient privileges.");
if($aClean['sSub'] == 'delete')
{
$oVendor->delete();
redirect($_SERVER['PHP_SELF']);
util_redirect_and_exit($_SERVER['PHP_SELF']);
}
}

View File

@@ -20,7 +20,7 @@ $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");
util_show_error_page_and_exit("Something went wrong with the bug ID");
apidb_header("Applications affected by Bug #".$aClean['iBugId']);
echo '<form method=post action="viewbugs.php?iBugId='.$aClean['iBugId'].'">',"\n";