Login or Register

RSS IconRecent posts in this topic

avatar
kenike on Mar 21. 2007. 7:19 pm
I had the same problem like many other members with open_basedir restriction and this fix worked for me like a charm on my fedora box...

- First locate activecollab\environment\functions folder and open the file "files.php".
- Find the function force_mkdir and change this line:

if(!is_dir($forced_path)) {

to:

if(!my_is_dir($forced_path)) {

* note that we added "my_" prefix on "is_dir" function.


- Add this new function just below force_mkdir to bypass open_basedir restrictions:



function my_is_dir($dir)
{
// bypasses open_basedir restrictions of is_dir and fileperms
$tmp_cmd = `ls -dl $dir`;
$dir_flag = $tmp_cmd[0];
if($dir_flag!="d")
{
// not d; use next char (first char might be 's' and is still directory)
$dir_flag = $tmp_cmd[1];
}
return ($dir_flag=="d");
}

- Save and upload.

*****

Great work, Ilija!!! Take care!
avatar
Anathema on Jun 26. 2007. 1:31 pm
Friends,

I don't understand well this issue. Example: My database prefix name, anathema_ so i have to use it like this : anathema_is_dir and change all my_ to anathema_ is it true?

And i don't understand well where i have to add these codes :

function my_is_dir($dir)
{
// bypasses open_basedir restrictions of is_dir and fileperms
$tmp_cmd = `ls -dl $dir`;
$dir_flag = $tmp_cmd[0];
if($dir_flag!="d")
{
// not d; use next char (first char might be 's' and is still directory)
$dir_flag = $tmp_cmd[1];
}
return ($dir_flag=="d");
}

Thanks for your reply from now. Take care
avatar
adamluz2 on Sep 6. 2007. 9:44 pm
The fix worked well for me. For those of you who are confused, here is the replacement code:

function force_mkdir($path, $chmod = null) {
if(is_dir($path)) return true;
$real_path = str_replace('\\', '/', $path);
$parts = explode('/', $real_path);

$forced_path = '';
foreach($parts as $part) {

// Skip first on windows
if($forced_path == '') {
$start = substr(__FILE__, 0, 1) == '/' ? '/' : '';
$forced_path = $start . $part;
} else {
$forced_path .= '/' . $part;
} // if

if(!my_is_dir($forced_path)) {
if(!is_null($chmod)) {
if(!mkdir($forced_path)) return false;
} else {
if(!mkdir($forced_path, $chmod)) return false;
} // if
} // if
} // foreach

return true;
} // force_mkdir

function my_is_dir($dir)
{
// bypasses open_basedir restrictions of is_dir and fileperms
$tmp_cmd = `ls -dl $dir`;
$dir_flag = $tmp_cmd[0];
if($dir_flag!="d")
{
// not d; use next char (first char might be 's' and is still directory)
$dir_flag = $tmp_cmd[1];
}
return ($dir_flag=="d");
}
Topic is locked. If you have something important to say about issues discussed on this page please write at hi@a51dev.com.

RSS IconRecent posts in this topic