Added status headers: In class.tslib_fe.php status header were set when an error...
authorAndreas Otto <andreas.otto@dkd.de>
Thu, 14 Jun 2007 11:31:00 +0000 (11:31 +0000)
committerAndreas Otto <andreas.otto@dkd.de>
Thu, 14 Jun 2007 11:31:00 +0000 (11:31 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@2363 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/cms/tslib/class.tslib_fe.php

index fb666e2..48adddb 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-06-13  Andreas Otto <andreas.otto@dkd.de>
+
+       * Added status headers: In class.tslib_fe.php status header were set when an error occurs after which TYPO3 throws an exit() statement. In addition to that t3lib_div::syslog() is called to write an entry to the syslog.
+
 2007-06-13  Oliver Hader  <oh@inpublica.de>
 
        * Fixed bug #5778: Missleading comment in TCEmain::copyRecord_procBasedOnFieldType()
index 93e584e..d7145c8 100755 (executable)
                                        </script>';
                                exit;
                        } elseif (!$GLOBALS['TYPO3_DB']->sql_select_db(TYPO3_db))       {
+                               header( 'http/1.0 503 Service Temporarily Unavailable' );
                                $this->printError('Cannot connect to the current database, "'.TYPO3_db.'"','Database Error');
                                exit;
                        }
                                        </script>';
                                exit;
                        }
+                       header( 'http/1.0 503 Service Temporarily Unavailable' );
                        $this->printError('The current username, password or host was not accepted when the connection to the database was attempted to be established!','Database Error');
                        exit;
                }
                                if ($theFirstPage)      {
                                        $this->id = $theFirstPage['uid'];
                                } else {
+                                       header( 'http/1.0 503 Service Temporarily Unavailable' );
+                                       t3lib_div::sysLog('No pages are found on the rootlevel!', 'cms', 3);
                                        $this->printError('No pages are found on the rootlevel!');
                                        exit;
                                }
                                if ($this->TYPO3_CONF_VARS['FE']['pageNotFound_handling'])      {
                                        $this->pageNotFoundAndExit('The requested page does not exist!');
                                } else {
+                                       header( 'http/1.0 404 Page Not Found' );
+                                       t3lib_div::sysLog('The requested page does not exist!', 'cms', 3);
                                        $this->printError('The requested page does not exist!');
                                        exit;
                                }
                        if ($this->TYPO3_CONF_VARS['FE']['pageNotFound_handling'])      {
                                $this->pageNotFoundAndExit('The requested page does not exist!');
                        } else {
+                               header( 'http/1.0 404 Page Not Found' );
+                               t3lib_div::sysLog('The requested page does not exist!', 'cms', 3);
                                $this->printError('The requested page does not exist!');
                                exit;
                        }
                                $this->rootLine = $this->sys_page->getRootLine($this->id,$this->MP);
                        }
                        if (!count($this->rootLine))    {
+                               header( 'http/1.0 503 Service Temporarily Unavailable' );
+                               t3lib_div::sysLog('The requested page didn\'t have a proper connection to the tree-root! ('.$this->sys_page->error_getRootLine.')', 'cms', 3);
                                $this->printError('The requested page didn\'t have a proper connection to the tree-root! <br /><br />('.$this->sys_page->error_getRootLine.')');
                                exit;
                        }
                        // Checking for include section regarding the hidden/starttime/endtime/fe_user (that is access control of a whole subbranch!)
                if ($this->checkRootlineForIncludeSection())    {
                        if (!count($this->rootLine))    {
+                               header( 'http/1.0 503 Service Temporarily Unavailable' );
+                               t3lib_div::sysLog('The requested page was not accessible!', 'cms', 3);
                                $this->printError('The requested page was not accessible!');
                                exit;
                        } else {
                                $page = $this->getPageShortcut($page['shortcut'],$page['shortcut_mode'],$page['uid'],$itera-1,$pageLog);
                        } else {
                                $pageLog[] = $page['uid'];
+                               header( 'http/1.0 500 Internal Server Error' );
+                               t3lib_div::sysLog('Page shortcuts were looping in uids '.implode(',',$pageLog).'...!', 'cms', 3);
                                $this->printError('Page shortcuts were looping in uids '.implode(',',$pageLog).'...!');
                                exit;
                        }
                                $this->pSetup = $this->tmpl->setup[$this->sPre.'.'];
 
                                if (!is_array($this->pSetup))   {
+                                       header( 'http/1.0 503 Service Temporarily Unavailable' );
+                                       t3lib_div::sysLog('The page is not configured! [type= '.$this->type.']['.$this->sPre.']', 'cms', 3);
                                        $this->printError('The page is not configured! [type= '.$this->type.']['.$this->sPre.']');
                                        exit;
                                } else {
                                }
                                $GLOBALS['TT']->pull();
                        } else {
+                               header( 'http/1.0 503 Service Temporarily Unavailable' );
+                               t3lib_div::sysLog('No template found!', 'cms', 3);
                                $this->printError('No template found!');
                                exit;
                        }
                if ($this->absRefPrefix_force && strcmp($this->config['config']['simulateStaticDocuments'],'PATH_INFO'))        {
                        $redirectUrl = t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR').'index.php?id='.$this->id.'&type='.$this->type;
                        if ($this->config['config']['simulateStaticDocuments_dontRedirectPathInfoError'])       {
+                               header( 'http/1.0 503 Service Temporarily Unavailable' );
+                               t3lib_div::sysLog('PATH_INFO was not configured for this website, and the URL tries to find the page by PATH_INFO!', 'cms', 3);
                                $this->printError('PATH_INFO was not configured for this website, and the URL tries to find the page by PATH_INFO!<br /><br /><a href="'.htmlspecialchars($redirectUrl).'">Click here to get to the right page.</a>','Error: PATH_INFO not configured');
                        } else {
                                header('Location: '.t3lib_div::locationHeaderUrl($redirectUrl));