summaryrefslogtreecommitdiff
path: root/debug.class
diff options
context:
space:
mode:
Diffstat (limited to 'debug.class')
-rw-r--r--debug.class58
1 files changed, 3 insertions, 55 deletions
diff --git a/debug.class b/debug.class
index cabe365..61b4889 100644
--- a/debug.class
+++ b/debug.class
@@ -19,23 +19,14 @@
class it_debug
{
var $level;
- var $email;
- var $subject;
- var $from;
/**
* Constructor
* @param $level Debug level. All debug() calls with a level <= $level are shown.
- * @param $email E-mail address for mail() and internal_error() functions.
- * @param $subject Subject of e-mail messages
- * @see ::debug(), ::mail(), ::internal_error()
*/
-function it_debug($level=0, $email="itools@gna.ch", $subject=null)
+function it_debug($level=0)
{
$this->level = isset($GLOBALS['debug_level']) ? $GLOBALS['debug_level'] : $level;
- $this->email = $email;
- $this->subject = isset($subject) ? $subject : 'ITools error ('.$_SERVER['HTTP_HOST'].') on '.getenv('HOSTNAME');
- $this->from = 'From: "it_debug '.getenv('HOSTNAME').'" <itools@'.$_SERVER['SERVER_NAME'].'>';
}
@@ -55,51 +46,8 @@ function debug($text, $level = 0)
/**
- * Send an e-mail to this debug object's maintainer
- * @param $text Text of mail message
- * @param $level Debug level - Mail is only sent if this is <= the global debug level
- */
-function mail($text, $level = 0)
-{
- if ($this->level >= $level)
- {
- if ($this->email)
- mail($this->email, $this->subject, $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."\n".$_SERVER['SCRIPT_FILENAME']."\n\n".$text, $this->from);
- else
- error_log("missing debug email addr: " . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . " " . substr($text,0,200));
- }
-}
-
-
-/**
- * DEPRECATED. Display error message or maintenance page and terminate processing. Mail message and vardump to maintainer
- * @param $text Message to display
- * @return This function never returns
- */
-function internal_error($text)
-{
- $text = "Host: ".getenv('HOSTNAME')."\nPage: //{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}\nFile: {$_SERVER['SCRIPT_FILENAME']}\n\n$text\n\n";
-
- if ($this->email)
- mail($this->email, $this->subject, $text.'$_REQUEST: '.print_r($_REQUEST, true). "\nStack:\n" . print_r(debug_backtrace(), true), $this->from);
- else
- error_log("missing debug email addr: " . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . " " . substr($text,0,200));
-
- /* If we have a maintenance display page show this instead of error */
- if (file_exists($_SERVER['DOCUMENT_ROOT'].'/maintenance.html'))
- {
- header("Location: http://{$_SERVER['HTTP_HOST']}/maintenance.html");
- exit;
- }
- else
- fail("<pre>Internal Error:\n\n$text");
-}
-
-
-/**
- * Function to return dump of all it's parameters,
- * normally used through D(), ED(), EDX() in functions.php
- * @param Varargs of mixed stuff to dump
+ * Backend for functions D(), ED() and EDX() in functions.php
+ * @param Origargs Array containing original arguments do ED() etc
* @return String representation of dump
*/
function dump($args)