summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
Diffstat (limited to 'program/include')
-rw-r--r--program/include/html.php2
-rw-r--r--program/include/main.inc4
-rw-r--r--program/include/rcmail.php2
-rw-r--r--program/include/rcube_imap.php54
-rw-r--r--program/include/rcube_imap_generic.php17
5 files changed, 35 insertions, 44 deletions
diff --git a/program/include/html.php b/program/include/html.php
index b73c54a8c..27d1d7750 100644
--- a/program/include/html.php
+++ b/program/include/html.php
@@ -75,7 +75,7 @@ class html
$suffix = $attrib['nl'] || ($content && $attrib['nl'] !== false && !in_array($tagname, $inline_tags)) ? "\n" : '';
$tagname = self::$lc_tags ? strtolower($tagname) : $tagname;
- if ($content || in_array($tagname, self::$containers)) {
+ if (isset($content) || in_array($tagname, self::$containers)) {
$templ = $attrib['noclose'] ? "<%s%s>%s" : "<%s%s>%s</%s>%s";
unset($attrib['noclose']);
return sprintf($templ, $tagname, self::attrib_string($attrib, $allowed_attrib), $content, $tagname, $suffix);
diff --git a/program/include/main.inc b/program/include/main.inc
index 31c9a0805..5bbc421af 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -1348,7 +1348,7 @@ function rcmail_build_folder_tree(&$arrFolders, $folder, $delm='/', $path='')
$currentFolder = substr($folder, 0, $pos);
// sometimes folder has a delimiter as the last character
- if (empty($subFolders))
+ if (!strlen($subFolders))
$virtual = false;
else if (!isset($arrFolders[$currentFolder]))
$virtual = true;
@@ -1378,7 +1378,7 @@ function rcmail_build_folder_tree(&$arrFolders, $folder, $delm='/', $path='')
else
$arrFolders[$currentFolder]['virtual'] = $virtual;
- if (!empty($subFolders))
+ if (strlen($subFolders))
rcmail_build_folder_tree($arrFolders[$currentFolder]['folders'], $subFolders, $delm, $path.$delm);
}
diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index 8fa9df72f..e76b1420a 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -782,7 +782,7 @@ class rcmail
if ($default_folders = $this->config->get('default_imap_folders')) {
$this->imap->set_default_mailboxes($default_folders);
}
- if (!empty($_SESSION['mbox'])) {
+ if (isset($_SESSION['mbox'])) {
$this->imap->set_mailbox($_SESSION['mbox']);
}
if (isset($_SESSION['page'])) {
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 14cf396de..a9ddf865c 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -565,7 +565,7 @@ class rcube_imap
*/
function messagecount($mbox_name='', $mode='ALL', $force=false, $status=true)
{
- $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox;
+ $mailbox = strlen($mbox_name) ? $this->mod_mailbox($mbox_name) : $this->mailbox;
return $this->_messagecount($mailbox, $mode, $force, $status);
}
@@ -586,7 +586,7 @@ class rcube_imap
{
$mode = strtoupper($mode);
- if (empty($mailbox))
+ if (!strlen($mailbox))
$mailbox = $this->mailbox;
// count search set
@@ -2551,7 +2551,7 @@ class rcube_imap
$fbox = $from_mbox;
$tbox = $to_mbox;
$to_mbox = $this->mod_mailbox($to_mbox);
- $from_mbox = $from_mbox ? $this->mod_mailbox($from_mbox) : $this->mailbox;
+ $from_mbox = strlen($from_mbox) ? $this->mod_mailbox($from_mbox) : $this->mailbox;
list($uids, $all_mode) = $this->_parse_uids($uids, $from_mbox);
@@ -2721,7 +2721,7 @@ class rcube_imap
*/
function clear_mailbox($mbox_name=NULL)
{
- $mailbox = !empty($mbox_name) ? $this->mod_mailbox($mbox_name) : $this->mailbox;
+ $mailbox = strlen($mbox_name) ? $this->mod_mailbox($mbox_name) : $this->mailbox;
// SELECT will set messages count for clearFolder()
if ($this->conn->select($mailbox)) {
@@ -2874,7 +2874,7 @@ class rcube_imap
$a_mboxes = $this->_list_mailboxes($root, $filter);
foreach ($a_mboxes as $idx => $mbox_row) {
- if ($name = $this->mod_mailbox($mbox_row, 'out'))
+ if (strlen($name = $this->mod_mailbox($mbox_row, 'out')))
$a_out[] = $name;
unset($a_mboxes[$idx]);
}
@@ -2978,7 +2978,7 @@ class rcube_imap
// modify names with root dir
foreach ($a_mboxes as $idx => $mbox_name) {
- if ($name = $this->mod_mailbox($mbox_name, 'out'))
+ if (strlen($name = $this->mod_mailbox($mbox_name, 'out')))
$a_folders[] = $name;
unset($a_mboxes[$idx]);
}
@@ -3194,27 +3194,25 @@ class rcube_imap
*/
function mailbox_exists($mbox_name, $subscription=false)
{
- if ($mbox_name) {
- if ($mbox_name == 'INBOX')
- return true;
+ if ($mbox_name == 'INBOX')
+ return true;
- $key = $subscription ? 'subscribed' : 'existing';
- $mbox = $this->mod_mailbox($mbox_name);
+ $key = $subscription ? 'subscribed' : 'existing';
+ $mbox = $this->mod_mailbox($mbox_name);
- if (is_array($this->icache[$key]) && in_array($mbox, $this->icache[$key]))
- return true;
+ if (is_array($this->icache[$key]) && in_array($mbox, $this->icache[$key]))
+ return true;
- if ($subscription) {
- $a_folders = $this->conn->listSubscribed('', $mbox);
- }
- else {
- $a_folders = $this->conn->listMailboxes('', $mbox);
- }
+ if ($subscription) {
+ $a_folders = $this->conn->listSubscribed('', $mbox);
+ }
+ else {
+ $a_folders = $this->conn->listMailboxes('', $mbox);
+ }
- if (is_array($a_folders) && in_array($mbox, $a_folders)) {
- $this->icache[$key][] = $mbox;
- return true;
- }
+ if (is_array($a_folders) && in_array($mbox, $a_folders)) {
+ $this->icache[$key][] = $mbox;
+ return true;
}
return false;
@@ -3230,7 +3228,7 @@ class rcube_imap
*/
function mod_mailbox($mbox_name, $mode='in')
{
- if (empty($mbox_name))
+ if (!strlen($mbox_name))
return '';
if ($mode == 'in') {
@@ -3460,8 +3458,8 @@ class rcube_imap
if ($mailbox)
$mailbox = $this->mod_mailbox($mailbox);
- if ($this->get_capability('METADATA') ||
- empty($mailbox) && $this->get_capability('METADATA-SERVER')
+ if ($this->get_capability('METADATA') ||
+ (!strlen($mailbox) && $this->get_capability('METADATA-SERVER'))
) {
return $this->conn->setMetadata($mailbox, $entries);
}
@@ -3494,7 +3492,7 @@ class rcube_imap
$mailbox = $this->mod_mailbox($mailbox);
if ($this->get_capability('METADATA') ||
- empty($mailbox) && $this->get_capability('METADATA-SERVER')
+ (!strlen($mailbox) && $this->get_capability('METADATA-SERVER'))
) {
return $this->conn->deleteMetadata($mailbox, $entries);
}
@@ -3528,7 +3526,7 @@ class rcube_imap
$mailbox = $this->mod_mailbox($mailbox);
if ($this->get_capability('METADATA') ||
- empty($mailbox) && $this->get_capability('METADATA-SERVER')
+ !strlen(($mailbox) && $this->get_capability('METADATA-SERVER'))
) {
return $this->conn->getMetadata($mailbox, $entries, $options);
}
diff --git a/program/include/rcube_imap_generic.php b/program/include/rcube_imap_generic.php
index 864c57193..8ee17c2ee 100644
--- a/program/include/rcube_imap_generic.php
+++ b/program/include/rcube_imap_generic.php
@@ -801,7 +801,7 @@ class rcube_imap_generic
function select($mailbox)
{
- if (empty($mailbox)) {
+ if (!strlen($mailbox)) {
return false;
}
@@ -852,7 +852,7 @@ class rcube_imap_generic
*/
function status($mailbox, $items=array())
{
- if (empty($mailbox)) {
+ if (!strlen($mailbox)) {
return false;
}
@@ -886,11 +886,12 @@ class rcube_imap_generic
function checkForRecent($mailbox)
{
- if (empty($mailbox)) {
+ if (!strlen($mailbox)) {
$mailbox = 'INBOX';
}
$this->select($mailbox);
+
if ($this->selected == $mailbox) {
return $this->data['RECENT'];
}
@@ -1618,10 +1619,6 @@ class rcube_imap_generic
function copy($messages, $from, $to)
{
- if (empty($from) || empty($to)) {
- return false;
- }
-
if (!$this->select($from)) {
return false;
}
@@ -1638,10 +1635,6 @@ class rcube_imap_generic
function move($messages, $from, $to)
{
- if (!$from || !$to) {
- return false;
- }
-
$r = $this->copy($messages, $from, $to);
if ($r) {
@@ -1881,7 +1874,7 @@ class rcube_imap_generic
private function _listMailboxes($ref, $mailbox, $subscribed=false,
$status_opts=array(), $select_opts=array())
{
- if (empty($mailbox)) {
+ if (!strlen($mailbox)) {
$mailbox = '*';
}