Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/roundcube/roundcubemail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2019-10-05 20:44:39 +0300
committerAleksander Machniak <alec@alec.pl>2019-10-05 20:44:39 +0300
commit66fab8cdb2b7160a34ed7d8074c7e8f413f21e91 (patch)
tree1796cf951d48a165ec66d820624ff95516c509ed /plugins
parent20e25582e7f4e57b35039d63654a0839744260be (diff)
CS fixes, Avoid usused variables, fixed minor bugs
Diffstat (limited to 'plugins')
-rw-r--r--plugins/archive/archive.php40
-rw-r--r--plugins/debug_logger/runlog/runlog.php10
-rw-r--r--plugins/enigma/lib/enigma_driver_gnupg.php6
-rw-r--r--plugins/enigma/lib/enigma_engine.php2
-rw-r--r--plugins/enigma/lib/enigma_key.php32
-rw-r--r--plugins/enigma/lib/enigma_ui.php1
-rw-r--r--plugins/filesystem_attachments/filesystem_attachments.php5
-rw-r--r--plugins/help/help.php2
-rw-r--r--plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php2
-rw-r--r--plugins/managesieve/lib/Roundcube/rcube_sieve_forward.php26
-rw-r--r--plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php15
-rw-r--r--plugins/password/drivers/directadmin.php768
-rw-r--r--plugins/password/drivers/domainfactory.php2
-rw-r--r--plugins/password/drivers/gearman.php2
-rw-r--r--plugins/password/drivers/ldap_simple.php2
-rw-r--r--plugins/password/drivers/virtualmin.php1
-rw-r--r--plugins/password/drivers/zxcvbn.php1
-rw-r--r--plugins/password/password.php1
-rw-r--r--plugins/zipdownload/zipdownload.php1
19 files changed, 431 insertions, 488 deletions
diff --git a/plugins/archive/archive.php b/plugins/archive/archive.php
index 3218b6e25..ecd88f713 100644
--- a/plugins/archive/archive.php
+++ b/plugins/archive/archive.php
@@ -14,7 +14,13 @@ class archive extends rcube_plugin
{
public $task = 'settings|mail|login';
+ private $archive_folder;
+ private $folders;
+
+ /**
+ * Plugin initialization.
+ */
function init()
{
$rcmail = rcmail::get_instance();
@@ -22,9 +28,9 @@ class archive extends rcube_plugin
// register special folder type
rcube_storage::$folder_types[] = 'archive';
- $archive_folder = $rcmail->config->get('archive_mbox');
+ $this->archive_folder = $rcmail->config->get('archive_mbox');
- if ($rcmail->task == 'mail' && ($rcmail->action == '' || $rcmail->action == 'show') && $archive_folder) {
+ if ($rcmail->task == 'mail' && ($rcmail->action == '' || $rcmail->action == 'show') && $this->archive_folder) {
$this->include_stylesheet($this->local_skin_path() . '/archive.css');
$this->include_script('archive.js');
$this->add_texts('localization', true);
@@ -47,7 +53,7 @@ class archive extends rcube_plugin
$this->add_hook('render_mailboxlist', array($this, 'render_mailboxlist'));
// set env variables for client
- $rcmail->output->set_env('archive_folder', $archive_folder);
+ $rcmail->output->set_env('archive_folder', $this->archive_folder);
$rcmail->output->set_env('archive_type', $rcmail->config->get('archive_type',''));
}
else if ($rcmail->task == 'mail') {
@@ -58,11 +64,11 @@ class archive extends rcube_plugin
$this->add_hook('preferences_list', array($this, 'prefs_table'));
$this->add_hook('preferences_save', array($this, 'save_prefs'));
- if ($rcmail->action == 'folders' && $archive_folder) {
+ if ($rcmail->action == 'folders' && $this->archive_folder) {
$this->include_stylesheet($this->local_skin_path() . '/archive.css');
$this->include_script('archive.js');
// set env variables for client
- $rcmail->output->set_env('archive_folder', $archive_folder);
+ $rcmail->output->set_env('archive_folder', $this->archive_folder);
}
}
}
@@ -72,18 +78,14 @@ class archive extends rcube_plugin
*/
function render_mailboxlist($p)
{
- $rcmail = rcmail::get_instance();
- $archive_folder = $rcmail->config->get('archive_mbox');
- $show_real_name = $rcmail->config->get('show_real_foldernames');
-
// set localized name for the configured archive folder
- if ($archive_folder && !$show_real_name) {
- if (isset($p['list'][$archive_folder])) {
- $p['list'][$archive_folder]['name'] = $this->gettext('archivefolder');
+ if ($this->archive_folder && !rcmail::get_instance()->config->get('show_real_foldernames')) {
+ if (isset($p['list'][$this->archive_folder])) {
+ $p['list'][$this->archive_folder]['name'] = $this->gettext('archivefolder');
}
else {
// search in subfolders
- $this->_mod_folder_name($p['list'], $archive_folder, $this->gettext('archivefolder'));
+ $this->_mod_folder_name($p['list'], $this->archive_folder, $this->gettext('archivefolder'));
}
}
@@ -129,15 +131,13 @@ class archive extends rcube_plugin
$delimiter = $storage->get_hierarchy_delimiter();
$read_on_move = (bool) $rcmail->config->get('read_on_archive');
$archive_type = $rcmail->config->get('archive_type', '');
- $archive_folder = $rcmail->config->get('archive_mbox');
- $archive_prefix = $archive_folder . $delimiter;
+ $archive_prefix = $this->archive_folder . $delimiter;
$search_request = rcube_utils::get_input_value('_search', rcube_utils::INPUT_GPC);
// count messages before changing anything
if ($_POST['_from'] != 'show') {
$threading = (bool) $storage->get_threading();
$old_count = $storage->count(null, $threading ? 'THREADS' : 'ALL');
- $old_pages = ceil($old_count / $storage->get_pagesize());
}
$count = 0;
@@ -152,12 +152,12 @@ class archive extends rcube_plugin
);
foreach (rcmail::get_uids(null, null, $multifolder, rcube_utils::INPUT_POST) as $mbox => $uids) {
- if (!$archive_folder || $mbox === $archive_folder || strpos($mbox, $archive_prefix) === 0) {
+ if (!$this->archive_folder || $mbox === $this->archive_folder || strpos($mbox, $archive_prefix) === 0) {
$count = count($uids);
continue;
}
else if (!$archive_type || $archive_type == 'folder') {
- $folder = $archive_folder;
+ $folder = $this->archive_folder;
if ($archive_type == 'folder') {
// compose full folder path
@@ -202,7 +202,7 @@ class archive extends rcube_plugin
}
// compose full folder path
- $folder = $archive_folder . ($subfolder ? $delimiter . $subfolder : '');
+ $folder = $this->archive_folder . ($subfolder ? $delimiter . $subfolder : '');
$execute[$folder][] = $message->uid;
}
@@ -348,7 +348,7 @@ class archive extends rcube_plugin
$delimiter = $storage->get_hierarchy_delimiter();
if ($this->folders === null) {
- $this->folders = $storage->list_folders('', $archive_folder . '*', 'mail', null, true);
+ $this->folders = $storage->list_folders('', $this->archive_folder . '*', 'mail', null, true);
}
if (!in_array($folder, $this->folders)) {
diff --git a/plugins/debug_logger/runlog/runlog.php b/plugins/debug_logger/runlog/runlog.php
index 6291a2fb7..460242f54 100644
--- a/plugins/debug_logger/runlog/runlog.php
+++ b/plugins/debug_logger/runlog/runlog.php
@@ -38,8 +38,8 @@ class runlog {
$this->parent_stack[] = $name;
- $this->print_to_console("start: ".$name, $tag, 'start');
- $this->print_to_file("start: ".$name, $tag, 'start');
+ $this->print_to_console("start: ".$name, $tag);
+ $this->print_to_file("start: ".$name, $tag);
$this->indent++;
}
@@ -72,8 +72,8 @@ class runlog {
$tag_report .= "$tag: $count, ";
}
$end_txt = sprintf("end: $name - %0.4f seconds $tag_report", $this->run_log[$lastk]['duration']);
- $this->print_to_console($end_txt, $this->run_log[$lastk]['tag'], 'end');
- $this->print_to_file($end_txt, $this->run_log[$lastk]['tag'], 'end');
+ $this->print_to_console($end_txt, $this->run_log[$lastk]['tag']);
+ $this->print_to_file($end_txt, $this->run_log[$lastk]['tag']);
}
}
@@ -137,7 +137,7 @@ class runlog {
$this->print_to_console($msg, $tag);
}
- public function print_to_file($msg, $tag = false, $type = false)
+ public function print_to_file($msg, $tag = false)
{
if (!$tag) {
$file_handle_tag = 'master';
diff --git a/plugins/enigma/lib/enigma_driver_gnupg.php b/plugins/enigma/lib/enigma_driver_gnupg.php
index 80753f2ec..5af339836 100644
--- a/plugins/enigma/lib/enigma_driver_gnupg.php
+++ b/plugins/enigma/lib/enigma_driver_gnupg.php
@@ -574,8 +574,8 @@ class enigma_driver_gnupg extends enigma_driver
$data_result = $db->query("SELECT `data`, `mtime` FROM $table"
. " WHERE `file_id` = ?", $record['file_id']);
- $data = $db->fetch_assoc($data_result);
- $data = $data ? base64_decode($data['data']) : null;
+ $record = $db->fetch_assoc($data_result);
+ $data = $record ? base64_decode($record['data']) : null;
if ($data === null || $data === false) {
rcube::raise_error(array(
@@ -590,7 +590,7 @@ class enigma_driver_gnupg extends enigma_driver
if (file_put_contents($tmpfile, $data, LOCK_EX) === strlen($data)) {
rename($tmpfile, $file);
- touch($file, $data_record['mtime']);
+ touch($file, $record['mtime']);
if ($this->debug) {
$this->debug("SYNC: Fetched file: $file");
diff --git a/plugins/enigma/lib/enigma_engine.php b/plugins/enigma/lib/enigma_engine.php
index 521c614d3..0f420bbe8 100644
--- a/plugins/enigma/lib/enigma_engine.php
+++ b/plugins/enigma/lib/enigma_engine.php
@@ -682,7 +682,7 @@ class enigma_engine
$sig = $this->pgp_verify($msg_body, $sig_body);
// Store signature data for display
- $this->signatures[$struct->mime_id] = $sig;
+ $this->signatures[$struct->mime_id] = $sig;
$this->signatures[$msg_part->mime_id] = $sig;
}
}
diff --git a/plugins/enigma/lib/enigma_key.php b/plugins/enigma/lib/enigma_key.php
index a4470da24..75ccf4fca 100644
--- a/plugins/enigma/lib/enigma_key.php
+++ b/plugins/enigma/lib/enigma_key.php
@@ -46,10 +46,12 @@ class enigma_key
*/
function get_type()
{
- if ($this->subkeys[0]->has_private)
+ if ($this->subkeys[0]->has_private) {
return enigma_key::TYPE_KEYPAIR;
- else if (!empty($this->subkeys[0]))
+ }
+ else if (!empty($this->subkeys[0])) {
return enigma_key::TYPE_PUBLIC;
+ }
return enigma_key::TYPE_UNKNOWN;
}
@@ -59,9 +61,11 @@ class enigma_key
*/
function is_revoked()
{
- foreach ($this->subkeys as $subkey)
- if (!$subkey->revoked)
+ foreach ($this->subkeys as $subkey) {
+ if (!$subkey->revoked) {
return false;
+ }
+ }
return true;
}
@@ -71,9 +75,11 @@ class enigma_key
*/
function is_valid()
{
- foreach ($this->users as $user)
- if ($user->valid)
+ foreach ($this->users as $user) {
+ if ($user->valid) {
return true;
+ }
+ }
return false;
}
@@ -85,9 +91,11 @@ class enigma_key
{
$now = time();
- foreach ($this->subkeys as $subkey)
- if (!$subkey->expires || $subkey->expires > $now)
+ foreach ($this->subkeys as $subkey) {
+ if (!$subkey->expires || $subkey->expires > $now) {
return true;
+ }
+ }
return false;
}
@@ -97,11 +105,11 @@ class enigma_key
*/
function is_private()
{
- $now = time();
-
- foreach ($this->subkeys as $subkey)
- if ($subkey->has_private)
+ foreach ($this->subkeys as $subkey) {
+ if ($subkey->has_private) {
return true;
+ }
+ }
return false;
}
diff --git a/plugins/enigma/lib/enigma_ui.php b/plugins/enigma/lib/enigma_ui.php
index 781ad1034..e95aec29a 100644
--- a/plugins/enigma/lib/enigma_ui.php
+++ b/plugins/enigma/lib/enigma_ui.php
@@ -1253,7 +1253,6 @@ class enigma_ui
$uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST);
$mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST);
$mime_id = rcube_utils::get_input_value('_part', rcube_utils::INPUT_POST);
- $storage = $this->rc->get_storage();
$engine = $this->enigma->load_engine();
if ($uid && $mime_id) {
diff --git a/plugins/filesystem_attachments/filesystem_attachments.php b/plugins/filesystem_attachments/filesystem_attachments.php
index ec32e763c..c77f402b6 100644
--- a/plugins/filesystem_attachments/filesystem_attachments.php
+++ b/plugins/filesystem_attachments/filesystem_attachments.php
@@ -71,8 +71,7 @@ class filesystem_attachments extends rcube_plugin
function upload($args)
{
$args['status'] = false;
- $group = $args['group'];
- $rcmail = rcube::get_instance();
+ $group = $args['group'];
// use common temp dir for file uploads
$tmpfname = rcube_utils::temp_filename('attmnt');
@@ -199,7 +198,7 @@ class filesystem_attachments extends rcube_plugin
private function find_file_by_id($id)
{
- foreach ((array) $_SESSION['plugins']['filesystem_attachments'] as $group => $files) {
+ foreach ((array) $_SESSION['plugins']['filesystem_attachments'] as $files) {
if (isset($files[$id])) {
return true;
}
diff --git a/plugins/help/help.php b/plugins/help/help.php
index bd18ec8d4..194e3fefa 100644
--- a/plugins/help/help.php
+++ b/plugins/help/help.php
@@ -143,7 +143,7 @@ class help extends rcube_plugin
// resolve task/action for deep linking
$rel = $_REQUEST['_rel'];
- list($task, $action) = explode('/', $rel);
+ list($task, ) = explode('/', $rel);
if ($add = $index_map[$rel]) {
$src .= $add;
}
diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
index 8d74b17db..da39cebd1 100644
--- a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
+++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
@@ -1564,7 +1564,7 @@ class rcube_sieve_engine
}
if ($compact) {
- $select = new html_select(array('name' => '_join', 'id' => '_join' . $id,
+ $select = new html_select(array('name' => '_join', 'id' => '_join',
'onchange' => 'rule_join_radio(this.value)'));
foreach (array('allof', 'anyof', 'any') as $val) {
diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_forward.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_forward.php
index db1c1b653..b4fcd4ced 100644
--- a/plugins/managesieve/lib/Roundcube/rcube_sieve_forward.php
+++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_forward.php
@@ -200,18 +200,12 @@ class rcube_sieve_forward extends rcube_sieve_engine
return;
}
- $date_extension = in_array('date', $this->exts);
- $regex_extension = in_array('regex', $this->exts);
+ $status = rcube_utils::get_input_value('forward_status', rcube_utils::INPUT_POST);
+ $action = rcube_utils::get_input_value('forward_action', rcube_utils::INPUT_POST);
+ $target = rcube_utils::get_input_value('action_target', rcube_utils::INPUT_POST, true);
- $status = rcube_utils::get_input_value('forward_status', rcube_utils::INPUT_POST);
- $action = rcube_utils::get_input_value('forward_action', rcube_utils::INPUT_POST);
- $target = rcube_utils::get_input_value('action_target', rcube_utils::INPUT_POST, true);
-
- $forward_action['type'] = 'forward';
- $forward_action['reason'] = $this->strip_value(str_replace("\r\n", "\n", $reason));
- $forward_action['subject'] = trim($subject);
- $forward_action['from'] = trim($from);
- $forward_tests = (array) $this->forward['tests'];
+ $date_extension = in_array('date', $this->exts);
+ $forward_tests = (array) $this->forward['tests'];
if ($action == 'redirect' || $action == 'copy') {
if (empty($target) || !rcube_utils::check_email($target)) {
@@ -230,7 +224,7 @@ class rcube_sieve_forward extends rcube_sieve_engine
$rule['disabled'] = $status == 'off';
$rule['tests'] = $forward_tests;
$rule['join'] = $date_extension ? count($forward_tests) > 1 : false;
- $rule['actions'] = array($forward_action);
+ $rule['actions'] = array();
$rule['after'] = $after;
if ($action && $action != 'keep') {
@@ -269,8 +263,8 @@ class rcube_sieve_forward extends rcube_sieve_engine
// form elements
- $status = new html_select(array('name' => 'forward_status', 'id' => 'forward_status'));
- $action = new html_select(array('name' => 'forward_action', 'id' => 'forward_action'));
+ $status = new html_select(array('name' => 'forward_status', 'id' => 'forward_status'));
+ $action = new html_select(array('name' => 'forward_action', 'id' => 'forward_action'));
$status->add($this->plugin->gettext('forward.on'), 'on');
$status->add($this->plugin->gettext('forward.off'), 'off');
@@ -455,7 +449,7 @@ class rcube_sieve_forward extends rcube_sieve_engine
$this->init_script();
$this->forward_rule();
- $forward['type'] = 'forward';
+ $date_extension = in_array('date', $this->exts);
if ($data['action'] == 'redirect' || $data['action'] == 'copy') {
if (empty($data['target']) || !rcube_utils::check_email($data['target'])) {
@@ -478,7 +472,7 @@ class rcube_sieve_forward extends rcube_sieve_engine
$rule['disabled'] = isset($data['enabled']) && !$data['enabled'];
$rule['tests'] = $forward_tests;
$rule['join'] = $date_extension ? count($forward_tests) > 1 : false;
- $rule['actions'] = array($forward);
+ $rule['actions'] = array();
if ($data['action'] && $data['action'] != 'keep') {
$rule['actions'][] = array(
diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php
index 0792f115b..931750110 100644
--- a/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php
+++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php
@@ -591,6 +591,7 @@ class rcube_sieve_vacation extends rcube_sieve_engine
public static function vacation_interval(&$vacation)
{
$rcube = rcube::get_instance();
+ $seconds_extension = in_array('vacation-seconds', $this->exts);
if (isset($vacation['seconds'])) {
$interval = $vacation['seconds'];
@@ -720,9 +721,8 @@ class rcube_sieve_vacation extends rcube_sieve_engine
$this->vacation_rule();
// check supported extensions
- $date_extension = in_array('date', $this->exts);
- $regex_extension = in_array('regex', $this->exts);
- $seconds_extension = in_array('vacation-seconds', $this->exts);
+ $date_extension = in_array('date', $this->exts);
+ $regex_extension = in_array('regex', $this->exts);
// set user's timezone
try {
@@ -754,8 +754,8 @@ class rcube_sieve_vacation extends rcube_sieve_engine
else if ($regex_extension) {
// Sieve 'date' extension not available, read start/end from RegEx based rules instead
if ($date_tests = self::parse_regexp_tests($this->vacation['tests'])) {
- $from = new DateTime($date_tests['from'] . ' ' . '00:00:00', $timezone);
- $to = new DateTime($date_tests['to'] . ' ' . '23:59:59', $timezone);
+ $start = new DateTime($date_tests['from'] . ' ' . '00:00:00', $timezone);
+ $end = new DateTime($date_tests['to'] . ' ' . '23:59:59', $timezone);
}
}
@@ -799,9 +799,8 @@ class rcube_sieve_vacation extends rcube_sieve_engine
$this->vacation_rule();
// check supported extensions
- $date_extension = in_array('date', $this->exts);
- $regex_extension = in_array('regex', $this->exts);
- $seconds_extension = in_array('vacation-seconds', $this->exts);
+ $date_extension = in_array('date', $this->exts);
+ $regex_extension = in_array('regex', $this->exts);
$vacation['type'] = 'vacation';
$vacation['reason'] = $this->strip_value(str_replace("\r\n", "\n", $data['message']));
diff --git a/plugins/password/drivers/directadmin.php b/plugins/password/drivers/directadmin.php
index 7444e1407..1b8a31d61 100644
--- a/plugins/password/drivers/directadmin.php
+++ b/plugins/password/drivers/directadmin.php
@@ -84,419 +84,369 @@ class rcube_directadmin_password
* @author Phi1 'l0rdphi1' Stier <l0rdphi1@liquenox.net>
* @package HTTPSocket
* @version 3.0.2
+ */
+class HTTPSocket
+{
+ var $version = '3.0.2';
+
+ // all vars are private except $error, $query_cache, and $doFollowLocationHeader
+
+ var $method = 'GET';
+
+ var $remote_host;
+ var $remote_port;
+ var $remote_uname;
+ var $remote_passwd;
+
+ var $result;
+ var $result_header;
+ var $result_body;
+ var $result_status_code;
+
+ var $lastTransferSpeed;
+ var $bind_host;
+ var $error = array();
+ var $warn = array();
+ var $query_cache = array();
+ var $doFollowLocationHeader = true;
+ var $redirectURL;
+ var $max_redirects = 5;
+ var $ssl_setting_message = 'DirectAdmin appears to be using SSL. Change your script to connect to ssl://';
+ var $extra_headers = array();
+
+ /**
+ * Create server "connection".
+ *
+ */
+ function connect($host, $port = '')
+ {
+ if (!is_numeric($port)) {
+ $port = 2222;
+ }
- * 3.0.2
- * added longer curl timeouts
+ $this->remote_host = $host;
+ $this->remote_port = $port;
+ }
- * 3.0.1
- * support for tcp:// conversion to http://
+ function bind($ip = '')
+ {
+ if ($ip == '') {
+ $ip = $_SERVER['SERVER_ADDR'];
+ }
- * 3.0.0
- * swapped to use curl to address ssl certificate issues with php 5.6
+ $this->bind_host = $ip;
+ }
- * 2.7.2
- * added x-use-https header check
- * added max number of location redirects
- * added custom settable message if x-use-https is found, so users can be told where to set their scripts
- * if a redirect host is https, add ssl:// to remote_host
+ /**
+ * Change the method being used to communicate.
+ *
+ * @param string|null request method. supports GET, POST, and HEAD. default is GET
+ */
+ function set_method($method = 'GET')
+ {
+ $this->method = strtoupper($method);
+ }
- * 2.7.1
- * added isset to headers['location'], line 306
+ /**
+ * Specify a username and password.
+ *
+ * @param string|null username. default is null
+ * @param string|null password. default is null
+ */
+ function set_login($uname = '', $passwd = '')
+ {
+ if (strlen($uname) > 0) {
+ $this->remote_uname = $uname;
+ }
- */
-class HTTPSocket {
-
- var $version = '3.0.2';
-
- /* all vars are private except $error, $query_cache, and $doFollowLocationHeader */
-
- var $method = 'GET';
-
- var $remote_host;
- var $remote_port;
- var $remote_uname;
- var $remote_passwd;
-
- var $result;
- var $result_header;
- var $result_body;
- var $result_status_code;
-
- var $lastTransferSpeed;
-
- var $bind_host;
-
- var $error = array();
- var $warn = array();
- var $query_cache = array();
-
- var $doFollowLocationHeader = TRUE;
- var $redirectURL;
- var $max_redirects = 5;
- var $ssl_setting_message = 'DirectAdmin appears to be using SSL. Change your script to connect to ssl://';
-
- var $extra_headers = array();
-
- /**
- * Create server "connection".
- *
- */
- function connect($host, $port = '' )
- {
- if (!is_numeric($port))
- {
- $port = 2222;
- }
-
- $this->remote_host = $host;
- $this->remote_port = $port;
- }
-
- function bind( $ip = '' )
- {
- if ( $ip == '' )
- {
- $ip = $_SERVER['SERVER_ADDR'];
- }
-
- $this->bind_host = $ip;
- }
-
- /**
- * Change the method being used to communicate.
- *
- * @param string|null request method. supports GET, POST, and HEAD. default is GET
- */
- function set_method( $method = 'GET' )
- {
- $this->method = strtoupper($method);
- }
-
- /**
- * Specify a username and password.
- *
- * @param string|null username. default is null
- * @param string|null password. default is null
- */
- function set_login( $uname = '', $passwd = '' )
- {
- if ( strlen($uname) > 0 )
- {
- $this->remote_uname = $uname;
- }
-
- if ( strlen($passwd) > 0 )
- {
- $this->remote_passwd = $passwd;
- }
-
- }
-
- /**
- * Query the server
- *
- * @param string containing properly formatted server API. See DA API docs and examples. Http:// URLs O.K. too.
- * @param string|array query to pass to url
- * @param int if connection KB/s drops below value here, will drop connection
- */
- function query( $request, $content = '', $doSpeedCheck = 0 )
- {
- $this->error = $this->warn = array();
- $this->result_status_code = NULL;
-
- $is_ssl = FALSE;
-
- // is our request a http:// ... ?
- if (preg_match('!^http://!i',$request) || preg_match('!^https://!i',$request))
- {
- $location = parse_url($request);
- if (preg_match('!^https://!i',$request))
- {
- $this->connect('https://'.$location['host'],$location['port']);
- }
- else
- $this->connect('http://'.$location['host'],$location['port']);
-
- $this->set_login($location['user'],$location['pass']);
-
- $request = $location['path'];
- $content = $location['query'];
-
- if ( strlen($request) < 1 )
- {
- $request = '/';
- }
-
- }
-
- if (preg_match('!^ssl://!i', $this->remote_host))
- $this->remote_host = 'https://'.substr($this->remote_host, 6);
-
- if (preg_match('!^tcp://!i', $this->remote_host))
- $this->remote_host = 'http://'.substr($this->remote_host, 6);
-
- if (preg_match('!^https://!i', $this->remote_host))
- $is_ssl = TRUE;
-
- $array_headers = array(
- 'Host' => ( $this->remote_port == 80 ? $this->remote_host : "$this->remote_host:$this->remote_port" ),
- 'Accept' => '*/*',
- 'Connection' => 'Close' );
-
- foreach ( $this->extra_headers as $key => $value )
- {
- $array_headers[$key] = $value;
- }
-
- $this->result = $this->result_header = $this->result_body = '';
-
- // was content sent as an array? if so, turn it into a string
- if (is_array($content))
- {
- $pairs = array();
-
- foreach ( $content as $key => $value )
- {
- $pairs[] = "$key=".urlencode($value);
- }
-
- $content = join('&',$pairs);
- unset($pairs);
- }
-
- $OK = TRUE;
-
- if ($this->method == 'GET')
- $request .= '?'.$content;
-
- $ch = curl_init($this->remote_host.':'.$this->remote_port.$request);
-
- if ($is_ssl)
- {
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //1
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); //2
- //curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
- }
-
- curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
- curl_setopt($ch, CURLOPT_USERAGENT, "HTTPSocket/$this->version");
- curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
- curl_setopt($ch, CURLOPT_TIMEOUT, 100);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
- curl_setopt($ch, CURLOPT_HEADER, 1);
-
- curl_setopt($ch, CURLOPT_LOW_SPEED_LIMIT, 512);
- curl_setopt($ch, CURLOPT_LOW_SPEED_TIME, 120);
-
- //if ($this->doFollowLocationHeader)
- //{
- // curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
- // curl_setopt($ch, CURLOPT_MAXREDIRS, $this->max_redirects);
- //}
-
- // instance connection
- if ($this->bind_host)
- {
- curl_setopt($ch, CURLOPT_INTERFACE, $this->bind_host);
- }
-
- // if we have a username and password, add the header
- if ( isset($this->remote_uname) && isset($this->remote_passwd) )
- {
- curl_setopt($ch, CURLOPT_USERPWD, $this->remote_uname.':'.$this->remote_passwd);
- }
-
- // for DA skins: if $this->remote_passwd is NULL, try to use the login key system
- if ( isset($this->remote_uname) && $this->remote_passwd == NULL )
- {
- $array_headers['Cookie'] = "session={$_SERVER['SESSION_ID']}; key={$_SERVER['SESSION_KEY']}";
- }
-
- // if method is POST, add content length & type headers
- if ( $this->method == 'POST' )
- {
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
-
- //$array_headers['Content-type'] = 'application/x-www-form-urlencoded';
- $array_headers['Content-length'] = strlen($content);
- }
-
- curl_setopt($ch, CURLOPT_HTTPHEADER, $array_headers);
-
-
- if( !($this->result = curl_exec($ch)) )
- {
- $this->error[] .= curl_error($ch);
- $OK = FALSE;
- }
-
- $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
- $this->result_header = substr($this->result, 0, $header_size);
- $this->result_body = substr($this->result, $header_size);
- $this->result_status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
-
- $this->lastTransferSpeed = curl_getinfo($ch, CURLINFO_SPEED_DOWNLOAD) / 1024;
-
- curl_close($ch);
-
- $this->query_cache[] = $this->remote_host.':'.$this->remote_port.$request;
-
- $headers = $this->fetch_header();
-
- // did we get the full file?
- if ( !empty($headers['content-length']) && $headers['content-length'] != strlen($this->result_body) )
- {
- $this->result_status_code = 206;
- }
-
- // now, if we're being passed a location header, should we follow it?
- if ($this->doFollowLocationHeader)
- {
- //dont bother if we didn't even setup the script correctly
- if (isset($headers['x-use-https']) && $headers['x-use-https']=='yes')
- die($this->ssl_setting_message);
-
- if (isset($headers['location']))
- {
- if ($this->max_redirects <= 0)
- die("Too many redirects on: ".$headers['location']);
-
- $this->max_redirects--;
- $this->redirectURL = $headers['location'];
- $this->query($headers['location']);
- }
- }
-
- }
-
- function getTransferSpeed()
- {
- return $this->lastTransferSpeed;
- }
-
- /**
- * The quick way to get a URL's content :)
- *
- * @param string URL
- * @param boolean return as array? (like PHP's file() command)
- * @return string result body
- */
- function get($location, $asArray = FALSE )
- {
- $this->query($location);
-
- if ( $this->get_status_code() == 200 )
- {
- if ($asArray)
- {
- return preg_split("/\n/",$this->fetch_body());
- }
-
- return $this->fetch_body();
- }
-
- return FALSE;
- }
-
- /**
- * Returns the last status code.
- * 200 = OK;
- * 403 = FORBIDDEN;
- * etc.
- *
- * @return int status code
- */
- function get_status_code()
- {
- return $this->result_status_code;
- }
-
- /**
- * Adds a header, sent with the next query.
- *
- * @param string header name
- * @param string header value
- */
- function add_header($key,$value)
- {
- $this->extra_headers[$key] = $value;
- }
-
- /**
- * Clears any extra headers.
- *
- */
- function clear_headers()
- {
- $this->extra_headers = array();
- }
-
- /**
- * Return the result of a query.
- *
- * @return string result
- */
- function fetch_result()
- {
- return $this->result;
- }
-
- /**
- * Return the header of result (stuff before body).
- *
- * @param string (optional) header to return
- * @return array result header
- */
- function fetch_header( $header = '' )
- {
- $array_headers = preg_split("/\r\n/",$this->result_header);
-
- $array_return = array( 0 => $array_headers[0] );
- unset($array_headers[0]);
-
- foreach ( $array_headers as $pair )
- {
- if ($pair == '' || $pair == "\r\n") continue;
- list($key,$value) = preg_split("/: /",$pair,2);
- $array_return[strtolower($key)] = $value;
- }
-
- if ( $header != '' )
- {
- return $array_return[strtolower($header)];
- }
-
- return $array_return;
- }
-
- /**
- * Return the body of result (stuff after header).
- *
- * @return string result body
- */
- function fetch_body()
- {
- return $this->result_body;
- }
-
- /**
- * Return parsed body in array format.
- *
- * @return array result parsed
- */
- function fetch_parsed_body()
- {
- parse_str($this->result_body,$x);
- return $x;
- }
-
- /**
- * Set a specifc message on how to change the SSL setting, in the event that it's not set correctly.
- */
- function set_ssl_setting_message($str)
- {
- $this->ssl_setting_message = $str;
- }
+ if (strlen($passwd) > 0) {
+ $this->remote_passwd = $passwd;
+ }
+
+ }
+
+ /**
+ * Query the server
+ *
+ * @param string containing properly formatted server API. See DA API docs and examples. Http:// URLs O.K. too.
+ * @param string|array query to pass to url
+ */
+ function query($request, $content = '')
+ {
+ $this->error = $this->warn = array();
+ $this->result_status_code = null;
+
+ $is_ssl = false;
+
+ // is our request a http:// ... ?
+ if (preg_match('!^http://!i',$request) || preg_match('!^https://!i',$request)) {
+ $location = parse_url($request);
+ if (preg_match('!^https://!i',$request)) {
+ $this->connect('https://'.$location['host'],$location['port']);
+ }
+ else {
+ $this->connect('http://'.$location['host'],$location['port']);
+ }
+
+ $this->set_login($location['user'],$location['pass']);
+
+ $request = $location['path'];
+ $content = $location['query'];
+
+ if (strlen($request) < 1) {
+ $request = '/';
+ }
+ }
+
+ if (preg_match('!^ssl://!i', $this->remote_host)) {
+ $this->remote_host = 'https://'.substr($this->remote_host, 6);
+ }
+
+ if (preg_match('!^tcp://!i', $this->remote_host)) {
+ $this->remote_host = 'http://'.substr($this->remote_host, 6);
+ }
+
+ if (preg_match('!^https://!i', $this->remote_host)) {
+ $is_ssl = true;
+ }
+
+ $array_headers = array(
+ 'Host' => $this->remote_port == 80 ? $this->remote_host : "$this->remote_host:$this->remote_port",
+ 'Accept' => '*/*',
+ 'Connection' => 'Close' );
+
+ foreach ($this->extra_headers as $key => $value) {
+ $array_headers[$key] = $value;
+ }
+
+ $this->result = $this->result_header = $this->result_body = '';
+
+ // was content sent as an array? if so, turn it into a string
+ if (is_array($content)) {
+ $pairs = array();
+
+ foreach ($content as $key => $value) {
+ $pairs[] = "$key=".urlencode($value);
+ }
+
+ $content = join('&',$pairs);
+ unset($pairs);
+ }
+
+ $OK = true;
+
+ if ($this->method == 'GET') {
+ $request .= '?'.$content;
+ }
+
+ $ch = curl_init($this->remote_host.':'.$this->remote_port.$request);
+
+ if ($is_ssl) {
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //1
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); //2
+ //curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
+ }
+
+ curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
+ curl_setopt($ch, CURLOPT_USERAGENT, "HTTPSocket/$this->version");
+ curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
+ curl_setopt($ch, CURLOPT_TIMEOUT, 100);
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
+ curl_setopt($ch, CURLOPT_HEADER, 1);
+
+ curl_setopt($ch, CURLOPT_LOW_SPEED_LIMIT, 512);
+ curl_setopt($ch, CURLOPT_LOW_SPEED_TIME, 120);
+
+ // instance connection
+ if ($this->bind_host) {
+ curl_setopt($ch, CURLOPT_INTERFACE, $this->bind_host);
+ }
+
+ // if we have a username and password, add the header
+ if (isset($this->remote_uname) && isset($this->remote_passwd)) {
+ curl_setopt($ch, CURLOPT_USERPWD, $this->remote_uname.':'.$this->remote_passwd);
+ }
+
+ // for DA skins: if $this->remote_passwd is NULL, try to use the login key system
+ if (isset($this->remote_uname) && $this->remote_passwd == NULL) {
+ $array_headers['Cookie'] = "session={$_SERVER['SESSION_ID']}; key={$_SERVER['SESSION_KEY']}";
+ }
+
+ // if method is POST, add content length & type headers
+ if ($this->method == 'POST') {
+ curl_setopt($ch, CURLOPT_POST, 1);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
+
+ //$array_headers['Content-type'] = 'application/x-www-form-urlencoded';
+ $array_headers['Content-length'] = strlen($content);
+ }
+
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $array_headers);
+
+ if(!($this->result = curl_exec($ch))) {
+ $this->error[] .= curl_error($ch);
+ $OK = false;
+ }
+
+ $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
+ $this->result_header = substr($this->result, 0, $header_size);
+ $this->result_body = substr($this->result, $header_size);
+ $this->result_status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+ $this->lastTransferSpeed = curl_getinfo($ch, CURLINFO_SPEED_DOWNLOAD) / 1024;
+
+ curl_close($ch);
+
+ $this->query_cache[] = $this->remote_host.':'.$this->remote_port.$request;
+
+ $headers = $this->fetch_header();
+
+ // did we get the full file?
+ if (!empty($headers['content-length']) && $headers['content-length'] != strlen($this->result_body)) {
+ $this->result_status_code = 206;
+ }
+
+ // now, if we're being passed a location header, should we follow it?
+ if ($this->doFollowLocationHeader) {
+ //dont bother if we didn't even setup the script correctly
+ if (isset($headers['x-use-https']) && $headers['x-use-https'] == 'yes') {
+ die($this->ssl_setting_message);
+ }
+
+ if (isset($headers['location'])) {
+ if ($this->max_redirects <= 0) {
+ die("Too many redirects on: ".$headers['location']);
+ }
+
+ $this->max_redirects--;
+ $this->redirectURL = $headers['location'];
+ $this->query($headers['location']);
+ }
+ }
+ }
+
+ function getTransferSpeed()
+ {
+ return $this->lastTransferSpeed;
+ }
+
+ /**
+ * The quick way to get a URL's content :)
+ *
+ * @param string URL
+ * @param boolean return as array? (like PHP's file() command)
+ * @return string result body
+ */
+ function get($location, $asArray = false)
+ {
+ $this->query($location);
+
+ if ($this->get_status_code() == 200) {
+ if ($asArray) {
+ return preg_split("/\n/",$this->fetch_body());
+ }
+
+ return $this->fetch_body();
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns the last status code.
+ * 200 = OK;
+ * 403 = FORBIDDEN;
+ * etc.
+ *
+ * @return int status code
+ */
+ function get_status_code()
+ {
+ return $this->result_status_code;
+ }
+
+ /**
+ * Adds a header, sent with the next query.
+ *
+ * @param string header name
+ * @param string header value
+ */
+ function add_header($key,$value)
+ {
+ $this->extra_headers[$key] = $value;
+ }
+
+ /**
+ * Clears any extra headers.
+ *
+ */
+ function clear_headers()
+ {
+ $this->extra_headers = array();
+ }
+
+ /**
+ * Return the result of a query.
+ *
+ * @return string result
+ */
+ function fetch_result()
+ {
+ return $this->result;
+ }
+
+ /**
+ * Return the header of result (stuff before body).
+ *
+ * @param string (optional) header to return
+ * @return array result header
+ */
+ function fetch_header($header = '')
+ {
+ $array_headers = preg_split("/\r\n/",$this->result_header);
+
+ $array_return = array(0 => $array_headers[0]);
+ unset($array_headers[0]);
+
+ foreach ($array_headers as $pair) {
+ if ($pair == '' || $pair == "\r\n") continue;
+ list($key,$value) = preg_split("/: /",$pair,2);
+ $array_return[strtolower($key)] = $value;
+ }
+
+ if ($header != '') {
+ return $array_return[strtolower($header)];
+ }
+
+ return $array_return;
+ }
+
+ /**
+ * Return the body of result (stuff after header).
+ *
+ * @return string result body
+ */
+ function fetch_body()
+ {
+ return $this->result_body;
+ }
+
+ /**
+ * Return parsed body in array format.
+ *
+ * @return array result parsed
+ */
+ function fetch_parsed_body()
+ {
+ parse_str($this->result_body,$x);
+ return $x;
+ }
+
+ /**
+ * Set a specifc message on how to change the SSL setting, in the event that it's not set correctly.
+ */
+ function set_ssl_setting_message($str)
+ {
+ $this->ssl_setting_message = $str;
+ }
}
diff --git a/plugins/password/drivers/domainfactory.php b/plugins/password/drivers/domainfactory.php
index 513e31e36..0183af02e 100644
--- a/plugins/password/drivers/domainfactory.php
+++ b/plugins/password/drivers/domainfactory.php
@@ -30,8 +30,6 @@ class rcube_domainfactory_password
{
function save($curpass, $passwd, $username)
{
- $rcmail = rcmail::get_instance();
-
if ($ch = curl_init()) {
// initial login
curl_setopt_array($ch, array(
diff --git a/plugins/password/drivers/gearman.php b/plugins/password/drivers/gearman.php
index a05e09a7f..21113d501 100644
--- a/plugins/password/drivers/gearman.php
+++ b/plugins/password/drivers/gearman.php
@@ -51,7 +51,7 @@ class rcube_gearman_password
'code' => 600,
'type' => 'php',
'file' => __FILE__, 'line' => __LINE__,
- 'message' => "Password plugin: Gearman authentication failed for user $username: $error"
+ 'message' => "Password plugin: Gearman authentication failed for user $username"
), true, false);
}
}
diff --git a/plugins/password/drivers/ldap_simple.php b/plugins/password/drivers/ldap_simple.php
index 33e939dad..cd5665005 100644
--- a/plugins/password/drivers/ldap_simple.php
+++ b/plugins/password/drivers/ldap_simple.php
@@ -85,7 +85,7 @@ class rcube_ldap_simple_password
$entry[$smblchattr] = time();
}
- $this->_debug("C: Modify $user_dn: " . print_r($entry, true));
+ $this->_debug("C: Modify {$this->user}: " . print_r($entry, true));
if (!ldap_modify($this->conn, $this->user, $entry)) {
$this->_debug("S: ".ldap_error($this->conn));
diff --git a/plugins/password/drivers/virtualmin.php b/plugins/password/drivers/virtualmin.php
index da8a59840..934b49057 100644
--- a/plugins/password/drivers/virtualmin.php
+++ b/plugins/password/drivers/virtualmin.php
@@ -33,7 +33,6 @@ class rcube_virtualmin_password
{
function save($currpass, $newpass, $username)
{
- $rcmail = rcmail::get_instance();
$curdir = RCUBE_PLUGINS_DIR . 'password/helpers';
$username = escapeshellarg($username);
diff --git a/plugins/password/drivers/zxcvbn.php b/plugins/password/drivers/zxcvbn.php
index 992fdc57a..0c80d73fe 100644
--- a/plugins/password/drivers/zxcvbn.php
+++ b/plugins/password/drivers/zxcvbn.php
@@ -55,7 +55,6 @@ class rcube_zxcvbn_password
return;
}
- $rcmail = rcmail::get_instance();
$zxcvbn = new ZxcvbnPhp\Zxcvbn();
$strength = $zxcvbn->passwordStrength($passwd);
diff --git a/plugins/password/password.php b/plugins/password/password.php
index 9be83ecec..42ba96c2f 100644
--- a/plugins/password/password.php
+++ b/plugins/password/password.php
@@ -132,7 +132,6 @@ class password extends rcube_plugin
$this->rc->output->set_pagetitle($this->gettext('changepasswd'));
- $form_disabled = $this->rc->config->get('password_disabled');
$confirm = $this->rc->config->get('password_confirm_current');
$required_length = intval($this->rc->config->get('password_minimum_length'));
$force_save = $this->rc->config->get('password_force_save');
diff --git a/plugins/zipdownload/zipdownload.php b/plugins/zipdownload/zipdownload.php
index 5a53ef6cf..4e5562133 100644
--- a/plugins/zipdownload/zipdownload.php
+++ b/plugins/zipdownload/zipdownload.php
@@ -133,7 +133,6 @@ class zipdownload extends rcube_plugin
// require CSRF protected request
$rcmail->request_security_check(rcube_utils::INPUT_GET);
- $imap = $rcmail->get_storage();
$tmpfname = rcube_utils::temp_filename('zipdownload');
$tempfiles = array($tmpfname);
$message = new rcube_message(rcube_utils::get_input_value('_uid', rcube_utils::INPUT_GET));