Project

General

Profile

Feature #23464 ยป 15576_v1.diff

Administrator Admin, 2010-08-27 14:22

View differences:

typo3/template.php (working copy)
* When calling from own extension, use syntax getHtmlTemplate('EXT:extkey/template.html')
*
* @param string tmpl name, usually in the typo3/template/ directory
* @deprecated since TYPO3 4.5 - Use t3lib_div::getHtmlTemplate instead
* @return string HTML of template
*/
function getHtmlTemplate($filename) {
if ($GLOBALS['TBE_STYLES']['htmlTemplates'][$filename]) {
$filename = $GLOBALS['TBE_STYLES']['htmlTemplates'][$filename];
}
if (substr($filename,0,4) != 'EXT:') {
$filename = t3lib_div::resolveBackPath($this->backPath . $filename);
} else {
$filename = t3lib_div::getFileAbsFileName($filename, true, true);
}
return t3lib_div::getURL($filename);
t3lib_div::logDeprecatedFunction();
return t3lib_div::getHtmlTemplate($filename, $this->backPath);
}
/**
typo3/templates/typo3_print_error.html (revision 0)
<!-- ###FULLDOC### begin -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml11.dtd">
<?xml version="1.0" encoding="utf-8"?>
<html>
<head>
<title>Error!</title>
<style type="text/css"><!--/*--><![CDATA[/*><!--*/
body { font-family:Verdana,Arial,Helvetica,sans-serif; font-size: 90%; text-align: center; background-color: #ffffff; }
h1 { font-size: 1.2em; margin: 0 0 1em 0; }
p { margin: 0; text-align: left; }
img { border: 0; margin: 10px 0; }
div.center div { margin: 0 auto; }
.errorBox { width: 400px; padding: 0.5em; border: 1px solid black; background-color: #F4F0E8; }
/*]]>*/--></style>
</head>
<body>
<div class="center">
###LOGO###
<div class="errorBox">
<h1>###HEADER###</h1>
<p>###TEXT###</p>
</div>
</div>
</body>
</html>
<!-- ###FULLDOC### end -->
t3lib/class.t3lib_befunc.php (working copy)
*
* @param string Header string
* @param string Content string
* @param boolean Will return an alert() with the content of header and text.
* @param boolean Print header.
* @deprecated since TYPO3 4.5 - Use t3lib_div::typo3PrintError instead
* @return void
*/
public static function typo3PrintError($header, $text, $js = '', $head = 1) {
// This prints out a TYPO3 error message.
// If $js is set the message will be output in JavaScript
if ($js) {
echo "alert('".t3lib_div::slashJS($header.'\n'.$text)."');";
} else {
echo $head?'<html>
<head>
<title>Error!</title>
</head>
<body bgcolor="white" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">':'';
echo '<div align="center">
<table border="0" cellspacing="0" cellpadding="0" width="333">
<tr>
<td align="center">'.
($GLOBALS['TBE_STYLES']['logo_login']?'<img src="'.$GLOBALS['BACK_PATH'].$GLOBALS['TBE_STYLES']['logo_login'].'" alt="" />':'<img src="'.$GLOBALS['BACK_PATH'].'gfx/typo3logo.gif" width="123" height="34" vspace="10" />').
'</td>
</tr>
<tr>
<td bgcolor="black">
<table width="100%" border="0" cellspacing="1" cellpadding="10">
<tr>
<td bgcolor="#F4F0E8">
<font face="verdana,arial,helvetica" size="2">';
echo '<strong><center><font size="+1">'.$header.'</font></center></strong><br />'.$text;
echo ' </font>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>';
echo $head?'
</body>
</html>':'';
}
public static function typo3PrintError($header, $text) {
t3lib_div::logDeprecatedFunction();
t3lib_div::typo3PrintError($header, $text);
}
/**
t3lib/class.t3lib_timetrack.php (working copy)
* @param string URL for the <base> tag (if you want it)
* @return string
*/
public function debug_typo3PrintError($header, $text, $js, $baseUrl = '') {
if ($js) {
$errorMessage = 'alert(\'' . t3lib_div::slashJS($header . '\n' . $text) . '\');';
} else {
$errorMessage = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml11.dtd">
<?xml version="1.0" encoding="utf-8"?>
<html>
<head>
'.($baseUrl ? '<base href="'.htmlspecialchars($baseUrl).'" />' : '').'
<title>Error!</title>
<style type="text/css"><!--/*--><![CDATA[/*><!--*/
body { font-family:Verdana,Arial,Helvetica,sans-serif; font-size: 90%; text-align: center; background-color: #ffffff; }
h1 { font-size: 1.2em; margin: 0 0 1em 0; }
p { margin: 0; text-align: left; }
img { border: 0; margin: 10px 0; }
div.center div { margin: 0 auto; }
.errorBox { width: 400px; padding: 0.5em; border: 1px solid black; background-color: #F4F0E8; }
/*]]>*/--></style>
</head>
<body>
<div class="center">
<img src="'.TYPO3_mainDir.'gfx/typo3logo.gif" width="123" height="34" alt="" />
<div class="errorBox">
<h1>'.$header.'</h1>
<p>'.$text.'</p>
</div>
</div>
</body>
</html>';
}
public function debug_typo3PrintError($header, $text) {
$errorMessage = t3lib_div::typo3PrintError($header, $text, TRUE);
// Hook to modify error message
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_timetrack.php']['debug_typo3PrintError'])) {
$params = array(
'header' => $header,
'text' => $text,
'js' => $js,
'baseUrl' => $baseUrl,
'errorMessage' => &$errorMessage
);
$null = null;
......
t3lib_div::callUserFunction($hookMethod, $params, $null);
}
}
echo $errorMessage;
print $errorMessage;
}
}
t3lib/class.t3lib_div.php (working copy)
return $content;
}
/**
* Function to load a HTML template file with markers.
* When calling from own extension, use syntax getHtmlTemplate('EXT:extkey/template.html')
*
* @param string tmpl name, usually in the typo3/template/ directory
* @param string custom back path
* @return string HTML of template
*/
static public function getHtmlTemplate($filename, $backPath = '') {
if ($GLOBALS['TBE_STYLES']['htmlTemplates'][$filename]) {
$filename = $GLOBALS['TBE_STYLES']['htmlTemplates'][$filename];
}
if (substr($filename, 0, 4) != 'EXT:') {
$filename = self::resolveBackPath($backPath . $filename);
} else {
$filename = self::getFileAbsFileName($filename, true, true);
}
return self::getURL($filename);
}
/**
* Writes $content to the file $file
......
public static function print_array($array_in) {
echo self::view_array($array_in);
}
/**
* This prints out a TYPO3 error message.
*
* @param string Header string
* @param string Message string
* @param boolean If set, this method will return the error HTML.
* @return string/void
*/
static public function typo3PrintError($header, $text, $returnError = FALSE) {
$filename = $GLOBALS['TYPO3_CONF_VARS']['SYS']['errorTemplate'];
$backPath = '';
if(TYPO3_MODE == 'FE') {
$backPath = PATH_typo3;
}
$template = self::getHtmlTemplate($filename, $backPath);
$template = t3lib_parsehtml::getSubpart($template, '###FULLDOC###');
$imageSrc = $GLOBALS['BACK_PATH'] . $GLOBALS['TYPO3_CONF_VARS']['SYS']['errorMessageLogo'];
// prepend "/" if necessary
if(substr($imageSrc, 0, 1) !== '/') {
$imageSrc = '/' . $imageSrc;
}
$logo = '<img src="' . $imageSrc . '" />';
$markers = array(
'LOGO' => $logo,
'HEADER' => $header,
'TEXT' => $text,
);
$errorMessage = t3lib_parsehtml::substituteMarkerArray($template, $markers, '###|###');
if($returnError) {
return $errorMessage;
}
print $errorMessage;
}
/**
* Makes debug output
* Prints $var in bold between two vertical lines
t3lib/config_default.php (working copy)
'syslogErrorReporting' => E_ALL ^ E_NOTICE, // Integer: Configures which PHP errors should be logged to the configured syslogs (see: [SYS][systemLog]). If set to "0" no PHP errors are logged to the syslog. Default is "E_ALL ^ E_NOTICE" (6135).
'belogErrorReporting' => E_ALL ^ E_NOTICE, // Integer: Configures which PHP errors should be logged to the "syslog" table (extension: belog). If set to "0" no PHP errors are logged to the sys_log table. Default is "E_ALL ^ E_NOTICE" (6135).
'locallangXMLOverride' => array(), // For extension/overriding of the arrays in 'locallang' files in frontend and backend. See 'Inside TYPO3' for more information.
'errorMessageLogo' => TYPO3_maindir . 'gfx/typo3logo.gif', // Path to an image. This image will be used in fatal error messages in frontend and backend.
'errorTemplate' => 'templates/typo3_print_error.html', // Path to a template file. This is the template for fatal error messages in frontend and backend. NOTE: The path is relative to the "typo3" folder.
),
'EXT' => array ( // Options related to the Extension Management
'noEdit' => TRUE, // Boolean: If set, the Extension Manager does NOT allow extension files to be edited! (Otherwise both local and global extensions can be edited.)
    (1-1/1)