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.6.2.2


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpgwapi/inc class.vfs_sql.inc.php,1.15.2.6.2.2,1.15.2.6.2.3
Date: Thu, 03 Jul 2003 13:10:30 -0400

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

Modified Files:
      Tag: Version-0_9_16-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.6.2.2
retrieving revision 1.15.2.6.2.3
diff -C2 -r1.15.2.6.2.2 -r1.15.2.6.2.3
*** class.vfs_sql.inc.php       3 Jul 2003 00:32:58 -0000       1.15.2.6.2.2
--- class.vfs_sql.inc.php       3 Jul 2003 17:10:28 -0000       1.15.2.6.2.3
***************
*** 84,88 ****
                        // test if the files-dir is inside the document-root, 
and refuse working if so
                        //
!                       if ($this->file_actions && 
(strstr($this->basedir,PHPGW_SERVER_ROOT) || 
strstr($this->basedir,$GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT'])))
                        {
                                $GLOBALS['phpgw']->common->phpgw_header();
--- 84,88 ----
                        // test if the files-dir is inside the document-root, 
and refuse working if so
                        //
!                       if ($this->file_actions && 
$this->in_docroot($this->basedir))
                        {
                                $GLOBALS['phpgw']->common->phpgw_header();
***************
*** 118,121 ****
--- 118,146 ----
                                $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]