phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: infolog/inc class.vfs.inc.php,1.8,1.9


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: infolog/inc class.vfs.inc.php,1.8,1.9
Date: Thu, 03 Jul 2003 13:11:25 -0400

Update of /cvsroot/phpgroupware/infolog/inc
In directory subversions:/tmp/cvs-serv3469

Modified Files:
        class.vfs.inc.php 
Log Message:
improved version of in_docroot, allows for pathnames starting like the docroot

Index: class.vfs.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/infolog/inc/class.vfs.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** class.vfs.inc.php   3 Jul 2003 00:33:26 -0000       1.8
--- class.vfs.inc.php   3 Jul 2003 17:11:23 -0000       1.9
***************
*** 103,107 ****
                        // test if the files-dir is inside the document-root, 
and refuse working if so
                        //
!                       if (strstr($this->basedir,PHPGW_SERVER_ROOT) || 
strstr($this->basedir,$GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT']))
                        {
                                $GLOBALS['phpgw']->common->phpgw_header();
--- 103,107 ----
                        // test if the files-dir is inside the document-root, 
and refuse working if so
                        //
!                       if ($this->in_docroot($this->basedir))
                        {
                                $GLOBALS['phpgw']->common->phpgw_header();
***************
*** 156,159 ****
--- 156,184 ----
                                $this->linked_dirs[] = 
$GLOBALS['phpgw']->db->Record;
                        }
+               }
+ 
+               /*!
+               @function in_docroot
+               @abstract test if $path lies within the webservers document-root
+               */
+               function in_docroot($path)
+               {
+                       $docroots = 
array(PHPGW_SERVER_ROOT,$GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT']);
+ 
+                       foreach ($docroots as $docroot)
+                       {
+                               $len = strlen($docroot);
+ 
+                               if ($docroot == substr($path,0,$len))
+                               {
+                                       $rest = substr($path,$len);
+ 
+                                       if (!strlen($rest) || $rest[0] == 
DIRECTORY_SEPARATOR)
+                                       {
+                                               return True;
+                                       }
+                               }
+                       }
+                       return False;
                }
  





reply via email to

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