]> git.donarmstrong.com Git - roundcube.git/blobdiff - program/include/rcmail.php
Imported Upstream version 0.5.4+dfsg
[roundcube.git] / program / include / rcmail.php
index 4aa95a0ded775d39a0aae422165e700fbddc8e9d..d324d4747c01c396394223d1b25d2a6777117d06 100644 (file)
@@ -15,7 +15,7 @@
  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
  +-----------------------------------------------------------------------+
 
- $Id: rcmail.php 4626 2011-03-31 12:32:44Z alec $
+ $Id: rcmail.php 4779 2011-05-17 15:35:14Z alec $
 
 */
 
@@ -915,6 +915,21 @@ class rcmail
     return $text;
   }
 
+  /**
+   * Check if the given text lable exists
+   *
+   * @param string Label name
+   * @return boolean True if text exists (either in the current language or in en_US)
+   */
+  public function text_exists($name, $domain=null)
+  {
+    // load localization files if not done yet
+    if (empty($this->texts))
+      $this->load_language();
+
+    // check for text with domain first
+    return ($domain && isset($this->texts[$domain.'.'.$name])) || isset($this->texts[$name]);
+  }
 
   /**
    * Load a localization package
@@ -1078,6 +1093,9 @@ class rcmail
       if (is_object($book))
         $book->close();
 
+    if (is_object($this->imap))
+      $this->imap->close();
+
     // before closing the database connection, write session data
     if ($_SERVER['REMOTE_ADDR'])
       session_write_close();
@@ -1193,9 +1211,6 @@ class rcmail
       }
     }
 
-    if (is_object($this->imap))
-      $this->imap->close();
-
     return $base64 ? base64_encode($cipher) : $cipher;
   }