Beispiel #1
0
function page_footer()
{
    global $nobar, $user;
    /* keep this footer or you are just a big meaning :( */
    if ($nobar != 1) {
        echo "<tr class=titlebar2 align=right><td class=titlebar2 align=right height=15>\n";
    }
    if ($user) {
        showdiskspace();
    }
    echo "</table></table><tr><td align=right><font class=copyright>Powerd by <a href=http://www.osfilemanager.com/>osFileManager</a><br>&copy; 2003-" . date("Y") . " <a href=http://www.arzy.net/>Arzy LLC</a></font></table>\n" . "</body>\n" . "</html>\n";
    die;
}
Beispiel #2
0
function home()
{
    global $nobar, $d, $bgcolor3, $tbcolor1, $tbcolor2, $tbcolor3, $tbcolor4, $userdir, $HTTP_HOST, $theme, $http, $extraheaders, $IMG_CHECK, $IMG_RENAME, $IMG_GET, $IMG_EDIT, $IMG_OPEN, $IMG_RENAME_NULL, $IMG_EDIT_NULL, $IMG_OPEN_NULL, $IMG_GET_NULL, $IMG_MIME_FOLDER, $IMG_MIME_BINARY, $IMG_MIME_AUDIO, $IMG_MIME_VIDEO, $IMG_MIME_IMAGE, $IMG_MIME_TEXT, $IMG_MIME_UNKNOWN, $permget, $permedit, $permrename, $permsub, $formatperm, $permmove, $permdelete, $permchmod;
    $extraheaders = "<script language=javascript>\n" . "function itemsel(item,ff,check,action,overcolor,outcolor,clickcolor) {\n" . "  if (action == 1) {\n" . "    item.bgColor=overcolor;\n" . "  }\n" . "  if (action == 2) {\n" . "    if (document.getElementById(check).checked == false) item.bgColor=outcolor;\n" . "    else item.bgColor=clickcolor;\n" . "  }\n" . "  if (action == 3) {\n" . "    document.getElementById(check).checked = (document.getElementById(check).checked ? false : true);\n" . "    item.bgColor=clickcolor;\n" . "  }\n" . "}\n" . "function selectall() {\n" . "  var holder;\n" . "  for (x=1;x<document.bulk_submit.filetotal.value;x++) {\n" . "    document.getElementById(\"filesel_\" + x).checked = (document.getElementById(\"filesel_\" + x).checked ? false : true);\n" . "    document.getElementById(\"filebg_\" + x).bgColor = (document.getElementById(\"filesel_\" + x).checked ? \"{$tbcolor3}\" : document.getElementById(\"filecolor_\" + x).value);\n" . "  }\n" . "  for (x=1;x<document.bulk_submit.foldertotal.value;x++) {\n" . "    document.getElementById(\"foldersel_\" + x).checked = (document.getElementById(\"foldersel_\" + x).checked ? false : true);\n" . "    document.getElementById(\"folderbg_\" + x).bgColor = (document.getElementById(\"foldersel_\" + x).checked ? \"{$tbcolor3}\" : document.getElementById(\"foldercolor_\" + x).value);\n" . "  }\n" . "}\n" . "</script>\n";
    page_header("Browse");
    $ud = "/" . $d;
    echo "<tr><td>\n";
    opentitle("Browsing: {$ud}");
    echo "</tr></td><form name=bulk_submit action=\"?p=bulk_submit\" method=post>\n" . "<tr><td bgcolor={$bgcolor3}><table border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=100%>\n" . "<input type=hidden name=d value=\"{$d}\">\n";
    $count = "0";
    $a = 1;
    $b = 1;
    $content1 = "";
    $content2 = "";
    $handle = opendir($userdir . $d);
    while ($fileinfo = readdir($handle)) {
        $filelist[] = $fileinfo;
    }
    natcasesort($filelist);
    while (list($key, $fileinfo) = each($filelist)) {
        if (strlen($fileinfo) > 40) {
            $fileinfoa = substr($fileinfo, 0, 40) . "...";
        } else {
            $fileinfoa = $fileinfo;
        }
        if ($fileinfo[0] != "." && $fileinfo[0] != "..") {
            if (is_dir($userdir . $d . $fileinfo) && is_readable($userdir . $d . $fileinfo)) {
                if ($formatperm == 1) {
                    $perms = formatperms(@fileperms($userdir . $d . $fileinfo));
                } else {
                    $perms = substr(sprintf('%o', @fileperms($userdir . $d . $fileinfo)), -4);
                }
                if ($permrename == 1) {
                    $lnk_rename = "<a href=\"" . $adminfile . "?p=ren&file=" . $fileinfo . "&d={$d}\"><img src=\"{$IMG_RENAME}\" border=0 onclick=\"itemsel(this,1,'foldersel_{$a}',3,'#CCCCFF','{$tcoloring}','#FFCC99');\"></a>\n";
                } else {
                    $lnk_rename = "<img src=\"{$IMG_RENAME_NULL}\" border=0>\n";
                }
                if ($permsub == 1) {
                    $lnk_open = "<a href=\"" . $adminfile . "?p=home&d=" . $d . $fileinfo . "/\">" . $fileinfoa . "</a>\n";
                } else {
                    $lnk_open = $fileinfoa;
                }
                $content1[$a] = "<td><input type=checkbox name=\"foldersel[{$a}]\" id=\"foldersel_{$a}\" value=\"" . $fileinfo . "\" onclick=\"itemsel(this,1,'foldersel_{$a}',3,'#CCCCFF','{$tcoloring}','#FFCC99');\"> \n" . "<td valign=bottom><img src=\"{$IMG_MIME_FOLDER}\"> " . $lnk_open . "</td>\n" . "<td align=\"center\">\n" . "<td align=\"center\">" . $lnk_rename . "\n" . "<td> <td align=\"center\"> <td align=\"center\">{$perms}\n";
                $a++;
            } elseif (!is_dir($userdir . $d . $fileinfo) && is_readable($userdir . $d . $fileinfo)) {
                if ($formatperm == 1) {
                    $perms = formatperms(@fileperms($userdir . $d . $fileinfo));
                } else {
                    $perms = substr(sprintf('%o', @fileperms($userdir . $d . $fileinfo)), -4);
                }
                $size = filesize($userdir . $d . $fileinfo);
                $totalsize = $totalsize + $size;
                $type = mime_content_type($userdir . $d . $fileinfo);
                if (substr($type, 0, 4) == "text") {
                    $mimeimage = "<img src=\"{$IMG_MIME_TEXT}\">";
                } elseif (substr($type, 0, 5) == "image") {
                    $mimeimage = "<img src=\"{$IMG_MIME_IMAGE}\">";
                } elseif (substr($type, 0, 11) == "application") {
                    $mimeimage = "<img src=\"{$IMG_MIME_BINARY}\">";
                } elseif (substr($type, 0, 5) == "audio") {
                    $mimeimage = "<img src=\"{$IMG_MIME_AUDIO}\">";
                } elseif (substr($type, 0, 5) == "video") {
                    $mimeimage = "<img src=\"{$IMG_MIME_VIDEO}\">";
                } elseif (substr($type, 0, 5) == "model") {
                    $mimeimage = "<img src=\"{$IMG_MIME_IMAGE}\">";
                } elseif (substr($type, 0, 7) == "message") {
                    $mimeimage = "<img src=\"{$IMG_MIME_TEXT}\">";
                } elseif (substr($type, 0, 9) == "multipart") {
                    $mimeimage = "<img src=\"{$IMG_MIME_TEXT}\">";
                } else {
                    $mimeimage = "<img src=\"{$IMG_MIME_UNKNOWN}\">";
                }
                if ((substr($type, 0, 4) == "text" || $size == 0) && $permedit == 1) {
                    $edit = "<a href=\"" . $adminfile . "?p=edit&fename=" . $fileinfo . "&d={$d}\"><img src=\"{$IMG_EDIT}\" border=0 onclick=\"itemsel(this,1,'filesel_{$b}',3,'#CCCCFF','{$tcoloring}','#FFCC99');\"></a>\n";
                } elseif (substr($type, 0, 4) == "text" || $size == 0) {
                    $edit = "<a href=\"" . $adminfile . "?p=edit&fename=" . $fileinfo . "&d={$d}\"><img src=\"{$IMG_EDIT_NULL}\" border=0>\n";
                } else {
                    $edit = "";
                }
                if ($permrename == 1) {
                    $rename = "<a href=\"" . $adminfile . "?p=ren&file=" . $fileinfo . "&d={$d}\"><img src=\"{$IMG_RENAME}\" border=0 onclick=\"itemsel(this,1,'filesel_{$b}',3,'#CCCCFF','{$tcoloring}','#FFCC99');\"></a>\n";
                } else {
                    $rename = "<img src=\"{$IMG_RENAME_NULL}\" border=0>\n";
                }
                if ($permget == 1) {
                    $get = "<a href=\"" . $adminfile . "?p=view&file=" . $fileinfo . "&d={$d}\"><img src=\"{$IMG_GET}\" border=0 onclick=\"itemsel(this,1,'filesel_{$b}',3,'#CCCCFF','{$tcoloring}','#FFCC99');\"></a>\n";
                } else {
                    $get = "<img src=\"{$IMG_GET_NULL}\" border=0>\n";
                }
                if ($permget == 1) {
                    $filefile = "<a href=\"" . $http . $d . $fileinfo . "\" onclick=\"itemsel(this,1,'filesel_{$b}',3,'#CCCCFF','{$tcoloring}','#FFCC99');\">" . $fileinfoa . "</a>\n";
                } else {
                    $filefile = "{$fileinfoa}\n";
                }
                $content2[$b] = "<td><input type=checkbox name=\"filesel[{$b}]\" id=\"filesel_{$b}\" value=\"" . $fileinfo . "\" onclick=\"itemsel(this,1,'filesel_{$b}',3,'#CCCCFF','{$tcoloring}','#FFCC99');\">\n" . "<td>{$mimeimage} {$filefile}</td>\n" . "<td align=\"center\" width=20> {$edit}\n" . "<td align=\"center\" width=20> {$rename}\n" . "<td align=\"center\" width=20> {$get}\n" . "<td align=\"left\" nowrap>" . getfilesize($size) . "\n" . "<td align=\"center\">{$perms}\n";
                $b++;
            } else {
                echo "<font class=error>Directory '{$fileinfo}' is unreadable.</font><br>\n";
            }
            $count++;
        }
    }
    @closedir($userdir . $d);
    $filetotal = $b;
    $foldertotal = $a;
    echo "<tr bgcolor=\"{$tbcolor3}\" width=20 class=titlebar1 height=25><td width=10 align=left valign=bottom><a href=\"javascript:selectall();\"><img src=\"{$IMG_CHECK}\" border=0></a> " . "<td class=theader width=420>Filename\n" . "<td align=\"center\" width=80 class=theader colspan=3>Actions<font size=1>\n" . "<td width=70 class=theader align=left>Size<font size=1>\n" . "<td align=\"center\" width=60 class=theader>Perms\n";
    if ($d) {
        $p = 1;
        $tcoloring = $p % 2 ? $tbcolor1 : $tbcolor2;
        if (substr($d, 0, strrpos(substr($d, 0, -1), "/")) != "") {
            $pdir = substr($d, 0, strrpos(substr($d, 0, -1), "/")) . "/";
        }
        echo "<tr height=20 id=p_sel bgcolor=" . $tcoloring . " width=100% height=22 onmouseover=\"itemsel(this,1,'p_sel',1,'{$tbcolor4}','{$tcoloring}','{$tbcolor3}');\" onmouseout=\"itemsel(this,1,'p_sel',2,'{$tbcolor4}','{$tcoloring}','{$tbcolor3}');\">\n" . "<td><td><img src=\"{$IMG_MIME_FOLDER}\"> <a href=\"" . $adminfile . "?p=home&d=" . $pdir . "\">../</a></td>\n" . "<input type=hidden name=\"p_sel\" value=\"{$tcoloring}\" id=\"p_sel\">\n" . "<td align=\"center\" width=20></a>\n" . "<td align=\"center\" width=20>\n" . "<td align=\"center\" width=20>\n" . "<td align=\"left\" nowrap>\n" . "<td align=\"center\">\n";
    }
    if ($content1) {
        for ($a = 1; $a < count($content1) + 1; $a++) {
            $tcoloring = ($a + $p) % 2 ? $tbcolor1 : $tbcolor2;
            echo "<tr height=20 id=\"folderbg_{$a}\" bgcolor=" . $tcoloring . " width=100% height=22 onmouseover=\"itemsel(this,1,'foldersel_{$a}',1,'{$tbcolor4}','{$tcoloring}','{$tbcolor3}');\" onmouseout=\"itemsel(this,1,'foldersel_{$a}',2,'{$tbcolor4}','{$tcoloring}','{$tbcolor3}');\" onclick=\"itemsel(this,1,'foldersel_{$a}',3,'{$tbcolor4}','{$tcoloring}','{$tbcolor3}');\">" . "<input type=hidden name=\"foldercolor_{$a}\" value=\"{$tcoloring}\" id=\"foldercolor_{$a}\">\n" . $content1[$a] . "</td></tr>\n";
        }
    }
    if ($content2) {
        for ($b = 1; $b < count($content2) + 1; $b++) {
            $tcoloring = ($a++ + $p) % 2 ? $tbcolor1 : $tbcolor2;
            echo "<tr id=\"filebg_{$b}\" bgcolor=" . $tcoloring . " width=100% height=22 onmouseover=\"itemsel(this,1,'filesel_{$b}',1,'{$tbcolor4}','{$tcoloring}','{$tbcolor3}');\" onmouseout=\"itemsel(this,1,'filesel_{$b}',2,'{$tbcolor4}','{$tcoloring}','{$tbcolor3}');\" onclick=\"itemsel(this,1,'filesel_{$b}',3,'{$tbcolor4}','{$tcoloring}','{$tbcolor3}');\">" . "<input type=hidden name=\"filecolor_{$b}\" value=\"{$tcoloring}\" id=\"filecolor_{$b}\">\n" . $content2[$b] . "</td></tr>\n";
        }
    }
    if ($formatperm == 1) {
        $perm = formatperms(@fileperms($userdir . $d));
    } else {
        $perm = substr(sprintf('%o', @fileperms($userdir . $d)), -4);
    }
    echo "<tr bgcolor=\"{$tbcolor3}\" width=100% class=titlebar2 height=20><td class=titlebar2 colspan=5>\n" . "<img src=images/pixel.gif width=25 height=1>Files: {$count}\n" . "<input type=hidden name=filetotal value=\"{$filetotal}\">\n" . "<input type=hidden name=foldertotal value=\"{$foldertotal}\">\n" . "<td align=\"left\" class=titlebar2 nowrap>" . getfilesize($totalsize) . "\n" . "<td align=\"center\" class=titlebar2>" . $perm . "\n";
    if ($permmove == 1 || $permdelete == 1 || $permchmod == 1) {
        echo "<tr class=titlebar2><td colspan=2 class=titlebar2><img src=images/pixel.gif width=25 height=1>Bulk Actions: <select name=bulk_action class=\"action\"\">\n" . "<option value=\"\" class=action>[ Select Action ]</option>\n";
        if ($permdelete) {
            echo "<option value=delete class=\"actiondelete\">Delete</option>\n";
        }
        if ($permmove) {
            echo "<option value=move class=\"actionmove\">Move</option>\n";
        }
        if ($permchmod) {
            echo "<option value=chmod class=\"actionchmod\">Change Permissions</option>\n";
        }
        echo "</select>\n" . "<input type=submit value=\"  Go  \" class=button>\n";
    }
    echo "</td><td colspan=5 align=center>" . showdiskspace() . "</td></tr></form></table>";
    $nobar = 1;
    page_footer();
}