From d04d202234b0ba1e65b1c581acf0cbe715120dd7 Mon Sep 17 00:00:00 2001 From: thomascube <thomas@roundcube.net> Date: Wed, 22 Nov 2006 06:49:30 -0500 Subject: [PATCH] Remove newlines from mail headers (#1484031) --- program/include/main.inc | 43 ++++++++++++++++++++++++++++--------------- 1 files changed, 28 insertions(+), 15 deletions(-) diff --git a/program/include/main.inc b/program/include/main.inc index 6768833..55336fd 100644 --- a/program/include/main.inc +++ b/program/include/main.inc @@ -550,21 +550,28 @@ $user_name = $user!=$user_email ? $user : ''; // try to resolve the e-mail address from the virtuser table - if (!empty($CONFIG['virtuser_query'])) - { - $sql_result = $DB->query(preg_replace('/%u/', $user, $CONFIG['virtuser_query'])); - if ($sql_arr = $DB->fetch_array($sql_result)) - $user_email = $sql_arr[0]; + if (!empty($CONFIG['virtuser_query']) && + ($sql_result = $DB->query(preg_replace('/%u/', $user, $CONFIG['virtuser_query']))) && + ($DB->num_rows()>0)) + while ($sql_arr = $DB->fetch_array($sql_result)) + { + $DB->query("INSERT INTO ".get_table_name('identities')." + (user_id, del, standard, name, email) + VALUES (?, 0, 1, ?, ?)", + $user_id, + $user_name, + preg_replace('/^@/', $user . '@', $sql_arr[0])); + } + else + { + // also create new identity records + $DB->query("INSERT INTO ".get_table_name('identities')." + (user_id, del, standard, name, email) + VALUES (?, 0, 1, ?, ?)", + $user_id, + $user_name, + $user_email); } - - // also create new identity records - $DB->query("INSERT INTO ".get_table_name('identities')." - (user_id, del, standard, name, email) - VALUES (?, 0, 1, ?, ?)", - $user_id, - $user_name, - $user_email); - // get existing mailboxes $a_mailboxes = $IMAP->list_mailboxes(); @@ -1056,7 +1063,13 @@ return $value; } - +/** + * Remove single and double quotes from given string + */ +function strip_quotes($str) +{ + return preg_replace('/[\'"]/', '', $str); +} // ************** template parsing and gui functions ************** -- Gitblit v1.9.1