*/ /** * This view prepares all the information the theme requires to render * an error page. * * @package GalleryCore * @subpackage UserInterface */ class ErrorPageView extends GalleryView { function setError($error) { $this->_error = $error; } /** * @see GalleryView::loadTemplate */ function loadTemplate(&$template, &$form) { global $gallery; $ErrorPage = array(); list ($ret, $isAdmin) = GalleryCoreApi::isUserInSiteAdminGroup(); $ErrorPage['isAdmin'] = (!$ret && $isAdmin); if ($gallery->getDebug() || $ErrorPage['isAdmin']) { $ErrorPage['stackTrace'] = $this->_error->getAsHtml($isAdmin); } /* Landing page for errors.. */ $errorCode = $this->_error->getErrorCode(); if ($errorCode & ERROR_OBSOLETE_DATA) { $ErrorPage['code']['obsoleteData'] = true; } if ($errorCode & (ERROR_PERMISSION_DENIED | ERROR_BAD_PARAMETER)) { $ErrorPage['code']['securityViolation'] = true; } if ($errorCode & ERROR_STORAGE_FAILURE) { $ErrorPage['code']['storageFailure'] = true; } if ($errorCode & ERROR_PLATFORM_FAILURE) { $ErrorPage['code']['platformFailure'] = true; } if ($ErrorPage['isAdmin']) { $ErrorPage['phpversion'] = phpversion(); $ErrorPage['php_uname'] = php_uname(); $ErrorPage['php_sapi_name'] = php_sapi_name(); $ErrorPage['webserver'] = GalleryUtilities::getServerVar('SERVER_SOFTWARE'); $ErrorPage['browser'] = GalleryUtilities::getServerVar('HTTP_USER_AGENT'); if ($gallery->isStorageInitialized()) { $storage =& $gallery->getStorage(); $ErrorPage['dbType'] = $storage->getAdoDbType(); $ErrorPage['dbVersion'] = @$storage->getVersion(); list ($ret, $list) = GalleryCoreApi::getToolkitOperationMimeTypes('thumbnail'); if (!$ret) { $toolkitList = array(); foreach ($list as $tmp) { $toolkitList = array_merge($toolkitList, $tmp); } $ErrorPage['toolkits'] = implode(', ', array_unique($toolkitList)); } } GalleryCoreApi::requireOnce('modules/core/module.inc'); $installedVersions = CoreModule::getInstalledVersions(); $ErrorPage['version'] = $installedVersions['gallery']; } $template->javascript('lib/javascript/BlockToggle.js'); $template->setVariable('ErrorPage', $ErrorPage); return array(null, array('body' => 'modules/core/templates/ErrorPage.tpl')); } } ?>