summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2009-07-07 16:38:31 +0000
committeralecpl <alec@alec.pl>2009-07-07 16:38:31 +0000
commitd559cba5f7b92f152dd0330e2870d5512cd34e51 (patch)
treec17c8f25f70d93fe05314105081248d2f99938d2 /program
parentb6b593416bb1bef12c30b0cea8c92221d4b7a5c2 (diff)
- Added 'imap_debug' option, described 'sql_debug' option in config file
Diffstat (limited to 'program')
-rw-r--r--program/include/rcmail.php1
-rw-r--r--program/include/rcube_mdb2.php4
-rw-r--r--program/lib/imap.inc17
3 files changed, 16 insertions, 6 deletions
diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index 22ec20b90..65bac3813 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -366,6 +366,7 @@ class rcmail
'imap' => $this->config->get('imap_auth_type', 'check'),
'delimiter' => isset($_SESSION['imap_delimiter']) ? $_SESSION['imap_delimiter'] : $this->config->get('imap_delimiter'),
'rootdir' => isset($_SESSION['imap_root']) ? $_SESSION['imap_root'] : $this->config->get('imap_root'),
+ 'debug_mode' => (bool) $this->config->get('imap_debug', 0),
);
$this->imap->set_options($options);
diff --git a/program/include/rcube_mdb2.php b/program/include/rcube_mdb2.php
index faf653539..a83b463b4 100644
--- a/program/include/rcube_mdb2.php
+++ b/program/include/rcube_mdb2.php
@@ -701,8 +701,6 @@ function mdb2_debug_handler(&$db, $scope, $message, $context = array())
{
$debug_output = $scope . '('.$db->db_index.'): ';
$debug_output .= $message . $db->getOption('log_line_break');
- write_log('sqllog', $debug_output);
+ write_log('sql', $debug_output);
}
}
-
-
diff --git a/program/lib/imap.inc b/program/lib/imap.inc
index 7b40c020b..a8f858ea6 100644
--- a/program/lib/imap.inc
+++ b/program/lib/imap.inc
@@ -197,7 +197,11 @@ function iil_xor($string, $string2) {
}
function iil_PutLine($fp, $string, $endln=true) {
-// console('C: '. rtrim($string));
+ global $my_prefs;
+
+ if(!empty($my_prefs['debug_mode']))
+ write_log('imap', 'C: '. rtrim($string));
+
return fputs($fp, $string . ($endln ? "\r\n" : ''));
}
@@ -225,6 +229,8 @@ function iil_PutLineC($fp, $string, $endln=true) {
}
function iil_ReadLine($fp, $size=1024) {
+ global $my_prefs;
+
$line = '';
if (!$fp) {
@@ -240,7 +246,8 @@ function iil_ReadLine($fp, $size=1024) {
if ($buffer === false) {
break;
}
-// console('S: '. chop($buffer));
+ if(!empty($my_prefs['debug_mode']))
+ write_log('imap', 'S: '. chop($buffer));
$line .= $buffer;
} while ($buffer[strlen($buffer)-1] != "\n");
@@ -265,6 +272,7 @@ function iil_MultLine($fp, $line, $escape=false) {
}
function iil_ReadBytes($fp, $bytes) {
+ global $my_prefs;
$data = '';
$len = 0;
do {
@@ -273,7 +281,8 @@ function iil_ReadBytes($fp, $bytes) {
if ($len == strlen($data)) {
break; //nothing was read -> exit to avoid apache lockups
}
-// console('[...] '. $d);
+ if(!empty($my_prefs['debug_mode']))
+ write_log('imap', 'S: '. $d);
$len = strlen($data);
} while ($len < $bytes);
@@ -553,6 +562,8 @@ function iil_Connect($host, $user, $password, $options=null) {
$my_prefs['rootdir'] = $optval;
} else if ($optkey == 'delimiter') {
$my_prefs['delimiter'] = $optval;
+ } else if ($optkey == 'debug_mode') {
+ $my_prefs['debug_mode'] = $optval;
}
}
}