From 93e64008a674afbad215c1d42bf5fa758a5c1a5e Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Wed, 05 Aug 2015 03:30:51 -0400 Subject: [PATCH] Small code improvements --- program/include/rcmail_output_html.php | 9 ++++++--- program/lib/Roundcube/rcube_result_thread.php | 2 +- program/lib/Roundcube/rcube_session.php | 1 + program/steps/addressbook/func.inc | 12 +++++++----- program/lib/Roundcube/rcube_message.php | 3 +-- program/lib/Roundcube/rcube_imap_generic.php | 3 ++- program/lib/Roundcube/rcube_utils.php | 4 ++-- 7 files changed, 20 insertions(+), 14 deletions(-) diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index 26bb91d..464008c 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -262,11 +262,14 @@ $meta = @file_get_contents(RCUBE_INSTALL_PATH . $skin_path . '/meta.json'); $meta = @json_decode($meta, true); - $meta['path'] = $skin_path; - $skin_id = end(explode('/', $skin_path)); + $meta['path'] = $skin_path; + $path_elements = explode('/', $skin_path); + $skin_id = end($path_elements); + if (!$meta['name']) { $meta['name'] = $skin_id; } + $this->skins[$skin_id] = $meta; if ($meta['extends']) { @@ -956,7 +959,7 @@ "rcube_utils::get_input_value('\\1', rcube_utils::INPUT_GPC)", "\$_COOKIE['\\1']", "\$browser->{'\\1'}", - $this->template_name, + "'" . $this->template_name . "'", ), $expression ); diff --git a/program/lib/Roundcube/rcube_imap_generic.php b/program/lib/Roundcube/rcube_imap_generic.php index 7686b56..498793e 100644 --- a/program/lib/Roundcube/rcube_imap_generic.php +++ b/program/lib/Roundcube/rcube_imap_generic.php @@ -690,7 +690,8 @@ list($code, $response) = $this->execute('NAMESPACE'); if ($code == self::ERROR_OK && preg_match('/^\* NAMESPACE /', $response)) { - $data = $this->tokenizeResponse(substr($response, 11)); + $response = substr($response, 11); + $data = $this->tokenizeResponse($response); } if (!is_array($data)) { diff --git a/program/lib/Roundcube/rcube_message.php b/program/lib/Roundcube/rcube_message.php index d022185..77d7476 100644 --- a/program/lib/Roundcube/rcube_message.php +++ b/program/lib/Roundcube/rcube_message.php @@ -96,8 +96,7 @@ return; } - $this->mime = new rcube_mime($this->headers->charset); - + $this->mime = new rcube_mime($this->headers->charset); $this->subject = $this->headers->get('subject'); list(, $this->sender) = each($this->mime->decode_address_list($this->headers->from, 1)); diff --git a/program/lib/Roundcube/rcube_result_thread.php b/program/lib/Roundcube/rcube_result_thread.php index aa3c7eb..5388eb1 100644 --- a/program/lib/Roundcube/rcube_result_thread.php +++ b/program/lib/Roundcube/rcube_result_thread.php @@ -413,7 +413,7 @@ */ public function get_parameters($param=null) { - $params = $this->params; + $params = array(); $params['MAILBOX'] = $this->mailbox; $params['ORDER'] = $this->order; diff --git a/program/lib/Roundcube/rcube_session.php b/program/lib/Roundcube/rcube_session.php index 86316f9..93a37d6 100644 --- a/program/lib/Roundcube/rcube_session.php +++ b/program/lib/Roundcube/rcube_session.php @@ -40,6 +40,7 @@ protected $reloaded = false; protected $appends = array(); protected $unsets = array(); + protected $gc_enabled = 0; protected $gc_handlers = array(); protected $cookiename = 'roundcube_sessauth'; protected $secret = ''; diff --git a/program/lib/Roundcube/rcube_utils.php b/program/lib/Roundcube/rcube_utils.php index db6c24c..eef554e 100644 --- a/program/lib/Roundcube/rcube_utils.php +++ b/program/lib/Roundcube/rcube_utils.php @@ -253,8 +253,8 @@ $js_rep_table["'"] = "\\'"; $js_rep_table["\\"] = "\\\\"; // Unicode line and paragraph separators (#1486310) - $js_rep_table[chr(hexdec(E2)).chr(hexdec(80)).chr(hexdec(A8))] = '
'; - $js_rep_table[chr(hexdec(E2)).chr(hexdec(80)).chr(hexdec(A9))] = '
'; + $js_rep_table[chr(hexdec('E2')).chr(hexdec('80')).chr(hexdec('A8'))] = '
'; + $js_rep_table[chr(hexdec('E2')).chr(hexdec('80')).chr(hexdec('A9'))] = '
'; } // encode for javascript use diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc index 8ecd931..fee2095 100644 --- a/program/steps/addressbook/func.inc +++ b/program/steps/addressbook/func.inc @@ -371,19 +371,21 @@ { global $OUTPUT, $RCMAIL; - if (empty($result) || $result->count == 0) + if (empty($result) || $result->count == 0) { return; + } // define list of cols to be displayed $a_show_cols = array('name','action'); while ($row = $result->next()) { - $row['CID'] = $row['ID']; - $row['email'] = reset(rcube_addressbook::get_col_values('email', $row, true)); + $emails = rcube_addressbook::get_col_values('email', $row, true); + $row['CID'] = $row['ID']; + $row['email'] = reset($emails); - $source_id = $OUTPUT->get_env('source'); + $source_id = $OUTPUT->get_env('source'); $a_row_cols = array(); - $classes = array($row['_type'] ? $row['_type'] : 'person'); + $classes = array($row['_type'] ? $row['_type'] : 'person'); // build contact ID with source ID if (isset($row['sourceid'])) { -- Gitblit v1.9.1