From 1d67fe13f6b0751c5ba3ab7a93f730e9ceac39cd Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Wed, 29 May 2013 03:42:12 -0400
Subject: [PATCH] Remove (move to bc.php) unused strip_newlines() and strip_quotes() functions

---
 program/include/bc.php               |   10 ++++++++++
 program/lib/Roundcube/bootstrap.php  |   26 --------------------------
 program/lib/Roundcube/rcube_user.php |    9 ++++-----
 3 files changed, 14 insertions(+), 31 deletions(-)

diff --git a/program/include/bc.php b/program/include/bc.php
index 0ddfb32..447876d 100644
--- a/program/include/bc.php
+++ b/program/include/bc.php
@@ -405,6 +405,16 @@
     return rcube_enriched::to_html($data);
 }
 
+function strip_quotes($str)
+{
+    return str_replace(array("'", '"'), '', $str);
+}
+
+function strip_newlines($str)
+{
+    return preg_replace('/[\r\n]/', '', $str);
+}
+
 class rcube_html_page extends rcmail_html_page
 {
 }
diff --git a/program/lib/Roundcube/bootstrap.php b/program/lib/Roundcube/bootstrap.php
index b7e69cb..5a371d2 100644
--- a/program/lib/Roundcube/bootstrap.php
+++ b/program/lib/Roundcube/bootstrap.php
@@ -293,32 +293,6 @@
 
 
 /**
- * Remove single and double quotes from a given string
- *
- * @param string Input value
- *
- * @return string Dequoted string
- */
-function strip_quotes($str)
-{
-    return str_replace(array("'", '"'), '', $str);
-}
-
-
-/**
- * Remove new lines characters from given string
- *
- * @param string $str  Input value
- *
- * @return string Stripped string
- */
-function strip_newlines($str)
-{
-    return preg_replace('/[\r\n]/', '', $str);
-}
-
-
-/**
  * Compose a valid representation of name and e-mail address
  *
  * @param string $email  E-mail address
diff --git a/program/lib/Roundcube/rcube_user.php b/program/lib/Roundcube/rcube_user.php
index 505b190..5e9c9af 100644
--- a/program/lib/Roundcube/rcube_user.php
+++ b/program/lib/Roundcube/rcube_user.php
@@ -495,9 +495,9 @@
             "INSERT INTO ".$dbh->table_name('users').
             " (created, last_login, username, mail_host, language)".
             " VALUES (".$dbh->now().", ".$dbh->now().", ?, ?, ?)",
-            strip_newlines($data['user']),
-            strip_newlines($data['host']),
-            strip_newlines($data['language']));
+            $data['user'],
+            $data['host'],
+            $data['language']);
 
         if ($user_id = $dbh->insert_id('users')) {
             // create rcube_user instance to make plugin hooks work
@@ -517,7 +517,7 @@
                 if (empty($user_email)) {
                     $user_email = strpos($data['user'], '@') ? $user : sprintf('%s@%s', $data['user'], $mail_domain);
                 }
-                $email_list[] = strip_newlines($user_email);
+                $email_list[] = $user_email;
             }
             // identities_level check
             else if (count($email_list) > 1 && $rcube->config->get('identities_level', 0) > 1) {
@@ -547,7 +547,6 @@
                     $record['name'] = $user_name != $record['email'] ? $user_name : '';
                 }
 
-                $record['name']     = strip_newlines($record['name']);
                 $record['user_id']  = $user_id;
                 $record['standard'] = $standard;
 

--
Gitblit v1.9.1