phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: phpgwapi/inc class.vfs_sql.inc.php,1.15.2.7,1.1


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpgwapi/inc class.vfs_sql.inc.php,1.15.2.7,1.15.2.8
Date: Thu, 03 Jul 2003 12:26:56 -0400

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

Modified Files:
      Tag: Version-0_9_14-branch
        class.vfs_sql.inc.php 
Log Message:
improved version of in_docroot, allows for pathnames starting like the docroot

Index: class.vfs_sql.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.vfs_sql.inc.php,v
retrieving revision 1.15.2.7
retrieving revision 1.15.2.8
diff -C2 -r1.15.2.7 -r1.15.2.8
*** class.vfs_sql.inc.php       3 Jul 2003 00:19:40 -0000       1.15.2.7
--- class.vfs_sql.inc.php       3 Jul 2003 16:26:54 -0000       1.15.2.8
***************
*** 104,108 ****
                        // 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();
--- 104,108 ----
                        // 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();
***************
*** 171,174 ****
--- 171,199 ----
                                $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]