phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] felamimail inc/class.bofelamimail.inc.php inc/c...


From: Sigurd Nes
Subject: [Phpgroupware-cvs] felamimail inc/class.bofelamimail.inc.php inc/c...
Date: Wed, 20 Dec 2006 13:56:26 +0000

CVSROOT:        /sources/phpgroupware
Module name:    felamimail
Changes by:     Sigurd Nes <sigurdne>   06/12/20 13:56:26

Modified files:
        inc            : class.bofelamimail.inc.php 
                         class.htmlfilter.inc.php 
                         class.uicompose.inc.php class.uidisplay.inc.php 
                         class.uifilter.inc.php 
                         class.uipreferences.inc.php hook_home.inc.php 
        templates/base : filterForm.tpl 

Log message:
        mostly notices - and an updated htmlfilter

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/felamimail/inc/class.bofelamimail.inc.php?cvsroot=phpgroupware&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/felamimail/inc/class.htmlfilter.inc.php?cvsroot=phpgroupware&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/felamimail/inc/class.uicompose.inc.php?cvsroot=phpgroupware&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/felamimail/inc/class.uidisplay.inc.php?cvsroot=phpgroupware&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/felamimail/inc/class.uifilter.inc.php?cvsroot=phpgroupware&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/felamimail/inc/class.uipreferences.inc.php?cvsroot=phpgroupware&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/felamimail/inc/hook_home.inc.php?cvsroot=phpgroupware&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/felamimail/templates/base/filterForm.tpl?cvsroot=phpgroupware&r1=1.2&r2=1.3

Patches:
Index: inc/class.bofelamimail.inc.php
===================================================================
RCS file: /sources/phpgroupware/felamimail/inc/class.bofelamimail.inc.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- inc/class.bofelamimail.inc.php      19 Dec 2006 21:36:26 -0000      1.12
+++ inc/class.bofelamimail.inc.php      20 Dec 2006 13:56:26 -0000      1.13
@@ -11,7 +11,7 @@
        * Free Software Foundation; either version 2 of the License, or (at 
your    *
        * option) any later version.                                            
    *
        
\***************************************************************************/
-       /* $Id: class.bofelamimail.inc.php,v 1.12 2006/12/19 21:36:26 sigurdne 
Exp $ */
+       /* $Id: class.bofelamimail.inc.php,v 1.13 2006/12/20 13:56:26 sigurdne 
Exp $ */
 
        class bofelamimail
        {
@@ -158,11 +158,11 @@
                {
                        if($this->mbAvailable)
                        {
-                               return mb_convert_encoding( $_folderName, 
"ISO_8859-1", "UTF7-IMAP");
+                               return $this->ascii2utf(mb_convert_encoding( 
$_folderName, "ISO_8859-1", "UTF7-IMAP"));
                        }
                        
                        // if not
-                       return imap_utf7_decode($_folderName);
+                       return $this->ascii2utf(imap_utf7_decode($_folderName));
                }
 
                function decode_header($string)
@@ -177,7 +177,7 @@
                                        #print "Match 
2:".$matches[$i][2]."<br>";
                                        $string = 
str_replace($matches[$i][0],base64_decode($matches[$i][2]),$string);
                                }
-                               return $string;
+                               return $this->ascii2utf($string);
                        }
                        /* Decode from qouted printable */
                        elseif (preg_match_all("/\=\?(.*?)\?q\?(.*?)\?\=/i", 
$string, $matches, PREG_SET_ORDER))
@@ -199,11 +199,36 @@
                                                        break;
                                        }
                                }
-                               return $string;
+                               return $this->ascii2utf($string);
                        }
-                       return $string;
+                       return $this->ascii2utf($string);
                }
                
+               function utf2ascii($text = '')
+               {       
+                       if ($text == utf8_decode($text))
+                       {
+                               return $text;
+                       }
+                       else
+                       {
+                               return utf8_decode($text);
+                       }
+               }
+
+               function ascii2utf($text = '')
+               {       
+                       if ($text == utf8_encode($text))
+                       {
+                               return $text;
+                       }
+                       else
+                       {
+                               return utf8_encode($text);
+                       }
+               }
+
+
                function deleteMessages($_messageUID)
                {
                        $caching = CreateObject('felamimail.bocaching',
@@ -212,6 +237,7 @@
                                        $this->sessionData['mailbox']);
 
                        reset($_messageUID);
+                       $msglist = '';
                        while(list($key, $value) = each($_messageUID))
                        {
                                if(!empty($msglist)) $msglist .= ",";
@@ -528,14 +554,14 @@
                                
                                        $messageData['date']            = 
$header->udate;
                                        $messageData['subject']         = 
$header->subject;
-                                       $messageData['to_name']         = 
$header->to[0]->personal;
+                                       $messageData['to_name']         = 
(isset($header->to[0]->personal)?$header->to[0]->personal:'');
                                        $messageData['to_address']      = 
$header->to[0]->mailbox."@".$header->to[0]->host;
-                                       $messageData['sender_name']     = 
$header->from[0]->personal;
+                                       $messageData['sender_name']     = 
(isset($header->from[0]->personal)?$header->from[0]->personal:'');
                                        $messageData['sender_address']  = 
$header->from[0]->mailbox."@".$header->from[0]->host;
                                        $messageData['size']            = 
$header->Size;
 
                                        $messageData['attachments']     = 
"false";
-                                       if (is_array($sections['attachment']))
+                                       if (isset($sections['attachment']) && 
is_array($sections['attachment']))
                                        {
                                                $messageData['attachments']     
= "true";
                                        }
@@ -1013,7 +1039,7 @@
                                        {
                                                
                                                $structureData = 
$this->parseMessage($_structure->parts[$i], $_partID.($i+1));
-                                               
if(is_array($structureData['body']))
+                                               
if(isset($structureData['body']) && is_array($structureData['body']))
                                                {
                                                        
reset($structureData['body']);
                                                        
while(list($partID,$partData) = each($structureData['body']))

Index: inc/class.htmlfilter.inc.php
===================================================================
RCS file: /sources/phpgroupware/felamimail/inc/class.htmlfilter.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- inc/class.htmlfilter.inc.php        18 Dec 2006 20:28:00 -0000      1.2
+++ inc/class.htmlfilter.inc.php        20 Dec 2006 13:56:26 -0000      1.3
@@ -6,42 +6,42 @@
  * any malicious tags from it. Useful in cases when you need to filter
  * user input for any cross-site-scripting attempts.
  *
- * Copyright (c) 2002 by Duke University
+ * Copyright (C) 2002-2004 by Duke University
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  
- * 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  
+ * 02110-1301  USA
  *
  * @Author  Konstantin Riabitsev <address@hidden>
- * @Version 1.0.5 (Oct-16-2002)
+ * @Version 1.1 ($Date: 2006/12/20 13:56:26 $)
  */
 
+
 class htmlfilter
 {
 
+       var $debug = false;
 /**
- * See http://www.mricon.com/html/phpfilter.html
- *
  * This is a debugging function used throughout the code. To enable
  * debugging you have to specify a global variable called "debug" before
- * calling sanitize() and set it to true. 
+ * calling $this->sanitize() and set it to true. 
  *
  * Note: Although insignificantly, debugging does slow you down even
  * when $debug is set to false. If you wish to get rid of all
  * debugging calls, run the following command:
  *
- * fgrep -v 'spew("' htmlfilter.inc > htmlfilter.inc.new
+ * fgrep -v '$this->spew("' htmlfilter.inc > htmlfilter.inc.new
  *
  * htmlfilter.inc.new will contain no debugging calls.
  *
@@ -49,10 +49,9 @@
  * @return           void.
  */
 function spew($message){
-  global $debug;
-  #$debug = true;
-  if ($debug == true){
-    echo "$message<br>";
+//    global $debug;
+    if ($this->debug == true){
+        echo "$message";
   }
 }
 
@@ -161,7 +160,7 @@
   $retarr = Array();
   $preg_rule = '%^(.*?)(' . $reg . ')%s';
   preg_match($preg_rule, substr($body, $offset), $matches);
-  if (!$matches{0}){
+    if (!isset($matches{0})){
     $this->spew("$me: No matches found.\n");
     $retarr = false;
   } else {
@@ -310,7 +309,7 @@
        * This is an invalid tag! Look for the next closing ">".
        */
       $this->spew("$me: Invalid characters found in tag name: $match\n");
-      $gt = $this->findnxstr($body, $offset, '>');
+            $gt = $this->findnxstr($body, $lt, '>');
       return Array(false, false, false, $lt, $gt);
     }
   }
@@ -517,53 +516,86 @@
 }
 
 /**
+ * Translates entities into literal values so they can be checked.
+ *
+ * @param $attvalue the by-ref value to check.
+ * @param $regex    the regular expression to check against.
+ * @param $hex      whether the entites are hexadecimal.
+ * @return          True or False depending on whether there were matches.
+ */
+function deent(&$attvalue, $regex, $hex=false){
+    $me = 'deent';
+    $this->spew("$me: matching '$regex' against: $attvalue\n");
+    $ret_match = false;
+    preg_match_all($regex, $attvalue, $matches);
+    if (is_array($matches) && sizeof($matches[0]) > 0){
+        $this->spew("$me: found " . sizeof($matches[0]) . " matches\n");
+        $repl = Array();
+        for ($i = 0; $i < sizeof($matches[0]); $i++){
+            $numval = $matches[1][$i];
+            $this->spew("$me: numval is $numval\n");
+            if ($hex){
+                $numval = hexdec($numval);
+                $this->spew("$me: hex! Numval is now $numval\n");
+            }
+            $repl{$matches[0][$i]} = chr($numval);
+        }
+        $attvalue = strtr($attvalue, $repl);
+        $this->spew("$me: attvalue after translation: $attvalue\n");
+        return true;
+    } else {
+        $this->spew("$me: no matches! Returning false.\n");
+        return false;
+    }
+}
+
+/**
  * This function checks attribute values for entity-encoded values
  * and returns them translated into 8-bit strings so we can run
  * checks on them.
  *
  * @param  $attvalue A string to run entity check against.
- * @return           Translated value.
+ * @return           Nothing, modifies a reference value.
  */
-function deent($attvalue){
-  $me = 'deent';
-  /**
-   * See if we have to run the checks first. All entities must start
-   * with "&".
-   */
-  if (strpos($attvalue, '&') === false){
-    return $attvalue;
-  }
+function defang(&$attvalue){
+    $me = 'defang';
   /**
-   * Check named entities first.
+     * Skip this if there aren't ampersands or backslashes.
    */
-  $this->spew("$me: translating named entities\n");
-  $trans = get_html_translation_table(HTML_ENTITIES);
-  /**
-   * Leave &quot; in, as it can mess us up.
-   */
-  $trans = array_flip($trans);
-  unset($trans{'&quot;'});
-  while (list($ent, $val) = each($trans)){
-    $attvalue = preg_replace('/' . $ent . '*/si', $val, $attvalue);
-  }
-  /**
-   * Now translate numbered entities from 1 to 255 if needed.
-   */
-  if (strpos($attvalue, '#') !== false){
-    $this->spew("$me: translating numbered entities\n");
-    $omit = Array(34, 39);
-    for ($asc = 256; $asc >= 0; $asc--){
-      if (!in_array($asc, $omit)){
-        $chr = chr($asc);
-        $octrule = '/\&#0*' . $asc . ';*/si';
-        $hexrule = '/\&#x0*' . dechex($asc) . ';*/si';
-        $attvalue = preg_replace($octrule, $chr, $attvalue);
-        $attvalue = preg_replace($hexrule, $chr, $attvalue);
-      }
-    }
-  }
+    $this->spew("$me: Checking '$attvalue' for suspicious content\n");
+    if (strpos($attvalue, '&') === false
+        && strpos($attvalue, '\\') === false){
+        $this->spew("$me: no suspicious content found, returning.\n");
+        return;
+    }
+    $m = false;
+    do {
+        $m = false;
+        $m = $m || $this->deent($attvalue, '/\&#0*(\d+);*/s');
+        $m = $m || $this->deent($attvalue, '/\&#x0*((\d|[a-f])+);*/si', true);
+        $m = $m || $this->deent($attvalue, '/\\\\(\d+)/s', true);
+        $this->spew("$me: m=$m\n");
+    } while ($m == true);
+    $attvalue = stripslashes($attvalue);
   $this->spew("$me: translated into: $attvalue\n");
-  return $attvalue;
+}
+
+/**
+ * Kill any tabs, newlines, or carriage returns. Our friends the
+ * makers of the browser with 95% market value decided that it'd
+ * be funny to make "java[tab]script" be just as good as "javascript".
+ * 
+ * @param  attvalue  The attribute value before extraneous spaces removed.
+ * @return attvalue  Nothing, modifies a reference value.
+ */
+function unspace(&$attvalue){
+    $me = 'unspace';
+    if (strcspn($attvalue, "\t\r\n\0 ") != strlen($attvalue)){
+        $this->spew("$me: Killing whitespace.\n");
+        $attvalue = str_replace(Array("\t", "\r", "\n", "\0", " "), 
+                                Array('',   '',   '',   '',   ''), $attvalue);
+    }
+    $this->spew("$me: after unspace: $attvalue\n");
 }
 
 /**
@@ -601,9 +633,10 @@
       }
     }
     /**
-     * Remove any entities.
+         * Remove any backslashes, entities, or extraneous whitespace.
      */
-    $attvalue = $this->deent($attvalue);
+        $this->defang($attvalue);
+        $this->unspace($attvalue);
     
     /**
      * Now let's run checks on the attvalues.
@@ -621,7 +654,7 @@
              * Second one is replacements
              */
             list($valmatch, $valrepl) = $valary;
-            $newvalue = preg_replace($valmatch, $valrepl, $attvalue);
+                        $newvalue = preg_replace($valmatch,$valrepl,$attvalue);
             if ($newvalue != $attvalue){
               $this->spew("$me: attvalue is now $newvalue\n");
               $attary{$attname} = $newvalue;
@@ -856,7 +889,7 @@
   /**
    * Normalize rm_tags and rm_tags_with_content.
    */
-  @array_walk($rm_tags, 'casenormalize');
+    @array_walk($tag_list, 'casenormalize');
   @array_walk($rm_tags_with_content, 'casenormalize');
   @array_walk($self_closing_tags, 'casenormalize');
   /**
@@ -867,8 +900,7 @@
   $rm_tags = array_shift($tag_list);
   $curpos = 0;
   $open_tags = Array();
-  #$trusted = "<!-- begin sanitized html -->\n";
-  $trusted = "";
+    $trusted = "<!-- begin sanitized html -->\n";
   $skip_content = false;
   /**
    * Take care of netscape's stupid javascript entities like
@@ -931,12 +963,15 @@
            * See if we should skip this tag and any content
            * inside it.
            */
-          if ($tagtype == 1 && in_array($tagname, $rm_tags_with_content)){
+                    if ($tagtype == 1 
+                        && in_array($tagname, $rm_tags_with_content)){
             $this->spew("$me: removing this tag with content\n");
             $skip_content = $tagname;
           } else {
-            if (($rm_tags == false && in_array($tagname, $tag_list)) ||
-                ($rm_tags == true && !in_array($tagname, $tag_list))){
+                        if (($rm_tags == false 
+                             && in_array($tagname, $tag_list)) ||
+                            ($rm_tags == true 
+                             && !in_array($tagname, $tag_list))){
               $this->spew("$me: Removing this tag.\n");
               $tagname = false;
             } else {
@@ -985,10 +1020,9 @@
     }
     $trusted .= "\n";
   }
-#  $trusted .= "<!-- end sanitized html -->\n";
-  $trusted .= "";
+    $trusted .= "<!-- end sanitized html -->\n";
   return $trusted;
 }
-// class end
 }
 ?>
+

Index: inc/class.uicompose.inc.php
===================================================================
RCS file: /sources/phpgroupware/felamimail/inc/class.uicompose.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- inc/class.uicompose.inc.php 19 Dec 2006 15:20:36 -0000      1.7
+++ inc/class.uicompose.inc.php 20 Dec 2006 13:56:26 -0000      1.8
@@ -11,7 +11,7 @@
        * Free Software Foundation; either version 2 of the License, or (at 
your    *
        * option) any later version.                                            
    *
        
\***************************************************************************/
-       /* $Id: class.uicompose.inc.php,v 1.7 2006/12/19 15:20:36 sigurdne Exp 
$ */
+       /* $Id: class.uicompose.inc.php,v 1.8 2006/12/20 13:56:26 sigurdne Exp 
$ */
 
        class uicompose
        {
@@ -112,12 +112,15 @@
                                        
                                        $linkData = array
                                        (
+                                               'menuaction'=> 
'felamimail.uifelamimail.viewMainScreen',
                                                'mailbox'       => 
$GLOBALS['HTTP_GET_VARS']['mailbox'],
                                                'startMessage'  => '1'
                                        );
-                                       $link = 
$GLOBALS['phpgw']->link('/felamimail/index.php',$linkData);
-                                       $GLOBALS['phpgw']->redirect($link);
-                                       $GLOBALS['phpgw']->common->phpgw_exit();
+                                       
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php',$linkData);
+       //                              $link = 
$GLOBALS['phpgw']->link('/felamimail/index.php',$linkData);
+       //                              $GLOBALS['phpgw']->redirect($link);
+       //                              $GLOBALS['phpgw']->common->phpgw_exit();
                                        break;
                        }
                }

Index: inc/class.uidisplay.inc.php
===================================================================
RCS file: /sources/phpgroupware/felamimail/inc/class.uidisplay.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- inc/class.uidisplay.inc.php 19 Dec 2006 15:20:36 -0000      1.7
+++ inc/class.uidisplay.inc.php 20 Dec 2006 13:56:26 -0000      1.8
@@ -11,7 +11,7 @@
        * Free Software Foundation; either version 2 of the License, or (at 
your    *
        * option) any later version.                                            
    *
        
\***************************************************************************/
-       /* $Id: class.uidisplay.inc.php,v 1.7 2006/12/19 15:20:36 sigurdne Exp 
$ */
+       /* $Id: class.uidisplay.inc.php,v 1.8 2006/12/20 13:56:26 sigurdne Exp 
$ */
 
        class uidisplay
        {
@@ -47,7 +47,7 @@
                        $this->rowColor[0] = 'row_on';
                        $this->rowColor[1] = 'row_off';
 
-                       if($GLOBALS['HTTP_GET_VARS']['showHeader'] == "false")
+                       if(isset($GLOBALS['HTTP_GET_VARS']['showHeader']) && 
$GLOBALS['HTTP_GET_VARS']['showHeader'] == "false")
                        {
                                $this->bofelamimail->sessionData['showHeader'] 
= 'False';
                                $this->bofelamimail->saveSessionData();
@@ -191,7 +191,7 @@
                                );
                                
$this->t->set_var("link_printable",$GLOBALS['phpgw']->link('/index.php',$linkData));
        
-                               if($nextMessage['previous'])
+                               if(isset($nextMessage['previous']) && 
$nextMessage['previous'])
                                {
                                        $linkData = array
                                        (
@@ -207,7 +207,7 @@
                                        
$this->t->set_var('previous_message','&nbsp');
                                }
        
-                               if($nextMessage['next'])
+                               if(isset($nextMessage['next']) && 
$nextMessage['next'])
                                {
                                        $linkData = array
                                        (
@@ -476,6 +476,7 @@
                                else
                                {
                                        $newBody        = 
$bodyParts[$i]['body'];
+//                                     $htmlFilter->debug = true;
                                        $newBody        = 
$htmlFilter->sanitize($newBody,
                                                                $tag_list, 
$rm_tags_with_content,
                                                                
$self_closing_tags, $force_tag_closing,
@@ -496,13 +497,14 @@
                        // create links for websites
                        #$body = 
preg_replace("/((http(s?):\/\/)|(www\.))([\w\.,-.,\/.,\?.,\=.,&amp;]+)/ie", 
                        #       "'<a 
href=\"/phpgroupware/redirect.php?go='.htmlentities(urlencode('http$3://$4$5')).'\"
 target=\"_blank\"><font color=\"blue\">$2$4$5</font></a>'", $body);
-                       $body = 
preg_replace("/((http(s?):\/\/)|(www\.))([\w,\-,\/,\?,\=,\.,&amp;,!\n,\%,@,\*,#,:,~,\+]+)/ie",
 
+               /*      $body = 
preg_replace("/((http(s?):\/\/)|(www\.))([\w,\-,\/,\?,\=,\.,&amp;,!\n,\%,@,\*,#,:,~,\+]+)/ie",
 
                                "'<a 
href=\"/phpgroupware/redirect.php?go='.htmlentities(urlencode('http$3://$4$5')).'\"
 target=\"_blank\"><font color=\"blue\">$2$4$5</font></a>'", $body);
+               */      
+                       // create links for ftp sites -- not working
                        
-                       // create links for ftp sites
-                       $body = 
preg_replace("/((ftp:\/\/)|(ftp\.))([\w\.,-.,\/.,\?.,\=.,&amp;]+)/i", 
+               /*      $body = 
preg_replace("/((ftp:\/\/)|(ftp\.))([\w\.,-.,\/.,\?.,\=.,&amp;]+)/i", 
                                "<a href=\"ftp://$3$4\"; target=\"_blank\"><font 
color=\"blue\">$1$3$4</font></a>", $body);
-
+               */
                        // create links for windows shares
                        // \\\\\\\\ == '\\' in real life!! :)
                        $body = preg_replace("/(\\\\\\\\)([\w,\\\\,-]+)/i", 
@@ -517,6 +519,7 @@
                                'menuaction'    => 
'felamimail.uicompose.compose'
                        );
                        $link = $GLOBALS['phpgw']->link('/index.php',$linkData);
+               
                        $body = 
preg_replace("/([\w\.,-.,_.,0-9.]+)(@)([\w\.,-.,_.,0-9.]+)/i", 
                                "<a href=\"$link&send_to=$0\"><font 
color=\"blue\">$0</font></a>", $body);
                                
@@ -634,7 +637,7 @@
                        $this->bofelamimail->closeConnection();
                        
                        header ("Content-Type: ".$attachment['type']."; 
name=\"".$attachment['filename']."\"");
-                       if($GLOBALS['HTTP_GET_VARS']['mode'] == "save")
+                       if(isset($GLOBALS['HTTP_GET_VARS']['mode']) && 
$GLOBALS['HTTP_GET_VARS']['mode'] == "save")
                        {
                                // ask for download
                                header ("Content-Disposition: attachment; 
filename=\"".$attachment['filename']."\"");

Index: inc/class.uifilter.inc.php
===================================================================
RCS file: /sources/phpgroupware/felamimail/inc/class.uifilter.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- inc/class.uifilter.inc.php  18 Dec 2006 20:03:32 -0000      1.4
+++ inc/class.uifilter.inc.php  20 Dec 2006 13:56:26 -0000      1.5
@@ -11,7 +11,7 @@
        * Free Software Foundation; either version 2 of the License, or (at 
your    *
        * option) any later version.                                            
    *
        
\***************************************************************************/
-       /* $Id: class.uifilter.inc.php,v 1.4 2006/12/18 20:03:32 sigurdne Exp $ 
*/
+       /* $Id: class.uifilter.inc.php,v 1.5 2006/12/20 13:56:26 sigurdne Exp $ 
*/
 
        class uifilter
        {
@@ -26,9 +26,9 @@
                {
                        
                        // get posted variables
-                       $this->urlMailbox       = 
urldecode($GLOBALS['HTTP_GET_VARS']['mailbox']);
-                       $this->startMessage     = 
$GLOBALS['HTTP_GET_VARS']['startMessage'];
-                       $this->sort             = 
$GLOBALS['HTTP_GET_VARS']['sort'];
+                       $this->urlMailbox       = 
isset($GLOBALS['HTTP_GET_VARS']['mailbox'])?urldecode($GLOBALS['HTTP_GET_VARS']['mailbox']):'';
+                       $this->startMessage     = 
isset($GLOBALS['HTTP_GET_VARS']['startMessage'])?$GLOBALS['HTTP_GET_VARS']['startMessage']:'';
+                       $this->sort             = 
isset($GLOBALS['HTTP_GET_VARS']['sort'])?$GLOBALS['HTTP_GET_VARS']['sort']:'';
                        
                        $this->bofelamimail     = 
CreateObject('felamimail.bofelamimail',$this->urlMailbox);
                        $this->bofilter         = 
CreateObject('felamimail.bofilter');
@@ -36,10 +36,6 @@
 
                        $this->t = 
CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
                        $this->t->set_unknowns('remove');
-                       
-                       $this->rowColor[0] = 
$GLOBALS['phpgw_info']["theme"]["bg01"];
-                       $this->rowColor[1] = 
$GLOBALS['phpgw_info']["theme"]["bg02"];
-
                }
                
                function display_app_header()
@@ -61,7 +57,7 @@
                        // translate most of the parts
                        $this->translate();
                        
-                       switch($GLOBALS['HTTP_GET_VARS']['action'])
+                       
switch(isset($GLOBALS['HTTP_GET_VARS']['action'])?$GLOBALS['HTTP_GET_VARS']['action']:'')
                        {
                                case "deleteFilter":
                                        $filterID = 
$GLOBALS['HTTP_GET_VARS']['filterID'];
@@ -95,10 +91,10 @@
                                        
$this->t->set_var('link_action',$GLOBALS['phpgw']->link('/index.php',$linkData));
 
                                        
$this->t->set_var("filterName",$filterList[$filterID]['filterName']);
-                                       
$this->t->set_var("from",$filterList[$filterID]['from']);
-                                       
$this->t->set_var("to",$filterList[$filterID]['to']);
-                                       
$this->t->set_var("subject",$filterList[$filterID]['subject']);
-                                       
if($filterList[$filterID]['filterActive'] == "true")
+                                       
$this->t->set_var("from",(isset($filterList[$filterID]['from'])?$filterList[$filterID]['from']:''));
+                                       
$this->t->set_var("to",(isset($filterList[$filterID]['to'])?$filterList[$filterID]['to']:''));
+                                       
$this->t->set_var("subject",(isset($filterList[$filterID]['subject'])?$filterList[$filterID]['subject']:''));
+                                       
if(isset($filterList[$filterID]['filterActive']) && 
$filterList[$filterID]['filterActive'] == "true")
                                        {
                                                
$this->t->set_var("filter_checked","checked");
                                        }
@@ -147,7 +143,6 @@
                                        $this->t->set_var("subject",'');
                                        $this->t->set_var("filter_checked",'');
                                        break;
-                                       
                        }
                        $linkData = array
                        (
@@ -165,8 +160,12 @@
                        
                        $filterList = $this->bofilter->getFilterList();
                        
+                       $i = 0;
                        while(list($key,$value)address@hidden($filterList))
                        {
+                               $row_class = $i % 2 ? 'row_on' : 'row_off';
+                               $i++;
+                               $this->t->set_var("row_class",$row_class);
                                $this->t->set_var("id",$key);
                                
$this->t->set_var("filtername",$value['filterName']);
 

Index: inc/class.uipreferences.inc.php
===================================================================
RCS file: /sources/phpgroupware/felamimail/inc/class.uipreferences.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- inc/class.uipreferences.inc.php     18 Dec 2006 20:03:32 -0000      1.2
+++ inc/class.uipreferences.inc.php     20 Dec 2006 13:56:26 -0000      1.3
@@ -11,7 +11,7 @@
        * Free Software Foundation; either version 2 of the License, or (at 
your    *
        * option) any later version.                                            
    *
        
\***************************************************************************/
-       /* $Id: class.uipreferences.inc.php,v 1.2 2006/12/18 20:03:32 sigurdne 
Exp $ */
+       /* $Id: class.uipreferences.inc.php,v 1.3 2006/12/20 13:56:26 sigurdne 
Exp $ */
 
        class uipreferences
        {
@@ -30,8 +30,8 @@
                        $this->bofelamimail->openConnection('',OP_HALFOPEN);
                        
                        
-                       $this->rowColor[0] = 
$GLOBALS['phpgw_info']["theme"]["bg01"];
-                       $this->rowColor[1] = 
$GLOBALS['phpgw_info']["theme"]["bg02"];
+                       $this->rowColor[0] = 'row_on';
+                       $this->rowColor[1] = 'row_off';
 
                }
                
@@ -115,6 +115,7 @@
                        
                        $this->display_app_header();
 
+                       $this->t->set_root(PHPGW_APP_TPL);
                        $this->t->set_file(array("body" => 
"preferences_manage_folder.tpl"));
                        $this->t->set_block('body','main');
                        $this->t->set_block('body','select_row');
@@ -166,7 +167,7 @@
                                
$this->t->set_var('unsubscribed_checked','checked');
                        }
                        
-                       if(is_array($quota))
+                       if(isset($quota) && is_array($quota))
                        {
                                
$this->t->set_var('storage_usage',$quota['STORAGE']['usage']);
                                
$this->t->set_var('storage_limit',$quota['STORAGE']['limit']);
@@ -222,6 +223,6 @@
                        
$this->t->set_var("bg02",$GLOBALS['phpgw_info']["theme"]["bg02"]);
                        
$this->t->set_var("bg03",$GLOBALS['phpgw_info']["theme"]["bg03"]);
                }
-}
+       }
 
 ?>

Index: inc/hook_home.inc.php
===================================================================
RCS file: /sources/phpgroupware/felamimail/inc/hook_home.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- inc/hook_home.inc.php       18 Dec 2006 20:03:32 -0000      1.9
+++ inc/hook_home.inc.php       20 Dec 2006 13:56:26 -0000      1.10
@@ -9,7 +9,7 @@
   *  option) any later version.                                              *
   \**************************************************************************/
 
-       /* $Id: hook_home.inc.php,v 1.9 2006/12/18 20:03:32 sigurdne Exp $ */
+       /* $Id: hook_home.inc.php,v 1.10 2006/12/20 13:56:26 sigurdne Exp $ */
 
        $d1 = strtolower(substr(PHPGW_APP_INC,0,3));
        if($d1 == 'htt' || $d1 == 'ftp' )
@@ -56,11 +56,11 @@
                                        'tertiary'      => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
                                        'width' => '100%',
                                        'outerborderwidth'      => '0',
-                                       'header_background_image'       => 
$GLOBALS['phpgw']->common->image('phpgwapi/templates/phpgw_website','bg_filler.gif')
+                                       'header_background_image' => 
$GLOBALS['phpgw']->common->image('phpgwapi/templates/phpgw_website','bg_filler')
                                )
                        );
 
-                       $app_id = 
$GLOBALS['phpgw']->applications->name2id('calendar');
+                       $app_id = 
$GLOBALS['phpgw']->applications->name2id('felamimail');
                        $GLOBALS['portal_order'][] = $app_id;
                        $var = Array(
                                'up'    => Array('url'  => '/set_box.php', 
'app'        => $app_id),
@@ -148,14 +148,14 @@
 #                      }
 #                      $GLOBALS['phpgw']->msg->end_request();
 #
-                       if($data)
+                       if(isset($data) && $data)
                        {
                                $portalbox->data = $data;
                        }
 
                        // output the portalbox and below it (1) the folders 
listbox (if applicable) and (2) Compose New mail link
                        echo "\r\n".'<!-- start Mailbox info -->'."\r\n"
-                               .$portalbox->draw($extra_data)
+                               
.$portalbox->draw(isset($extra_data)?$extra_data:'')
                                .'<!-- ends Mailox info -->'."\r\n";
 #              }
 #      }

Index: templates/base/filterForm.tpl
===================================================================
RCS file: /sources/phpgroupware/felamimail/templates/base/filterForm.tpl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- templates/base/filterForm.tpl       18 Dec 2006 20:03:33 -0000      1.2
+++ templates/base/filterForm.tpl       20 Dec 2006 13:56:26 -0000      1.3
@@ -71,17 +71,17 @@
 <form method="post" name="filterList" action="{link_action}">
 
 <table width="95%" border="0" cellspacing="1" cellpading="1">
-<tr>
-       <td class="body">
+<tr class="th">
+       <td >
                {lang_no_filter}
        </td>
-       <td class="body" align="right">
+       <td  align="right">
                <a href={link_noFilter}>{lang_activate}</a>
        </td>
-       <td class="body" align="right">
+       <td  align="right">
                &nbsp;
        </td>
-       <td class="body" align="right">
+       <td align="right">
                &nbsp;
        </td>
 </tr>
@@ -99,8 +99,8 @@
 <!-- END header -->
 
 <!-- BEGIN filterrow -->
-<tr>
-       <td class="body">
+<tr class="{row_class}">
+       <td >
                {filtername}
        </td>
        <td class="body" align="right">




reply via email to

[Prev in Thread] Current Thread [Next in Thread]