Undelete button shouldn't be related to whether or not a trash folder is in use ...
[squirrelmail.git] / functions / imap_general.php
index 0121a21002998256607debe03972ddde0b685199..b2062224f371b6883285866718e33ef7273e2ae7 100755 (executable)
@@ -5,7 +5,7 @@
  *
  * This implements all functions that do general IMAP functions.
  *
- * @copyright © 1999-2009 The SquirrelMail Project Team
+ * @copyright 1999-2011 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
@@ -1075,8 +1075,8 @@ function sqimap_get_delimiter ($imap_stream = false) {
              * TODO: remove this in favour of the information from sqimap_get_namespace()
              */
             $read = sqimap_run_command($imap_stream, 'NAMESPACE', true, $a, $b);
-            if (eregi('\\* NAMESPACE +(\\( *\\(.+\\) *\\)|NIL) +(\\( *\\(.+\\) *\\)|NIL) +(\\( *\\(.+\\) *\\)|NIL)', $read[0], $data)) {
-                if (eregi('^\\( *\\((.*)\\) *\\)', $data[1], $data2)) {
+            if (preg_match('/\* NAMESPACE +(\( *\(.+\) *\)|NIL) +(\( *\(.+\) *\)|NIL) +(\( *\(.+\) *\)|NIL)/i', $read[0], $data)) {
+                if (preg_match('/^\( *\((.*)\) *\)/', $data[1], $data2)) {
                     $pn = $data2[1];
                 }
                 $pna = explode(')(', $pn);
@@ -1138,7 +1138,7 @@ function sqimap_parse_namespace(&$input) {
     $ns_strings = array(1=>'personal', 2=>'users', 3=>'shared');
     $namespace = array();
 
-    if(ereg('NAMESPACE (\(\(.*\)\)|NIL) (\(\(.*\)\)|NIL) (\(\(.*\)\)|NIL)', $input, $regs) !== false) {
+    if (preg_match('/NAMESPACE (\(\(.*\)\)|NIL) (\(\(.*\)\)|NIL) (\(\(.*\)\)|NIL)/', $input, $regs)) {
         for($i=1; $i<=3; $i++) {
             if($regs[$i] == 'NIL') {
                 $namespace[$ns_strings[$i]] = array();
@@ -1174,7 +1174,7 @@ function sqimap_parse_namespace(&$input) {
  */
 function sqimap_encode_mailbox_name($what)
 {
-    if (ereg("[\"\\\r\n]", $what))
+    if (preg_match('/["\\\r\n]/', $what))
         return '{' . strlen($what) . "}\r\n" . $what;        /* 4.3 literal form */
     return '"' . $what . '"';        /* 4.3 quoted string form */
 }
@@ -1436,6 +1436,7 @@ function sqimap_get_user_server ($imap_server, $username) {
  * @since 1.3.0
  */
 function map_yp_alias($username) {
-   $yp = `ypmatch ' . escapeshellarg($username) . ' aliases`;
+   $safe_username = escapeshellarg($username);
+   $yp = `ypmatch $safe_username aliases`;
    return chop(substr($yp, strlen($username)+1));
 }