wahlhelfer/setup/filePermissions.php
Klaus-Uwe Mitterer b384099d9b Restructuring a few things
Finally adding the setup files ._.
2016-02-07 23:16:32 +01:00

45 lines
1 KiB
PHP
Executable file

<?php
include("helper.php");
$goToNextStep = true;
clearstatcache();
$showPermissions = array();
foreach ($filePermissions as $key => $value)
{
$error = "";
$values = str_split($value);
$file = getRealpath(dirname(getenv('SCRIPT_FILENAME'))."/".$config['applicationPath'].$key);
if (file_exists($file))
{
foreach ($values as $char)
{
switch ($char)
{
case "r": if (!is_readable($file)) $error = "Not readable"; break;
case "w": if (!is_writable($file)) $error = "Not writeable"; break;
}
}
}
else
$error = "File doesnt exist!";
$showRequired = array();
foreach ($values as $char)
{
switch ($char)
{
case "r": $showRequired[] = "Read"; break;
case "w": $showRequired[] = "Write"; break;
case "x": $showRequired[] = "Execute"; break;
}
}
$showPermissions[$key] = array("required" => $value, "error" => $error, "showRequired" => implode(", ", $showRequired), "realpath" => $file);
if ($error != "") $goToNextStep = false;
}
include("templates/filePermissions.php");