/** * This is called whenever an error occurs in one of the database handlers. * * If a transaction is active it will be invalidated as well. * * @access protected * @throws eZDBException */ function reportError() { // If we have a running transaction we must mark as invalid // in which case a call to commit() will perform a rollback if ($this->TransactionCounter > 0) { $this->invalidateTransaction(); // This is the unique ID for this incidence which will also be placed in the error logs. $transID = 'TRANSID-' . md5(time() . mt_rand()); eZDebug::writeError('Transaction in progress failed due to DB error, transaction was rollbacked. Transaction ID is ' . $transID . '.', 'eZDBInterface::commit ' . $transID); $this->rollback(); if ($this->errorHandling == eZDB::ERROR_HANDLING_EXCEPTIONS) { throw new eZDBException($this->ErrorMessage, $this->ErrorNumber); } else { // Stop execution immediately while allowing other systems (session etc.) to cleanup eZExecution::cleanup(); eZExecution::setCleanExit(); // Give some feedback, and also possibly show the debug output eZDebug::setHandleType(eZDebug::HANDLE_NONE); $ini = eZINI::instance(); $adminEmail = $ini->variable('MailSettings', 'AdminEmail'); if (!eZSys::isShellExecution()) { if (!headers_sent()) { header("HTTP/1.1 500 Internal Server Error"); } $site = eZSys::serverVariable('HTTP_HOST'); $uri = eZSys::serverVariable('REQUEST_URI'); print "<div class=\"fatal-error\" style=\""; print 'margin: 0.5em 0 1em 0; ' . 'padding: 0.25em 1em 0.75em 1em;' . 'border: 4px solid #000000;' . 'background-color: #f8f8f4;' . 'border-color: #f95038;" >'; print "<b>Fatal error</b>: A database transaction in eZ Publish failed.<br/>"; print "<p>"; print "The current execution was stopped to prevent further problems.<br/>\n" . "You should contact the <a href=\"mailto:{$adminEmail}?subject=Transaction failed on {$site} and URI {$uri} with ID {$transID}\">System Administrator</a> of this site with the information on this page.<br/>\n" . "The current transaction ID is <b>{$transID}</b> and has been logged.<br/>\n" . "Please include the transaction ID and the current URL when contacting the system administrator.<br/>\n"; print "</p>"; print "</div>"; $templateResult = null; if (function_exists('eZDisplayResult')) { eZDisplayResult($templateResult); } } else { fputs(STDERR, "Fatal error: A database transaction in eZ Publish failed.\n"); fputs(STDERR, "\n"); fputs(STDERR, "The current execution was stopped to prevent further problems.\n" . "You should contact the System Administrator ({$adminEmail}) of this site.\n" . "The current transaction ID is {$transID} and has been logged.\n" . "Please include the transaction ID and the name of the current script when contacting the system administrator.\n"); fputs(STDERR, "\n"); fputs(STDERR, eZDebug::printReport(false, false, true)); } // PHP execution stops here exit(1); } } }
$contentObject = $node->attribute('object'); $nodeResult = eZNodeviewfunctions::generateNodeViewData($tpl, $node, $contentObject, $languageCode, 'full', 0); // Generate a unique cache key for use in cache-blocks in pagelayout.tpl. // This should be looked as a temporary fix as ideally all cache-blocks // should be disabled by this view. $cacheKey = "timeline-" + time(); $nodeResult["title_path"] = array(array("text" => "Timeline Preview"), array("text" => $node->attribute('name'))); $httpCharset = eZTextCodec::httpCharset(); $locale = eZLocale::instance(); $languageCode = $locale->httpLocaleCode(); $nodeResult['content_info']['persistent_variable']['extra_template_list'] = array('timeline.tpl'); $nodeResult['content_info']['persistent_variable']['pagestyle_css_classes'] = array('yui-skin-sam', 'yui-skin-ezflow'); $site = array('title' => $ini->variable('SiteSettings', 'SiteName'), 'design' => $ini->variable('DesignSettings', 'SiteDesign'), 'uri' => eZURI::instance(eZSys::requestURI()), 'http_equiv' => array('Content-Type' => 'text/html; charset=' . $httpCharset, 'Content-language' => $languageCode)); $currentUser = eZUser::currentUser(); $tpl->setVariable("current_user", $currentUser); $tpl->setVariable('ui_context', ""); $uri = eZURI::instance(eZSys::requestURI()); $GLOBALS['eZRequestedURI'] = $uri; $access = eZSiteAccess::match($uri, eZSys::hostname(), eZSys::serverPort(), eZSys::indexFile()); $tpl->setVariable('access_type', $access); $tpl->setVariable('uri_string', $uri->uriString()); $tpl->setVariable("site", $site); $tpl->setVariable("extra_cache_key", $cacheKey); $tpl->setVariable("module_result", $nodeResult); $tpl->setVariable("node", $node); $tpl->setVariable("display_timeline_sider", true); $pagelayoutResult = $tpl->fetch('design:pagelayout.tpl'); eZDisplayResult($pagelayoutResult); // Stop execution at this point, if we do not we'll have the // pagelayout.tpl inside another pagelayout.tpl. eZExecution::cleanExit();
/** * Performs a redirection */ protected function redirect() { $GLOBALS['eZRedirection'] = true; $ini = eZINI::instance(); $automaticRedirect = true; if ($GLOBALS['eZDebugAllowed'] && ($redirUri = $ini->variable('DebugSettings', 'DebugRedirection')) !== 'disabled') { if ($redirUri == "enabled") { $automaticRedirect = false; } else { $uri = eZURI::instance(eZSys::requestURI()); $uri->toBeginning(); foreach ($ini->variableArray("DebugSettings", "DebugRedirection") as $redirUri) { $redirUri = new eZURI($redirUri); if ($redirUri->matchBase($uri)) { $automaticRedirect = false; break; } } } } $redirectURI = eZSys::indexDir(); $moduleRedirectUri = $this->module->redirectURI(); if ($ini->variable('URLTranslator', 'Translation') === 'enabled' && eZURLAliasML::urlTranslationEnabledByUri(new eZURI($moduleRedirectUri))) { $translatedModuleRedirectUri = $moduleRedirectUri; if (eZURLAliasML::translate($translatedModuleRedirectUri, true)) { $moduleRedirectUri = $translatedModuleRedirectUri; if (strlen($moduleRedirectUri) > 0 && $moduleRedirectUri[0] !== '/') { $moduleRedirectUri = '/' . $moduleRedirectUri; } } } if (preg_match('#^(\\w+:)|^//#', $moduleRedirectUri)) { $redirectURI = $moduleRedirectUri; } else { $leftSlash = strlen($redirectURI) > 0 && $redirectURI[strlen($redirectURI) - 1] === '/'; $rightSlash = strlen($moduleRedirectUri) > 0 && $moduleRedirectUri[0] === '/'; if (!$leftSlash && !$rightSlash) { // Both are without a slash, so add one $moduleRedirectUri = '/' . $moduleRedirectUri; } else { if ($leftSlash && $rightSlash) { // Both are with a slash, so we remove one $moduleRedirectUri = substr($moduleRedirectUri, 1); } } $redirectURI .= $moduleRedirectUri; } eZStaticCache::executeActions(); eZDB::checkTransactionCounter(); if ($automaticRedirect) { eZHTTPTool::redirect($redirectURI, array(), $this->module->redirectStatus()); } else { // Make sure any errors or warnings are reported if ($ini->variable('DebugSettings', 'DisplayDebugWarnings') === 'enabled') { if (isset($GLOBALS['eZDebugError']) && $GLOBALS['eZDebugError']) { eZAppendWarningItem(array('error' => array('type' => 'error', 'number' => 1, 'count' => $GLOBALS['eZDebugErrorCount']), 'identifier' => 'ezdebug-first-error', 'text' => ezpI18n::tr('index.php', 'Some errors occurred, see debug for more information.'))); } if (isset($GLOBALS['eZDebugWarning']) && $GLOBALS['eZDebugWarning']) { eZAppendWarningItem(array('error' => array('type' => 'warning', 'number' => 1, 'count' => $GLOBALS['eZDebugWarningCount']), 'identifier' => 'ezdebug-first-warning', 'text' => ezpI18n::tr('index.php', 'Some general warnings occured, see debug for more information.'))); } } $tpl = eZTemplate::factory(); $tpl->setVariable('site', $this->site); $tpl->setVariable('warning_list', !empty($this->warningList) ? $this->warningList : false); $tpl->setVariable('redirect_uri', eZURI::encodeURL($redirectURI)); $templateResult = $tpl->fetch('design:redirect.tpl'); eZDebug::addTimingPoint("Script end"); eZDisplayResult($templateResult); } eZExecution::cleanExit(); }
function eZFatalError() { header("HTTP/1.1 500 Internal Server Error"); print "<b>Fatal error</b>: The web server did not finish its request<br/>"; if (ini_get('display_errors') == 1) { if (eZDebug::isDebugEnabled()) { print "<p>The execution of eZ Publish was abruptly ended, the debug output is present below.</p>"; } else { print "<p>Debug information can be found in the log files normally placed in var/log/* or by enabling 'DebugOutput' in site.ini</p>"; } } else { print "<p>Contact website owner with current url and info on what you did, and owner will be able to debug the issue further (by enabling 'display_errors' in php.ini).</p>"; } $templateResult = null; eZDisplayResult($templateResult); }
function eZFatalError() { header("HTTP/1.1 500 Internal Server Error"); print "<b>Fatal error</b>: eZ Publish did not finish its request<br/>"; if (ini_get('display_errors') == 1) { $ini = eZINI::instance(); if ($ini->variable('DebugSettings', 'DebugOutput') === 'enabled') { print "<p>The execution of eZ Publish was abruptly ended, the debug output is present below.</p>"; } else { print "<p>The execution of eZ Publish was abruptly ended, debug information can be found in the log files normally placed in var/log/*</p>"; } } else { print "<p>The execution of eZ Publish was abruptly ended. Contact website owner with current url and what you did, and owner will be able to debug the issue further.</p>"; } $templateResult = null; eZDisplayResult($templateResult); }
$result = $stepInstaller->init(); if ($result === true) { $step = $stepData->nextStep($step); } else { if (is_int($result) || is_string($result)) { $step = $stepData->step($result); } else { $tpl->setVariable('setup_current_step', $step['class']); // set current step $result = $stepInstaller->display(); $result['help'] = $tpl->fetch('design:setup/init/' . $step['file'] . '_help.tpl'); $done = true; } } } else { print '<h1>Step ' . $step['class'] . ' is not valid, no such file ' . $includeFile . '. I\'m exiting...</h1>'; //TODO : i18n eZDisplayResult($templateResult); eZExecution::cleanExit(); } } // generate summary $summary = new eZSetupSummary($tpl, $persistenceList); $result['summary'] = $summary->summary(); // Compute install progress $result['progress'] = $stepData->progress($step); // Print debug information and exit. eZDebug::addTimingPoint("End"); return $result; //eZDisplayResult( $templateResult ); //eZExecution::cleanExit();
$result = $stepInstaller->init(); if ($result === true) { $step = $stepData->nextStep($step); } else { if (is_int($result) || is_string($result)) { $step = $stepData->step($result); } else { $tpl->setVariable('setup_current_step', $step['class']); // set current step $result = $stepInstaller->display(); $result['help'] = $tpl->fetch('design:setup/init/' . $step['file'] . '_help.tpl'); $done = true; } } } else { print '<h1>Step ' . $step['class'] . ' is not valid, no such file ' . $includeFile . '. I\'m exiting...</h1>'; //TODO : i18n eZDisplayResult($templateResult, eZDisplayDebug()); eZExecution::cleanExit(); } } // generate summary $summary = new eZSetupSummary($tpl, $persistenceList); $result['summary'] = $summary->summary(); // Compute install progress $result['progress'] = $stepData->progress($step); // Print debug information and exit. eZDebug::addTimingPoint("End"); return $result; //eZDisplayResult( $templateResult, eZDisplayDebug() ); //eZExecution::cleanExit();