Joomla! Discussion Forums



It is currently Fri Nov 27, 2009 2:54 pm (All times are UTC )

 




Post new topic Reply to topic  [ 2 posts ] 
Author Message
Posted: Tue Nov 03, 2009 3:04 am 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Sun Feb 03, 2008 8:08 pm
Posts: 2
As like (i assume) many of you I am a PHP developer and have been using Joomla! for many of the sites we have been making for people and decided that to make it easier we are going to create a "core" folder for all of the sites that use Joomla!, that way when we update one site it updates them all.

I have finished the initial setup of the process, however joomla is using the file_exists() function, which does not check the INI setting "include_path", which the file does exist, just not within the directory the rest of the files are in.

In other words, I have the php.ini file's 'include_path' flag set to: "include_path:".;D:\PHP_INCLUDES\" (windows) and everything works fine except in many of the files joomla uses if(file_exists(JPATH_ROOT.DS.'includes'.DS.'application.php')) or something similer to see if the file is actually there. This creates a problem for me because the strict path does not exist, however if you where to do require(JPATH_ROOT.DS.'includes'.DS.'application.php') the file would load because of the 'include_path' flag that I have set in the php.ini file.

My suggestion is to use a global function to substitute file_exists()... something like:

(taken from: http://www.php.net/manual/en/function.f ... .php#92619, not sure if it even works, but I think you get the point)
Code:
<?php
    /*
     * Expanden file_exists function
     * Searches in include_path
     */
    function file_exists_ip($filename) {
        if(function_exists("get_include_path")) {
            $include_path = get_include_path();
        } elseif(false !== ($ip = ini_get("include_path"))) {
            $include_path = $ip;
        } else {return false;}

        if(false !== strpos($include_path, PATH_SEPARATOR)) {
            if(false !== ($temp = explode(PATH_SEPARATOR, $include_path)) && count($temp) > 0) {
                for($n = 0; $n < count($temp); $n++) {
                    if(false !== @file_exists($temp[$n] . $filename)) {
                        return true;
                    }
                }
                return false;
            } else {return false;}
        } elseif(!empty($include_path)) {
            if(false !== @file_exists($include_path)) {
                return true;
            } else {return false;}
        } else {return false;}
    }
?>


Top
  E-mail  
 
Posted: Thu Nov 05, 2009 9:28 am 
User avatar
Joomla! Champion
Joomla! Champion
Online

Joined: Fri Sep 09, 2005 2:13 pm
Posts: 6776
Location: The Netherlands
Mod Note: Please, no bumping, it's against forum rules.

_________________
Robert Dam - Joomla Forum Moderator
Dutch Boards | Joomla Coding Boards | English Support Boards


Top
  E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

Quick reply

 



Who is online

Users browsing this forum: dam-man, postgate, uglykidjoe and 42 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group