From 9f1f754daf4b57a0d0d3aea95d2321716d218cf5 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 22 Nov 2015 03:41:53 -0500
Subject: [PATCH] CS fixes
---
plugins/enigma/lib/enigma_mime_message.php | 2
plugins/http_authentication/http_authentication.php | 2
plugins/debug_logger/runlog/runlog.php | 2
plugins/acl/acl.php | 2
plugins/debug_logger/debug_logger.php | 2
plugins/userinfo/userinfo.php | 79 +++++++++----------
plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php | 6
plugins/managesieve/managesieve.php | 2
plugins/redundant_attachments/redundant_attachments.php | 2
plugins/attachment_reminder/attachment_reminder.php | 0
plugins/enigma/lib/enigma_error.php | 7 -
plugins/attachment_reminder/attachment_reminder.js | 0
plugins/help/help.php | 5
plugins/hide_blockquote/hide_blockquote.php | 4
plugins/markasjunk/markasjunk.php | 101 +++++++++++++------------
plugins/zipdownload/zipdownload.php | 4
plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php | 8 +-
plugins/database_attachments/database_attachments.php | 2
plugins/managesieve/lib/Roundcube/rcube_sieve.php | 2
plugins/subscriptions_option/subscriptions_option.php | 2
20 files changed, 116 insertions(+), 118 deletions(-)
diff --git a/plugins/acl/acl.php b/plugins/acl/acl.php
index 2526683..8058656 100644
--- a/plugins/acl/acl.php
+++ b/plugins/acl/acl.php
@@ -123,7 +123,7 @@
$group_id = is_array($record[$group_field]) ? $record[$group_field][0] : $record[$group_field];
if ($group) {
- $users[] = array('name' => ($prefix ? $prefix : '') . $group_id, 'display' => $group, 'type' => 'group');
+ $users[] = array('name' => ($prefix ?: '') . $group_id, 'display' => $group, 'type' => 'group');
$keys[] = $group;
}
}
diff --git a/plugins/attachment_reminder/attachment_reminder.js b/plugins/attachment_reminder/attachment_reminder.js
old mode 100755
new mode 100644
diff --git a/plugins/attachment_reminder/attachment_reminder.php b/plugins/attachment_reminder/attachment_reminder.php
old mode 100755
new mode 100644
diff --git a/plugins/database_attachments/database_attachments.php b/plugins/database_attachments/database_attachments.php
index f3804f3..aacafae 100644
--- a/plugins/database_attachments/database_attachments.php
+++ b/plugins/database_attachments/database_attachments.php
@@ -155,7 +155,7 @@
*/
protected function _key($args)
{
- $uname = $args['path'] ? $args['path'] : $args['name'];
+ $uname = $args['path'] ?: $args['name'];
return $args['group'] . md5(time() . $uname . $_SESSION['user_id']);
}
diff --git a/plugins/debug_logger/debug_logger.php b/plugins/debug_logger/debug_logger.php
index 07190e5..c66b8b6 100644
--- a/plugins/debug_logger/debug_logger.php
+++ b/plugins/debug_logger/debug_logger.php
@@ -18,7 +18,7 @@
* @version @package_version@
* @author Ziba Scott
* @website http://roundcube.net
- *
+ *
* Example:
*
* config.inc.php:
diff --git a/plugins/debug_logger/runlog/runlog.php b/plugins/debug_logger/runlog/runlog.php
index 0f43df8..ae352bd 100644
--- a/plugins/debug_logger/runlog/runlog.php
+++ b/plugins/debug_logger/runlog/runlog.php
@@ -130,7 +130,7 @@
$this->debug_messages[] = $msg;
$this->run_log[] = array(
'type' => 'note',
- 'tag' => $tag ? $tag:"text",
+ 'tag' => $tag ?: 'text',
'value' => htmlentities($msg),
'time' => microtime(true),
'parents' => $this->parent_stack,
diff --git a/plugins/enigma/lib/enigma_error.php b/plugins/enigma/lib/enigma_error.php
index d563854..d5f190b 100644
--- a/plugins/enigma/lib/enigma_error.php
+++ b/plugins/enigma/lib/enigma_error.php
@@ -51,11 +51,6 @@
function getData($name)
{
- if ($name) {
- return $this->data[$name];
- }
- else {
- return $this->data;
- }
+ return $name ? $this->data[$name] : $this->data;
}
}
diff --git a/plugins/enigma/lib/enigma_mime_message.php b/plugins/enigma/lib/enigma_mime_message.php
index 395de8f..07afef5 100644
--- a/plugins/enigma/lib/enigma_mime_message.php
+++ b/plugins/enigma/lib/enigma_mime_message.php
@@ -264,7 +264,7 @@
{
$this->checkParams();
- $eol = !empty($this->build_params['eol']) ? $this->build_params['eol'] : "\r\n";
+ $eol = $this->build_params['eol'] ?: "\r\n";
// multipart message: and boundary
if (!empty($this->build_params['boundary'])) {
diff --git a/plugins/help/help.php b/plugins/help/help.php
index 5387c9f..029ab97 100644
--- a/plugins/help/help.php
+++ b/plugins/help/help.php
@@ -155,9 +155,10 @@
private function resolve_language($path)
{
// resolve language placeholder
- $rcmail = rcmail::get_instance();
+ $rcmail = rcmail::get_instance();
$langmap = $rcmail->config->get('help_language_map', array('*' => 'en_US'));
- $lang = !empty($langmap[$_SESSION['language']]) ? $langmap[$_SESSION['language']] : $langmap['*'];
+ $lang = $langmap[$_SESSION['language']] ?: $langmap['*'];
+
return str_replace('%l', $lang, $path);
}
}
diff --git a/plugins/hide_blockquote/hide_blockquote.php b/plugins/hide_blockquote/hide_blockquote.php
index 2ad5dd8..cf999be 100644
--- a/plugins/hide_blockquote/hide_blockquote.php
+++ b/plugins/hide_blockquote/hide_blockquote.php
@@ -59,8 +59,8 @@
$input = new html_inputfield(array('name' => '_'.$field_id, 'id' => $field_id, 'size' => 5));
$args['blocks']['main']['options']['hide_blockquote_limit'] = array(
- 'title' => $this->gettext('quotelimit'),
- 'content' => $input->show($limit ? $limit : '')
+ 'title' => $this->gettext('quotelimit'),
+ 'content' => $input->show($limit ?: '')
);
return $args;
diff --git a/plugins/http_authentication/http_authentication.php b/plugins/http_authentication/http_authentication.php
index 39d7015..d3be5b7 100644
--- a/plugins/http_authentication/http_authentication.php
+++ b/plugins/http_authentication/http_authentication.php
@@ -93,7 +93,7 @@
// We'll set it back on startup (#1486553)
rcmail::get_instance()->session->remove('password');
}
-
+
function login($args)
{
// Redirect to the previous QUERY_STRING
diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve.php b/plugins/managesieve/lib/Roundcube/rcube_sieve.php
index 898f694..2d000fe 100644
--- a/plugins/managesieve/lib/Roundcube/rcube_sieve.php
+++ b/plugins/managesieve/lib/Roundcube/rcube_sieve.php
@@ -111,7 +111,7 @@
*/
public function error()
{
- return $this->error ? $this->error : false;
+ return $this->error ?: false;
}
/**
diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
index 2e267eb..987c639 100644
--- a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
+++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
@@ -633,8 +633,8 @@
foreach ($sizeitems as $item)
$items[] = $item;
- $this->form['disabled'] = $_POST['_disabled'] ? true : false;
- $this->form['join'] = $join=='allof' ? true : false;
+ $this->form['disabled'] = !empty($_POST['_disabled']);
+ $this->form['join'] = $join == 'allof';
$this->form['name'] = $name;
$this->form['tests'] = array();
$this->form['actions'] = array();
@@ -1685,7 +1685,7 @@
$test = $rule['type'];
}
else if (in_array($rule['test'], $set)) {
- $test = ($rule['not'] ? 'not' : '') . ($rule['type'] ? $rule['type'] : 'is');
+ $test = ($rule['not'] ? 'not' : '') . ($rule['type'] ?: 'is');
}
else {
$test = ($rule['not'] ? 'not' : '') . $rule['test'];
@@ -2358,7 +2358,7 @@
if (empty($filter['actions'])) {
continue;
}
- $fname = $filter['name'] ? $filter['name'] : "#$i";
+ $fname = $filter['name'] ?: "#$i";
$result[] = array(
'id' => $idx,
'name' => $fname,
diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php
index 13082cd..932aaaa 100644
--- a/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php
+++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php
@@ -312,7 +312,7 @@
}
}
- $this->rc->output->show_message($error ? $error : 'managesieve.saveerror', 'error');
+ $this->rc->output->show_message($error ?: 'managesieve.saveerror', 'error');
$this->rc->output->send();
}
@@ -327,7 +327,7 @@
$seconds_extension = in_array('vacation-seconds', $this->exts);
// build FORM tag
- $form_id = !empty($attrib['id']) ? $attrib['id'] : 'form';
+ $form_id = $attrib['id'] ?: 'form';
$out = $this->rc->output->request_form(array(
'id' => $form_id,
'name' => $form_id,
@@ -597,7 +597,7 @@
}
}
- return $interval ? $interval : '';
+ return $interval ?: '';
}
/**
diff --git a/plugins/managesieve/managesieve.php b/plugins/managesieve/managesieve.php
index 6643847..68d56a1 100644
--- a/plugins/managesieve/managesieve.php
+++ b/plugins/managesieve/managesieve.php
@@ -239,7 +239,7 @@
$include_path .= ini_get('include_path');
set_include_path($include_path);
- $class_name = 'rcube_sieve_' . ($type ? $type : 'engine');
+ $class_name = 'rcube_sieve_' . ($type ?: 'engine');
$this->engine = new $class_name($this);
}
diff --git a/plugins/markasjunk/markasjunk.php b/plugins/markasjunk/markasjunk.php
index d07b494..1f92390 100644
--- a/plugins/markasjunk/markasjunk.php
+++ b/plugins/markasjunk/markasjunk.php
@@ -12,64 +12,67 @@
*/
class markasjunk extends rcube_plugin
{
- public $task = 'mail';
+ public $task = 'mail';
- function init()
- {
- $rcmail = rcmail::get_instance();
+ function init()
+ {
+ $rcmail = rcmail::get_instance();
- $this->register_action('plugin.markasjunk', array($this, 'request_action'));
- $this->add_hook('storage_init', array($this, 'storage_init'));
+ $this->register_action('plugin.markasjunk', array($this, 'request_action'));
+ $this->add_hook('storage_init', array($this, 'storage_init'));
- if ($rcmail->action == '' || $rcmail->action == 'show') {
- $skin_path = $this->local_skin_path();
- $this->include_script('markasjunk.js');
- if (is_file($this->home . "/$skin_path/markasjunk.css"))
- $this->include_stylesheet("$skin_path/markasjunk.css");
- $this->add_texts('localization', true);
+ if ($rcmail->action == '' || $rcmail->action == 'show') {
+ $skin_path = $this->local_skin_path();
- $this->add_button(array(
- 'type' => 'link',
- 'label' => 'buttontext',
- 'command' => 'plugin.markasjunk',
- 'class' => 'button buttonPas junk disabled',
- 'classact' => 'button junk',
- 'title' => 'buttontitle',
- 'domain' => 'markasjunk'), 'toolbar');
- }
- }
+ $this->add_texts('localization', true);
+ $this->include_script('markasjunk.js');
- function storage_init($args)
- {
- $flags = array(
- 'JUNK' => 'Junk',
- 'NONJUNK' => 'NonJunk',
- );
+ if (is_file($this->home . "/$skin_path/markasjunk.css")) {
+ $this->include_stylesheet("$skin_path/markasjunk.css");
+ }
- // register message flags
- $args['message_flags'] = array_merge((array)$args['message_flags'], $flags);
-
- return $args;
- }
-
- function request_action()
- {
- $this->add_texts('localization');
-
- $rcmail = rcmail::get_instance();
- $storage = $rcmail->get_storage();
-
- foreach (rcmail::get_uids() as $mbox => $uids) {
- $storage->unset_flag($uids, 'NONJUNK', $mbox);
- $storage->set_flag($uids, 'JUNK', $mbox);
+ $this->add_button(array(
+ 'type' => 'link',
+ 'label' => 'buttontext',
+ 'command' => 'plugin.markasjunk',
+ 'class' => 'button buttonPas junk disabled',
+ 'classact' => 'button junk',
+ 'title' => 'buttontitle',
+ 'domain' => 'markasjunk'
+ ),'toolbar');
+ }
}
- if (($junk_mbox = $rcmail->config->get('junk_mbox'))) {
- $rcmail->output->command('move_messages', $junk_mbox);
+ function storage_init($args)
+ {
+ $flags = array(
+ 'JUNK' => 'Junk',
+ 'NONJUNK' => 'NonJunk',
+ );
+
+ // register message flags
+ $args['message_flags'] = array_merge((array)$args['message_flags'], $flags);
+
+ return $args;
}
- $rcmail->output->command('display_message', $this->gettext('reportedasjunk'), 'confirmation');
- $rcmail->output->send();
- }
+ function request_action()
+ {
+ $this->add_texts('localization');
+ $rcmail = rcmail::get_instance();
+ $storage = $rcmail->get_storage();
+
+ foreach (rcmail::get_uids() as $mbox => $uids) {
+ $storage->unset_flag($uids, 'NONJUNK', $mbox);
+ $storage->set_flag($uids, 'JUNK', $mbox);
+ }
+
+ if (($junk_mbox = $rcmail->config->get('junk_mbox'))) {
+ $rcmail->output->command('move_messages', $junk_mbox);
+ }
+
+ $rcmail->output->command('display_message', $this->gettext('reportedasjunk'), 'confirmation');
+ $rcmail->output->send();
+ }
}
diff --git a/plugins/redundant_attachments/redundant_attachments.php b/plugins/redundant_attachments/redundant_attachments.php
index 55ec3be..52a7ea3 100644
--- a/plugins/redundant_attachments/redundant_attachments.php
+++ b/plugins/redundant_attachments/redundant_attachments.php
@@ -90,7 +90,7 @@
*/
private function _key($args)
{
- $uname = $args['path'] ? $args['path'] : $args['name'];
+ $uname = $args['path'] ?: $args['name'];
return $args['group'] . md5(time() . $uname . $_SESSION['user_id']);
}
diff --git a/plugins/subscriptions_option/subscriptions_option.php b/plugins/subscriptions_option/subscriptions_option.php
index 5b926f2..fa40631 100644
--- a/plugins/subscriptions_option/subscriptions_option.php
+++ b/plugins/subscriptions_option/subscriptions_option.php
@@ -61,7 +61,7 @@
$rcmail = rcmail::get_instance();
$use_subscriptions = $rcmail->config->get('use_subscriptions');
- $args['prefs']['use_subscriptions'] = isset($_POST['_use_subscriptions']) ? true : false;
+ $args['prefs']['use_subscriptions'] = isset($_POST['_use_subscriptions']);
// if the use_subscriptions preference changes, flush the folder cache
if (($use_subscriptions && !isset($_POST['_use_subscriptions'])) ||
diff --git a/plugins/userinfo/userinfo.php b/plugins/userinfo/userinfo.php
index a175563..74c099f 100644
--- a/plugins/userinfo/userinfo.php
+++ b/plugins/userinfo/userinfo.php
@@ -6,50 +6,49 @@
*/
class userinfo extends rcube_plugin
{
- public $task = 'settings';
- public $noajax = true;
- public $noframe = true;
+ public $task = 'settings';
+ public $noajax = true;
+ public $noframe = true;
- function init()
- {
- $this->add_texts('localization/', array('userinfo'));
- $this->register_action('plugin.userinfo', array($this, 'infostep'));
- $this->include_script('userinfo.js');
- }
+ function init()
+ {
+ $this->add_texts('localization/', array('userinfo'));
+ $this->register_action('plugin.userinfo', array($this, 'infostep'));
+ $this->include_script('userinfo.js');
+ }
- function infostep()
- {
- $this->register_handler('plugin.body', array($this, 'infohtml'));
- rcmail::get_instance()->output->send('plugin');
- }
-
- function infohtml()
- {
- $rcmail = rcmail::get_instance();
- $user = $rcmail->user;
-
- $table = new html_table(array('cols' => 2, 'cellpadding' => 3));
+ function infostep()
+ {
+ $this->register_handler('plugin.body', array($this, 'infohtml'));
+ rcmail::get_instance()->output->send('plugin');
+ }
- $table->add('title', 'ID');
- $table->add('', rcube::Q($user->ID));
-
- $table->add('title', rcube::Q($this->gettext('username')));
- $table->add('', rcube::Q($user->data['username']));
-
- $table->add('title', rcube::Q($this->gettext('server')));
- $table->add('', rcube::Q($user->data['mail_host']));
+ function infohtml()
+ {
+ $rcmail = rcmail::get_instance();
+ $user = $rcmail->user;
+ $identity = $user->get_identity();
- $table->add('title', rcube::Q($this->gettext('created')));
- $table->add('', rcube::Q($user->data['created']));
+ $table = new html_table(array('cols' => 2, 'cellpadding' => 3));
- $table->add('title', rcube::Q($this->gettext('lastlogin')));
- $table->add('', rcube::Q($user->data['last_login']));
-
- $identity = $user->get_identity();
- $table->add('title', rcube::Q($this->gettext('defaultidentity')));
- $table->add('', rcube::Q($identity['name'] . ' <' . $identity['email'] . '>'));
-
- return html::tag('h4', null, rcube::Q('Infos for ' . $user->get_username())) . $table->show();
- }
+ $table->add('title', 'ID');
+ $table->add('', rcube::Q($user->ID));
+ $table->add('title', rcube::Q($this->gettext('username')));
+ $table->add('', rcube::Q($user->data['username']));
+
+ $table->add('title', rcube::Q($this->gettext('server')));
+ $table->add('', rcube::Q($user->data['mail_host']));
+
+ $table->add('title', rcube::Q($this->gettext('created')));
+ $table->add('', rcube::Q($user->data['created']));
+
+ $table->add('title', rcube::Q($this->gettext('lastlogin')));
+ $table->add('', rcube::Q($user->data['last_login']));
+
+ $table->add('title', rcube::Q($this->gettext('defaultidentity')));
+ $table->add('', rcube::Q($identity['name'] . ' <' . $identity['email'] . '>'));
+
+ return html::tag('h4', null, rcube::Q('Infos for ' . $user->get_username())) . $table->show();
+ }
}
diff --git a/plugins/zipdownload/zipdownload.php b/plugins/zipdownload/zipdownload.php
index 983db12..2928f49 100644
--- a/plugins/zipdownload/zipdownload.php
+++ b/plugins/zipdownload/zipdownload.php
@@ -156,7 +156,7 @@
$zip->close();
- $filename = ($message->subject ? $message->subject : 'roundcube') . '.zip';
+ $filename = ($message->subject ?: 'roundcube') . '.zip';
$this->_deliver_zipfile($tmpfname, $filename);
// delete temporary files from disk
@@ -247,7 +247,7 @@
$subject = $this->_convert_filename($subject);
$subject = substr($subject, 0, 16);
- $disp_name = ($subject ? $subject : 'message_rfc822') . ".eml";
+ $disp_name = ($subject ?: 'message_rfc822') . ".eml";
$disp_name = $path . $uid . "_" . $disp_name;
$tmpfn = tempnam($temp_dir, 'zipmessage');
--
Gitblit v1.9.1