From 8271597836eeb9b6f50062c1ce6d685cb61e0e72 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Mon, 16 Nov 2015 03:11:47 -0500
Subject: [PATCH] Use ternary operator where applicable

---
 program/steps/addressbook/list.inc       |    2 
 program/steps/addressbook/undo.inc       |    2 
 program/steps/mail/compose.inc           |    6 +-
 program/steps/addressbook/delete.inc     |    2 
 program/steps/mail/show.inc              |    2 
 program/steps/settings/about.inc         |    6 +-
 program/steps/mail/list_contacts.inc     |    2 
 program/steps/settings/edit_folder.inc   |    2 
 program/steps/mail/func.inc              |    8 +-
 program/steps/settings/func.inc          |   12 ++--
 program/steps/addressbook/show.inc       |    2 
 program/steps/mail/mark.inc              |    2 
 program/steps/addressbook/copy.inc       |    2 
 program/steps/mail/addcontact.inc        |    4 
 program/steps/settings/identities.inc    |    2 
 program/steps/addressbook/move.inc       |    6 +-
 program/steps/addressbook/edit.inc       |   10 +-
 program/steps/addressbook/save.inc       |    8 +-
 program/steps/addressbook/func.inc       |   12 ++--
 program/steps/mail/viewsource.inc        |    4 
 program/steps/settings/save_identity.inc |    6 +-
 program/steps/mail/sendmail.inc          |    6 +-
 program/steps/settings/save_prefs.inc    |    2 
 program/steps/settings/edit_identity.inc |   13 +--
 program/steps/addressbook/groups.inc     |   12 ++--
 program/steps/addressbook/import.inc     |    4 
 program/steps/addressbook/print.inc      |    2 
 program/steps/settings/save_folder.inc   |    4 
 program/steps/mail/search_contacts.inc   |    2 
 program/steps/mail/get.inc               |    2 
 program/steps/addressbook/search.inc     |    8 +-
 31 files changed, 77 insertions(+), 80 deletions(-)

diff --git a/program/steps/addressbook/copy.inc b/program/steps/addressbook/copy.inc
index da1a466..6c1c0e8 100644
--- a/program/steps/addressbook/copy.inc
+++ b/program/steps/addressbook/copy.inc
@@ -115,7 +115,7 @@
             $success = $plugin['result'];
         }
 
-        $errormsg = $plugin['message'] ? $plugin['message'] : 'copyerror';
+        $errormsg = $plugin['message'] ?: 'copyerror';
     }
 }
 
diff --git a/program/steps/addressbook/delete.inc b/program/steps/addressbook/delete.inc
index 51b6e1b..fb860df 100644
--- a/program/steps/addressbook/delete.inc
+++ b/program/steps/addressbook/delete.inc
@@ -143,7 +143,7 @@
 
 // update message count display
 $OUTPUT->set_env('pagecount', ceil($result->count / $PAGE_SIZE));
-$OUTPUT->command('set_rowcount', $rowcount ? $rowcount : rcmail_get_rowcount_text($result));
+$OUTPUT->command('set_rowcount', $rowcount ?: rcmail_get_rowcount_text($result));
 
 // add new rows from next page (if any)
 if (!empty($records)) {
diff --git a/program/steps/addressbook/edit.inc b/program/steps/addressbook/edit.inc
index e945429..a826f17 100644
--- a/program/steps/addressbook/edit.inc
+++ b/program/steps/addressbook/edit.inc
@@ -104,7 +104,7 @@
 
     // check if we have a valid result
     $record = rcmail_get_edit_record();
-    $i_size = !empty($attrib['size']) ? $attrib['size'] : 20;
+    $i_size = $attrib['size'] ?: 20;
 
     $form = array(
         'head' => array(
@@ -143,9 +143,9 @@
     if (preg_match_all('/\{([a-z0-9]+)\}([^{]*)/i', $RCMAIL->config->get('address_template', ''), $templ, PREG_SET_ORDER))
       $RCMAIL->output->set_env('address_template', $templ);
 
-    $i_size = !empty($attrib['size']) ? $attrib['size'] : 40;
-    $t_rows = !empty($attrib['textarearows']) ? $attrib['textarearows'] : 10;
-    $t_cols = !empty($attrib['textareacols']) ? $attrib['textareacols'] : 40;
+    $i_size = $attrib['size'] ?: 40;
+    $t_rows = $attrib['textarearows'] ?: 10;
+    $t_cols = $attrib['textareacols'] ?: 40;
 
     $form = array(
         'contact' => array(
@@ -270,7 +270,7 @@
             'noclose' => true) + $attrib, $hiddenfields->show());
         $form_end = !strlen($attrib['form']) ? '</form>' : '';
 
-        $EDIT_FORM = !empty($attrib['form']) ? $attrib['form'] : 'form';
+        $EDIT_FORM = $attrib['form'] ?: 'form';
         $RCMAIL->output->add_gui_object('editform', $EDIT_FORM);
     }
 
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index fee2095..5b85705 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -234,7 +234,7 @@
         if ($source['class_name'])
             $class_name .= ' ' . $source['class_name'];
 
-        $name = !empty($source['name']) ? $source['name'] : $id;
+        $name = $source['name'] ?: $id;
         $out .= sprintf($line_templ,
             rcube_utils::html_identifier($id, true),
             $class_name,
@@ -292,7 +292,7 @@
             rcube_utils::html_identifier('S'.$id, true),
             join(' ', $classes),
             $id,
-            $js_id, (!empty($source['name']) ? rcube::Q($source['name']) : rcube::Q($id))
+            $js_id, rcube::Q($source['name'] ?: $id)
         );
     }
 
@@ -385,7 +385,7 @@
 
         $source_id  = $OUTPUT->get_env('source');
         $a_row_cols = array();
-        $classes    = array($row['_type'] ? $row['_type'] : 'person');
+        $classes    = array($row['_type'] ?: 'person');
 
         // build contact ID with source ID
         if (isset($row['sourceid'])) {
@@ -485,7 +485,7 @@
         $out = $RCMAIL->gettext('nocontactsfound');
     else
         $out = $RCMAIL->gettext(array(
-            'name'  => $_SESSION['contactcountdisplay'] ? $_SESSION['contactcountdisplay'] : 'contactsfromto',
+            'name'  => $_SESSION['contactcountdisplay'] ?: 'contactsfromto',
             'vars'  => array(
             'from'  => $result->first + 1,
             'to'    => min($result->count, $result->first + $PAGE_SIZE),
@@ -660,7 +660,7 @@
                         }
                     }
                     else {
-                        $values = $record[$fullkey] ? $record[$fullkey] : $record[$field];
+                        $values   = $record[$fullkey] ?: $record[$field];
                         $subtypes = null;
                     }
                 }
@@ -687,7 +687,7 @@
                         $template = $RCMAIL->config->get($col . '_template', '{'.join('} {', array_keys($colprop['childs'])).'}');
                         foreach ($colprop['childs'] as $childcol => $cp) {
                             if (!empty($val) && is_array($val)) {
-                                $childvalue = $val[$childcol] ? $val[$childcol] : $val[$j];
+                                $childvalue = $val[$childcol] ?: $val[$j];
                             }
                             else {
                                 $childvalue = '';
diff --git a/program/steps/addressbook/groups.inc b/program/steps/addressbook/groups.inc
index 81ee94b..68665b7 100644
--- a/program/steps/addressbook/groups.inc
+++ b/program/steps/addressbook/groups.inc
@@ -53,9 +53,9 @@
         if ($result)
             $OUTPUT->show_message('contactaddedtogroup');
         else if ($plugin['abort'] || $CONTACTS->get_error())
-            $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error');
+            $OUTPUT->show_message($plugin['message'] ?: 'errorsaving', 'error');
         else
-            $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'nogroupassignmentschanged');
+            $OUTPUT->show_message($plugin['message'] ?: 'nogroupassignmentschanged');
     }
 }
 else if ($RCMAIL->action == 'group-delmembers') {
@@ -76,7 +76,7 @@
             $OUTPUT->command('remove_group_contacts',array('source' => $source, 'gid' => $gid));
         }
         else {
-            $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error');
+            $OUTPUT->show_message($plugin['message'] ?: 'errorsaving', 'error');
         }
     }
 }
@@ -100,7 +100,7 @@
         $OUTPUT->command('insert_contact_group', array('source' => $source) + $created);
     }
     else if (!$created) {
-        $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error');
+        $OUTPUT->show_message($plugin['message'] ?: 'errorsaving', 'error');
     }
 }
 else if ($RCMAIL->action == 'group-rename') {
@@ -125,7 +125,7 @@
             'source' => $source, 'id' => $gid, 'name' => rcube::Q($newname), 'newid' => $newgid));
     }
     else if (!$newname) {
-        $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error');
+        $OUTPUT->show_message($plugin['message'] ?: 'errorsaving', 'error');
     }
 }
 else if ($RCMAIL->action == 'group-delete') {
@@ -146,7 +146,7 @@
         $OUTPUT->command('remove_group_item', array('source' => $source, 'id' => $gid));
     }
     else {
-        $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error');
+        $OUTPUT->show_message($plugin['message'] ?: 'errorsaving', 'error');
     }
 }
 
diff --git a/program/steps/addressbook/import.inc b/program/steps/addressbook/import.inc
index 9c108ff..4425498 100644
--- a/program/steps/addressbook/import.inc
+++ b/program/steps/addressbook/import.inc
@@ -136,7 +136,7 @@
                 }
                 if ($existing && $existing->count) {
                     $IMPORT_STATS->skipped++;
-                    $IMPORT_STATS->skipped_names[] = $vcard->displayname ? $vcard->displayname : $email;
+                    $IMPORT_STATS->skipped_names[] = $vcard->displayname ?: $email;
                     continue;
                 }
             }
@@ -164,7 +164,7 @@
                 }
 
                 $IMPORT_STATS->inserted++;
-                $IMPORT_STATS->names[] = $a_record['name'] ? $a_record['name'] : $email;
+                $IMPORT_STATS->names[] = $a_record['name'] ?: $email;
             }
             else {
                 $IMPORT_STATS->errors++;
diff --git a/program/steps/addressbook/list.inc b/program/steps/addressbook/list.inc
index be46427..1918f91 100644
--- a/program/steps/addressbook/list.inc
+++ b/program/steps/addressbook/list.inc
@@ -22,7 +22,7 @@
 if (!empty($_GET['_page']))
     $page = intval($_GET['_page']);
 else
-    $page = !empty($_SESSION['page']) ? $_SESSION['page'] : 1;
+    $page = $_SESSION['page'] ?: 1;
 
 $_SESSION['page'] = $page;
 
diff --git a/program/steps/addressbook/move.inc b/program/steps/addressbook/move.inc
index 9a1473c..bdbf4b1 100644
--- a/program/steps/addressbook/move.inc
+++ b/program/steps/addressbook/move.inc
@@ -33,7 +33,7 @@
 $success  = 0;
 $errormsg = 'moveerror';
 $maxnum   = $RCMAIL->config->get('max_group_members', 0);
-$page     = !empty($_SESSION['page']) ? $_SESSION['page'] : 1;
+$page     = $_SESSION['page'] ?: 1;
 
 foreach ($cids as $source => $source_cids) {
     // Something wrong, target not specified
@@ -137,7 +137,7 @@
             $success = $plugin['result'];
         }
 
-        $errormsg = $plugin['message'] ? $plugin['message'] : 'moveerror';
+        $errormsg = $plugin['message'] ?: 'moveerror';
     }
 }
 
@@ -197,7 +197,7 @@
 
     // update message count display
     $OUTPUT->set_env('pagecount', ceil($result->count / $PAGE_SIZE));
-    $OUTPUT->command('set_rowcount', $rowcount ? $rowcount : rcmail_get_rowcount_text($result));
+    $OUTPUT->command('set_rowcount', $rowcount ?: rcmail_get_rowcount_text($result));
 
     // add new rows from next page (if any)
     if (!empty($records)) {
diff --git a/program/steps/addressbook/print.inc b/program/steps/addressbook/print.inc
index de02660..232e105 100644
--- a/program/steps/addressbook/print.inc
+++ b/program/steps/addressbook/print.inc
@@ -83,7 +83,7 @@
         return false;
     }
 
-    $i_size = !empty($attrib['size']) ? $attrib['size'] : 40;
+    $i_size = $attrib['size'] ?: 40;
 
     $form = array(
         'contact' => array(
diff --git a/program/steps/addressbook/save.inc b/program/steps/addressbook/save.inc
index 4f35949..3f2a75c 100644
--- a/program/steps/addressbook/save.inc
+++ b/program/steps/addressbook/save.inc
@@ -124,7 +124,7 @@
     else if ($tempfile = $_SESSION['contacts']['files'][$a_record['photo']]) {
         $tempfile = $RCMAIL->plugins->exec_hook('attachment_get', $tempfile);
         if ($tempfile['status'])
-            $a_record['photo'] = $tempfile['data'] ? $tempfile['data'] : @file_get_contents($tempfile['path']);
+            $a_record['photo'] = $tempfile['data'] ?: @file_get_contents($tempfile['path']);
     }
     else
         unset($a_record['photo']);
@@ -166,7 +166,7 @@
 
         // define list of cols to be displayed
         $a_js_cols = array();
-        $record = $CONTACTS->get_record($newcid ? $newcid : $cid, true);
+        $record = $CONTACTS->get_record($newcid ?: $cid, true);
         $record['email'] = reset($CONTACTS->get_col_values('email', $record, true));
         $record['name']  = rcube_addressbook::compose_list_name($record);
 
@@ -186,7 +186,7 @@
     else {
         // show error message
         $err = $CONTACTS->get_error();
-        $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : ($err['message'] ? $err['message'] : 'errorsaving'), 'error', null, false);
+        $OUTPUT->show_message($plugin['message'] ?: ($err['message'] ?: 'errorsaving'), 'error', null, false);
         $RCMAIL->overwrite_action('show');
     }
 }
@@ -249,7 +249,7 @@
     else {
         // show error message
         $err = $CONTACTS->get_error();
-        $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : ($err['message'] ? $err['message'] : 'errorsaving'), 'error', null, false);
+        $OUTPUT->show_message($plugin['message'] ?: ($err['message'] ?: 'errorsaving'), 'error', null, false);
         $RCMAIL->overwrite_action('add');
     }
 }
diff --git a/program/steps/addressbook/search.inc b/program/steps/addressbook/search.inc
index d5d5c32..f16abd7 100644
--- a/program/steps/addressbook/search.inc
+++ b/program/steps/addressbook/search.inc
@@ -49,7 +49,7 @@
         $OUTPUT->command('insert_saved_search', rcube::Q($name), rcube::Q($result));
     }
     else
-        $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'savedsearchcreateerror', 'error');
+        $OUTPUT->show_message($plugin['message'] ?: 'savedsearchcreateerror', 'error');
 
     $OUTPUT->send();
 }
@@ -72,7 +72,7 @@
         $OUTPUT->set_env('pagecount', 0);
     }
     else
-        $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'savedsearchdeleteerror', 'error');
+        $OUTPUT->show_message($plugin['message'] ?: 'savedsearchdeleteerror', 'error');
 
     $OUTPUT->send();
 }
@@ -253,7 +253,7 @@
 {
     global $RCMAIL, $CONTACT_COLTYPES;
 
-    $i_size = !empty($attrib['size']) ? $attrib['size'] : 30;
+    $i_size = $attrib['size'] ?: 30;
 
     $form = array(
         'main' => array(
@@ -298,7 +298,7 @@
         {
             $ftype    = $colprop['type'] == 'select' ? 'select' : 'text';
             $label    = isset($colprop['label']) ? $colprop['label'] : $RCMAIL->gettext($col);
-            $category = $colprop['category'] ? $colprop['category'] : 'other';
+            $category = $colprop['category'] ?: 'other';
 
             // load jquery UI datepicker for date fields 
             if ($colprop['type'] == 'date')
diff --git a/program/steps/addressbook/show.inc b/program/steps/addressbook/show.inc
index 77e88e8..35f381d 100644
--- a/program/steps/addressbook/show.inc
+++ b/program/steps/addressbook/show.inc
@@ -94,7 +94,7 @@
         return false;
     }
 
-    $i_size = !empty($attrib['size']) ? $attrib['size'] : 40;
+    $i_size = $attrib['size'] ?: 40;
 
     $form = array(
         'contact' => array(
diff --git a/program/steps/addressbook/undo.inc b/program/steps/addressbook/undo.inc
index 580d034..973bfec 100644
--- a/program/steps/addressbook/undo.inc
+++ b/program/steps/addressbook/undo.inc
@@ -36,7 +36,7 @@
     $restored = !$plugin['abort'] ? $CONTACTS->undelete($cid) : $plugin['result'];
 
     if (!$restored) {
-        $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'contactrestoreerror', 'error');
+        $OUTPUT->show_message($plugin['message'] ?: 'contactrestoreerror', 'error');
         $OUTPUT->command('list_contacts');
         $OUTPUT->send();
     }
diff --git a/program/steps/mail/addcontact.inc b/program/steps/mail/addcontact.inc
index 904d997..64a01d2 100644
--- a/program/steps/mail/addcontact.inc
+++ b/program/steps/mail/addcontact.inc
@@ -63,7 +63,7 @@
             // TODO: show dialog to complete record
             // if ($error['type'] == rcube_addressbook::ERROR_VALIDATE) { }
 
-            $OUTPUT->show_message($error['message'] ? $error['message'] : 'errorsavingcontact', 'error');
+            $OUTPUT->show_message($error['message'] ?: 'errorsavingcontact', 'error');
             $OUTPUT->send();
         }
 
@@ -87,7 +87,7 @@
 }
 
 if (!$done) {
-    $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsavingcontact', 'error');
+    $OUTPUT->show_message($plugin['message'] ?: 'errorsavingcontact', 'error');
 }
 
 $OUTPUT->send();
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 86e33fc..934b862 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -1826,8 +1826,8 @@
         $form_start .= $hiddenfields->show();
     }
 
-    $form_end = ($MESSAGE_FORM && !strlen($attrib['form'])) ? '</form>' : '';
-    $form_name = !empty($attrib['form']) ? $attrib['form'] : 'form';
+    $form_end  = ($MESSAGE_FORM && !strlen($attrib['form'])) ? '</form>' : '';
+    $form_name = $attrib['form'] ?: 'form';
 
     if (!$MESSAGE_FORM)
         $RCMAIL->output->add_gui_object('messageform', $form_name);
@@ -1864,7 +1864,7 @@
             rcube_utils::html_identifier($id,true),
             $class_name,
             $source['id'],
-            $js_id, (!empty($source['name']) ? $source['name'] : $id));
+            $js_id, ($source['name'] ?: $id));
     }
 
     $OUTPUT->add_gui_object('addressbookslist', $attrib['id']);
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 672bbd2..b6c3fff 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -168,7 +168,7 @@
     // race condition and unintentional page overwrite in session
     if ($RCMAIL->action == 'list' || $RCMAIL->action == 'getunread') {
         if (!($page = intval($_GET['_page']))) {
-            $page = $_SESSION['page'] ? $_SESSION['page'] : 1;
+            $page = $_SESSION['page'] ?: 1;
         }
 
         $_SESSION['page'] = $page;
@@ -179,7 +179,7 @@
 
     // set default sort col/order to session
     if (!isset($_SESSION['sort_col'])) {
-        $_SESSION['sort_col'] = $message_sort_col ? $message_sort_col : '';
+        $_SESSION['sort_col'] = $message_sort_col ?: '';
     }
     if (!isset($_SESSION['sort_order'])) {
         $_SESSION['sort_order'] = strtoupper($message_sort_order) == 'ASC' ? 'ASC' : 'DESC';
@@ -1634,7 +1634,7 @@
                     $content = rcube::Q($name ? sprintf('%s <%s>', $name, $mailto) : $mailto);
                 }
                 else {
-                    $content = rcube::Q($name ? $name : $mailto);
+                    $content = rcube::Q($name ?: $mailto);
                     $attrs['title'] = $mailto;
                 }
 
@@ -1642,7 +1642,7 @@
             }
             else {
                 $address = html::span(array('title' => $mailto, 'class' => "rcmContactAddress"),
-                    rcube::Q($name ? $name : $mailto));
+                    rcube::Q($name ?: $mailto));
             }
 
             if ($addicon && $_SESSION['writeable_abook']) {
diff --git a/program/steps/mail/get.inc b/program/steps/mail/get.inc
index 2cc0d49..9806303 100644
--- a/program/steps/mail/get.inc
+++ b/program/steps/mail/get.inc
@@ -232,7 +232,7 @@
         list($ctype_primary, $ctype_secondary) = explode('/', $mimetype);
 
         if (!$plugin['download'] && $ctype_primary == 'text') {
-            header("Content-Type: text/$ctype_secondary; charset=" . ($part->charset ? $part->charset : RCUBE_CHARSET));
+            header("Content-Type: text/$ctype_secondary; charset=" . ($part->charset ?: RCUBE_CHARSET));
         }
         else {
             header("Content-Type: $mimetype");
diff --git a/program/steps/mail/list_contacts.inc b/program/steps/mail/list_contacts.inc
index 13a5c4c..7077b5f 100644
--- a/program/steps/mail/list_contacts.inc
+++ b/program/steps/mail/list_contacts.inc
@@ -110,7 +110,7 @@
             $keyname = $row['_type'] == 'group' ? 'contactgroup' : 'contact';
 
             $OUTPUT->command('add_contact_row', $row_id, array(
-                $keyname => html::a(array('title' => $email), rcube::Q($name ? $name : $email) .
+                $keyname => html::a(array('title' => $email), rcube::Q($name ?: $email) .
                     ($name && count($emails) > 1 ? '&nbsp;' . html::span('email', rcube::Q($email)) : '')
                 )), $classname);
         }
diff --git a/program/steps/mail/mark.inc b/program/steps/mail/mark.inc
index 12b95ae..8a49114 100644
--- a/program/steps/mail/mark.inc
+++ b/program/steps/mail/mark.inc
@@ -40,7 +40,7 @@
 if (($_uids = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST))
     && ($flag = rcube_utils::get_input_value('_flag', rcube_utils::INPUT_POST))
 ) {
-    $flag = $a_flags_map[$flag] ? $a_flags_map[$flag] : strtoupper($flag);
+    $flag = $a_flags_map[$flag] ?: strtoupper($flag);
 
     if ($flag == 'DELETED' && $skip_deleted && $_POST['_from'] != 'show') {
         // count messages before changing anything
diff --git a/program/steps/mail/search_contacts.inc b/program/steps/mail/search_contacts.inc
index c4a4392..12066a9 100644
--- a/program/steps/mail/search_contacts.inc
+++ b/program/steps/mail/search_contacts.inc
@@ -87,7 +87,7 @@
             $row_id = $row['ID'].'-'.$i;
             $jsresult[$row_id] = format_email_recipient($email, $name);
             $OUTPUT->command('add_contact_row', $row_id, array(
-                'contact' => html::a(array('title' => $email), rcube::Q($name ? $name : $email) .
+                'contact' => html::a(array('title' => $email), rcube::Q($name ?: $email) .
                     ($name && count($emails) > 1 ? '&nbsp;' . html::span('email', rcube::Q($email)) : '')
                 )), 'person');
         }
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index f797e2d..dbd6f98 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -234,7 +234,7 @@
 
 // sending aborted by plugin
 if ($data['abort'] && !$savedraft) {
-    $OUTPUT->show_message($data['message'] ? $data['message'] : 'sendingfailed');
+    $OUTPUT->show_message($data['message'] ?: 'sendingfailed');
     $OUTPUT->send('iframe');
 }
 else {
@@ -455,7 +455,7 @@
         }
         else {
             $ctype   = str_replace('image/pjpeg', 'image/jpeg', $attachment['mimetype']); // #1484914
-            $file    = $attachment['data'] ? $attachment['data'] : $attachment['path'];
+            $file    = $attachment['data'] ?: $attachment['path'];
             $folding = (int) $RCMAIL->config->get('mime_param_folding');
 
             $MAIL_MIME->addAttachment($file,
@@ -673,7 +673,7 @@
             array('msgid' => $message_id, 'uid' => $saved, 'folder' => $store_target));
 
         // display success
-        $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'messagesaved', 'confirmation');
+        $OUTPUT->show_message($plugin['message'] ?: 'messagesaved', 'confirmation');
 
         // update "_draft_saveid" and the "cmp_hash" to prevent "Unsaved changes" warning
         $COMPOSE['param']['draft_uid'] = $plugin['uid'];
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index 82bcb41..59ae134 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -346,7 +346,7 @@
     global $RCMAIL, $MESSAGE;
 
     $placeholder = $attrib['placeholder'] ? $RCMAIL->output->abs_url($attrib['placeholder'], true) : null;
-    $placeholder = $RCMAIL->output->asset_url($placeholder ? $placeholder : 'program/resources/blank.gif');
+    $placeholder = $RCMAIL->output->asset_url($placeholder ?: 'program/resources/blank.gif');
 
     if ($MESSAGE->sender) {
         $photo_img = $RCMAIL->url(array(
diff --git a/program/steps/mail/viewsource.inc b/program/steps/mail/viewsource.inc
index 359d5d2..1198505 100644
--- a/program/steps/mail/viewsource.inc
+++ b/program/steps/mail/viewsource.inc
@@ -24,13 +24,13 @@
 // similar code as in program/steps/mail/get.inc
 if ($uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_GET)) {
     $headers = $RCMAIL->storage->get_message_headers($uid);
-    $charset = $headers->charset ? $headers->charset : $RCMAIL->config->get('default_charset');
+    $charset = $headers->charset ?: $RCMAIL->config->get('default_charset');
 
     header("Content-Type: text/plain; charset={$charset}");
 
     if (!empty($_GET['_save'])) {
         $subject  = rcube_mime::decode_header($headers->subject, $headers->charset);
-        $filename = ($subject ? $subject : $RCMAIL->config->get('product_name', 'email')) . '.eml';
+        $filename = ($subject ?: $RCMAIL->config->get('product_name', 'email')) . '.eml';
         $browser  = $RCMAIL->output->browser;
 
         if ($browser->ie)
diff --git a/program/steps/settings/about.inc b/program/steps/settings/about.inc
index 201a88a..eac57ca 100644
--- a/program/steps/settings/about.inc
+++ b/program/steps/settings/about.inc
@@ -35,7 +35,7 @@
     global $RCMAIL;
 
     if ($url = $RCMAIL->config->get('support_url')) {
-        $label = $attrib['label'] ? $attrib['label'] : 'support';
+        $label = $attrib['label'] ?: 'support';
         $attrib['href'] = $url;
 
         return html::a($attrib, $RCMAIL->gettext($label));
@@ -85,13 +85,13 @@
     $table->add_header('source', $RCMAIL->gettext('source'));
 
     foreach ($plugin_info as $name => $data) {
-        $uri = $data['src_uri'] ? $data['src_uri'] : $data['uri'];
+        $uri = $data['src_uri'] ?: $data['uri'];
         if ($uri && stripos($uri, 'http') !== 0) {
             $uri = 'http://' . $uri;
         }
 
         $table->add_row();
-        $table->add('name', rcube::Q($data['name'] ? $data['name'] : $name));
+        $table->add('name', rcube::Q($data['name'] ?: $name));
         $table->add('version', rcube::Q($data['version']));
         $table->add('license', $data['license_uri'] ? html::a(array('target' => '_blank', href=> rcube::Q($data['license_uri'])),
             rcube::Q($data['license'])) : $data['license']);
diff --git a/program/steps/settings/edit_folder.inc b/program/steps/settings/edit_folder.inc
index 69c2170..8ddc17e 100644
--- a/program/steps/settings/edit_folder.inc
+++ b/program/steps/settings/edit_folder.inc
@@ -306,7 +306,7 @@
         $table = new html_table(array('cols' => 2));
         foreach ($form['content'] as $col => $colprop) {
             $colprop['id'] = '_'.$col;
-            $label = !empty($colprop['label']) ? $colprop['label'] : $RCMAIL->gettext($col);
+            $label = $colprop['label'] ?: $RCMAIL->gettext($col);
 
             $table->add('title', html::label($colprop['id'], rcube::Q($label)));
             $table->add(null, $colprop['value']);
diff --git a/program/steps/settings/edit_identity.inc b/program/steps/settings/edit_identity.inc
index aac8009..a645277 100644
--- a/program/steps/settings/edit_identity.inc
+++ b/program/steps/settings/edit_identity.inc
@@ -73,9 +73,9 @@
     // add some labels to client
     $OUTPUT->add_label('noemailwarning', 'converting', 'editorwarning');
 
-    $i_size = !empty($attrib['size']) ? $attrib['size'] : 40;
-    $t_rows = !empty($attrib['textarearows']) ? $attrib['textarearows'] : 6;
-    $t_cols = !empty($attrib['textareacols']) ? $attrib['textareacols'] : 40;
+    $i_size = $attrib['size'] ?: 40;
+    $t_rows = $attrib['textarearows'] ?: 6;
+    $t_cols = $attrib['textareacols'] ?: 40;
 
     // list of available cols
     $form = array(
@@ -159,11 +159,8 @@
             foreach ($fieldset['content'] as $col => $colprop) {
                 $colprop['id'] = 'rcmfd_'.$col;
 
-                $label = !empty($colprop['label']) ? $colprop['label'] :
-                    $RCMAIL->gettext(str_replace('-', '', $col));
-
-                $value = !empty($colprop['value']) ? $colprop['value'] :
-                    rcube_output::get_edit_field($col, $IDENTITY_RECORD[$col], $colprop, $colprop['type']);
+                $label = $colprop['label'] ?: $RCMAIL->gettext(str_replace('-', '', $col));
+                $value = $colprop['value'] ?: rcube_output::get_edit_field($col, $IDENTITY_RECORD[$col], $colprop, $colprop['type']);
 
                 $table->add('title', html::label($colprop['id'], rcube::Q($label)));
                 $table->add(null, $value);
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index 3183f62..93e780b 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -500,11 +500,11 @@
 
                 $field_id = 'rcmfd_mail_pagesize';
                 $input    = new html_inputfield(array('name' => '_mail_pagesize', 'id' => $field_id, 'size' => 5));
-                $size     = intval($config['mail_pagesize'] ? $config['mail_pagesize'] : $config['pagesize']);
+                $size     = intval($config['mail_pagesize'] ?: $config['pagesize']);
 
                 $blocks['main']['options']['pagesize'] = array(
                     'title'   => html::label($field_id, rcube::Q($RCMAIL->gettext('pagesize'))),
-                    'content' => $input->show($size ? $size : 50),
+                    'content' => $input->show($size ?: 50),
                 );
             }
 
@@ -1043,11 +1043,11 @@
 
                 $field_id = 'rcmfd_addressbook_pagesize';
                 $input    = new html_inputfield(array('name' => '_addressbook_pagesize', 'id' => $field_id, 'size' => 5));
-                $size     = intval($config['addressbook_pagesize'] ? $config['addressbook_pagesize'] : $config['pagesize']);
+                $size     = intval($config['addressbook_pagesize'] ?: $config['pagesize']);
 
                 $blocks['main']['options']['pagesize'] = array(
                     'title'   => html::label($field_id, rcube::Q($RCMAIL->gettext('pagesize'))),
-                    'content' => $input->show($size ? $size : 50),
+                    'content' => $input->show($size ?: 50),
                 );
             }
 
@@ -1404,8 +1404,8 @@
         $button = $OUTPUT->button($action);
         $attr   = $attrib;
 
-        $cmd = $action['action'] ? $action['action'] : $action['command'];
-        $id  = $action['id'] ? $action['id'] : $cmd;
+        $cmd = $action['action'] ?: $action['command'];
+        $id  = $action['id'] ?: $cmd;
 
         if (!empty($id)) {
             $attr['id'] = preg_replace('/[^a-z0-9]/i', '', $attrib['idprefix'] . $id);
diff --git a/program/steps/settings/identities.inc b/program/steps/settings/identities.inc
index ec17196..288c161 100644
--- a/program/steps/settings/identities.inc
+++ b/program/steps/settings/identities.inc
@@ -32,7 +32,7 @@
             $OUTPUT->command('remove_identity', $iid);
         }
         else {
-            $msg = $plugin['message'] ? $plugin['message'] : ($deleted < 0 ? 'nodeletelastidentity' : 'errorsaving');
+            $msg = $plugin['message'] ?: ($deleted < 0 ? 'nodeletelastidentity' : 'errorsaving');
             $OUTPUT->show_message($msg, 'error', null, false);
         }
     }
diff --git a/program/steps/settings/save_folder.inc b/program/steps/settings/save_folder.inc
index 879f5e8..e724212 100644
--- a/program/steps/settings/save_folder.inc
+++ b/program/steps/settings/save_folder.inc
@@ -132,7 +132,7 @@
     }
     else {
         // show error message
-        $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error', null, false);
+        $OUTPUT->show_message($plugin['message'] ?: 'errorsaving', 'error', null, false);
     }
 }
 // update a mailbox
@@ -195,7 +195,7 @@
     }
     else {
         // show error message
-        $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error', null, false);
+        $OUTPUT->show_message($plugin['message'] ?: 'errorsaving', 'error', null, false);
     }
 }
 
diff --git a/program/steps/settings/save_identity.inc b/program/steps/settings/save_identity.inc
index 89a8db7..8ffe39e 100644
--- a/program/steps/settings/save_identity.inc
+++ b/program/steps/settings/save_identity.inc
@@ -135,7 +135,7 @@
     }
     else {
         // show error message
-        $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error', null, false);
+        $OUTPUT->show_message($plugin['message'] ?: 'errorsaving', 'error', null, false);
         $RCMAIL->overwrite_action('edit-identity');
         return;
     }
@@ -177,7 +177,7 @@
     }
     else {
         // show error message
-        $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error', null, false);
+        $OUTPUT->show_message($plugin['message'] ?: 'errorsaving', 'error', null, false);
         $RCMAIL->overwrite_action('edit-identity');
         return;
     }
@@ -218,7 +218,7 @@
             $file = $RCMAIL->plugins->exec_hook('attachment_get', $file);
 
             $data_uri .= 'src="data:' . $file['mimetype'] . ';base64,';
-            $data_uri .= base64_encode($file['data'] ? $file['data'] : file_get_contents($file['path']));
+            $data_uri .= base64_encode($file['data'] ?: file_get_contents($file['path']));
             $data_uri .= '" ';
         }
 
diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc
index 355954c..4657454 100644
--- a/program/steps/settings/save_prefs.inc
+++ b/program/steps/settings/save_prefs.inc
@@ -215,7 +215,7 @@
 if ($saved)
     $OUTPUT->show_message('successfullysaved', 'confirmation');
 else
-    $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error');
+    $OUTPUT->show_message($plugin['message'] ?: 'errorsaving', 'error');
 
 // display the form again
 $RCMAIL->overwrite_action('edit-prefs');

--
Gitblit v1.9.1