Beispiel #1
0
function _rmdir($path)
{
    global $ftp, $can_write, $settings;
    if ($can_write) {
        return @rmdir($path);
    }
    return $ftp->rmdir(spath($path));
}
Beispiel #2
0
function _chmod($path, $oct)
{
    global $ftp, $can_write, $settings;
    if ($can_write) {
        return @chmod($path, $oct);
    }
    return $ftp->chmod(spath($path), $oct);
}
Beispiel #3
0
 function privDirCheck($p_dir, $p_is_dir = false)
 {
     $v_result = 1;
     // ----- Remove the final '/'
     if ($p_is_dir && substr($p_dir, -1) == '/') {
         $p_dir = substr($p_dir, 0, strlen($p_dir) - 1);
     }
     // ----- Check the directory availability
     if (is_dir($p_dir) || $p_dir == "") {
         return 1;
     }
     // ----- Extract parent directory
     $p_parent_dir = dirname($p_dir);
     // ----- Just a check
     if ($p_parent_dir != $p_dir) {
         // ----- Look for parent directory
         if ($p_parent_dir != "") {
             if (($v_result = $this->privDirCheck($p_parent_dir)) != 1) {
                 return $v_result;
             }
         }
     }
     if (!empty($GLOBALS['can_write'])) {
         // ----- Create the directory
         if (!@mkdir($p_dir, 0777)) {
             // ----- Error log
             PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '{$p_dir}'");
             // ----- Return
             return PclZip::errorCode();
         }
     } else {
         // ----- Create the directory
         if (!@$GLOBALS['ftp']->mkdir(spath($p_dir))) {
             // ----- Error log
             PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '{$p_dir}'");
             // ----- Return
             return PclZip::errorCode();
         }
     }
     // ----- Return
     return $v_result;
 }