<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
  <title>aC forum: Upload file error: open_basedir restriction quickfix</title>
  <link>http://www.activecollab.com/forums/topic/1499/</link>
  <description>Recent posts on topic: Upload file error: open_basedir restriction quickfix</description>
  <dc:language>en-us</dc:language>
  <pubDate>Thu, 04 Dec 2008 03:55:01 UTC</pubDate>
  
  <item>
    <link>http://www.activecollab.com/forums/post/8609/#post8609</link>
    <guid>http://www.activecollab.com/forums/post/8609/#post8609</guid>
    <title>Post #3 by adamluz2</title>
    <dc:creator>adamluz2</dc:creator>
    <description><![CDATA[<p>The fix worked well for me. For those of you who are confused, here is the replacement code:<br />
<br />
function force_mkdir($path, $chmod = null) {<br />
    if(is_dir($path)) return true;<br />
    $real_path = str_replace('\\', '/', $path);<br />
    $parts = explode('/', $real_path);<br />
    <br />
    $forced_path = '';<br />
    foreach($parts as $part) {<br />
      <br />
      // Skip first on windows<br />
      if($forced_path == '') {<br />
        $start = substr(__FILE__, 0, 1) == '/' ? '/' : '';<br />
        $forced_path = $start . $part;<br />
      } else {<br />
        $forced_path .= '/' . $part;<br />
      } // if<br />
      <br />
      if(!my_is_dir($forced_path)) {<br />
        if(!is_null($chmod)) {<br />
          if(!mkdir($forced_path)) return false;<br />
        } else {<br />
          if(!mkdir($forced_path, $chmod)) return false;<br />
        } // if<br />
      } // if<br />
    } // foreach<br />
    <br />
    return true;<br />
  } // force_mkdir<br />
<br />
function my_is_dir($dir)<br />
{<br />
  // bypasses open_basedir restrictions of is_dir and fileperms<br />
  $tmp_cmd = `ls -dl $dir`;<br />
  $dir_flag = $tmp_cmd[0];<br />
  if($dir_flag!=&quot;d&quot;)<br />
  {<br />
  // not d; use next char (first char might be 's' and is still directory)<br />
  $dir_flag = $tmp_cmd[1];<br />
  }<br />
  return ($dir_flag==&quot;d&quot;);<br />
}</p>]]></description>
    <pubDate>Thu, 06 Sep 2007 21:44:41 UTC</pubDate>
  </item>
  <item>
    <link>http://www.activecollab.com/forums/post/8060/#post8060</link>
    <guid>http://www.activecollab.com/forums/post/8060/#post8060</guid>
    <title>Post #2 by Anathema</title>
    <dc:creator>Anathema</dc:creator>
    <description><![CDATA[<p>Friends,<br />
<br />
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?<br />
<br />
And i don't understand well where i have to add these codes :<br />
<br />
function my_is_dir($dir)<br />
{<br />
// bypasses open_basedir restrictions of is_dir and fileperms<br />
$tmp_cmd = `ls -dl $dir`;<br />
$dir_flag = $tmp_cmd[0];<br />
if($dir_flag!=&quot;d&quot;)<br />
{<br />
// not d; use next char (first char might be 's' and is still directory)<br />
$dir_flag = $tmp_cmd[1];<br />
}<br />
return ($dir_flag==&quot;d&quot;);<br />
}<br />
<br />
Thanks for your reply from now. Take care<br />
</p>]]></description>
    <pubDate>Tue, 26 Jun 2007 13:31:48 UTC</pubDate>
  </item>
  <item>
    <link>http://www.activecollab.com/forums/post/7245/#post7245</link>
    <guid>http://www.activecollab.com/forums/post/7245/#post7245</guid>
    <title>Post #1 by kenike</title>
    <dc:creator>kenike</dc:creator>
    <description><![CDATA[<p>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...<br />
<br />
- First locate activecollab\environment\functions folder and open the file &quot;files.php&quot;.<br />
- Find the function force_mkdir and change this line:<br />
<br />
		if(!is_dir($forced_path)) {<br />
<br />
to:<br />
<br />
		if(!my_is_dir($forced_path)) {<br />
<br />
* note that we added &quot;my_&quot; prefix on &quot;is_dir&quot; function.<br />
<br />
<br />
- Add this new function just below force_mkdir to bypass open_basedir restrictions:<br />
<br />
<br />
<br />
function my_is_dir($dir)<br />
{<br />
   // bypasses open_basedir restrictions of is_dir and fileperms<br />
   $tmp_cmd = `ls -dl $dir`;<br />
   $dir_flag = $tmp_cmd[0];<br />
   if($dir_flag!=&quot;d&quot;)<br />
   {<br />
       // not d; use next char (first char might be 's' and is still directory)<br />
       $dir_flag = $tmp_cmd[1];<br />
   }<br />
   return ($dir_flag==&quot;d&quot;);<br />
}<br />
<br />
- Save and upload.<br />
<br />
*****<br />
<br />
Great work, Ilija!!! Take care!<br />
</p>]]></description>
    <pubDate>Wed, 21 Mar 2007 19:19:50 UTC</pubDate>
  </item>
</channel>
</rss>