From a9587489473baf3854999e711083be212ca0c1c4 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 07 Jun 2015 09:26:33 -0400
Subject: [PATCH] CS fixes
---
program/lib/Roundcube/rcube_imap.php | 187 +++++++++++-----------------------------------
1 files changed, 45 insertions(+), 142 deletions(-)
diff --git a/program/lib/Roundcube/rcube_imap.php b/program/lib/Roundcube/rcube_imap.php
index 65e0950..b60eeca 100644
--- a/program/lib/Roundcube/rcube_imap.php
+++ b/program/lib/Roundcube/rcube_imap.php
@@ -1,6 +1,6 @@
<?php
-/*
+/**
+-----------------------------------------------------------------------+
| This file is part of the Roundcube Webmail client |
| Copyright (C) 2005-2012, The Roundcube Dev Team |
@@ -95,7 +95,6 @@
}
}
-
/**
* Magic getter for backward compat.
*
@@ -107,7 +106,6 @@
return $this->{$name};
}
}
-
/**
* Connect to an IMAP server
@@ -203,7 +201,6 @@
return false;
}
-
/**
* Close IMAP connection.
* Usually done on script shutdown
@@ -215,7 +212,6 @@
$this->mcache->close();
}
}
-
/**
* Check connection state, connect if not connected.
@@ -238,7 +234,6 @@
return $this->is_connected();
}
-
/**
* Checks IMAP connection.
*
@@ -248,7 +243,6 @@
{
return $this->conn->connected();
}
-
/**
* Returns code of last error
@@ -260,7 +254,6 @@
return $this->conn->errornum;
}
-
/**
* Returns text of last error
*
@@ -270,7 +263,6 @@
{
return $this->conn->error;
}
-
/**
* Returns code of last command response
@@ -301,7 +293,6 @@
}
}
-
/**
* Activate/deactivate debug mode
*
@@ -313,23 +304,21 @@
$this->conn->setDebug($dbg, array($this, 'debug_handler'));
}
-
/**
* Set internal folder reference.
* All operations will be perfomed on this folder.
*
- * @param string $folder Folder name
+ * @param string $folder Folder name
*/
public function set_folder($folder)
{
$this->folder = $folder;
}
-
/**
* Save a search result for future message listing methods
*
- * @param array $set Search set, result from rcube_imap::get_search_set():
+ * @param array $set Search set, result from rcube_imap::get_search_set():
* 0 - searching criteria, string
* 1 - search result, rcube_result_index|rcube_result_thread
* 2 - searching character set, string
@@ -352,7 +341,6 @@
}
}
-
/**
* Return the saved search set as hash array
*
@@ -372,7 +360,6 @@
$this->search_sorted,
);
}
-
/**
* Returns the IMAP server's capability.
@@ -397,14 +384,13 @@
return $_SESSION[$sess_key];
}
-
/**
* Checks the PERMANENTFLAGS capability of the current folder
* and returns true if the given flag is supported by the IMAP server
*
- * @param string $flag Permanentflag name
+ * @param string $flag Permanentflag name
*
- * @return boolean True if this flag is supported
+ * @return boolean True if this flag is supported
*/
public function check_permflag($flag)
{
@@ -415,11 +401,10 @@
return $imap_flag && !empty($perm_flags) && in_array_nocase($imap_flag, $perm_flags);
}
-
/**
* Returns PERMANENTFLAGS of the specified folder
*
- * @param string $folder Folder name
+ * @param string $folder Folder name
*
* @return array Flags
*/
@@ -447,25 +432,22 @@
return $permflags;
}
-
/**
* Returns the delimiter that is used by the IMAP server for folder separation
*
- * @return string Delimiter string
- * @access public
+ * @return string Delimiter string
*/
public function get_hierarchy_delimiter()
{
return $this->delimiter;
}
-
/**
* Get namespace
*
* @param string $name Namespace array index: personal, other, shared, prefix
*
- * @return array Namespace data
+ * @return array Namespace data
*/
public function get_namespace($name = null)
{
@@ -478,7 +460,6 @@
unset($ns['prefix']);
return $ns;
}
-
/**
* Sets delimiter and namespaces
@@ -560,7 +541,6 @@
$_SESSION['imap_delimiter'] = $this->delimiter;
}
-
/**
* Get message count for a specific folder
*
@@ -570,7 +550,7 @@
* @param boolean $status Enables storing folder status info (max UID/count),
* required for folder_status()
*
- * @return int Number of messages
+ * @return int Number of messages
*/
public function count($folder='', $mode='ALL', $force=false, $status=true)
{
@@ -580,7 +560,6 @@
return $this->countmessages($folder, $mode, $force, $status);
}
-
/**
* protected method for getting nr of messages
@@ -696,7 +675,6 @@
return (int)$count;
}
-
/**
* Public method for listing message flags
*
@@ -731,7 +709,6 @@
return $result;
}
-
/**
* Public method for listing headers
*
@@ -741,7 +718,7 @@
* @param string $sort_order Sort order [ASC|DESC]
* @param int $slice Number of slice items to extract from result array
*
- * @return array Indexed array with message header objects
+ * @return array Indexed array with message header objects
*/
public function list_messages($folder='', $page=NULL, $sort_field=NULL, $sort_order=NULL, $slice=0)
{
@@ -752,7 +729,6 @@
return $this->_list_messages($folder, $page, $sort_field, $sort_order, $slice);
}
-
/**
* protected method for listing message headers
*
@@ -762,8 +738,8 @@
* @param string $sort_order Sort order [ASC|DESC]
* @param int $slice Number of slice items to extract from result array
*
- * @return array Indexed array with message header objects
- * @see rcube_imap::list_messages
+ * @return array Indexed array with message header objects
+ * @see rcube_imap::list_messages
*/
protected function _list_messages($folder='', $page=NULL, $sort_field=NULL, $sort_order=NULL, $slice=0)
{
@@ -806,16 +782,15 @@
return array_values($a_msg_headers);
}
-
/**
* protected method for listing message headers using threads
*
- * @param string $folder Folder name
- * @param int $page Current page to list
- * @param int $slice Number of slice items to extract from result array
+ * @param string $folder Folder name
+ * @param int $page Current page to list
+ * @param int $slice Number of slice items to extract from result array
*
- * @return array Indexed array with message header objects
- * @see rcube_imap::list_messages
+ * @return array Indexed array with message header objects
+ * @see rcube_imap::list_messages
*/
protected function list_thread_messages($folder, $page, $slice=0)
{
@@ -833,7 +808,7 @@
/**
* Method for fetching threads data
*
- * @param string $folder Folder name
+ * @param string $folder Folder name
*
* @return rcube_imap_thread Thread data object
*/
@@ -857,11 +832,10 @@
return $this->icache['threads'] = $result;
}
-
/**
* Method for direct fetching of threads data
*
- * @param string $folder Folder name
+ * @param string $folder Folder name
*
* @return rcube_imap_thread Thread data object
*/
@@ -876,7 +850,6 @@
$this->options['skip_deleted'] ? 'UNDELETED' : '', true);
}
-
/**
* protected method for fetching threaded messages headers
*
@@ -885,7 +858,7 @@
* @param int $page List page number
* @param int $slice Number of threads to slice
*
- * @return array Messages headers
+ * @return array Messages headers
*/
protected function fetch_thread_headers($folder, $threads, $page, $slice=0)
{
@@ -915,13 +888,12 @@
return array_values($a_msg_headers);
}
-
/**
* protected method for setting threaded messages flags:
* depth, has_children and unread_children
*
- * @param array $headers Reference to headers array indexed by message UID
- * @param rcube_result_thread $threads Threads data object
+ * @param array $headers Reference to headers array indexed by message UID
+ * @param rcube_result_thread $threads Threads data object
*
* @return array Message headers array indexed by message UID
*/
@@ -947,7 +919,6 @@
}
}
-
/**
* protected method for listing a set of message headers (search results)
*
@@ -955,7 +926,7 @@
* @param int $page Current page to list
* @param int $slice Number of slice items to extract from result array
*
- * @return array Indexed array with message header objects
+ * @return array Indexed array with message header objects
*/
protected function list_search_messages($folder, $page, $slice=0)
{
@@ -1140,7 +1111,6 @@
}
}
-
/**
* protected method for listing a set of threaded message headers (search results)
*
@@ -1148,7 +1118,7 @@
* @param int $page Current page to list
* @param int $slice Number of slice items to extract from result array
*
- * @return array Indexed array with message header objects
+ * @return array Indexed array with message header objects
* @see rcube_imap::list_search_messages()
*/
protected function list_search_thread_messages($folder, $page, $slice=0)
@@ -1163,7 +1133,6 @@
return $this->fetch_thread_headers($folder, clone $this->search_set, $page, $slice);
}
-
/**
* Fetches messages headers (by UID)
@@ -1212,7 +1181,6 @@
return $a_msg_headers;
}
-
/**
* Returns current status of a folder (compared to the last time use)
*
@@ -1260,7 +1228,6 @@
return $result;
}
-
/**
* Stores folder statistic data in session
* @TODO: move to separate DB table (cache?)
@@ -1273,7 +1240,6 @@
{
$_SESSION['folders'][$folder][$name] = $data;
}
-
/**
* Gets folder statistic data
@@ -1290,7 +1256,6 @@
return array();
}
-
/**
* Return sorted list of message UIDs
@@ -1369,7 +1334,6 @@
return $this->index_direct($folder, $this->sort_field, $this->sort_order);
}
-
/**
* Return sorted list of message UIDs ignoring current search settings.
* Doesn't uses cache by default.
@@ -1437,7 +1401,6 @@
return $index;
}
-
/**
* Return index of threaded message UIDs
*
@@ -1468,7 +1431,6 @@
return $threads;
}
-
/**
* Sort threaded result, using THREAD=REFS method if available.
* If not, use any method and re-sort the result in THREAD=REFS way.
@@ -1497,7 +1459,6 @@
$threads->revert();
}
}
-
/**
* Invoke search request to IMAP server
@@ -1574,7 +1535,6 @@
return $results;
}
-
/**
* Direct (real and simple) SEARCH request (without result sorting and caching).
*
@@ -1608,7 +1568,6 @@
return $index;
}
-
/**
* protected search method
@@ -1686,7 +1645,6 @@
return $messages;
}
-
/**
* Converts charset of search criteria string
*
@@ -1726,7 +1684,6 @@
return $res;
}
-
/**
* Refresh saved search set
*
@@ -1758,7 +1715,6 @@
}
}
}
-
/**
* Return message headers object of a specific message
@@ -1797,7 +1753,6 @@
return $headers;
}
-
/**
* Fetch message headers and body structure from the IMAP server and build
@@ -1924,7 +1879,6 @@
return $this->icache['message'] = $headers;
}
-
/**
* Build message part object
*
@@ -1932,7 +1886,7 @@
* @param int $count
* @param string $parent
*/
- protected function structure_part($part, $count=0, $parent='', $mime_headers=null)
+ protected function structure_part($part, $count = 0, $parent = '', $mime_headers = null)
{
$struct = new rcube_message_part;
$struct->mime_id = empty($parent) ? (string)$count : "$parent.$count";
@@ -2150,14 +2104,13 @@
return $struct;
}
-
/**
* Set attachment filename from message part structure
*
- * @param rcube_message_part $part Part object
- * @param string $headers Part's raw headers
+ * @param rcube_message_part $part Part object
+ * @param string $headers Part's raw headers
*/
- protected function set_part_filename(&$part, $headers=null)
+ protected function set_part_filename(&$part, $headers = null)
{
if (!empty($part->d_parameters['filename'])) {
$filename_mime = $part->d_parameters['filename'];
@@ -2285,11 +2238,10 @@
}
}
-
/**
* Get charset name from message structure (first part)
*
- * @param array $structure Message structure
+ * @param array $structure Message structure
*
* @return string Charset name
*/
@@ -2318,7 +2270,8 @@
*
* @return string Message/part body if not printed
*/
- public function get_message_part($uid, $part=1, $o_part=NULL, $print=NULL, $fp=NULL, $skip_charset_conv=false, $max_bytes=0, $formatted=true)
+ public function get_message_part($uid, $part = 1, $o_part = null, $print = null, $fp = null,
+ $skip_charset_conv = false, $max_bytes = 0, $formatted = true)
{
if (!$this->check_connection()) {
return null;
@@ -2370,7 +2323,6 @@
return $body;
}
-
/**
* Returns the whole message source as string (or saves to a file)
*
@@ -2390,7 +2342,6 @@
true, $part, null, false, $fp);
}
-
/**
* Returns the message headers as string
*
@@ -2408,7 +2359,6 @@
return $this->conn->fetchPartHeader($this->folder, $uid, true, $part);
}
-
/**
* Sends the whole message source to stdout
*
@@ -2423,7 +2373,6 @@
$this->conn->handlePartBody($this->folder, $uid, true, null, null, true, null, $formatted);
}
-
/**
* Set message flag to one or several messages
@@ -2484,7 +2433,6 @@
return $result;
}
-
/**
* Append a mail message (source) to a specific folder
*
@@ -2541,7 +2489,6 @@
return $saved;
}
-
/**
* Move a message from one folder to another
@@ -2620,7 +2567,6 @@
return $moved;
}
-
/**
* Copy a message from one folder to another
*
@@ -2656,7 +2602,6 @@
return $copied;
}
-
/**
* Mark messages as deleted and expunge them
@@ -2714,7 +2659,6 @@
return $deleted;
}
-
/**
* Send IMAP expunge command and clear cache
@@ -2838,15 +2782,14 @@
return $a_mboxes;
}
-
/**
* Method for direct folders listing (LSUB)
*
- * @param string $root Optional root folder
- * @param string $name Optional name pattern
+ * @param string $root Optional root folder
+ * @param string $name Optional name pattern
*
- * @return array List of subscribed folders
- * @see rcube_imap::list_folders_subscribed()
+ * @return array List of subscribed folders
+ * @see rcube_imap::list_folders_subscribed()
*/
public function list_folders_subscribed_direct($root='', $name='*')
{
@@ -2906,7 +2849,6 @@
return $a_folders;
}
-
/**
* Get a list of all folders available on the server
@@ -2976,15 +2918,14 @@
return $a_mboxes;
}
-
/**
* Method for direct folders listing (LIST)
*
- * @param string $root Optional root folder
- * @param string $name Optional name pattern
+ * @param string $root Optional root folder
+ * @param string $name Optional name pattern
*
- * @return array List of folders
- * @see rcube_imap::list_folders()
+ * @return array List of folders
+ * @see rcube_imap::list_folders()
*/
public function list_folders_direct($root='', $name='*')
{
@@ -3008,13 +2949,12 @@
return $result;
}
-
/**
* Fix folders list by adding folders from other namespaces.
* Needed on some servers eg. Courier IMAP
*
- * @param array $result Reference to folders list
- * @param string $type Listing type (ext-subscribed, subscribed or all)
+ * @param array $result Reference to folders list
+ * @param string $type Listing type (ext-subscribed, subscribed or all)
*/
protected function list_folders_update(&$result, $type = null)
{
@@ -3064,7 +3004,6 @@
}
}
-
/**
* Filter the given list of folders according to access rights
*
@@ -3090,7 +3029,6 @@
return $a_folders;
}
-
/**
* Get mailbox quota information
*
@@ -3106,7 +3044,6 @@
return false;
}
-
/**
* Get folder size (size of all messages in a folder)
@@ -3131,7 +3068,6 @@
return $result;
}
-
/**
* Subscribe to a specific folder(s)
*
@@ -3145,7 +3081,6 @@
return $this->change_subscription($folders, 'subscribe');
}
-
/**
* Unsubscribe folder(s)
*
@@ -3158,7 +3093,6 @@
// let this common function do the main work
return $this->change_subscription($folders, 'unsubscribe');
}
-
/**
* Create a new folder on the server and register it in local cache
@@ -3199,7 +3133,6 @@
return $result;
}
-
/**
* Set a new name to an existing folder
@@ -3260,7 +3193,6 @@
return $result;
}
-
/**
* Remove folder from server
*
@@ -3308,7 +3240,6 @@
return $result;
}
-
/**
* Detect special folder associations stored in storage backend
*/
@@ -3353,7 +3284,6 @@
return array_merge($result, $special);
}
-
/**
* Set special folder associations stored in storage backend
*/
@@ -3391,7 +3321,6 @@
return true;
}
-
/**
* Checks if folder exists and is subscribed
@@ -3446,7 +3375,6 @@
return false;
}
-
/**
* Returns the namespace where the folder is in
*
@@ -3476,7 +3404,6 @@
return 'personal';
}
-
/**
* Modify folder name according to namespace.
@@ -3516,7 +3443,6 @@
return $folder;
}
-
/**
* Gets folder attributes from LIST response, e.g. \Noselect, \Noinferiors
*
@@ -3548,7 +3474,6 @@
return is_array($opts) ? $opts : array();
}
-
/**
* Gets connection (and current folder) data: UIDVALIDITY, EXISTS, RECENT,
@@ -3588,7 +3513,6 @@
return $data;
}
-
/**
* Returns extended information about the folder
@@ -3685,7 +3609,6 @@
return $options;
}
-
/**
* Synchronizes messages cache.
*
@@ -3697,7 +3620,6 @@
$mcache->synchronize($folder);
}
}
-
/**
* Get message header names for rcube_imap_generic::fetchHeader(s)
@@ -3750,7 +3672,6 @@
return $this->conn->setACL($folder, $user, $acl);
}
-
/**
* Removes any <identifier,rights> pair for the
* specified user from the ACL for the specified
@@ -3775,7 +3696,6 @@
return $this->conn->deleteACL($folder, $user);
}
-
/**
* Returns the access control list for folder (GETACL)
*
@@ -3796,7 +3716,6 @@
return $this->conn->getACL($folder);
}
-
/**
* Returns information about what rights can be granted to the
@@ -3821,7 +3740,6 @@
return $this->conn->listRights($folder, $user);
}
-
/**
* Returns the set of rights that the current user has to
* folder (MYRIGHTS)
@@ -3843,7 +3761,6 @@
return $this->conn->myRights($folder);
}
-
/**
* Sets IMAP metadata/annotations (SETMETADATA/SETANNOTATION)
@@ -3878,7 +3795,6 @@
return false;
}
-
/**
* Unsets IMAP metadata/annotations (SETMETADATA/SETANNOTATION)
*
@@ -3911,7 +3827,6 @@
return false;
}
-
/**
* Returns IMAP metadata/annotations (GETMETADATA/GETANNOTATION)
@@ -3984,7 +3899,6 @@
return null;
}
-
/**
* Converts the METADATA extension entry name into the correct
@@ -4115,7 +4029,6 @@
}
}
-
/**
* Getter for messages cache object
*/
@@ -4134,7 +4047,6 @@
return $this->mcache;
}
-
/**
* Clears the messages cache.
*
@@ -4147,7 +4059,6 @@
$mcache->clear($folder, $uids);
}
}
-
/**
* Delete outdated cache entries
@@ -4177,7 +4088,6 @@
$this->sort_order = strtoupper($sort_order) == 'DESC' ? 'DESC' : 'ASC';
}
}
-
/**
* Sort folders first by default folders and then in alphabethical order
@@ -4265,12 +4175,11 @@
}
}
-
/**
* Find UID of the specified message sequence ID
*
- * @param int $id Message (sequence) ID
- * @param string $folder Folder name
+ * @param int $id Message (sequence) ID
+ * @param string $folder Folder name
*
* @return int Message UID
*/
@@ -4294,7 +4203,6 @@
return $uid;
}
-
/**
* Subscribe/unsubscribe a list of folders and update local cache
@@ -4328,7 +4236,6 @@
return $updated;
}
-
/**
* Increde/decrese messagecount for a specific folder
*/
@@ -4359,7 +4266,6 @@
return true;
}
-
/**
* Remove messagecount of a specific folder from cache
*/
@@ -4377,7 +4283,6 @@
$this->update_cache('messagecount', $a_folder_cache);
}
}
-
/**
* Converts date string/object into IMAP date/time format
@@ -4400,7 +4305,6 @@
return $date->format('d-M-Y H:i:s O');
}
-
/**
* This is our own debug handler for the IMAP connection
@@ -4531,7 +4435,7 @@
return $this->mod_folder($folder, $mode);
}
- public function mailbox_attributes($folder, $force=false)
+ public function mailbox_attributes($folder, $force = false)
{
return $this->folder_attributes($folder, $force);
}
@@ -4551,9 +4455,8 @@
return $this->folder_sync($folder);
}
- public function expunge($folder='', $clear_cache=true)
+ public function expunge($folder = '', $clear_cache = true)
{
return $this->expunge_folder($folder, $clear_cache);
}
-
}
--
Gitblit v1.9.1