From 062cf6c9ec522020b05351e817aba5c929870e4c Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Sat, 22 Mar 2008 18:29:09 +0000 Subject: [PATCH] Turn on error logging, and forbid errors.log from public viewing. git-svn-id: http://htmlpurifier.org/svnroot@1619 48356398-32a2-884e-a903-53898d9a118a --- xhtml-compiler/common.php | 9 +++++++-- xhtml-compiler/htaccess.php | 7 +++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/xhtml-compiler/common.php b/xhtml-compiler/common.php index 98e8276..cdec72e 100644 --- a/xhtml-compiler/common.php +++ b/xhtml-compiler/common.php @@ -2,6 +2,13 @@ if (!version_compare(PHP_VERSION, "5", ">=")) exit('Requires PHP 5.'); +// setup our error reporting, ideally this would be in php.ini but shared +// hosting environment requires a little more flexibility. +error_reporting(E_STRICT | E_ALL); +ini_set('display_errors', false); +ini_set('log_errors', true); +ini_set('error_log', dirname(__FILE__) . '/errors.log'); + // set working directory to parent directory (slightly hacky) // if we want this to be able to be included in other apps, // this must be removed @@ -28,5 +35,3 @@ require_once 'XHTMLCompiler/DOMFilter.php'; set_exception_handler('xhtmlcompiler_exception_handler'); XHTMLCompiler::getInstance(); // invoke the super-object - -?> \ No newline at end of file diff --git a/xhtml-compiler/htaccess.php b/xhtml-compiler/htaccess.php index a964711..b8ce184 100644 --- a/xhtml-compiler/htaccess.php +++ b/xhtml-compiler/htaccess.php @@ -142,6 +142,13 @@ $new_contents[] = ' Order allow,deny'; $new_contents[] = ' Deny from all'; $new_contents[] = ''; +// errors.log is forbidden to outside world. In theory, this will occur only +// in xhtml-compiler/, but it won't hurt to deny it everywhere. +$new_contents[] = ''; +$new_contents[] = ' Order allow,deny'; +$new_contents[] = ' Deny from all'; +$new_contents[] = ''; + // setup RSS $new_contents[] = 'AddType application/rss+xml rss'; $new_contents[] = 'AddCharset UTF-8 .rss'; -- 2.11.4.GIT