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.206,1.207


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpgwapi/inc class.common.inc.php,1.206,1.207
Date: Sat, 03 May 2003 06:59:19 -0400

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

Modified Files:
        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.206
retrieving revision 1.207
diff -C2 -r1.206 -r1.207
*** class.common.inc.php        27 Apr 2003 19:27:28 -0000      1.206
--- class.common.inc.php        3 May 2003 10:59:16 -0000       1.207
***************
*** 726,729 ****
--- 726,755 ----
  
                /*!
+               @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
***************
*** 754,766 ****
                        $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;
--- 780,792 ----
                        $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;
***************
*** 802,814 ****
                        $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';
--- 828,840 ----
                        $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]