diff --git a/inc/inc.ClassUI.php b/inc/inc.ClassUI.php index a06f120bb..41f606fe1 100644 --- a/inc/inc.ClassUI.php +++ b/inc/inc.ClassUI.php @@ -136,12 +136,17 @@ class UI extends UI_Default { return $themes; } /* }}} */ - static function exitError($pagetitle, $error) { + static function exitError($pagetitle, $error, $noexit=false, $plain=false) { global $theme, $dms; - $tmp = 'ErrorDlg'; - $view = UI::factory($theme, $tmp); + $view = UI::factory($theme, 'ErrorDlg'); $view->setParam('dms', $dms); - $view->exitError($pagetitle, $error); + $view->setParam('pagetitle', $pagetitle); + $view->setParam('errormsg', $error); + $view->setParam('plain', $plain); + $view(); + if($noexit) + return; + exit; } } diff --git a/op/op.Login.php b/op/op.Login.php index b558e8af9..bf7603656 100644 --- a/op/op.Login.php +++ b/op/op.Login.php @@ -33,8 +33,7 @@ include $settings->_rootDir . "languages/" . $settings->_language . "/lang.inc"; function _printMessage($heading, $message) { /* {{{ */ global $dms, $theme; - $view = UI::factory($theme, 'Login', array('dms'=>$dms)); - $view->exitError($heading, $message, true); + UI::exitError($heading, $message, true); return; } /* }}} */ diff --git a/out/out.Calendar.php b/out/out.Calendar.php index 9ada3263b..fbc9e96c8 100644 --- a/out/out.Calendar.php +++ b/out/out.Calendar.php @@ -38,7 +38,7 @@ else $end = ''; if(isset($_GET['documentid']) && $_GET['documentid'] && is_numeric($_GET['documentid'])) { $document = $dms->getDocument($_GET["documentid"]); if (!is_object($document)) { - $view->exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); + UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } } else $document = null; diff --git a/out/out.Timeline.php b/out/out.Timeline.php index 798be2079..17b5412ab 100644 --- a/out/out.Timeline.php +++ b/out/out.Timeline.php @@ -30,7 +30,7 @@ include("../inc/inc.Authentication.php"); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { - $view->exitError(getMLText("admin_tools"),getMLText("access_denied")); + UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } $rootfolder = $dms->getFolder($settings->_rootFolderID); diff --git a/out/out.ViewDocument.php b/out/out.ViewDocument.php index a05b1c391..1fd66e748 100644 --- a/out/out.ViewDocument.php +++ b/out/out.ViewDocument.php @@ -34,24 +34,24 @@ $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_GET["documentid"])<1) { - $view->exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); + UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } $document = $dms->getDocument($_GET["documentid"]); if (!is_object($document)) { - $view->exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); + UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } $accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); $folder = $document->getFolder(); if ($document->getAccessMode($user) < M_READ || !$document->getLatestContent()) { - $view->exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied")); + UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied")); } /* Could be that the advanced access rights prohibit access on the content */ if (!$document->getLatestContent()) { - $view->exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied")); + UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied")); } /* Recalculate the status of a document and reload the page if the status diff --git a/out/out.ViewFolder.php b/out/out.ViewFolder.php index 18916c729..021e418ba 100644 --- a/out/out.ViewFolder.php +++ b/out/out.ViewFolder.php @@ -41,7 +41,7 @@ else { $folder = $dms->getFolder($folderid); if (!is_object($folder)) { - UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); + UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))), getMLText("invalid_folder_id")); } if (isset($_GET["orderby"]) && strlen($_GET["orderby"])==1 ) { diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index ed3c7a620..ceaa80103 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -1351,7 +1351,7 @@ $(document).ready(function() { echo "\n"; } /* }}} */ - function exitError($pagetitle, $error, $noexit=false, $plain=false) { /* {{{ */ + function ___exitError($pagetitle, $error, $noexit=false, $plain=false) { /* {{{ */ /* This is just a hack to prevent creation of js files in an error * case, because they will contain this error page again. It would be much @@ -2445,6 +2445,38 @@ mayscript> parent::show(); } /* }}} */ + function error(){ /* {{{ */ + parent::error(); + $dms = $this->params['dms']; + $user = $this->params['user']; + $pagetitle = $this->params['pagetitle']; + $errormsg = $this->params['errormsg']; + $plain = $this->params['plain']; + $noexit = $this->params['noexit']; + + if(!$plain) { + $this->htmlStartPage($pagetitle); + $this->globalNavigation(); + $this->contentStart(); + } + + print "