Esempio n. 1
0
 public function chmod($path, $filemode)
 {
     if (!is_dir($path)) {
         return chmod($path, $filemode);
     }
     $dh = opendir($path);
     while (($file = readdir($dh)) !== false) {
         if ($file != '.' && $file != '..') {
             $fullpath = $path . '/' . $file;
             if (is_link($fullpath)) {
                 return FALSE;
             } elseif (!is_dir($fullpath)) {
                 if (!chmod($fullpath, $filemode)) {
                     return FALSE;
                 } elseif (!chmod_R($fullpath, $filemode)) {
                     return FALSE;
                 }
             }
         }
     }
     closedir($dh);
     if (chmod($path, $filemode)) {
         return TRUE;
     } else {
         return FALSE;
     }
 }
Esempio n. 2
0
function chmod_R($path, $filemode)
{
    if (!is_dir($path)) {
        return chmod($path, $filemode);
    }
    $dh = opendir($path);
    while ($file = readdir($dh)) {
        if ($file != '.' && $file != '..') {
            $fullpath = $path . '/' . $file;
            if (!is_dir($fullpath)) {
                if (!chmod($fullpath, $filemode)) {
                    return FALSE;
                }
            } else {
                if (!chmod_R($fullpath, $filemode)) {
                    return FALSE;
                }
            }
        }
    }
    closedir($dh);
    if (chmod($path, $filemode)) {
        return true;
    } else {
        return false;
    }
}
Esempio n. 3
0
function chmod_R($path, $filemode, $dirmode)
{
    if (is_dir($path)) {
        if (!chmod($path, $dirmode)) {
            $dirmode_str = decoct($dirmode);
            print "Failed applying filemode '{$dirmode_str}' on directory '{$path}'\n";
            print "  `-> the directory '{$path}' will be skipped from recursive chmod\n";
            return;
        }
        $dh = opendir($path);
        while (($file = readdir($dh)) !== false) {
            if ($file != '.' && $file != '..') {
                // skip self and parent pointing directories
                $fullpath = $path . '/' . $file;
                chmod_R($fullpath, $filemode, $dirmode);
            }
        }
        closedir($dh);
    } else {
        if (is_link($path)) {
            print "link '{$path}' is skipped\n";
            return;
        }
        if (!chmod($path, $filemode)) {
            $filemode_str = decoct($filemode);
            print "Failed applying filemode '{$filemode_str}' on file '{$path}'\n";
            return;
        }
    }
}
Esempio n. 4
0
function chmod_R($path, $perm) {
 $handle = opendir($path);
 while ( false !== ($file = readdir($handle)) ) {
 if ( ($file !== "..") ) {
 @chmod($path . "/" . $file, $perm);
 if ( !is_file($path."/".$file) && ($file !== ".") )
 chmod_R($path . "/" . $file, $perm);
 }
 }
 closedir($handle);
}
Esempio n. 5
0
function chmod_R($path, $perm)
{
    $handle = opendir($path);
    while (false !== ($file = readdir($handle))) {
        if ($file !== "." && $file !== "..") {
            if (is_file($path . "/" . $file)) {
                chmod($path . "/" . $file, $perm);
            } else {
                chmod($path . "/" . $file, $perm);
                chmod_R($path . "/" . $file, $perm);
            }
        }
    }
    closedir($handle);
}
Esempio n. 6
0
function chmod_R($path, $mode)
{
    if (is_dir($path)) {
        if (chmod($path, $mode) == false) {
            return false;
        }
        $files = scandir($path);
        foreach ($files as $file) {
            if ($file != '.' && $file != '..') {
                $fullpath = $path . '/' . $file;
                if (!chmod_R($fullpath, $mode)) {
                    return false;
                }
            }
        }
        return true;
    } else {
        return chmod($path, $mode);
    }
}
Esempio n. 7
0
    die(__('Athentication failed!', $flutter_domain));
}
require_once 'RCCWP_CustomWriteModule.php';
require_once 'RCCWP_CustomWritePanel.php';
require_once 'RCCWP_Application.php';
require_once 'RCCWP_CustomWritePanel.php';
$moduleID = (int) $_REQUEST['custom-write-module-id'];
$module = RCCWP_CustomWriteModule::Get($moduleID);
if (isset($_POST["write_panels"])) {
    //$write_panels = json_decode(stripslashes($_POST["write_panels"]));
    $modulePath = FLUTTER_MODULES_DIR . $module->name . DIRECTORY_SEPARATOR;
    $tmpPath = sys_get_temp_dir() . DIRECTORY_SEPARATOR;
    // Copy dir to tmp folder
    dircopy($modulePath, $tmpPath . $module->name);
    $moduleTmpPath = "{$tmpPath}{$module->name}";
    chmod_R($moduleTmpPath, 0777);
    // Export write panels
    //check if arrary the write modules is empty
    if ($_POST["write_panels"] != NULL) {
        $write_panels = split(",", $_POST["write_panels"]);
        foreach ($write_panels as $panelID) {
            $writePanel = RCCWP_CustomWritePanel::Get($panelID);
            $exportedFilename = $moduleTmpPath . DIRECTORY_SEPARATOR . '_' . $writePanel->name . '.pnl';
            RCCWP_CustomWritePanel::Export($panelID, $exportedFilename);
        }
    }
    // Export duplicates and description
    $moduleInfoFilename = $moduleTmpPath . DIRECTORY_SEPARATOR . 'module_info.exp';
    $moduleInfo_exported_data['duplicates'] = RCCWP_ModuleDuplicate::GetCustomModulesDuplicates($moduleID);
    $moduleInfo_exported_data['moduleinfo'] = RCCWP_CustomWriteModule::Get($moduleID);
    $handle = fopen($moduleInfoFilename, "w");
Esempio n. 8
0
/**
 * Рекурсвная смена прав для файлов и папок. Функция взята из курса Битрикс "Администратор. Базовый"
 *
 * @param $path
 */
function chmod_R($path)
{
    $BX_FILE_PERMISSIONS = 0644;
    $BX_DIR_PERMISSIONS = 0755;
    $handle = opendir($path);
    while (false !== ($file = readdir($handle))) {
        if ($file !== "." && $file !== "..") {
            if (is_file($path . "/" . $file)) {
                chmod($path . "/" . $file, $BX_FILE_PERMISSIONS);
            } else {
                chmod($path . "/" . $file, $BX_DIR_PERMISSIONS);
                chmod_R($path . "/" . $file);
            }
        }
    }
    closedir($handle);
}
Esempio n. 9
0
function tb_chmod_R($path, $filemode) {
 
    $dh = opendir($path);
    while ($file = readdir($dh)) {
        if($file != '.' && $file != '..') {
            $fullpath = $path.'/'.$file;
			chmod($fullpath, $filemode);
            if(is_dir($fullpath)) {
 
               chmod_R($fullpath, $filemode);
 
            } 
        }
    }
 
    closedir($dh);    
}