/** * Created by PhpStorm. * User: Asus- * Date: 24.11.2015 * Time: 18:12 */ function chm($folder) { /* Получаем полный список файлов и каталогов внутри $folder */ $files = scandir($folder); foreach ($files as $file) { /* Отбрасываем текущий и родительский каталог */ if (($file == '.') || ($file == '..')) continue; $f0 = $folder . '/' . $file; //Получаем полный путь к файлу var_dump(chmode($f0,0777)); /* Если это директория */ if (is_dir($f0)) { $res = chm( $f0 ); if ($res) { $result [] = $res; } } } }
/* -------------------------------------------------------------------------------- File: _squeeze.php Unit: Code Squeezer Author: Quoc Viet [aFeLiOn] (Based on xajax) Begin: 2006-02-10 -------------------------------------------------------------------------------- */ $source_dir = 'd:/viet/web/eposys/js'; $target_dir = 'd:/server/htdocs/eposys/js'; $allows = array('js'); if (!is_dir($target_dir)) { mkdir($target_dir, 0777); } else { if (!is_writeable($target_dir)) { chmode($target_dir, 0777); } } //Scan Directory $dir = dir($source_dir); while ($filename = $dir->read()) { $old_file = $source_dir . '/' . $filename; if (is_file($old_file)) { $ext = explode('.', $filename); $ext = strtolower($ext[count($ext) - 1]); if (in_array($ext, $allows)) { $new_file = $target_dir . '/' . $filename; squeeze($old_file, $new_file); echo $filename . '<br />' . "\n"; } }
$filegroup_other_perms = $_POST['cmodmodeother']; $filegroup_other_perms = preg_replace('/[^0-7]*/', '', $filegroup_other_perms); $filegroup_other_perms = substr($filegroup_other_perms, 0, 3); } else { $filegroup_other_activated = FALSE; } if (isset($_POST['newdirperms'])) { $new_dir_perms_on = TRUE; $new_dir_perms = $_POST['cmodmodedirs']; $new_dir_perms = preg_replace('/[^0-7]*/', '', $new_dir_perms); $new_dir_perms = substr($new_dir_perms, 0, 3); } else { $new_dir_perms_on = FALSE; } } $path_result = chmode($site_root); _gettpl('chmodding'); break; case 'compress': $conf['step_id'] = 'setmode'; if (isset($_POST['postpath'])) { $path = preg_replace('/\\\\+|\\/+/', '/', $_POST['postpath']); if (!preg_match('/\\w{1,3}/', $path)) { $path = $site_root; } $site_root = $path; if (isset($_POST['archivename'])) { $archivename = $_POST['archivename']; $archivename = preg_replace("/([\\W])+/i", "", $archivename); $archivename = $archivename . '.auae'; }