Bontiv-Sourceer source code viewer
Root | Help
./nk-auto-install-googlecode/class/localdir.php
<?php
require_once 'dir.php';

class
LocalDir extends Dir
{
    protected
$base_dir;
   
    public function
__construct($dir)
    {
       
$this->base_dir = $this->cleanPath($dir . '/');
       
parent::__construct();
    }    
   
    public function
set_content ($file, $data)
    {
       
$path = $this->base_dir
           
. $this->getPath($file);
        if (!
file_exists(dirname($path)) && !mkdir(dirname($path), 0777, true))
        {
            return
false;
        }

        if (
file_exists($path))
        {
           
chmod($path, 0666);
        }
       
        if (!
file_put_contents ($path, $data) && $data !== '')
        {
            return
false;
        }
        return
true;
    }
}
Presented with Bontiv-Sourceer