function set_chmod_r($dir, $chmod, $type = CHMOD_DIR, $files = array()) {
	$dh = opendir($dir);
	if (count($files) == 0 && $type == CHMOD_DIR) {
		set_chmod($dir, $chmod, $type);
		$files[] = $dir;
	}
	while ($file = readdir($dh)) {
		if($file != '.' && $file != '..') {
			$fullpath = $dir.'/'.$file;
			if($type($fullpath)) {
				set_chmod($fullpath, $chmod, $type);
				$files[] = $fullpath;
			}
			if (is_dir($fullpath)) {
				$files = set_chmod_r($fullpath, $chmod, $type, $files);
			}
		}
	}
	closedir($dh);
	return $files;
}
 foreach ($chmod as $dat) {
     if ($dat['recursive']) {
         $filenames = array();
         if ($dat['chmod'] == CHMOD_EX) {
             $filenames = set_chmod_r($dat['path'], 0777, CHMOD_DIR);
         } elseif ($dat['chmod'] == CHMOD_WR) {
             $filenames = set_chmod_r($dat['path'], 0666, CHMOD_FILE);
         }
         foreach ($filenames as $f) {
             $files[] = array('path' => $f, 'chmod' => $dat['chmod'], 'recursive' => false, 'req' => $dat['req']);
         }
     } else {
         if ($dat['chmod'] == CHMOD_EX) {
             set_chmod($dat['path'], 0777, CHMOD_DIR);
         } elseif ($dat['chmod'] == CHMOD_WR) {
             set_chmod($dat['path'], 0666, CHMOD_FILE);
         }
         $files[] = $dat;
     }
 }
 @clearstatcache();
 sort($files);
 foreach ($files as $arr) {
     $chmod = get_chmod($arr['path']);
     if (check_chmod($arr['chmod'], $chmod)) {
         $status = '<strong style="color: #008000;">' . $lang->phrase('admin_explorer_chmod_status_ok') . '</strong>';
     } elseif ($arr['req'] == false) {
         $status = '<strong style="color: #ffaa00;">' . $lang->phrase('admin_explorer_chmod_status_failure_x') . '</strong>';
     } else {
         $status = '<strong style="color: #ff0000;">' . $lang->phrase('admin_explorer_chmod_status_failure') . '</strong>';
     }
Exemple #3
0
    if ($dat['recursive']) {
        $filenames = array();
        if ($dat['chmod'] == CHEX) {
            $filenames = set_chmod_r($path, 0777, CHMOD_DIR);
        } elseif ($dat['chmod'] == CHWR) {
            $filenames = set_chmod_r($path, 0666, CHMOD_FILE);
        }
        foreach ($filenames as $f) {
            $f = str_replace('../', '', $f);
            $files[] = array('path' => $f, 'chmod' => $dat['chmod'], 'recursive' => false, 'req' => $dat['req']);
        }
    } else {
        if ($dat['chmod'] == CHEX) {
            set_chmod($path, 0777, CHMOD_DIR);
        } elseif ($dat['chmod'] == CHWR) {
            set_chmod($path, 0666, CHMOD_FILE);
        }
        $files[] = $dat;
    }
}
@clearstatcache();
sort($files);
$failure = false;
foreach ($files as $arr) {
    $filesys_path = '../' . $arr['path'];
    $path = realpath($filesys_path);
    if (empty($path)) {
        $path = $arr['path'];
    }
    $chmod = get_chmod($filesys_path);
    if (check_chmod($arr['chmod'], $chmod)) {
Exemple #4
0
>&nbsp;<font color="#FFFFFF"><?php 
echo html_specialchars($phpwcms["templates"] . "/inc_css/frontend.css");
?>
</font>&nbsp;</td>
    <td><img src="../img/leer.gif" alt="" width="1" height="19"></td>
    <td><?php 
echo gib_status_text($status);
?>
</td>
  </tr>

  <tr><td colspan="4" class="v10"><img src="../img/leer.gif" alt="" width="1" height="2"></td></tr>
  <tr><?php 
$status = check_file_status($phpwcms["root"] . "/include/config/conf.indexpage.inc.php");
if ($status != 2) {
    $status = set_chmod($phpwcms["root"] . "/" . $phpwcms["templates"] . "/include/config/conf.indexpage.inc.php", 0666, $status, 1);
}
?>
    <td align="right" class="v10">index level settings:&nbsp;</td>
    <td<?php 
echo gib_bg_color($status == 2 ? 2 : 0);
?>
>&nbsp;<font color="#FFFFFF"><?php 
echo html_specialchars("include/config/conf.indexpage.inc.php");
?>
</font>&nbsp;</td>
    <td><img src="../img/leer.gif" alt="" width="1" height="19"></td>
    <td><?php 
echo gib_status_text($status);
?>
</td>