phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: phpgwapi/inc class.common.inc.php,1.123.2.9.2.3


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpgwapi/inc class.common.inc.php,1.123.2.9.2.3,1.123.2.9.2.4
Date: Sat, 03 May 2003 06:43:48 -0400

Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv22553

Modified Files:
      Tag: Version-0_9_16-branch
        class.common.inc.php 
Log Message:
Fixed get_image_dir and get_image_path to not return the templates imagedir if 
it only contains the navbar icon (eg. idots or idsociety).
Thats only a fix, better would be if every app uses the image or find_image 
function.

Index: class.common.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.common.inc.php,v
retrieving revision 1.123.2.9.2.3
retrieving revision 1.123.2.9.2.4
diff -C2 -r1.123.2.9.2.3 -r1.123.2.9.2.4
*** class.common.inc.php        18 Apr 2003 14:35:27 -0000      1.123.2.9.2.3
--- class.common.inc.php        3 May 2003 10:43:46 -0000       1.123.2.9.2.4
***************
*** 715,718 ****
--- 715,744 ----
  
                /*!
+               @function is_image_dir
+               @abstract checks if image_dir exists and has more than just a 
navbar-icon
+               @note this is just a workaround for idots, better to use 
find_image, which has a fallback \
+                       on a per image basis to the default dir
+               */
+               function is_image_dir($dir)
+               {
+                       if (address@hidden($dir))
+                       {
+                               return False;
+                       }
+                       if ($d = opendir($dir))
+                       {
+                               while ($f = readdir($d))
+                               {
+                                       $ext = strtolower(strrchr($f,'.'));
+                                       if (($ext == '.gif' || $ext == '.png') 
&& strstr($f,'navbar') === False)
+                                       {
+                                               return True;
+                                       }
+                               }
+                       }
+                       return False;
+               }
+ 
+               /*!
                @function get_image_dir
                @abstract get image dir of an application
***************
*** 735,747 ****
                        $imagedir_olddefault = PHPGW_SERVER_ROOT . '/' . 
$appname . '/images';
  
!                       if (@is_dir ($imagedir))
                        {
                                return $imagedir;
                        }
!                       elseif (@is_dir ($imagedir_default))
                        {
                                return $imagedir_default;
                        }
!                       elseif (@is_dir ($imagedir_olddefault))
                        {
                                return $imagedir_olddefault;
--- 761,773 ----
                        $imagedir_olddefault = PHPGW_SERVER_ROOT . '/' . 
$appname . '/images';
  
!                       if ($this->is_image_dir ($imagedir))
                        {
                                return $imagedir;
                        }
!                       elseif ($this->is_image_dir ($imagedir_default))
                        {
                                return $imagedir_default;
                        }
!                       elseif ($this->is_image_dir ($imagedir_olddefault))
                        {
                                return $imagedir_olddefault;
***************
*** 774,786 ****
                        $imagedir_olddefault = PHPGW_SERVER_ROOT . 
'/'.$appname.'/images';
  
!                       if (@is_dir ($imagedir))
                        {
                                return 
$GLOBALS['phpgw_info']['server']['webserver_url'].'/'.$appname.'/templates/'.$GLOBALS['phpgw_info']['server']['template_set'].'/images';
                        }
!                       elseif (@is_dir ($imagedir_default))
                        {
                                return 
$GLOBALS['phpgw_info']['server']['webserver_url'].'/'.$appname.'/templates/default/images';
                        }
!                       elseif (@is_dir ($imagedir_olddefault))
                        {
                                return 
$GLOBALS['phpgw_info']['server']['webserver_url'].'/'.$appname.'/images';
--- 800,812 ----
                        $imagedir_olddefault = PHPGW_SERVER_ROOT . 
'/'.$appname.'/images';
  
!                       if ($this->is_image_dir ($imagedir))
                        {
                                return 
$GLOBALS['phpgw_info']['server']['webserver_url'].'/'.$appname.'/templates/'.$GLOBALS['phpgw_info']['server']['template_set'].'/images';
                        }
!                       elseif ($this->is_image_dir ($imagedir_default))
                        {
                                return 
$GLOBALS['phpgw_info']['server']['webserver_url'].'/'.$appname.'/templates/default/images';
                        }
!                       elseif ($this->is_image_dir ($imagedir_olddefault))
                        {
                                return 
$GLOBALS['phpgw_info']['server']['webserver_url'].'/'.$appname.'/images';





reply via email to

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