diff --git a/account.php b/account.php index dbb1ed1..b0da9b5 100644 --- a/account.php +++ b/account.php @@ -2,7 +2,6 @@ /********************************************/ /* Account Login / Logout Handler for AppDB */ /********************************************/ - include("path.php"); require(BASE."include/incl.php"); require(BASE."include/mail.php"); @@ -61,7 +60,7 @@ function do_account($cmd = null) exit; } //not valid command, display error page - errorpage("Internal Error","This module was called with incorrect parameters"); + util_show_error_page("Internal Error","This module was called with incorrect parameters"); exit; } diff --git a/addcomment.php b/addcomment.php index a25eb7b..e037a0c 100644 --- a/addcomment.php +++ b/addcomment.php @@ -28,7 +28,7 @@ if(!$_SESSION['current']->isLoggedIn()) if( !is_numeric($aClean['versionId']) ) { - errorpage('Internal Database Access Error'); + util_show_error_page('Internal Database Access Error'); exit; } diff --git a/admin/addAppNote.php b/admin/addAppNote.php index 83a143a..e3a5213 100644 --- a/admin/addAppNote.php +++ b/admin/addAppNote.php @@ -26,7 +26,7 @@ $appId = $oRow->appId; //check for admin privs if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->isMaintainer($aClean['versionId']) && !$_SESSION['current']->isSuperMaintainer($aClean['appId'])) { - errorpage("Insufficient Privileges!"); + util_show_error_page("Insufficient Privileges!"); exit; } diff --git a/admin/addCategory.php b/admin/addCategory.php index 95647f0..77f4eb0 100644 --- a/admin/addCategory.php +++ b/admin/addCategory.php @@ -13,7 +13,7 @@ $aClean['submit'] = makeSafe($_REQUEST['submit']); if(!$_SESSION['current']->hasPriv("admin")) { - errorpage(); + util_show_error_page(); exit; } $oCat = new Category($aClean['catId']); diff --git a/admin/adminAppDataQueue.php b/admin/adminAppDataQueue.php index 396708c..1f47143 100644 --- a/admin/adminAppDataQueue.php +++ b/admin/adminAppDataQueue.php @@ -21,7 +21,7 @@ $aClean['reject'] = makeSafe($_REQUEST['reject']); // deny access if not admin or at least some kind of maintainer if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->isMaintainer()) { - errorpage("Insufficient privileges."); + util_show_error_page("Insufficient privileges."); exit; } diff --git a/admin/adminAppQueue.php b/admin/adminAppQueue.php index 34a57aa..c3e06b0 100644 --- a/admin/adminAppQueue.php +++ b/admin/adminAppQueue.php @@ -133,7 +133,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()) { - errorpage("Insufficient privileges."); + util_show_error_page("Insufficient privileges."); exit; } $oTest = new testData($aClean['iTestingId']); @@ -145,7 +145,7 @@ if ($aClean['sub']) /* make sure the user is authorized to view this application request */ if(!$_SESSION['current']->hasPriv("admin")) { - errorpage("Insufficient privileges."); + util_show_error_page("Insufficient privileges."); exit; } @@ -165,7 +165,7 @@ if ($aClean['sub']) $oVersion = new Version($aClean['versionId']); if(!$_SESSION['current']->hasAppVersionModifyPermission($oVersion)) { - errorpage("Insufficient privileges."); + util_show_error_page("Insufficient privileges."); exit; } } else diff --git a/admin/adminBugs.php b/admin/adminBugs.php index da98d8a..c1abc34 100644 --- a/admin/adminBugs.php +++ b/admin/adminBugs.php @@ -23,7 +23,7 @@ $aClean['page'] = makeSafe($_REQUEST['page']); // deny access if not logged in if(!$_SESSION['current']->hasPriv("admin")) { - errorpage("Insufficient privileges."); + util_show_error_page("Insufficient privileges."); exit; } diff --git a/admin/adminMaintainerQueue.php b/admin/adminMaintainerQueue.php index b6fc639..bc59a1c 100644 --- a/admin/adminMaintainerQueue.php +++ b/admin/adminMaintainerQueue.php @@ -21,7 +21,7 @@ $aClean['replyText'] = makeSafe( $_REQUEST['replyText'] ); if(!$_SESSION['current']->hasPriv("admin")) { - errorpage("Insufficient privileges."); + util_show_error_page("Insufficient privileges."); exit; } @@ -42,7 +42,7 @@ if ($aClean['sub']) else { //error no Id! - errorpage("

QueueId Not Found!

"); + util_show_error_page("

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 813a3c2..87912b7 100644 --- a/admin/adminMaintainers.php +++ b/admin/adminMaintainers.php @@ -17,7 +17,7 @@ $aClean['maintainerId'] = makeSafe($_REQUEST['maintainerId']); // deny access if not logged in if(!$_SESSION['current']->hasPriv("admin")) { - errorpage("Insufficient privileges."); + util_show_error_page("Insufficient privileges."); exit; } diff --git a/admin/adminScreenshots.php b/admin/adminScreenshots.php index 3102343..a784b2e 100644 --- a/admin/adminScreenshots.php +++ b/admin/adminScreenshots.php @@ -22,7 +22,7 @@ $aClean['versionId'] = makeSafe($_REQUEST['versionId']); // deny access if not admin if(!$_SESSION['current']->hasPriv("admin")) { - errorpage("Insufficient privileges."); + util_show_error_page("Insufficient privileges."); exit; } /* diff --git a/admin/adminTestResults.php b/admin/adminTestResults.php index 7bfea76..b89de3a 100644 --- a/admin/adminTestResults.php +++ b/admin/adminTestResults.php @@ -22,7 +22,7 @@ if ($aClean['sub']) $oVersion = new Version($oTest->iVersionId); if(!($_SESSION['current']->hasAppVersionModifyPermission($oVersion))) { - errorpage("Insufficient privileges."); + util_show_error_page("Insufficient privileges."); exit; } diff --git a/admin/adminUsers.php b/admin/adminUsers.php index fe35633..5ffe40b 100644 --- a/admin/adminUsers.php +++ b/admin/adminUsers.php @@ -19,7 +19,7 @@ apidb_header("Admin Users Management"); if(!$_SESSION['current']->hasPriv("admin")) { - errorpage("Insufficient privileges."); + util_show_error_page("Insufficient privileges."); exit; } diff --git a/admin/deleteAny.php b/admin/deleteAny.php index 6d7334d..49bf029 100644 --- a/admin/deleteAny.php +++ b/admin/deleteAny.php @@ -29,7 +29,7 @@ if($aClean['confirmed'] != "yes") // // perhaps we can do this with some javascript, popup - errorpage("Not confirmed"); + util_show_error_page("Not confirmed"); } if($aClean['what']) @@ -40,7 +40,7 @@ if($aClean['what']) // delete category and the apps in it $oCategory = new Category($aClean['catId']); if(!$oCategory->delete()) - errorpage(); + util_show_error_page(); else redirect(BASE."appbrowse.php"); break; @@ -48,14 +48,14 @@ if($aClean['what']) // delete app family & all its versions $oApp = new Application($aClean['appId']); if(!$oApp->delete()) - errorpage(); + util_show_error_page(); else redirect(BASE."appbrowse.php"); break; case "appVersion": $oVersion = new Version($aClean['versionId']); if(!$oVersion->delete()) - errorpage(); + util_show_error_page(); else redirect(BASE."appview.php?appId=".$aClean['appId']); break; diff --git a/admin/editAppFamily.php b/admin/editAppFamily.php index 14ee443..02cd7b6 100644 --- a/admin/editAppFamily.php +++ b/admin/editAppFamily.php @@ -17,13 +17,13 @@ $aClean['submit'] = makeSafe($_REQUEST['submit']); if(!is_numeric($aClean['appId'])) { - errorpage("Wrong ID"); + util_show_error_page("Wrong ID"); exit; } if(!($_SESSION['current']->hasPriv("admin") || $_SESSION['current']->isSuperMaintainer($aClean['appId']))) { - errorpage("Insufficient Privileges!"); + util_show_error_page("Insufficient Privileges!"); exit; } @@ -42,7 +42,7 @@ else if(!$oApp) { - errorpage('Application does not exist'); + util_show_error_page('Application does not exist'); } if($_SESSION['current']->showDebuggingInfos()) { echo "

appName: $oApp->sName

"; } diff --git a/admin/editAppNote.php b/admin/editAppNote.php index 56799ab..4bca246 100644 --- a/admin/editAppNote.php +++ b/admin/editAppNote.php @@ -20,7 +20,7 @@ $aClean['versionId'] = makeSafe($_REQUEST['versionId']); if(!is_numeric($aClean['noteId'])) { - errorpage('Wrong note ID'); + util_show_error_page('Wrong note ID'); exit; } @@ -30,7 +30,7 @@ $oNote = new Note($aClean['noteId']); /* Check for privs */ if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->isMaintainer($oNote->iVersionId) && !$_SESSION['current']->isSuperMaintainer($oNote->iAppId)) { - errorpage("Insufficient Privileges!"); + util_show_error_page("Insufficient Privileges!"); exit; } diff --git a/admin/editAppVersion.php b/admin/editAppVersion.php index 77dc46a..b2e54a8 100644 --- a/admin/editAppVersion.php +++ b/admin/editAppVersion.php @@ -13,14 +13,14 @@ $aClean['submit'] = makeSafe($_REQUEST['submit']); if(!is_numeric($aClean['appId']) OR !is_numeric($aClean['versionId'])) { - errorpage("Wrong ID"); + util_show_error_page("Wrong ID"); exit; } /* Check for admin privs */ if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->isMaintainer($aClean['versionId']) && !$_SESSION['current']->isSuperMaintainer($aClean['appId'])) { - errorpage("Insufficient Privileges!"); + util_show_error_page("Insufficient Privileges!"); exit; } diff --git a/admin/editBundle.php b/admin/editBundle.php index ca5298e..0e9db7f 100644 --- a/admin/editBundle.php +++ b/admin/editBundle.php @@ -5,7 +5,7 @@ include(BASE."include/"."incl.php"); if(!$_SESSION['current']->hasPriv("admin")) { - errorpage(); + util_show_error_page(); exit; } diff --git a/admin/editDistribution.php b/admin/editDistribution.php index d5dcc9c..0b5308c 100644 --- a/admin/editDistribution.php +++ b/admin/editDistribution.php @@ -10,7 +10,7 @@ $aClean['Submit'] = makeSafe($_REQUEST['Submit']); if(!$_SESSION['current']->hasPriv("admin")) { - errorpage("Insufficient privileges."); + util_show_error_page("Insufficient privileges."); exit; } diff --git a/admin/editVendor.php b/admin/editVendor.php index 26fad04..c251fff 100644 --- a/admin/editVendor.php +++ b/admin/editVendor.php @@ -11,7 +11,7 @@ $aClean['sWebpage'] = makeSafe($_REQUEST['sWebpage']); if(!$_SESSION['current']->hasPriv("admin")) { - errorpage(); + util_show_error_page(); exit; } diff --git a/admin/moveAppVersion.php b/admin/moveAppVersion.php index 6621a7e..976b9f3 100644 --- a/admin/moveAppVersion.php +++ b/admin/moveAppVersion.php @@ -13,14 +13,14 @@ $aClean['action'] = makeSafe($_REQUEST['action']); if(!is_numeric($aClean['appId']) OR !is_numeric($aClean['versionId'])) { - errorpage("Wrong ID"); + util_show_error_page("Wrong ID"); exit; } /* Check for admin privs */ if(!$_SESSION['current']->hasPriv("admin")) { - errorpage("Insufficient Privileges!"); + util_show_error_page("Insufficient Privileges!"); exit; } diff --git a/appbrowse.php b/appbrowse.php index fc2a3f2..7734987 100644 --- a/appbrowse.php +++ b/appbrowse.php @@ -32,7 +32,7 @@ if( empty( $aClean['catId'] ) ) if( !is_numeric($aClean['catId']) ) { - errorpage("Something went wrong with the category ID"); + util_show_error_page("Something went wrong with the category ID"); exit; } diff --git a/appimage.php b/appimage.php index b3dc05e..285b572 100644 --- a/appimage.php +++ b/appimage.php @@ -21,7 +21,7 @@ header("Pragma: "); /* display an error message and exit */ if(!$_SESSION['current']->canViewImage($aClean['id'])) { - errorpage("Insufficient privileges."); + util_show_error_page("Insufficient privileges."); exit; } @@ -30,7 +30,7 @@ if ($aClean['REQUEST_METHOD']='HEAD') /* WARNING! optimization of logic in include/screenshots.php */ if (sscanf($aClean['id'],"%d", &$iId) < 1) { - errorpage("Bad parameter"); + util_show_error_page("Bad parameter"); exit; } $hResult = query_parameters("SELECT id, url FROM appData diff --git a/appsubmit.php b/appsubmit.php index bd7daa0..71e7e70 100644 --- a/appsubmit.php +++ b/appsubmit.php @@ -66,7 +66,7 @@ function newSubmition($errors) //deny access if not logged on if(!$_SESSION['current']->isLoggedIn()) { - errorpage("Insufficient privilages to create application. Are you sure you are logged in?"); + util_show_error_page("Insufficient privilages to create application. Are you sure you are logged in?"); exit; } @@ -91,7 +91,7 @@ if ($aClean['sub']) (($oApp->queued=="false")?true:false) && !$_SESSION['current']->isVersionSubmitter($oApp->AppId)) { - errorpage("Insufficient privileges."); + util_show_error_page("Insufficient privileges."); exit; } @@ -111,7 +111,7 @@ if ($aClean['sub']) (($oVersion->queued=="false")?true:false) && !$_SESSION['current']->isVersionSubmitter($oVersion->versionId)) { - errorpage("Insufficient privileges."); + util_show_error_page("Insufficient privileges."); exit; } } diff --git a/appview.php b/appview.php index 8712d9c..c288e27 100644 --- a/appview.php +++ b/appview.php @@ -133,7 +133,7 @@ function show_note($sType,$oData) if(!is_numeric($aClean['appId']) && !is_numeric($aClean['versionId'])) { - errorpage("Something went wrong with the application or version id"); + util_show_error_page("Something went wrong with the application or version id"); exit; } @@ -207,7 +207,7 @@ if($aClean['appId']) } else { // Oops! Called with no params, bad llamah! - errorpage('Page Called with No Params!'); + util_show_error_page('Page Called with No Params!'); exit; } diff --git a/commentview.php b/commentview.php index 220e517..37e426f 100644 --- a/commentview.php +++ b/commentview.php @@ -23,7 +23,7 @@ apidb_header("Comments"); if(!is_numeric($aClean['appId']) OR !is_numeric($aClean['versionId']) OR (!empty($aClean['threadId']) AND !is_numeric($aClean['threadId']))) { - errorpage("Wrong IDs"); + util_show_error_page("Wrong IDs"); exit; } diff --git a/deletecomment.php b/deletecomment.php index f035298..24246eb 100644 --- a/deletecomment.php +++ b/deletecomment.php @@ -25,7 +25,7 @@ if (!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->isMaintainer($oComment->iVersionId) && !$_SESSION['current']->isSuperMaintainer($oComment->iAppId)) { - errorpage('You don\'t have sufficient privileges to delete this comment.'); + util_show_error_page("You don't have sufficient privileges to delete this comment."); exit; } diff --git a/distributionView.php b/distributionView.php index 178e781..39fe5ab 100644 --- a/distributionView.php +++ b/distributionView.php @@ -21,7 +21,7 @@ if ($aClean['sub']) { if(!$_SESSION['current']->hasPriv("admin")) { - errorpage("Insufficient privileges."); + util_show_error_page("Insufficient privileges."); exit; } diff --git a/include/application.php b/include/application.php index 02ee4c8..99aef8d 100644 --- a/include/application.php +++ b/include/application.php @@ -530,7 +530,7 @@ class Application { /* is this user supposed to view this version? */ if(!$_SESSION['current']->canViewApplication($this)) { - errorpage("Something went wrong with the application or version id"); + util_show_error_page("Something went wrong with the application or version id"); exit; } diff --git a/include/incl.php b/include/incl.php index f65398d..85a229e 100644 --- a/include/incl.php +++ b/include/incl.php @@ -164,23 +164,6 @@ function apidb_image($name) } -/** - * display an error page - */ -function errorpage($text = null, $message = null) -{ - if (!$text) { - $text = "You must be logged in to perform that operation."; - } - header("HTTP/1.0 404 Object not found or user is not logged in"); - apidb_header("Oops"); - echo "
$text
\n"; - echo "

$message

\n"; - apidb_footer(); -} - - - /** * redirect to $url */ diff --git a/include/util.php b/include/util.php index 1fb3142..74c1d16 100644 --- a/include/util.php +++ b/include/util.php @@ -1,4 +1,18 @@ $text\n"; + echo "

$message

\n"; + apidb_footer(); +} function makeSafe($var) { diff --git a/include/version.php b/include/version.php index 3dfe4fd..c49c6f4 100644 --- a/include/version.php +++ b/include/version.php @@ -623,7 +623,7 @@ class Version { /* is this user supposed to view this version? */ if(!$_SESSION['current']->canViewVersion($this)) { - errorpage("Something went wrong with the application or version id"); + util_show_error_page("Something went wrong with the application or version id"); exit; } @@ -631,14 +631,14 @@ class Version { if(!$oApp->iAppId) { // Oops! application not found or other error. do something - errorpage('Internal Database Access Error. No App found.'); + util_show_error_page('Internal Database Access Error. No App found.'); exit; } if(!$this->iVersionId) { // Oops! Version not found or other error. do something - errorpage('Internal Database Access Error. No Version Found.'); + util_show_error_page('Internal Database Access Error. No Version Found.'); exit; } diff --git a/include/vote.php b/include/vote.php index a4a0504..226e500 100644 --- a/include/vote.php +++ b/include/vote.php @@ -152,7 +152,7 @@ function vote_update($vars) { if(!$_SESSION['current']->isLoggedIn()) { - errorpage("You must be logged in to vote"); + util_show_error_page("You must be logged in to vote"); return; } diff --git a/maintainerdelete.php b/maintainerdelete.php index 7ac3939..4506119 100644 --- a/maintainerdelete.php +++ b/maintainerdelete.php @@ -20,7 +20,7 @@ $aClean['superMaintainer'] = makeSafe($_POST['superMaintainer']); if(!$_SESSION['current']->isLoggedIn()) { - errorpage("You need to be logged in to resign from being a maintainer."); + util_show_error_page("You need to be logged in to resign from being a maintainer."); exit; } diff --git a/maintainersubmit.php b/maintainersubmit.php index 6b96220..2f3856a 100644 --- a/maintainersubmit.php +++ b/maintainersubmit.php @@ -45,7 +45,7 @@ function checkAppMaintainerInput( $maintainReason ) if(!$_SESSION['current']->isLoggedIn()) { - errorpage("You need to be logged in to apply to be a maintainer."); + util_show_error_page("You need to be logged in to apply to be a maintainer."); exit; } @@ -71,7 +71,7 @@ if( $aClean['maintainReason'] ) $errors = checkAppMaintainerInput($aClean['maintainReason']); if(!empty($errors)) { - errorpage("We found the following errors:","
Please go back and correct them."); + util_show_error_page("We found the following errors:","
Please go back and correct them."); exit; } diff --git a/preferences.php b/preferences.php index 94e8e76..b9d9f3c 100644 --- a/preferences.php +++ b/preferences.php @@ -33,7 +33,7 @@ while(list($key, $value) = each($_REQUEST)) if(!$_SESSION['current']->isLoggedIn()) { - errorpage("You must be logged in to edit preferences"); + util_show_error_page("You must be logged in to edit preferences"); exit; } diff --git a/testResults.php b/testResults.php index 3339b18..d5d3108 100644 --- a/testResults.php +++ b/testResults.php @@ -81,7 +81,7 @@ if ($aClean['sub']) !$_SESSION['current']->hasAppVersionModifyPermission($oVersion)&& !(($_SESSION['current']->iUserId == $oTest->iSubmitterId) && !($oTest->sQueued == 'false'))) { - errorpage("Insufficient privileges."); + util_show_error_page("Insufficient privileges."); exit; } else $oVersion = new version($oTest->iVersionId); diff --git a/vendorview.php b/vendorview.php index bc4232e..a1d53cb 100644 --- a/vendorview.php +++ b/vendorview.php @@ -21,7 +21,7 @@ if ($aClean['sub']) { if(!$_SESSION['current']->hasPriv("admin")) { - errorpage("Insufficient privileges."); + util_show_error_page("Insufficient privileges."); exit; } diff --git a/viewbugs.php b/viewbugs.php index d1e7843..c8b5cec 100644 --- a/viewbugs.php +++ b/viewbugs.php @@ -14,7 +14,7 @@ $aClean['bug_id'] = makeSafe($_REQUEST['bug_id']); if( !is_numeric($aClean['bug_id'])) { - errorpage("Something went wrong with the bug ID"); + util_show_error_page("Something went wrong with the bug ID"); exit; } {