Example #1
0
function plug_new($root_name, $index_file = '')
{
    require_once 'Archive/Tar.php';
    $tar = new Archive_Tar($cfg_cms['cms_path'] . "tpl/pluginvorlage.tar");
    $tmp_plugmeta = $tar->extractInString('pluginvorlage.php');
    $tmp_plugmeta = str_replace('{pluginname}', $root_name, $tmp_plugmeta);
    if (!$tar->extractModify($cfg_cms['cms_path'] . 'plugins/' . $root_name . '/', '/')) {
        return '-1';
    }
    if (true != ($write = lib_write_file($cfg_cms['cms_path'] . 'plugins/' . $root_name . '/' . $root_name . '_meta.php', $tmp_plugmeta))) {
        return '-2';
    }
    if ('-1' == ($delete = lib_delete_file($cfg_cms['cms_path'] . 'plugins/' . $root_name . '/pluginvorlage.php'))) {
        return '-3';
    }
    if ($index_file != '' && !lib_check_file($cfg_cms['cms_path'] . 'plugins/' . $root_name . '/' . $index_file)) {
        $content = "<?PHP\n/*\n * Plugin-Indexfile\n */\n?" . ">\n";
        if (true != lib_write_file($cfg_cms['cms_path'] . 'plugins/' . $root_name . '/' . $index_file, $content)) {
            return '-4';
        }
    }
    return true;
}
 /**
  * repository::_checkFile()
  *
  * { Description }
  *
  * @param string $file_name
  */
 function _checkFile($file, $file_name = '')
 {
     if (!$this->_safemode) {
         return lib_check_file($file);
     }
 }
Example #3
0
function lib_remove_dir($dir)
{
    @chmod($dir, 0777);
    if (lib_check_dir($dir)) {
        if (($handle = @opendir($dir)) != false) {
            while (($filename = @readdir($handle)) != false) {
                if ($filename == "." || $filename == "..") {
                    continue;
                } else {
                    clearstatcache();
                    if (@is_file($dir . "/" . $filename)) {
                        if (lib_delete_file($dir . "/" . $filename) == '-1') {
                            return '-1';
                        }
                    } else {
                        clearstatcache();
                        if (@is_dir($dir . "/" . $filename)) {
                            if (lib_remove_dir($dir . "/" . $filename) == '-1') {
                                return '-1';
                            }
                        }
                    }
                }
            }
            closedir($handle);
            @rmdir($dir);
        }
    } elseif (lib_check_file($dir)) {
        return lib_delete_dir($dir);
    }
    clearstatcache();
    if (@is_dir($dir)) {
        return '-1';
    }
}