diff --git a/account.php b/account.php index 4049d8a..a8a4d02 100644 --- a/account.php +++ b/account.php @@ -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 = '(Note: accounts for appdb.winehq.org and bugs.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); diff --git a/addcomment.php b/addcomment.php index df15476..0f82ccf 100644 --- a/addcomment.php +++ b/addcomment.php @@ -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 { diff --git a/admin/addAppNote.php b/admin/addAppNote.php index 2acd497..2265f65 100644 --- a/admin/addAppNote.php +++ b/admin/addAppNote.php @@ -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'])) { diff --git a/admin/addCategory.php b/admin/addCategory.php index a86a324..4d65e58 100644 --- a/admin/addCategory.php +++ b/admin/addCategory.php @@ -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 { diff --git a/admin/adminAppDataQueue.php b/admin/adminAppDataQueue.php index e080b9e..3ea308c 100644 --- a/admin/adminAppDataQueue.php +++ b/admin/adminAppDataQueue.php @@ -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 "

Application data was successfully deleted from the Queue.

\n"; } } - redirect(apidb_fullurl("admin/adminAppDataQueue.php")); + util_redirect_and_exit(apidb_fullurl("admin/adminAppDataQueue.php")); } } echo html_frame_end(" "); diff --git a/admin/adminAppQueue.php b/admin/adminAppQueue.php index 09ecd0f..c9f5125 100644 --- a/admin/adminAppQueue.php +++ b/admin/adminAppQueue.php @@ -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 */ diff --git a/admin/adminBugs.php b/admin/adminBugs.php index 69590fd..cbe8561 100644 --- a/admin/adminBugs.php +++ b/admin/adminBugs.php @@ -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']); } { diff --git a/admin/adminMaintainerQueue.php b/admin/adminMaintainerQueue.php index 569daf3..75f1ee7 100644 --- a/admin/adminMaintainerQueue.php +++ b/admin/adminMaintainerQueue.php @@ -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("

QueueId Not Found!

"); + util_show_error_page_and_exit("

QueueId Not Found!

"); } //process according to which request was submitted and optionally the sub flag diff --git a/admin/adminMaintainers.php b/admin/adminMaintainers.php index ff48c99..251f0fa 100644 --- a/admin/adminMaintainers.php +++ b/admin/adminMaintainers.php @@ -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 '
',"\n"; diff --git a/admin/adminScreenshots.php b/admin/adminScreenshots.php index 909d9a5..30c7035 100644 --- a/admin/adminScreenshots.php +++ b/admin/adminScreenshots.php @@ -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']); } diff --git a/admin/adminTestResults.php b/admin/adminTestResults.php index 4ef26c7..62a076c 100644 --- a/admin/adminTestResults.php +++ b/admin/adminTestResults.php @@ -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 diff --git a/admin/adminUsers.php b/admin/adminUsers.php index 658b6ae..165f3d7 100644 --- a/admin/adminUsers.php +++ b/admin/adminUsers.php @@ -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 diff --git a/admin/deleteAny.php b/admin/deleteAny.php index fb38a67..f523506 100644 --- a/admin/deleteAny.php +++ b/admin/deleteAny.php @@ -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; } } diff --git a/admin/editAppFamily.php b/admin/editAppFamily.php index d26047b..1fb8132 100644 --- a/admin/editAppFamily.php +++ b/admin/editAppFamily.php @@ -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 "

appName: $oApp->sName

"; } diff --git a/admin/editAppNote.php b/admin/editAppNote.php index 26e45b9..7416ba7 100644 --- a/admin/editAppNote.php +++ b/admin/editAppNote.php @@ -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 diff --git a/admin/editAppVersion.php b/admin/editAppVersion.php index db2173f..de16171 100644 --- a/admin/editAppVersion.php +++ b/admin/editAppVersion.php @@ -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 */ { diff --git a/admin/editBundle.php b/admin/editBundle.php index fa69978..bd8aaad 100644 --- a/admin/editBundle.php +++ b/admin/editBundle.php @@ -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() { diff --git a/admin/editDistribution.php b/admin/editDistribution.php index cfada76..3fe97cd 100644 --- a/admin/editDistribution.php +++ b/admin/editDistribution.php @@ -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 { diff --git a/admin/editVendor.php b/admin/editVendor.php index 7fbe2a8..5e88c41 100644 --- a/admin/editVendor.php +++ b/admin/editVendor.php @@ -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 { diff --git a/admin/moveAppVersion.php b/admin/moveAppVersion.php index ecf36b0..a94b58c 100644 --- a/admin/moveAppVersion.php +++ b/admin/moveAppVersion.php @@ -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 */ { ?> diff --git a/admin/resubmitRejectedApps.php b/admin/resubmitRejectedApps.php index ed29941..0e011c6 100644 --- a/admin/resubmitRejectedApps.php +++ b/admin/resubmitRejectedApps.php @@ -7,7 +7,7 @@ include("path.php"); require_once(BASE."include/incl.php"); - redirect(BASE."appsubmit.php"); + util_redirect_and_exit(BASE."appsubmit.php"); ?> diff --git a/appbrowse.php b/appbrowse.php index 5df818d..1ca034f 100644 --- a/appbrowse.php +++ b/appbrowse.php @@ -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']); diff --git a/appimage.php b/appimage.php index 5dd4192..4d3ceaf 100644 --- a/appimage.php +++ b/appimage.php @@ -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 = '?' diff --git a/appsubmit.php b/appsubmit.php index c89173f..9500e67 100644 --- a/appsubmit.php +++ b/appsubmit.php @@ -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 diff --git a/appview.php b/appview.php index 7d06e43..179ac24 100644 --- a/appview.php +++ b/appview.php @@ -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(); diff --git a/commentview.php b/commentview.php index 737ed7f..149de61 100644 --- a/commentview.php +++ b/commentview.php @@ -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']); diff --git a/deletecomment.php b/deletecomment.php index f13d212..303ea24 100644 --- a/deletecomment.php +++ b/deletecomment.php @@ -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)); } ?> diff --git a/distributionView.php b/distributionView.php index 8f1afee..56abd25 100644 --- a/distributionView.php +++ b/distributionView.php @@ -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']); diff --git a/include/application.php b/include/application.php index 815188f..6013f81 100644 --- a/include/application.php +++ b/include/application.php @@ -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()) diff --git a/include/filter.php b/include/filter.php index c4752d0..fa249cb 100644 --- a/include/filter.php +++ b/include/filter.php @@ -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; } } diff --git a/include/incl.php b/include/incl.php index e07ee37..7400a7c 100644 --- a/include/incl.php +++ b/include/incl.php @@ -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 */ diff --git a/include/util.php b/include/util.php index f1ea593..bcab051 100644 --- a/include/util.php +++ b/include/util.php @@ -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 */ diff --git a/include/version.php b/include/version.php index b8cc7f5..b68cf4f 100644 --- a/include/version.php +++ b/include/version.php @@ -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); diff --git a/include/vote.php b/include/vote.php index d5ca822..3f5ce3d 100644 --- a/include/vote.php +++ b/include/vote.php @@ -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 diff --git a/maintainerdelete.php b/maintainerdelete.php index 8d24131..7ff436b 100644 --- a/maintainerdelete.php +++ b/maintainerdelete.php @@ -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']) diff --git a/maintainersubmit.php b/maintainersubmit.php index fb7c58e..d8262ed 100644 --- a/maintainersubmit.php +++ b/maintainersubmit.php @@ -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:","
Please go back and correct them."); + util_show_error_page_and_exit("We found the following errors:","
Please go back and correct them."); // header if($aClean['iSuperMaintainer']) diff --git a/preferences.php b/preferences.php index 1a8c08e..f83ee50 100644 --- a/preferences.php +++ b/preferences.php @@ -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 diff --git a/screenshots.php b/screenshots.php index 27d182c..b293211 100644 --- a/screenshots.php +++ b/screenshots.php @@ -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'])); } diff --git a/testResults.php b/testResults.php index 46d84d9..057090f 100644 --- a/testResults.php +++ b/testResults.php @@ -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 diff --git a/vendorview.php b/vendorview.php index 463a4d7..38943d7 100644 --- a/vendorview.php +++ b/vendorview.php @@ -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']); } } diff --git a/viewbugs.php b/viewbugs.php index 7657266..ed27036 100644 --- a/viewbugs.php +++ b/viewbugs.php @@ -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 '',"\n";