From 184de7735c71e6711dfc9a738a2d7cc7b0cac7df Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Thu, 18 Aug 2016 08:50:59 +0200 Subject: [PATCH] CS fixes (mostly phpdoc) --- plugins/acl/acl.php | 1 - program/include/rcmail.php | 182 ++++++++------ program/include/rcmail_install.php | 51 ++-- program/include/rcmail_output.php | 18 +- program/include/rcmail_output_cli.php | 2 +- program/include/rcmail_output_html.php | 248 +++++++++++--------- program/include/rcmail_output_json.php | 46 ++-- program/include/rcmail_string_replacer.php | 5 +- program/include/rcmail_utils.php | 22 +- program/lib/Roundcube/html.php | 12 +- program/lib/Roundcube/rcube.php | 18 +- program/lib/Roundcube/rcube_addressbook.php | 125 +++++----- program/lib/Roundcube/rcube_config.php | 28 ++- program/lib/Roundcube/rcube_contacts.php | 14 +- program/lib/Roundcube/rcube_db.php | 14 +- program/lib/Roundcube/rcube_db_oracle.php | 2 +- program/lib/Roundcube/rcube_html2text.php | 20 +- 17 files changed, 449 insertions(+), 359 deletions(-) diff --git a/plugins/acl/acl.php b/plugins/acl/acl.php index 6a0468154..30b5da99f 100644 --- a/plugins/acl/acl.php +++ b/plugins/acl/acl.php @@ -6,7 +6,6 @@ * @version @package_version@ * @author Aleksander Machniak * - * * Copyright (C) 2011-2012, Kolab Systems AG * * This program is free software: you can redistribute it and/or modify diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 27fb7cb26..28c843bcc 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -138,18 +138,19 @@ class rcmail extends rcube /** * Setter for application task * - * @param string Task to set + * @param string $task Task to set */ public function set_task($task) { - $task = asciiwords($task, true); - - if ($this->user && $this->user->ID) - $task = !$task ? 'mail' : $task; - else if (php_sapi_name() == 'cli') + if (php_sapi_name() == 'cli') { $task = 'cli'; - else + } + else if (!$this->user || !$this->user->ID) { $task = 'login'; + } + else { + $task = asciiwords($task, true) ?: 'mail'; + } $this->task = $task; $this->comm_path = $this->url(array('task' => $this->task)); @@ -167,7 +168,7 @@ class rcmail extends rcube /** * Setter for system user object * - * @param rcube_user Current user instance + * @param rcube_user $user Current user instance */ public function set_user($user) { @@ -190,8 +191,8 @@ class rcmail extends rcube /** * Return instance of the internal address book class * - * @param string Address book identifier (-1 for default addressbook) - * @param boolean True if the address book needs to be writeable + * @param string $id Address book identifier (-1 for default addressbook) + * @param boolean $writeable True if the address book needs to be writeable * * @return rcube_contacts Address book object */ @@ -280,7 +281,7 @@ class rcmail extends rcube /** * Return identifier of the address book object * - * @param rcube_addressbook Addressbook source object + * @param rcube_addressbook $object Addressbook source object * * @return string Source identifier */ @@ -296,10 +297,10 @@ class rcmail extends rcube /** * Return address books list * - * @param boolean True if the address book needs to be writeable - * @param boolean True if the address book needs to be not hidden + * @param boolean $writeable True if the address book needs to be writeable + * @param boolean $skip_hidden True if the address book needs to be not hidden * - * @return array Address books array + * @return array Address books array */ public function get_address_sources($writeable = false, $skip_hidden = false) { @@ -367,8 +368,8 @@ class rcmail extends rcube * Getter for compose responses. * These are stored in local config and user preferences. * - * @param boolean True to sort the list alphabetically - * @param boolean True if only this user's responses shall be listed + * @param boolean $sorted True to sort the list alphabetically + * @param boolean $user_only True if only this user's responses shall be listed * * @return array List of the current user's stored responses */ @@ -385,7 +386,7 @@ class rcmail extends rcube $response['static'] = true; $response['class'] = 'readonly'; - $k = $sorted ? '0000-' . strtolower($response['name']) : $response['key']; + $k = $sorted ? '0000-' . mb_strtolower($response['name']) : $response['key']; $responses[$k] = $response; } } @@ -395,7 +396,7 @@ class rcmail extends rcube $response['key'] = substr(md5($response['name']), 0, 16); } - $k = $sorted ? strtolower($response['name']) : $response['key']; + $k = $sorted ? mb_strtolower($response['name']) : $response['key']; $responses[$k] = $response; } @@ -412,7 +413,7 @@ class rcmail extends rcube * This will instantiate a rcmail_output_html object and set * environment vars according to the current session and configuration * - * @param boolean True if this request is loaded in a (i)frame + * @param boolean $framed True if this request is loaded in a (i)frame * * @return rcube_output Reference to HTML output object */ @@ -487,10 +488,10 @@ class rcmail extends rcube * Perfom login to the mail server and to the webmail service. * This will also create a new user entry if auto_create_user is configured. * - * @param string Mail storage (IMAP) user name - * @param string Mail storage (IMAP) password - * @param string Mail storage (IMAP) host - * @param bool Enables cookie check + * @param string $username Mail storage (IMAP) user name + * @param string $password Mail storage (IMAP) password + * @param string $host Mail storage (IMAP) host + * @param bool $cookiecheck Enables cookie check * * @return boolean True on success, False on failure */ @@ -793,10 +794,11 @@ class rcmail extends rcube /** * Build a valid URL to this instance of Roundcube * - * @param mixed Either a string with the action or url parameters as key-value pairs - * @param boolean Build an URL absolute to document root - * @param boolean Create fully qualified URL including http(s):// and hostname - * @param bool Return absolute URL in secure location + * @param mixed $p Either a string with the action or + * url parameters as key-value pairs + * @param boolean $absolute Build an URL absolute to document root + * @param boolean $full Create fully qualified URL including http(s):// and hostname + * @param bool $secure Return absolute URL in secure location * * @return string Valid application URL */ @@ -870,8 +872,9 @@ class rcmail extends rcube parent::shutdown(); foreach ($this->address_books as $book) { - if (is_object($book) && is_a($book, 'rcube_addressbook')) + if (is_object($book) && is_a($book, 'rcube_addressbook')) { $book->close(); + } } // write performance stats to logs/console @@ -879,39 +882,41 @@ class rcmail extends rcube // make sure logged numbers use unified format setlocale(LC_NUMERIC, 'en_US.utf8', 'en_US.UTF-8', 'en_US', 'C'); - if (function_exists('memory_get_usage')) + if (function_exists('memory_get_usage')) { $mem = $this->show_bytes(memory_get_usage()); - if (function_exists('memory_get_peak_usage')) + } + if (function_exists('memory_get_peak_usage')) { $mem .= '/'.$this->show_bytes(memory_get_peak_usage()); + } $log = $this->task . ($this->action ? '/'.$this->action : '') . ($mem ? " [$mem]" : ''); - if (defined('RCMAIL_START')) + if (defined('RCMAIL_START')) { self::print_timer(RCMAIL_START, $log); - else + } + else { self::console($log); + } } } /** - * CSRF attack prevention code + * CSRF attack prevention code. Raises error when check fails. * - * @param int Request mode + * @param int $mode Request mode */ public function request_security_check($mode = rcube_utils::INPUT_POST) { // check request token if (!$this->check_request($mode)) { - self::raise_error(array( - 'code' => 403, 'type' => 'php', - 'message' => "Request security check failed"), false, true); + $error = array('code' => 403, 'message' => "Request security check failed"); + self::raise_error($error, false, true); } // check referer if configured if ($this->config->get('referer_check') && !rcube_utils::check_referer()) { - self::raise_error(array( - 'code' => 403, 'type' => 'php', - 'message' => "Referer check failed"), true, true); + $error = array('code' => 403, 'message' => "Referer check failed"); + self::raise_error($error, true, true); } } @@ -1044,7 +1049,7 @@ class rcmail extends rcube /** * Overwrite action variable * - * @param string New action value + * @param string $action New action value */ public function overwrite_action($action) { @@ -1054,6 +1059,8 @@ class rcmail extends rcube /** * Set environment variables for specified config options + * + * @param array $options List of configuration option names */ public function set_env_config($options) { @@ -1123,20 +1130,21 @@ class rcmail extends rcube /** * Create a HTML table based on the given data * - * @param array Named table attributes - * @param mixed Table row data. Either a two-dimensional array or a valid SQL result set - * @param array List of cols to show - * @param string Name of the identifier col + * @param array $attrib Named table attributes + * @param mixed $table_data Table row data. Either a two-dimensional array + * or a valid SQL result set + * @param array $show_cols List of cols to show + * @param string $id_col Name of the identifier col * * @return string HTML table code */ - public function table_output($attrib, $table_data, $a_show_cols, $id_col) + public function table_output($attrib, $table_data, $show_cols, $id_col) { $table = new html_table($attrib); // add table header if (!$attrib['noheader']) { - foreach ($a_show_cols as $col) { + foreach ($show_cols as $col) { $table->add_header($col, $this->Q($this->gettext($col))); } } @@ -1147,7 +1155,7 @@ class rcmail extends rcube $table->add_row(array('id' => 'rcmrow' . rcube_utils::html_identifier($sql_arr[$id_col]))); // format each col - foreach ($a_show_cols as $col) { + foreach ($show_cols as $col) { $table->add($col, $this->Q($sql_arr[$col])); } } @@ -1162,7 +1170,7 @@ class rcmail extends rcube $table->add_row(array('id' => $rowid, 'class' => $class)); // format each col - foreach ($a_show_cols as $col) { + foreach ($show_cols as $col) { $val = is_array($row_data[$col]) ? $row_data[$col][0] : $row_data[$col]; $table->add($col, empty($attrib['ishtml']) ? $this->Q($val) : $val); } @@ -1176,9 +1184,9 @@ class rcmail extends rcube * Convert the given date to a human readable form * This uses the date formatting properties from config * - * @param mixed Date representation (string, timestamp or DateTime object) - * @param string Date format to use - * @param bool Enables date convertion according to user timezone + * @param mixed $date Date representation (string, timestamp or DateTime object) + * @param string $format Date format to use + * @param bool $convert Enables date convertion according to user timezone * * @return string Formatted date string */ @@ -1396,7 +1404,7 @@ class rcmail extends rcube /** * Return folders list as html_select object * - * @param array $p Named parameters + * @param array $p Named parameters * * @return html_select HTML drop-down object */ @@ -1567,19 +1575,20 @@ class rcmail extends rcube $classes[] = 'unread'; } - $js_name = $this->JQ($folder['id']); - $html_name = $this->Q($foldername) . ($unread ? html::span('unreadcount', sprintf($attrib['unreadwrap'], $unread)) : ''); + $js_name = $this->JQ($folder['id']); + $html_name = $this->Q($foldername) . ($unread ? html::span('unreadcount', sprintf($attrib['unreadwrap'], $unread)) : ''); $link_attrib = $folder['virtual'] ? array() : array( - 'href' => $this->url(array('_mbox' => $folder['id'])), + 'href' => $this->url(array('_mbox' => $folder['id'])), 'onclick' => sprintf("return %s.command('list','%s',this,event)", rcmail_output::JS_OBJECT_NAME, $js_name), - 'rel' => $folder['id'], - 'title' => $title, + 'rel' => $folder['id'], + 'title' => $title, ); $out .= html::tag('li', array( - 'id' => "rcmli".$folder_id, - 'class' => join(' ', $classes), - 'noclose' => true), + 'id' => "rcmli" . $folder_id, + 'class' => join(' ', $classes), + 'noclose' => true + ), html::a($link_attrib, $html_name)); if (!empty($folder['folders'])) { @@ -1698,7 +1707,9 @@ class rcmail extends rcube $folder = implode($delimiter, array_slice($path, 0, -$i)); if ($folder_class = $this->folder_classname($folder)) { $name = implode($delimiter, array_slice($path, $count - $i)); - return $this->gettext($folder_class) . $delimiter . rcube_charset::convert($name, 'UTF7-IMAP'); + $name = rcube_charset::convert($name, 'UTF7-IMAP'); + + return $this->gettext($folder_class) . $delimiter . $name; } } } @@ -1707,7 +1718,9 @@ class rcmail extends rcube return rcube_charset::convert($name, 'UTF7-IMAP'); } - + /** + * Localize folder path + */ public function localize_folderpath($path) { $protect_folders = $this->config->get('protect_default_folders'); @@ -1729,7 +1742,13 @@ class rcmail extends rcube return implode($delimiter, $result); } - + /** + * Return HTML for quota indicator object + * + * @param array $attrib Named parameters + * + * @return string HTML code for the quota indicator object + */ public static function quota_display($attrib) { $rcmail = rcmail::get_instance(); @@ -1749,13 +1768,20 @@ class rcmail extends rcube return html::span($attrib, ' '); } - + /** + * Return (parsed) quota information + * + * @param array $attrib Named parameters + * @param array $folder Current folder + * + * @return array Quota information + */ public function quota_content($attrib = null, $folder = null) { $quota = $this->storage->get_quota($folder); $quota = $this->plugins->exec_hook('quota', $quota); - $quota_result = (array) $quota; + $quota_result = (array) $quota; $quota_result['type'] = isset($_SESSION['quota_display']) ? $_SESSION['quota_display'] : ''; $quota_result['folder'] = $folder !== null && $folder !== '' ? $folder : 'INBOX'; @@ -1765,8 +1791,10 @@ class rcmail extends rcube } $title = sprintf('%s / %s (%.0f%%)', - $this->show_bytes($quota['used'] * 1024), $this->show_bytes($quota['total'] * 1024), - $quota_result['percent']); + $this->show_bytes($quota['used'] * 1024), + $this->show_bytes($quota['total'] * 1024), + $quota_result['percent'] + ); $quota_result['title'] = $title; @@ -1827,10 +1855,10 @@ class rcmail extends rcube /** * Outputs error message according to server error/response codes * - * @param string $fallback Fallback message label - * @param array $fallback_args Fallback message label arguments - * @param string $suffix Message label suffix - * @param array $params Additional parameters (type, prefix) + * @param string $fallback Fallback message label + * @param array $fallback_args Fallback message label arguments + * @param string $suffix Message label suffix + * @param array $params Additional parameters (type, prefix) */ public function display_server_error($fallback = null, $fallback_args = null, $suffix = '', $params = array()) { @@ -1889,7 +1917,7 @@ class rcmail extends rcube /** * Output HTML editor scripts * - * @param string $mode Editor mode + * @param string $mode Editor mode */ public function html_editor($mode = '') { @@ -2031,7 +2059,7 @@ class rcmail extends rcube /** * Initializes file uploading interface. * - * @param $int Optional maximum file size in bytes + * @param int $max_size Optional maximum file size in bytes */ public function upload_init($max_size = null) { @@ -2265,9 +2293,9 @@ class rcmail extends rcube /** * Returns message UID(s) and IMAP folder(s) from GET/POST data * - * @param string UID value to decode - * @param string Default mailbox value (if not encoded in UIDs) - * @param bool Will be set to True if multi-folder request + * @param string $uids UID value to decode + * @param string $mbox Default mailbox value (if not encoded in UIDs) + * @param bool $is_multifolder Will be set to True if multi-folder request * * @return array List of message UIDs per folder */ diff --git a/program/include/rcmail_install.php b/program/include/rcmail_install.php index 19092c2db..54da96ad3 100644 --- a/program/include/rcmail_install.php +++ b/program/include/rcmail_install.php @@ -115,6 +115,8 @@ class rcmail_install /** * Read the default config file and store properties + * + * @param string $file File name with path */ public function load_config_file($file) { @@ -158,8 +160,8 @@ class rcmail_install /** * Getter for a certain config property * - * @param string Property name - * @param string Default value + * @param string $name Property name + * @param string $default Default value * * @return string The property value */ @@ -435,11 +437,11 @@ class rcmail_install * Compare the local database schema with the reference schema * required for this version of Roundcube * - * @param rcube_db Database object + * @param rcube_db $db Database object * * @return boolean True if the schema is up-to-date, false if not or an error occurred */ - public function db_schema_check($DB) + public function db_schema_check($db) { if (!$this->configured) { return false; @@ -450,7 +452,7 @@ class rcmail_install $errors = array(); // check list of tables - $existing_tables = $DB->list_tables(); + $existing_tables = $db->list_tables(); foreach ($db_schema as $table => $cols) { $table = $this->config['db_prefix'] . $table; @@ -459,7 +461,7 @@ class rcmail_install $errors[] = "Missing table '".$table."'"; } else { // compare cols - $db_cols = $DB->list_cols($table); + $db_cols = $db->list_cols($table); $diff = array_diff(array_keys($cols), $db_cols); if (!empty($diff)) { @@ -647,8 +649,8 @@ class rcmail_install /** * Display OK status * - * @param string Test name - * @param string Confirm message + * @param string $name Test name + * @param string $message Confirm message */ public function pass($name, $message = '') { @@ -659,10 +661,10 @@ class rcmail_install /** * Display an error status and increase failure count * - * @param string Test name - * @param string Error message - * @param string URL for details - * @param bool Do not count this failure + * @param string $name Test name + * @param string $message Error message + * @param string $url URL for details + * @param bool $optional Do not count this failure */ public function fail($name, $message = '', $url = '', $optional=false) { @@ -677,9 +679,9 @@ class rcmail_install /** * Display an error status for optional settings/features * - * @param string Test name - * @param string Error message - * @param string URL for details + * @param string $name Test name + * @param string $message Error message + * @param string $url URL for details */ public function optfail($name, $message = '', $url = '') { @@ -690,9 +692,9 @@ class rcmail_install /** * Display warning status * - * @param string Test name - * @param string Warning message - * @param string URL for details + * @param string $name Test name + * @param string $message Warning message + * @param string $url URL for details */ public function na($name, $message = '', $url = '') { @@ -787,18 +789,19 @@ class rcmail_install /** * Initialize the database with the according schema * - * @param object rcube_db Database connection + * @param rcube_db $db Database connection + * * @return boolen True on success, False on error */ - public function init_db($DB) + public function init_db($db) { - $engine = $DB->db_provider; + $engine = $db->db_provider; // read schema file from /SQL/* $fname = INSTALL_PATH . "SQL/$engine.initial.sql"; if ($sql = @file_get_contents($fname)) { - $DB->set_option('table_prefix', $this->config['db_prefix']); - $DB->exec_script($sql); + $db->set_option('table_prefix', $this->config['db_prefix']); + $db->exec_script($sql); } else { $this->fail('DB Schema', "Cannot read the schema file: $fname"); @@ -816,7 +819,7 @@ class rcmail_install /** * Update database schema * - * @param string Version to update from + * @param string $version Version to update from * * @return boolen True on success, False on error */ diff --git a/program/include/rcmail_output.php b/program/include/rcmail_output.php index b5fd78559..aeff78bcd 100644 --- a/program/include/rcmail_output.php +++ b/program/include/rcmail_output.php @@ -22,7 +22,7 @@ /** * Class for output generation * - * @package Webmail + * @package Webmail * @subpackage View */ abstract class rcmail_output extends rcube_output @@ -91,23 +91,25 @@ abstract class rcmail_output extends rcube_output /** * Register a template object handler * - * @param string Object name - * @param string Function name to call + * @param string $name Object name + * @param string $func Function name to call + * * @return void */ - public function add_handler($obj, $func) + public function add_handler($name, $func) { - $this->object_handlers[$obj] = $func; + $this->object_handlers[$name] = $func; } /** * Register a list of template object handlers * - * @param array Hash array with object=>handler pairs + * @param array $handlers Hash array with object=>handler pairs + * * @return void */ - public function add_handlers($arr) + public function add_handlers($handlers) { - $this->object_handlers = array_merge($this->object_handlers, $arr); + $this->object_handlers = array_merge($this->object_handlers, $handlers); } } diff --git a/program/include/rcmail_output_cli.php b/program/include/rcmail_output_cli.php index 33481d23c..7d877cc88 100644 --- a/program/include/rcmail_output_cli.php +++ b/program/include/rcmail_output_cli.php @@ -21,7 +21,7 @@ /** * Class for output generation * - * @package Webmail + * @package Webmail * @subpackage View */ class rcmail_output_cli extends rcmail_output diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index 8dda8c3c1..daec191a4 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -22,7 +22,7 @@ /** * Class to create HTML page output using a skin template * - * @package Webmail + * @package Webmail * @subpackage View */ class rcmail_output_html extends rcmail_output @@ -42,7 +42,7 @@ class rcmail_output_html extends rcmail_output protected $default_template = "\n\n\n"; protected $header = ''; protected $footer = ''; - protected $body = ''; + protected $body = ''; protected $base_path = ''; protected $assets_path; protected $assets_dir = RCUBE_INSTALL_PATH; @@ -134,9 +134,10 @@ EOF; /** * Set environment variable * - * @param string Property name - * @param mixed Property value - * @param boolean True if this property should be added to client environment + * @param string $name Property name + * @param mixed $value Property value + * @param boolean $addtojs True if this property should be added + * to client environment */ public function set_env($name, $value, $addtojs = true) { @@ -150,7 +151,8 @@ EOF; /** * Parse and set assets path * - * @param string Assets path (relative or absolute URL) + * @param string $path Assets path URL (relative or absolute) + * @param string $fs_dif Assets path in filesystem */ public function set_assets_path($path, $fs_dir = null) { @@ -221,6 +223,10 @@ EOF; /** * Set skin + * + * @param string $skin Skin name + * + * @return bool True if the skin exist and is readable, False otherwise */ public function set_skin($skin) { @@ -294,7 +300,8 @@ EOF; /** * Check if a specific template exists * - * @param string Template name + * @param string $name Template name + * * @return boolean True if template exists */ public function template_exists($name) @@ -314,9 +321,9 @@ EOF; /** * Find the given file in the current skin path stack * - * @param string File name/path to resolve (starting with /) - * @param string Reference to the base path of the matching skin - * @param string Additional path to search in + * @param string $file File name/path to resolve (starting with /) + * @param string &$skin_path Reference to the base path of the matching skin + * @param string $add_path Additional path to search in * * @return mixed Relative path to the requested file or False if not found */ @@ -349,9 +356,8 @@ EOF; /** * Register a GUI object to the client script * - * @param string Object name - * @param string Object ID - * @return void + * @param string $obj Object name + * @param string $id Object ID */ public function add_gui_object($obj, $id) { @@ -379,8 +385,10 @@ EOF; public function add_label() { $args = func_get_args(); - if (count($args) == 1 && is_array($args[0])) + + if (count($args) == 1 && is_array($args[0])) { $args = $args[0]; + } foreach ($args as $name) { $this->js_labels[$name] = $this->app->gettext($name); @@ -395,6 +403,7 @@ EOF; * @param array $vars Key-value pairs to be replaced in localized text * @param boolean $override Override last set message * @param int $timeout Message display time in seconds + * * @uses self::command() */ public function show_message($message, $type='notice', $vars=null, $override=true, $timeout=0) @@ -462,8 +471,8 @@ EOF; * Send the request output to the client. * This will either parse a skin tempalte or send an AJAX response * - * @param string Template name - * @param boolean True if script should terminate (default) + * @param string $templ Template name + * @param boolean $exit True if script should terminate (default) */ public function send($templ = null, $exit = true) { @@ -529,11 +538,11 @@ EOF; /** * Parse a specific skin template and deliver to stdout (or return) * - * @param string Template name - * @param boolean Exit script - * @param boolean Don't write to stdout, return parsed content instead + * @param string $name Template name + * @param boolean $exit Exit script + * @param boolean $write Don't write to stdout, return parsed content instead * - * @link http://php.net/manual/en/function.exit.php + * @link http://php.net/manual/en/function.exit.php */ function parse($name = 'main', $exit = true, $write = true) { @@ -570,23 +579,22 @@ EOF; $path = RCUBE_INSTALL_PATH . "$skin_path/templates/$name.html"; // fallback to deprecated template names - if (!is_readable($path) && $this->deprecated_templates[$realname]) { - $path = RCUBE_INSTALL_PATH . "$skin_path/templates/" . $this->deprecated_templates[$realname] . ".html"; + if (!is_readable($path) && ($dname = $this->deprecated_templates[$realname])) { + $path = RCUBE_INSTALL_PATH . "$skin_path/templates/$dname.html"; if (is_readable($path)) { rcube::raise_error(array( - 'code' => 502, 'type' => 'php', - 'file' => __FILE__, 'line' => __LINE__, - 'message' => "Using deprecated template '" . $this->deprecated_templates[$realname] - . "' in $skin_path/templates. Please rename to '$realname'"), - true, false); + 'code' => 502, 'file' => __FILE__, 'line' => __LINE__, + 'message' => "Using deprecated template '$dname' in $skin_path/templates. Please rename to '$realname'" + ), true, false); } } if (is_readable($path)) { $this->config->set('skin_path', $skin_path); - $this->base_path = preg_replace('!plugins/\w+/!', '', $skin_path); // set base_path to core skin directory (not plugin's skin) - $skin_dir = preg_replace('!^plugins/!', '', $skin_path); + // set base_path to core skin directory (not plugin's skin) + $this->base_path = preg_replace('!plugins/\w+/!', '', $skin_path); + $skin_dir = preg_replace('!^plugins/!', '', $skin_path); break; } else { @@ -611,7 +619,11 @@ EOF; // replace all path references to plugins/... with the configured plugins dir // and /this/ to the current plugin skin directory if ($plugin) { - $templ = preg_replace(array('/\bplugins\//', '/(["\']?)\/this\//'), array($this->app->plugins->url, '\\1'.$this->app->plugins->url.$skin_dir.'/'), $templ); + $templ = preg_replace( + array('/\bplugins\//', '/(["\']?)\/this\//'), + array($this->app->plugins->url, '\\1'.$this->app->plugins->url.$skin_dir.'/'), + $templ + ); } // parse for specialtags @@ -626,7 +638,7 @@ EOF; unset($hook['content']); // make sure all
tags have a valid request token - $output = preg_replace_callback('/]+)>/Ui', array($this, 'alter_form_tag'), $output); + $output = preg_replace_callback('/]+)>/Ui', array($this, 'alter_form_tag'), $output); $this->footer = preg_replace_callback('/]+)>/Ui', array($this, 'alter_form_tag'), $this->footer); // remove plugin skin paths from current context @@ -645,8 +657,6 @@ EOF; /** * Return executable javascript code for all registered commands - * - * @return string $out */ protected function get_js_commands(&$framed = null) { @@ -710,9 +720,10 @@ EOF; /** * Make URLs starting with a slash point to skin directory * - * @param string Input string - * @param boolean True if URL should be resolved using the current skin path stack - * @return string + * @param string $str Input string + * @param bool $search_path True if URL should be resolved using the current skin path stack + * + * @return string URL */ public function abs_url($str, $search_path = false) { @@ -730,8 +741,8 @@ EOF; /** * Show error page and terminate script execution * - * @param int $code Error code - * @param string $message Error message + * @param int $code Error code + * @param string $message Error message */ public function raise_error($code, $message) { @@ -866,7 +877,8 @@ EOF; /** * Public wrapper to dipp into template parsing. * - * @param string $input + * @param string $input Template content + * * @return string * @uses rcmail_output_html::parse_xml() * @since 0.1-rc1 @@ -881,9 +893,6 @@ EOF; /** * Parse for conditional tags - * - * @param string $input - * @return string */ protected function parse_conditions($input) { @@ -892,36 +901,45 @@ EOF; if (preg_match('/^(else|endif)$/i', $matches[1])) { return $matches[0] . $this->parse_conditions($matches[3]); } + $attrib = html::parse_attrib_string($matches[2]); + if (isset($attrib['condition'])) { - $condmet = $this->check_condition($attrib['condition']); + $condmet = $this->check_condition($attrib['condition']); $submatches = preg_split('/]+)>\n?/is', $matches[3], 2, PREG_SPLIT_DELIM_CAPTURE); + if ($condmet) { $result = $submatches[0]; - $result.= ($submatches[1] != 'endif' ? preg_replace('/.*]+>\n?/Uis', '', $submatches[3], 1) : $submatches[3]); + if ($submatches[1] != 'endif') { + $result .= preg_replace('/.*]+>\n?/Uis', '', $submatches[3], 1); + } + else { + $result .= $submatches[3]; + } } else { $result = "" . $submatches[3]; } + return $matches[0] . $this->parse_conditions($result); } + rcube::raise_error(array( - 'code' => 500, - 'type' => 'php', - 'line' => __LINE__, - 'file' => __FILE__, - 'message' => "Unable to parse conditional tag " . $matches[2] - ), true, false); + 'code' => 500, 'line' => __LINE__, 'file' => __FILE__, + 'message' => "Unable to parse conditional tag " . $matches[2] + ), true, false); } + return $input; } /** * Determines if a given condition is met * - * @todo Extend this to allow real conditions, not just "set" - * @param string Condition statement + * @param string $condition Condition statement + * * @return boolean True if condition is met, False if not + * @todo Extend this to allow real conditions, not just "set" */ protected function check_condition($condition) { @@ -947,7 +965,7 @@ EOF; /** * Parse & evaluate a given expression and return its result. * - * @param string Expression statement + * @param string $expression Expression statement * * @return mixed Expression result */ @@ -978,13 +996,11 @@ EOF; $fn = create_function('$app,$browser,$env', "return ($expression);"); if (!$fn) { rcube::raise_error(array( - 'code' => 505, - 'type' => 'php', - 'file' => __FILE__, - 'line' => __LINE__, - 'message' => "Expression parse error on: ($expression)"), true, false); + 'code' => 505, 'file' => __FILE__, 'line' => __LINE__, + 'message' => "Expression parse error on: ($expression)" + ), true, false); - return null; + return; } return $fn($this->app, $this->browser, $this->env); @@ -994,7 +1010,8 @@ EOF; * Search for special tags in input and replace them * with the appropriate content * - * @param string Input string to parse + * @param string $input Input string to parse + * * @return string Altered input string * @todo Use DOM-parser to traverse template HTML * @todo Maybe a cache. @@ -1008,7 +1025,8 @@ EOF; * Callback function for parsing an xml command tag * and turn it into real html content * - * @param array Matches array of preg_replace_callback + * @param array $matches Matches array of preg_replace_callback + * * @return string Tag/Object content */ protected function xml_command($matches) @@ -1082,7 +1100,8 @@ EOF; $old_base_path = $this->base_path; if (!empty($attrib['skin_path'])) $attrib['skinpath'] = $attrib['skin_path']; if ($path = $this->get_skin_file($attrib['file'], $skin_path, $attrib['skinpath'])) { - $this->base_path = preg_replace('!plugins/\w+/!', '', $skin_path); // set base_path to core skin directory (not plugin's skin) + // set base_path to core skin directory (not plugin's skin) + $this->base_path = preg_replace('!plugins/\w+/!', '', $skin_path); $path = realpath(RCUBE_INSTALL_PATH . $path); } @@ -1238,7 +1257,8 @@ EOF; /** * Include a specific file and return it's contents * - * @param string File path + * @param string $file File path + * * @return string Contents of the processed file */ protected function include_php($file) @@ -1254,7 +1274,8 @@ EOF; /** * Create and register a button * - * @param array Named button attributes + * @param array $attrib Named button attributes + * * @return string HTML button * @todo Remove all inline JS calls and use jQuery instead. * @todo Remove all sprintf()'s - they are pretty, but also slow. @@ -1443,8 +1464,8 @@ EOF; /** * Link an external script file * - * @param string File URL - * @param string Target position [head|foot] + * @param string $file File URL + * @param string $position Target position [head|foot] */ public function include_script($file, $position='head') { @@ -1464,8 +1485,8 @@ EOF; /** * Add inline javascript code * - * @param string JS code snippet - * @param string Target position [head|head_top|foot] + * @param string $script JS code snippet + * @param string $position Target position [head|head_top|foot] */ public function add_script($script, $position='head') { @@ -1480,7 +1501,7 @@ EOF; /** * Link an external css file * - * @param string File URL + * @param string $file File URL */ public function include_css($file) { @@ -1511,8 +1532,8 @@ EOF; /** * Process template and write to stdOut * - * @param string HTML template - * @param string Base for absolute paths + * @param string $templ HTML template + * @param string $base_path Base for absolute paths */ public function _write($templ = '', $base_path = '') { @@ -1653,8 +1674,9 @@ EOF; /** * Returns iframe object, registers some related env variables * - * @param array $attrib HTML attributes + * @param array $attrib HTML attributes * @param boolean $is_contentframe Register this iframe as the 'contentframe' gui object + * * @return string IFRAME element */ public function frame($attrib, $is_contentframe = false) @@ -1683,34 +1705,40 @@ EOF; /** * Create a form tag with the necessary hidden fields * - * @param array Named tag parameters + * @param array $attrib Named tag parameters + * @param string $content HTML content of the form + * * @return string HTML code for the form */ public function form_tag($attrib, $content = null) { - if ($this->framed || $this->env['framed']) { - $hiddenfield = new html_hiddenfield(array('name' => '_framed', 'value' => '1')); - $hidden = $hiddenfield->show(); - } - if ($this->env['extwin']) { - $hiddenfield = new html_hiddenfield(array('name' => '_extwin', 'value' => '1')); - $hidden = $hiddenfield->show(); - } - - if (!$content) - $attrib['noclose'] = true; - - return html::tag('form', - $attrib + array('action' => $this->app->comm_path, 'method' => "get"), - $hidden . $content, - array('id','class','style','name','method','action','enctype','onsubmit')); + if ($this->env['extwin']) { + $hiddenfield = new html_hiddenfield(array('name' => '_extwin', 'value' => '1')); + $hidden = $hiddenfield->show(); + } + else if ($this->framed || $this->env['framed']) { + $hiddenfield = new html_hiddenfield(array('name' => '_framed', 'value' => '1')); + $hidden = $hiddenfield->show(); + } + + if (!$content) { + $attrib['noclose'] = true; + } + + return html::tag('form', + $attrib + array('action' => $this->app->comm_path, 'method' => "get"), + $hidden . $content, + array('id','class','style','name','method','action','enctype','onsubmit') + ); } /** * Build a form tag with a unique request token * - * @param array Named tag parameters including 'action' and 'task' values which will be put into hidden fields - * @param string Form content + * @param array $attrib Named tag parameters including 'action' and 'task' values + * which will be put into hidden fields + * @param string $content Form content + * * @return string HTML code for the form */ public function request_form($attrib, $content = '') @@ -1723,24 +1751,27 @@ EOF; $hidden->add(array('name' => '_action', 'value' => $attrib['action'])); } - unset($attrib['task'], $attrib['request']); - $attrib['action'] = './'; - // we already have a tag if ($attrib['form']) { - if ($this->framed || $this->env['framed']) + if ($this->framed || $this->env['framed']) { $hidden->add(array('name' => '_framed', 'value' => '1')); + } + return $hidden->show() . $content; } - else - return $this->form_tag($attrib, $hidden->show() . $content); + + unset($attrib['task'], $attrib['request']); + $attrib['action'] = './'; + + return $this->form_tag($attrib, $hidden->show() . $content); } /** * GUI object 'username' * Showing IMAP username of the current session * - * @param array Named tag parameters (currently not used) + * @param array $attrib Named tag parameters (currently not used) + * * @return string HTML code for the gui object */ public function current_username($attrib) @@ -1771,7 +1802,8 @@ EOF; * GUI object 'loginform' * Returns code for the webmail login form * - * @param array Named parameters + * @param array $attrib Named parameters + * * @return string HTML code for the gui object */ protected function login_form($attrib) @@ -1876,7 +1908,7 @@ EOF; * GUI object 'preloader' * Loads javascript code for images preloading * - * @param array Named parameters + * @param array $attrib Named parameters * @return void */ protected function preloader($attrib) @@ -1900,7 +1932,8 @@ EOF; * GUI object 'searchform' * Returns code for search function * - * @param array Named parameters + * @param array $attrib Named parameters + * * @return string HTML code for the gui object */ protected function search_form($attrib) @@ -1918,17 +1951,17 @@ EOF; } $input_q = new html_inputfield($attrib); - $out = $input_q->show(); + $out = $input_q->show(); $this->add_gui_object('qsearchbox', $attrib['id']); // add form tag around text field if (empty($attrib['form'])) { $out = $this->form_tag(array( - 'name' => "rcmqsearchform", - 'onsubmit' => self::JS_OBJECT_NAME . ".command('search'); return false", - 'style' => "display:inline"), - $out); + 'name' => "rcmqsearchform", + 'onsubmit' => self::JS_OBJECT_NAME . ".command('search'); return false", + 'style' => "display:inline" + ), $out); } return $out; @@ -1954,7 +1987,8 @@ EOF; /** * GUI object 'charsetselector' * - * @param array Named parameters for the select tag + * @param array $attrib Named parameters for the select tag + * * @return string HTML code for the gui object */ public function charset_selector($attrib) diff --git a/program/include/rcmail_output_json.php b/program/include/rcmail_output_json.php index 9cf43d9d9..0d7e278b8 100644 --- a/program/include/rcmail_output_json.php +++ b/program/include/rcmail_output_json.php @@ -22,7 +22,7 @@ /** * View class to produce JSON responses * - * @package Webmail + * @package Webmail * @subpackage View */ class rcmail_output_json extends rcmail_output @@ -43,10 +43,12 @@ class rcmail_output_json extends rcmail_output */ public function set_pagetitle($title) { - if ($this->config->get('devel_mode') && !empty($_SESSION['username'])) + if ($this->config->get('devel_mode') && !empty($_SESSION['username'])) { $name = $_SESSION['username']; - else + } + else { $name = $this->config->get('product_name'); + } $this->command('set_pagetitle', empty($name) ? $title : $name . ' :: ' . $title); } @@ -54,8 +56,8 @@ class rcmail_output_json extends rcmail_output /** * Register a template object handler * - * @param string $obj Object name - * @param string $func Function name to call + * @param string $obj Object name + * @param string $func Function name to call */ public function add_handler($obj, $func) { @@ -65,7 +67,7 @@ class rcmail_output_json extends rcmail_output /** * Register a list of template object handlers * - * @param array $arr Hash array with object=>handler pairs + * @param array $arr Hash array with object=>handler pairs */ public function add_handlers($arr) { @@ -82,10 +84,12 @@ class rcmail_output_json extends rcmail_output { $cmd = func_get_args(); - if (strpos($cmd[0], 'plugin.') === 0) - $this->callbacks[] = $cmd; - else - $this->commands[] = $cmd; + if (strpos($cmd[0], 'plugin.') === 0) { + $this->callbacks[] = $cmd; + } + else { + $this->commands[] = $cmd; + } } /** @@ -94,8 +98,9 @@ class rcmail_output_json extends rcmail_output public function add_label() { $args = func_get_args(); - if (count($args) == 1 && is_array($args[0])) + if (count($args) == 1 && is_array($args[0])) { $args = $args[0]; + } foreach ($args as $name) { $this->texts[$name] = $this->app->gettext($name); @@ -110,6 +115,7 @@ class rcmail_output_json extends rcmail_output * @param array $vars Key-value pairs to be replaced in localized text * @param boolean $override Override last set message * @param int $timeout Message displaying time in seconds + * * @uses self::command() */ public function show_message($message, $type='notice', $vars=null, $override=true, $timeout=0) @@ -142,8 +148,9 @@ class rcmail_output_json extends rcmail_output /** * Redirect to a certain url * - * @param mixed $p Either a string with the action or url parameters as key-value pairs - * @param int $delay Delay in seconds + * @param mixed $p Either a string with the action or url parameters as key-value pairs + * @param int $delay Delay in seconds + * * @see rcmail::url() */ public function redirect($p = array(), $delay = 1) @@ -166,8 +173,8 @@ class rcmail_output_json extends rcmail_output /** * Show error page and terminate script execution * - * @param int $code Error code - * @param string $message Error message + * @param int $code Error code + * @param string $message Error message */ public function raise_error($code, $message) { @@ -184,12 +191,9 @@ class rcmail_output_json extends rcmail_output /** * Send an AJAX response with executable JS code * - * @param string $add Additional JS code - * @param boolean True if output buffer should be flushed - * @return void - * @deprecated + * @param string $add Additional JS code */ - protected function remote_response($add='') + protected function remote_response($add = '') { static $s_header_sent = false; @@ -233,8 +237,6 @@ class rcmail_output_json extends rcmail_output /** * Return executable javascript code for all registered commands - * - * @return string $out */ protected function get_js_commands() { diff --git a/program/include/rcmail_string_replacer.php b/program/include/rcmail_string_replacer.php index 2037db669..c3b979719 100644 --- a/program/include/rcmail_string_replacer.php +++ b/program/include/rcmail_string_replacer.php @@ -23,7 +23,7 @@ * Helper class for turning URLs and email addresses in plaintext content * into clickable links. * - * @package Webmail + * @package Webmail * @subpackage Utils */ class rcmail_string_replacer extends rcube_string_replacer @@ -33,7 +33,8 @@ class rcmail_string_replacer extends rcube_string_replacer * * This also adds an onclick-handler to open the Rouncube compose message screen on such links * - * @param array Matches result from preg_replace_callback + * @param array $matches Matches result from preg_replace_callback + * * @return int Index of saved string value * @see rcube_string_replacer::mailto_callback() */ diff --git a/program/include/rcmail_utils.php b/program/include/rcmail_utils.php index 6de4f1873..72cc55bb9 100644 --- a/program/include/rcmail_utils.php +++ b/program/include/rcmail_utils.php @@ -23,7 +23,7 @@ /** * Roundcube utilities * - * @package Webmail + * @package Webmail * @subpackage Utils */ class rcmail_utils @@ -59,7 +59,7 @@ class rcmail_utils /** * Initialize database schema * - * @param string Directory with sql files + * @param string $dir Directory with sql files */ public static function db_init($dir) { @@ -93,10 +93,10 @@ class rcmail_utils /** * Update database schema * - * @param string Directory with sql files - * @param string Component name - * @param string Optional current version number - * @param array Parameters (errors, quiet) + * @param string $dir Directory with sql files + * @param string $package Component name + * @param string $ver Optional current version number + * @param array $opts Parameters (errors, quiet) * * @return True on success, False on failure */ @@ -255,7 +255,7 @@ class rcmail_utils /** * Removes all deleted records older than X days * - * @param int Number of days + * @param int $days Number of days */ public static function db_clean($days) { @@ -324,10 +324,10 @@ class rcmail_utils /** * Modify user preferences * - * @param string Option name - * @param string Option value - * @param int Optional user identifier - * @param string Optional value type (bool, int, string) + * @param string $name Option name + * @param string $value Option value + * @param int $userid Optional user identifier + * @param string $type Optional value type (bool, int, string) */ public static function mod_pref($name, $value, $userid = null, $type = 'string') { diff --git a/program/lib/Roundcube/html.php b/program/lib/Roundcube/html.php index 07b72009d..dd814ef76 100644 --- a/program/lib/Roundcube/html.php +++ b/program/lib/Roundcube/html.php @@ -267,7 +267,7 @@ class html /** * Derrived method for line breaks * - * @param array $attrib Associative arry with tag attributes + * @param array $attrib Associative arry with tag attributes * * @return string HTML code * @see html::tag() @@ -337,7 +337,7 @@ class html /** * Convert a HTML attribute string attributes to an associative array (name => value) * - * @param string Input string + * @param string $str Input string * * @return array Key-value pairs of parsed attributes */ @@ -773,12 +773,12 @@ class html_table extends html * Remove a column from a table * Useful for plugins making alterations * - * @param string $class + * @param string $class Class name */ public function remove_column($class) { // Remove the header - foreach ($this->header as $index=>$header){ + foreach ($this->header as $index => $header){ if ($header->attrib['class'] == $class){ unset($this->header[$index]); break; @@ -786,8 +786,8 @@ class html_table extends html } // Remove cells from rows - foreach ($this->rows as $i=>$row){ - foreach ($row->cells as $j=>$cell){ + foreach ($this->rows as $i => $row){ + foreach ($row->cells as $j => $cell){ if ($cell->attrib['class'] == $class){ unset($this->rows[$i]->cells[$j]); break; diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php index a1b6e82dc..afc7115fa 100644 --- a/program/lib/Roundcube/rcube.php +++ b/program/lib/Roundcube/rcube.php @@ -584,8 +584,8 @@ class rcube /** * Get localized text in the desired language * - * @param mixed $attrib Named parameters array or label name - * @param string $domain Label domain (plugin) name + * @param mixed $attrib Named parameters array or label name + * @param string $domain Label domain (plugin) name * * @return string Localized text */ @@ -640,9 +640,9 @@ class rcube /** * Check if the given text label exists * - * @param string $name Label name - * @param string $domain Label domain (plugin) name or '*' for all domains - * @param string $ref_domain Sets domain name if label is found + * @param string $name Label name + * @param string $domain Label domain (plugin) name or '*' for all domains + * @param string $ref_domain Sets domain name if label is found * * @return boolean True if text exists (either in the current language or in en_US) */ @@ -1014,7 +1014,7 @@ class rcube * The functions will be executed before destroying any * objects like smtp, imap, session, etc. * - * @param callback Function callback + * @param callback $function Function callback */ public function add_shutdown_function($function) { @@ -1203,7 +1203,7 @@ class rcube * * @param array $arg Named parameters * - code: Error code (required) - * - type: Error type [php|db|imap|javascript] (required) + * - type: Error type [php|db|imap|javascript] * - message: Error message * - file: File where error occurred * - line: Line where error occurred @@ -1463,8 +1463,8 @@ class rcube */ protected function get_user_log_dir() { - $log_dir = $this->config->get('log_dir', RCUBE_INSTALL_PATH . 'logs'); - $user_name = $this->get_user_name(); + $log_dir = $this->config->get('log_dir', RCUBE_INSTALL_PATH . 'logs'); + $user_name = $this->get_user_name(); $user_log_dir = $log_dir . '/' . $user_name; return !empty($user_name) && is_writable($user_log_dir) ? $user_log_dir : false; diff --git a/program/lib/Roundcube/rcube_addressbook.php b/program/lib/Roundcube/rcube_addressbook.php index 3943fcf8a..7a0285037 100644 --- a/program/lib/Roundcube/rcube_addressbook.php +++ b/program/lib/Roundcube/rcube_addressbook.php @@ -68,7 +68,7 @@ abstract class rcube_addressbook /** * Save a search string for future listings * - * @param mixed Search params to use in listing method, obtained by get_search_set() + * @param mixed $filter Search params to use in listing method, obtained by get_search_set() */ abstract function set_search_set($filter); @@ -97,21 +97,22 @@ abstract class rcube_addressbook /** * List the current set of contact records * - * @param array List of cols to show - * @param int Only return this number of records, use negative values for tail - * @return array Indexed list of contact records, each a hash array + * @param array $cols List of cols to show + * @param int $subset Only return this number of records, use negative values for tail + * + * @return array Indexed list of contact records, each a hash array */ abstract function list_records($cols=null, $subset=0); /** * Search records * - * @param array List of fields to search in - * @param string Search value - * @param int Search mode. Sum of self::SEARCH_*. - * @param boolean True if results are requested, False if count only - * @param boolean True to skip the count query (select only) - * @param array List of fields that cannot be empty + * @param array $fields List of fields to search in + * @param string $value Search value + * @param int $mode Search mode. Sum of self::SEARCH_*. + * @param boolean $select True if results are requested, False if count only + * @param boolean $nocount True to skip the count query (select only) + * @param array $required List of fields that cannot be empty * * @return object rcube_result_set List of contact records and 'count' value */ @@ -134,8 +135,8 @@ abstract class rcube_addressbook /** * Get a specific contact record * - * @param mixed Record identifier(s) - * @param boolean True to return record as associative array, otherwise a result set is returned + * @param mixed $id Record identifier(s) + * @param boolean $assoc True to return record as associative array, otherwise a result set is returned * * @return rcube_result_set|array Result object with all record fields */ @@ -154,8 +155,8 @@ abstract class rcube_addressbook /** * Setter for errors for internal use * - * @param int Error type (one of this class' error constants) - * @param string Error message (name of a text label) + * @param int $type Error type (one of this class' error constants) + * @param string $message Error message (name of a text label) */ protected function set_error($type, $message) { @@ -171,7 +172,7 @@ abstract class rcube_addressbook /** * Set internal list page * - * @param number Page number to list + * @param number $page Page number to list */ function set_page($page) { @@ -181,7 +182,7 @@ abstract class rcube_addressbook /** * Set internal page size * - * @param number Number of messages to display on one page + * @param number $size Number of messages to display on one page */ function set_pagesize($size) { @@ -191,7 +192,7 @@ abstract class rcube_addressbook /** * Set internal sort settings * - * @param string $sort_col Sort column + * @param string $sort_col Sort column * @param string $sort_order Sort order */ function set_sort_order($sort_col, $sort_order = null) @@ -208,8 +209,8 @@ abstract class rcube_addressbook * Check the given data before saving. * If input isn't valid, the message to display can be fetched using get_error() * - * @param array Assoziative array with data to save - * @param boolean Attempt to fix/complete record automatically + * @param array &$save_data Associative array with data to save + * @param boolean $autofix Attempt to fix/complete record automatically * * @return boolean True if input is valid, False if not. */ @@ -251,10 +252,11 @@ abstract class rcube_addressbook /** * Create a new contact record * - * @param array Assoziative array with save data + * @param array $save_data Associative array with save data * Keys: Field name with optional section in the form FIELD:SECTION * Values: Field value. Can be either a string or an array of strings for multiple values - * @param boolean True to check for duplicates first + * @param boolean $check True to check for duplicates first + * * @return mixed The created record ID on success, False on error */ function insert($save_data, $check=false) @@ -265,8 +267,9 @@ abstract class rcube_addressbook /** * Create new contact records for every item in the record set * - * @param object rcube_result_set Recordset to insert - * @param boolean True to check for duplicates first + * @param rcube_result_set $recset Recordset to insert + * @param boolean $check True to check for duplicates first + * * @return array List of created record IDs */ function insertMultiple($recset, $check=false) @@ -284,8 +287,8 @@ abstract class rcube_addressbook /** * Update a specific contact record * - * @param mixed Record identifier - * @param array Assoziative array with save data + * @param mixed $id Record identifier + * @param array $save_cols Associative array with save data * Keys: Field name with optional section in the form FIELD:SECTION * Values: Field value. Can be either a string or an array of strings for multiple values * @@ -299,8 +302,8 @@ abstract class rcube_addressbook /** * Mark one or more contact records as deleted * - * @param array Record identifiers - * @param bool Remove records irreversible (see self::undelete) + * @param array $ids Record identifiers + * @param bool $force Remove records irreversible (see self::undelete) */ function delete($ids, $force = true) { @@ -310,7 +313,7 @@ abstract class rcube_addressbook /** * Unmark delete flag on contact record(s) * - * @param array Record identifiers + * @param array $ids Record identifiers */ function undelete($ids) { @@ -331,13 +334,13 @@ abstract class rcube_addressbook * Setter for the current group * (empty, has to be re-implemented by extending class) */ - function set_group($gid) { } + function set_group($group_id) { } /** * List all active contact groups of this source * - * @param string Optional search string to match group name - * @param int Search mode. Sum of self::SEARCH_* + * @param string $search Optional search string to match group name + * @param int $mode Search mode. Sum of self::SEARCH_* * * @return array Indexed list of contact groups, each a hash array */ @@ -350,7 +353,8 @@ abstract class rcube_addressbook /** * Get group properties such as name and email address(es) * - * @param string Group identifier + * @param string $group_id Group identifier + * * @return array Group properties as hash array */ function get_group($group_id) @@ -362,7 +366,8 @@ abstract class rcube_addressbook /** * Create a contact group with the given name * - * @param string The group name + * @param string $name The group name + * * @return mixed False on error, array with record props in success */ function create_group($name) @@ -374,10 +379,11 @@ abstract class rcube_addressbook /** * Delete the given group and all linked group members * - * @param string Group identifier + * @param string $group_id Group identifier + * * @return boolean True on success, false if no data was changed */ - function delete_group($gid) + function delete_group($group_id) { /* empty for address books don't supporting groups */ return false; @@ -386,12 +392,13 @@ abstract class rcube_addressbook /** * Rename a specific contact group * - * @param string Group identifier - * @param string New name to set for this group - * @param string New group identifier (if changed, otherwise don't set) + * @param string $group_id Group identifier + * @param string $newname New name to set for this group + * @param string &$newid New group identifier (if changed, otherwise don't set) + * * @return boolean New name on success, false if no data was changed */ - function rename_group($gid, $newname, &$newid) + function rename_group($group_id, $newname, &$newid) { /* empty for address books don't supporting groups */ return false; @@ -400,8 +407,8 @@ abstract class rcube_addressbook /** * Add the given contact records the a certain group * - * @param string Group identifier - * @param array|string List of contact identifiers to be added + * @param string $group_id Group identifier + * @param array|string $ids List of contact identifiers to be added * * @return int Number of contacts added */ @@ -414,8 +421,8 @@ abstract class rcube_addressbook /** * Remove the given contact records from a certain group * - * @param string Group identifier - * @param array|string List of contact identifiers to be removed + * @param string $group_id Group identifier + * @param array|string $ids List of contact identifiers to be removed * * @return int Number of deleted group members */ @@ -430,7 +437,7 @@ abstract class rcube_addressbook * * @param mixed Record identifier * - * @return array List of assigned groups as ID=>Name pairs + * @return array $id List of assigned groups as ID=>Name pairs * @since 0.5-beta */ function get_record_groups($id) @@ -443,9 +450,11 @@ abstract class rcube_addressbook * Utility function to return all values of a certain data column * either as flat list or grouped by subtype * - * @param string Col name - * @param array Record data array as used for saving - * @param boolean True to return one array with all values, False for hash array with values grouped by type + * @param string $col Col name + * @param array $data Record data array as used for saving + * @param bool $flat True to return one array with all values, + * False for hash array with values grouped by type + * * @return array List of column values */ public static function get_col_values($col, $data, $flat = false) @@ -475,7 +484,7 @@ abstract class rcube_addressbook * Normalize the given string for fulltext search. * Currently only optimized for Latin-1 characters; to be extended * - * @param string Input string (UTF-8) + * @param string $str Input string (UTF-8) * @return string Normalized string * @deprecated since 0.9-beta */ @@ -487,8 +496,8 @@ abstract class rcube_addressbook /** * Compose a valid display name from the given structured contact data * - * @param array Hash array with contact data as key-value pairs - * @param bool Don't attempt to extract components from the email address + * @param array $contact Hash array with contact data as key-value pairs + * @param bool $full_email Don't attempt to extract components from the email address * * @return string Display name */ @@ -523,7 +532,8 @@ abstract class rcube_addressbook * Compose the name to display in the contacts list for the given contact record. * This respects the settings parameter how to list conacts. * - * @param array Hash array with contact data as key-value pairs + * @param array $contact Hash array with contact data as key-value pairs + * * @return string List name */ public static function compose_list_name($contact) @@ -570,10 +580,10 @@ abstract class rcube_addressbook /** * Build contact display name for autocomplete listing * - * @param array Hash array with contact data as key-value pairs - * @param string Optional email address - * @param string Optional name (self::compose_list_name() result) - * @param string Optional template to use (defaults to the 'contact_search_name' config option) + * @param array $contact Hash array with contact data as key-value pairs + * @param string $email Optional email address + * @param string $name Optional name (self::compose_list_name() result) + * @param string $templ Optional template to use (defaults to the 'contact_search_name' config option) * * @return string Display name */ @@ -632,6 +642,11 @@ abstract class rcube_addressbook /** * Create a unique key for sorting contacts + * + * @param array $contact Contact record + * @param string $sort_col Sorting column name + * + * @return string Unique key */ public static function compose_contact_key($contact, $sort_col) { diff --git a/program/lib/Roundcube/rcube_config.php b/program/lib/Roundcube/rcube_config.php index 2764a4f0b..2c4e7ac36 100644 --- a/program/lib/Roundcube/rcube_config.php +++ b/program/lib/Roundcube/rcube_config.php @@ -52,7 +52,7 @@ class rcube_config /** * Object constructor * - * @param string Environment suffix for config files to load + * @param string $env Environment suffix for config files to load */ public function __construct($env = '') { @@ -98,7 +98,7 @@ class rcube_config * * Look inside the string to determine what type might be best as a container. * - * @param $value The value to inspect + * @param mixed $value The value to inspect * * @return The guess at the type. */ @@ -126,8 +126,8 @@ class rcube_config * * Perform an appropriate parsing of the string to create the desired PHP type. * - * @param $string String to parse into PHP type - * @param $type Type of value to return + * @param string $string String to parse into PHP type + * @param string $type Type of value to return * * @return Appropriately typed interpretation of $string. */ @@ -168,9 +168,9 @@ class rcube_config * Retrieve an environment variable's value or if it's not found, return the * provided default value. * - * @param $varname Environment variable name - * @param $default_value Default value to return if necessary - * @param $type Type of value to return + * @param string $varname Environment variable name + * @param mixed $default_value Default value to return if necessary + * @param string $type Type of value to return * * @return Value of the environment variable or default if not found. */ @@ -302,6 +302,7 @@ class rcube_config * and merge with the already stored config values * * @param string $file Name of the config file to be loaded + * * @return booelan True on success, false on failure */ public function load_from_file($file) @@ -334,9 +335,10 @@ class rcube_config * Helper method to resolve absolute paths to the given config file. * This also takes the 'env' property into account. * - * @param string Filename or absolute file path - * @param boolean Return -$env file path if exists - * @return array List of candidates in config dir path(s) + * @param string $file Filename or absolute file path + * @param boolean $use_env Return -$env file path if exists + * + * @return array List of candidates in config dir path(s) */ public function resolve_paths($file, $use_env = true) { @@ -372,6 +374,7 @@ class rcube_config * * @param string $name Parameter name * @param mixed $def Default value if not set + * * @return mixed The requested config value */ public function get($name, $def = null) @@ -460,7 +463,7 @@ class rcube_config /** * Getter for all config options * - * @return array Hash array containing all config properties + * @return array Hash array containing all config properties */ public function all() { @@ -480,7 +483,7 @@ class rcube_config /** * Special getter for user's timezone offset including DST * - * @return float Timezone offset (in hours) + * @return float Timezone offset (in hours) * @deprecated */ public function get_timezone() @@ -566,6 +569,7 @@ class rcube_config * * @param string $host IMAP host * @param boolean $encode If true, domain name will be converted to IDN ASCII + * * @return string Resolved SMTP host */ public function mail_domain($host, $encode=true) diff --git a/program/lib/Roundcube/rcube_contacts.php b/program/lib/Roundcube/rcube_contacts.php index 498571561..787c9ae56 100644 --- a/program/lib/Roundcube/rcube_contacts.php +++ b/program/lib/Roundcube/rcube_contacts.php @@ -68,7 +68,7 @@ class rcube_contacts extends rcube_addressbook * Object constructor * * @param object $dbconn Instance of the rcube_db class - * @param integer $user User-ID + * @param integer $user User-ID */ function __construct($dbconn, $user) { @@ -88,7 +88,7 @@ class rcube_contacts extends rcube_addressbook /** * Save a search string for future listings * - * @param string SQL params to use in listing method + * @param string $filter SQL params to use in listing method */ function set_search_set($filter) { @@ -199,7 +199,7 @@ class rcube_contacts extends rcube_addressbook * @param int Only return this number of records, use negative values for tail * @param boolean True to skip the count query (select only) * - * @return array Indexed list of contact records, each a hash array + * @return array Indexed list of contact records, each a hash array */ function list_records($cols = null, $subset = 0, $nocount = false) { @@ -585,8 +585,8 @@ class rcube_contacts extends rcube_addressbook * Check the given data before saving. * If input not valid, the message to display can be fetched using get_error() * - * @param array $save_data Associative array with data to save - * @param boolean $autofix Try to fix/complete record automatically + * @param array &$save_data Associative array with data to save + * @param boolean $autofix Try to fix/complete record automatically * * @return boolean True if input is valid, False if not. */ @@ -983,8 +983,8 @@ class rcube_contacts extends rcube_addressbook /** * Remove the given contact records from a certain group * - * @param string Group identifier - * @param array|string List of contact identifiers to be removed + * @param string $group_id Group identifier + * @param array|string $ids List of contact identifiers to be removed * * @return int Number of deleted group members */ diff --git a/program/lib/Roundcube/rcube_db.php b/program/lib/Roundcube/rcube_db.php index af6af05eb..8fc3898c5 100644 --- a/program/lib/Roundcube/rcube_db.php +++ b/program/lib/Roundcube/rcube_db.php @@ -201,7 +201,7 @@ class rcube_db /** * Connect to appropriate database depending on the operation * - * @param string $mode Connection mode (r|w) + * @param string $mode Connection mode (r|w) * @param boolean $force Enforce using the given mode */ public function db_connect($mode, $force = false) @@ -524,7 +524,8 @@ class rcube_db * Helper method to handle DB errors. * This by default logs the error but could be overriden by a driver implementation * - * @param string Query that triggered the error + * @param string $query Query that triggered the error + * * @return mixed Result to be stored and returned */ protected function handle_error($query) @@ -567,7 +568,8 @@ class rcube_db * If no query handle is specified, the last query will be taken as reference * * @param mixed $result Optional query handle - * @return mixed Number of rows or false on failure + * + * @return mixed Number of rows or false on failure * @deprecated This method shows very poor performance and should be avoided. */ public function num_rows($result = null) @@ -1098,8 +1100,8 @@ class rcube_db /** * Set DSN connection to be used for the given table * - * @param string Table name - * @param string DSN connection ('r' or 'w') to be used + * @param string $table Table name + * @param string $mode DSN connection ('r' or 'w') to be used */ public function set_table_dsn($table, $mode) { @@ -1295,7 +1297,7 @@ class rcube_db /** * Execute the given SQL script * - * @param string SQL queries to execute + * @param string $sql SQL queries to execute * * @return boolen True on success, False on error */ diff --git a/program/lib/Roundcube/rcube_db_oracle.php b/program/lib/Roundcube/rcube_db_oracle.php index 9775f96dc..edcc5f75d 100644 --- a/program/lib/Roundcube/rcube_db_oracle.php +++ b/program/lib/Roundcube/rcube_db_oracle.php @@ -493,7 +493,7 @@ class rcube_db_oracle extends rcube_db /** * Execute the given SQL script * - * @param string SQL queries to execute + * @param string $sql SQL queries to execute * * @return boolen True on success, False on error */ diff --git a/program/lib/Roundcube/rcube_html2text.php b/program/lib/Roundcube/rcube_html2text.php index 0639edd84..ee625886a 100644 --- a/program/lib/Roundcube/rcube_html2text.php +++ b/program/lib/Roundcube/rcube_html2text.php @@ -328,10 +328,10 @@ class rcube_html2text * will instantiate with that source propagated, all that has * to be done it to call get_text(). * - * @param string $source HTML content + * @param string $source HTML content * @param boolean $from_file Indicates $source is a file to pull content from - * @param boolean $do_links Indicate whether a table of link URLs is desired - * @param integer $width Maximum width of the formatted text, 0 for no limit + * @param boolean $do_links Indicate whether a table of link URLs is desired + * @param integer $width Maximum width of the formatted text, 0 for no limit */ function __construct($source = '', $from_file = false, $do_links = true, $width = 75, $charset = 'UTF-8') { @@ -349,7 +349,7 @@ class rcube_html2text /** * Loads source HTML into memory, either from $source string or a file. * - * @param string $source HTML content + * @param string $source HTML content * @param boolean $from_file Indicates $source is a file to pull content from */ function set_html($source, $from_file = false) @@ -454,7 +454,7 @@ class rcube_html2text * and newlines to a readable format, and word wraps the text to * $width characters. * - * @param string Reference to HTML content string + * @param string &$text Reference to HTML content string */ protected function _converter(&$text) { @@ -512,7 +512,7 @@ class rcube_html2text * appeared. Also makes an effort at identifying and handling absolute * and relative links. * - * @param string $link URL of the link + * @param string $link URL of the link * @param string $display Part of the text to associate number with */ protected function _build_link_list($link, $display) @@ -553,7 +553,7 @@ class rcube_html2text /** * Helper function for PRE body conversion. * - * @param string HTML content + * @param string &$text HTML content */ protected function _convert_pre(&$text) { @@ -581,7 +581,7 @@ class rcube_html2text /** * Helper function for BLOCKQUOTE body conversion. * - * @param string HTML content + * @param string &$text HTML content */ protected function _convert_blockquotes(&$text) { @@ -653,7 +653,7 @@ class rcube_html2text /** * Callback function for preg_replace_callback use. * - * @param array PREG matches + * @param array $matches PREG matches * @return string */ public function tags_preg_callback($matches) @@ -676,7 +676,7 @@ class rcube_html2text /** * Callback function for preg_replace_callback use in PRE content handler. * - * @param array PREG matches + * @param array $matches PREG matches * @return string */ public function pre_preg_callback($matches)