debug-objects
debug-objects copied to clipboard
File Permissions overview
<table class="widefat">
<thead>
<tr>
<tr>
<th>File</th>
<th>Permission</th>
<th>Size</th>
</tr>
</thead>
<tbody>
<?php // ---- Root folder
$iterator = new DirectoryIterator( ABSPATH );
// don't scan for these files types
$filetypes = array("jpg", "png", "gif", "jpeg", "ico", "css", "txt");
foreach ($iterator as $fileinfo) {
if (!$fileinfo->isDot()) {
//get file extension
$filetype = pathinfo($fileinfo, PATHINFO_EXTENSION);
// get permissions in octal
$stringy = substr(sprintf('%o', $fileinfo->getPerms()), -4);
?>
</tr>
<?php if (!in_array(strtolower($filetype), $filetypes)) {
//output file name
echo "<td>" . $fileinfo . "</td>";
//check for 777 ! and outputs perms
if ($stringy == '0777'){
echo "<td>" . substr(sprintf('%o', $fileinfo->getPerms()), -4) .
"<span class='red'> × </span>" . "</td>" ;
}else{
echo "<td>" . substr(sprintf('%o', $fileinfo->getPerms()), -4) . "</td>" ;
}
//output file sizes
echo "<td>" . number_format($fileinfo->getSize()/1024, 2) . " KB" . "</td>";
}
}
}?>
</tbody>
</table>
</div>
<!--TAB TWO -->
<div>
<table class="widefat">
<thead>
<tr>
<tr>
<th>File</th>
<th>Permission</th>
<th>Size</th>
</tr>
</thead>
<tbody>
<?php // ---- wp-admin folder
$it = new RecursiveDirectoryIterator( ABSPATH . "wp-admin");
foreach(new RecursiveIteratorIterator($it) as $file) {
$filetype = pathinfo($file, PATHINFO_EXTENSION);
$stringy = substr(sprintf('%o', $fileinfo->getPerms()), -4);
?>
</tr>
<?php if (!in_array(strtolower($filetype), $filetypes)) {
echo "<td>" . $file . "</td>";
//check for 777 !
if ($stringy == '0777'){
echo "<td>" . substr(sprintf('%o', $fileinfo->getPerms()), -4) .
"<span class='red'> × </span>" . "</td>" ;
}else{
echo "<td>" . substr(sprintf('%o', $fileinfo->getPerms()), -4) . "</td>" ;
}
echo "<td>" . number_format($file->getSize()/1024, 2) . " KB" . "</td>";
}
}?>
</tbody>
</table>
</div>
<!--TAB THREE-->
<div>
<table class="widefat">
<thead>
<tr>
<tr>
<th>File</th>
<th>Permission</th>
<th>Size</th>
</tr>
</thead>
<tbody>
<?php // ---- wp-content folder
$it = new RecursiveDirectoryIterator( ABSPATH . "wp-content" );
foreach(new RecursiveIteratorIterator($it) as $file) {
$filetype = pathinfo($file, PATHINFO_EXTENSION);
$stringy = substr(sprintf('%o', $fileinfo->getPerms()), -4);
?>
</tr>
<?php if (!in_array(strtolower($filetype), $filetypes)) {
echo "<td>" . $file . "</td>";
//check for 777 !
if ($stringy == '0777'){
echo "<td>" . substr(sprintf('%o', $fileinfo->getPerms()), -4) .
"<span class='red'> × </span>" . "</td>" ;
}else{
echo "<td>" . substr(sprintf('%o', $fileinfo->getPerms()), -4) . "</td>" ;
}
echo "<td>" . number_format($file->getSize()/1024, 2) . " KB" . "</td>";
}
}?>
</tbody>
</table>
</div>
<!--TAB FOUR-->
<div>
<table class="widefat">
<thead>
<tr>
<tr>
<th>File</th>
<th>Permission</th>
<th>Size</th>
</tr>
</thead>
<tbody>
<?php // ---- wp-includes folder
$it = new RecursiveDirectoryIterator( ABSPATH . "wp-includes" );
foreach(new RecursiveIteratorIterator($it) as $file) {
$filetype = pathinfo($file, PATHINFO_EXTENSION);
$stringy = substr(sprintf('%o', $fileinfo->getPerms()), -4); ?>
</tr>
<?php if (!in_array(strtolower($filetype), $filetypes)) {
echo "<td>" . $file . "</td>";
//check for 777 !
if ($stringy == '0777'){
echo "<td>" . substr(sprintf('%o', $fileinfo->getPerms()), -4) .
"<span class='red'> × </span>" . "</td>" ;
}else{
echo "<td>" . substr(sprintf('%o', $fileinfo->getPerms()), -4) . "</td>" ;
}
echo "<td>" . number_format($file->getSize()/1024, 2) . " KB" . "</td>";
}
}?>
</tbody>
</table>