function form(&$dat, $resno, $iscollapse = true, $retURL = PHP_SELF, $name = '', $mail = '', $sub = '', $com = '', $cat = '', $mode = 'regist') { global $PTE, $PMS, $ADDITION_INFO, $language; $pte_vals = array('{$SELF}' => $retURL, '{$FORMTOP}' => '', '{$MODE}' => $mode); $isedit = $mode == 'edit'; // 是否為編輯模式 if ($resno && !$isedit) { $links = '[<a href="' . PHP_SELF2 . '?' . time() . '">' . _T('return') . '</a>]'; $PMS->useModuleMethods('LinksAboveBar', array(&$links, 'reply', $resno)); // "LinksAboveBar" Hook Point $pte_vals['{$FORMTOP}'] = $links . '<div class="bar_reply">' . _T('form_top') . '</div>'; } if (USE_FLOATFORM && !$resno && $iscollapse) { $pte_vals['{$FORMTOP}'] .= "\n" . '[<span id="show" class="hide" onmouseover="showform();" onclick="showform();">' . _T('form_showpostform') . '</span><span id="hide" class="show" onmouseover="hideform();" onclick="hideform();">' . _T('form_hidepostform') . '</span>]'; } $pte_vals += array('{$MAX_FILE_SIZE}' => MAX_KB * 1024, '{$RESTO}' => $resno ? '<input type="hidden" name="resto" value="' . $resno . '" />' : '', '{$FORM_NAME_TEXT}' => _T('form_name'), '{$FORM_NAME_FIELD}' => '<input class="hide" type="text" name="name" value="spammer" /><input type="text" name="' . FT_NAME . '" id="fname" size="28" value="' . $name . '" />', '{$FORM_EMAIL_TEXT}' => _T('form_email'), '{$FORM_EMAIL_FIELD}' => '<input type="text" name="' . FT_EMAIL . '" id="femail" size="28" value="' . $mail . '" /><input type="text" class="hide" name="email" value="*****@*****.**" />', '{$FORM_TOPIC_TEXT}' => _T('form_topic'), '{$FORM_TOPIC_FIELD}' => '<input class="hide" value="DO NOT FIX THIS" type="text" name="sub" /><input type="text" name="' . FT_SUBJECT . '" id="fsub" size="28" value="' . $sub . '" />', '{$FORM_SUBMIT}' => '<input type="submit" name="sendbtn" value="' . _T('form_submit_btn') . '" />', '{$FORM_COMMENT_TEXT}' => _T('form_comment'), '{$FORM_COMMENT_FIELD}' => '<textarea name="' . FT_COMMENT . '" id="fcom" cols="48" rows="4" style="width: 400px; height: 80px;">' . $com . '</textarea><textarea name="com" class="hide" cols="48" rows="4">EID OG SMAPS</textarea>', '{$FORM_DELETE_PASSWORD_FIELD}' => '<input type="password" name="pwd" size="8" maxlength="8" value="" />', '{$FORM_DELETE_PASSWORD_TEXT}' => _T('form_delete_password'), '{$FORM_DELETE_PASSWORD_NOTICE}' => _T('form_delete_password_notice'), '{$FORM_EXTRA_COLUMN}' => '', '{$FORM_NOTICE}' => _T('form_notice', str_replace('|', ', ', ALLOW_UPLOAD_EXT), MAX_KB, $resno ? MAX_RW : MAX_W, $resno ? MAX_RH : MAX_H), '{$HOOKPOSTINFO}' => '', '{$ADDITION_INFO}' => $ADDITION_INFO, '{$FORM_NOTICE_NOSCRIPT}' => _T('form_notice_noscript')); $PMS->useModuleMethods('PostForm', array(&$pte_vals['{$FORM_EXTRA_COLUMN}'])); // "PostForm" Hook Point if (!$isedit && (RESIMG || !$resno)) { $pte_vals += array('{$FORM_ATTECHMENT_TEXT}' => _T('form_attechment'), '{$FORM_ATTECHMENT_FIELD}' => '<input type="file" name="upfile" id="fupfile" size="25" /><input class="hide" type="checkbox" name="reply" value="yes" />', '{$FORM_NOATTECHMENT_TEXT}' => _T('form_noattechment'), '{$FORM_NOATTECHMENT_FIELD}' => '<input type="checkbox" name="noimg" id="noimg" value="on" />'); if (USE_UPSERIES) { // 啟動連貼機能 $pte_vals['{$FORM_CONTPOST_FIELD}'] = '<input type="checkbox" name="up_series" id="up_series" value="on"' . (isset($_GET["upseries"]) && $resno ? ' checked="checked"' : '') . ' />'; $pte_vals['{$FORM_CONTPOST_TEXT}'] = _T('form_contpost'); } } if (USE_CATEGORY) { $pte_vals += array('{$FORM_CATEGORY_FIELD}' => '<input type="text" name="category" size="28" value="' . $cat . '" />', '{$FORM_CATEGORY_TEXT}' => _T('form_category'), '{$FORM_CATEGORY_NOTICE}' => _T('form_category_notice')); } if (STORAGE_LIMIT) { $pte_vals['{$FORM_NOTICE_STORAGE_LIMIT}'] = _T('form_notice_storage_limit', total_size(), STORAGE_MAX); } $PMS->useModuleMethods('PostInfo', array(&$pte_vals['{$HOOKPOSTINFO}'])); // "PostInfo" Hook Point if (USE_FLOATFORM && !$resno && $iscollapse) { $pte_vals['{$FORMBOTTOM}'] = '<script type="text/javascript">hideform();</script>'; } $dat .= $PTE->ParseBlock('POSTFORM', $pte_vals); }
function dir_list_form() { global $fm_current_root, $current_dir, $quota_mb, $resolveIDs, $order_dir_list_by, $islinux, $cmd_name, $ip, $path_info, $fm_color; $ti = getmicrotime(); clearstatcache(); $out = "<table border=0 cellspacing=1 cellpadding=4 width=\"100%\" bgcolor=\"#eeeeee\">\n"; if ($opdir = @opendir($current_dir)) { $has_files = false; $entry_count = 0; $total_size = 0; $entry_list = array(); while ($file = readdir($opdir)) { if ($file != "." && $file != "..") { $entry_list[$entry_count]["size"] = 0; $entry_list[$entry_count]["sizet"] = 0; $entry_list[$entry_count]["type"] = "none"; if (is_file($current_dir . $file)) { $ext = lowercase(strrchr($file, ".")); $entry_list[$entry_count]["type"] = "file"; // Função filetype() returns only "file"... $entry_list[$entry_count]["size"] = filesize($current_dir . $file); $entry_list[$entry_count]["sizet"] = format_size($entry_list[$entry_count]["size"]); if (strstr($ext, ".")) { $entry_list[$entry_count]["ext"] = $ext; $entry_list[$entry_count]["extt"] = $ext; } else { $entry_list[$entry_count]["ext"] = ""; $entry_list[$entry_count]["extt"] = " "; } $has_files = true; } elseif (is_dir($current_dir . $file)) { // Recursive directory size disabled // $entry_list[$entry_count]["size"] = total_size($current_dir.$file); $entry_list[$entry_count]["size"] = 0; $entry_list[$entry_count]["sizet"] = " "; $entry_list[$entry_count]["type"] = "dir"; } $entry_list[$entry_count]["name"] = $file; $entry_list[$entry_count]["date"] = date("Ymd", filemtime($current_dir . $file)); $entry_list[$entry_count]["time"] = date("his", filemtime($current_dir . $file)); $entry_list[$entry_count]["datet"] = date("d/m/y h:i", filemtime($current_dir . $file)); if ($islinux && $resolveIDs) { $entry_list[$entry_count]["p"] = show_perms(fileperms($current_dir . $file)); $entry_list[$entry_count]["u"] = get_user(fileowner($current_dir . $file)); $entry_list[$entry_count]["g"] = get_group(filegroup($current_dir . $file)); } else { $entry_list[$entry_count]["p"] = base_convert(fileperms($current_dir . $file), 10, 8); $entry_list[$entry_count]["p"] = substr($entry_list[$entry_count]["p"], strlen($entry_list[$entry_count]["p"]) - 3); $entry_list[$entry_count]["u"] = fileowner($current_dir . $file); $entry_list[$entry_count]["g"] = filegroup($current_dir . $file); } $total_size += $entry_list[$entry_count]["size"]; $entry_count++; } } @closedir($opdir); if ($entry_count) { $or1 = "1A"; $or2 = "2D"; $or3 = "3A"; $or4 = "4A"; $or5 = "5A"; $or6 = "6D"; $or7 = "7D"; switch ($order_dir_list_by) { case "1A": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "name", SORT_STRING, SORT_ASC); $or1 = "1D"; break; case "1D": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "name", SORT_STRING, SORT_DESC); $or1 = "1A"; break; case "2A": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "p", SORT_STRING, SORT_ASC, "g", SORT_STRING, SORT_ASC, "u", SORT_STRING, SORT_ASC); $or2 = "2D"; break; case "2D": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "p", SORT_STRING, SORT_DESC, "g", SORT_STRING, SORT_ASC, "u", SORT_STRING, SORT_ASC); $or2 = "2A"; break; case "3A": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "u", SORT_STRING, SORT_ASC, "g", SORT_STRING, SORT_ASC); $or3 = "3D"; break; case "3D": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "u", SORT_STRING, SORT_DESC, "g", SORT_STRING, SORT_ASC); $or3 = "3A"; break; case "4A": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "g", SORT_STRING, SORT_ASC, "u", SORT_STRING, SORT_DESC); $or4 = "4D"; break; case "4D": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "g", SORT_STRING, SORT_DESC, "u", SORT_STRING, SORT_DESC); $or4 = "4A"; break; case "5A": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "size", SORT_NUMERIC, SORT_ASC); $or5 = "5D"; break; case "5D": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "size", SORT_NUMERIC, SORT_DESC); $or5 = "5A"; break; case "6A": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "date", SORT_STRING, SORT_ASC, "time", SORT_STRING, SORT_ASC, "name", SORT_STRING, SORT_ASC); $or6 = "6D"; break; case "6D": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "date", SORT_STRING, SORT_DESC, "time", SORT_STRING, SORT_DESC, "name", SORT_STRING, SORT_ASC); $or6 = "6A"; break; case "7A": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "ext", SORT_STRING, SORT_ASC, "name", SORT_STRING, SORT_ASC); $or7 = "7D"; break; case "7D": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "ext", SORT_STRING, SORT_DESC, "name", SORT_STRING, SORT_ASC); $or7 = "7A"; break; } } $out .= "\r\n <script language=\"Javascript\" type=\"text/javascript\">\r\n <!--\r\n function go(arg) {\r\n document.location.href='" . addslashes($path_info["basename"]) . "?frame=3¤t_dir=" . addslashes($current_dir) . "'+arg+'/';\r\n }\r\n function resolveIDs() {\r\n document.location.href='" . addslashes($path_info["basename"]) . "?frame=3&set_resolveIDs=1¤t_dir=" . addslashes($current_dir) . "';\r\n }\r\n var entry_list = new Array();\r\n // Custom object constructor\r\n function entry(name, type, size, selected){\r\n this.name = name;\r\n this.type = type;\r\n this.size = size;\r\n this.selected = false;\r\n }\r\n // Declare entry_list for selection procedures"; foreach ($entry_list as $i => $data) { $out .= "\nentry_list['entry{$i}'] = new entry('" . addslashes($data["name"]) . "', '" . $data["type"] . "', " . $data["size"] . ", false);"; } $out .= "\r\n // Select/Unselect Rows OnClick/OnMouseOver\r\n var lastRows = new Array(null,null);\r\n function selectEntry(Row, Action){\r\n if (multipleSelection){\r\n // Avoid repeated onmouseover events from same Row ( cell transition )\r\n if (Row != lastRows[0]){\r\n if (Action == 'over') {\r\n if (entry_list[Row.id].selected){\r\n if (unselect(entry_list[Row.id])) {\r\n Row.className = 'entryUnselected';\r\n }\r\n // Change the last Row when you change the movement orientation\r\n if (lastRows[0] != null && lastRows[1] != null){\r\n var LastRowID = lastRows[0].id;\r\n if (Row.id == lastRows[1].id){\r\n if (unselect(entry_list[LastRowID])) {\r\n lastRows[0].className = 'entryUnselected';\r\n }\r\n }\r\n }\r\n } else {\r\n if (select(entry_list[Row.id])){\r\n Row.className = 'entrySelected';\r\n }\r\n // Change the last Row when you change the movement orientation\r\n if (lastRows[0] != null && lastRows[1] != null){\r\n var LastRowID = lastRows[0].id;\r\n if (Row.id == lastRows[1].id){\r\n if (select(entry_list[LastRowID])) {\r\n lastRows[0].className = 'entrySelected';\r\n }\r\n }\r\n }\r\n }\r\n lastRows[1] = lastRows[0];\r\n lastRows[0] = Row;\r\n }\r\n }\r\n } else {\r\n if (Action == 'click') {\r\n var newClassName = null;\r\n if (entry_list[Row.id].selected){\r\n if (unselect(entry_list[Row.id])) newClassName = 'entryUnselected';\r\n } else {\r\n if (select(entry_list[Row.id])) newClassName = 'entrySelected';\r\n }\r\n if (newClassName) {\r\n lastRows[0] = lastRows[1] = Row;\r\n Row.className = newClassName;\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n // Disable text selection and bind multiple selection flag\r\n var multipleSelection = false;\r\n if (is.ie) {\r\n document.onselectstart=new Function('return false');\r\n document.onmousedown=switch_flag_on;\r\n document.onmouseup=switch_flag_off;\r\n // Event mouseup is not generated over scrollbar.. curiously, mousedown is.. go figure.\r\n window.onscroll=new Function('multipleSelection=false');\r\n window.onresize=new Function('multipleSelection=false');\r\n } else {\r\n if (document.layers) window.captureEvents(Event.MOUSEDOWN);\r\n if (document.layers) window.captureEvents(Event.MOUSEUP);\r\n window.onmousedown=switch_flag_on;\r\n window.onmouseup=switch_flag_off;\r\n }\r\n // Using same function and a ternary operator couses bug on double click\r\n function switch_flag_on(e) {\r\n if (is.ie){\r\n multipleSelection = (event.button == 1);\r\n } else {\r\n multipleSelection = (e.which == 1);\r\n }\r\n\t\t\tvar type = String(e.target.type);\r\n\t\t\treturn (type.indexOf('select') != -1 || type.indexOf('button') != -1 || type.indexOf('input') != -1 || type.indexOf('radio') != -1);\r\n }\r\n function switch_flag_off(e) {\r\n if (is.ie){\r\n multipleSelection = (event.button != 1);\r\n } else {\r\n multipleSelection = (e.which != 1);\r\n }\r\n lastRows[0] = lastRows[1] = null;\r\n update_sel_status();\r\n return false;\r\n }\r\n var total_dirs_selected = 0;\r\n var total_files_selected = 0;\r\n function unselect(Entry){\r\n if (!Entry.selected) return false;\r\n Entry.selected = false;\r\n sel_totalsize -= Entry.size;\r\n if (Entry.type == 'dir') total_dirs_selected--;\r\n else total_files_selected--;\r\n return true;\r\n }\r\n function select(Entry){\r\n if(Entry.selected) return false;\r\n Entry.selected = true;\r\n sel_totalsize += Entry.size;\r\n if(Entry.type == 'dir') total_dirs_selected++;\r\n else total_files_selected++;\r\n return true;\r\n }\r\n function is_anything_selected(){\r\n var selected_dir_list = new Array();\r\n var selected_file_list = new Array();\r\n for(var x=0;x<" . (int) count($entry_list) . ";x++){\r\n if(entry_list['entry'+x].selected){\r\n if(entry_list['entry'+x].type == 'dir') selected_dir_list.push(entry_list['entry'+x].name);\r\n else selected_file_list.push(entry_list['entry'+x].name);\r\n }\r\n }\r\n document.form_action.selected_dir_list.value = selected_dir_list.join('<|*|>');\r\n document.form_action.selected_file_list.value = selected_file_list.join('<|*|>');\r\n return (total_dirs_selected>0 || total_files_selected>0);\r\n }\r\n function format_size (arg) {\r\n var resul = '';\r\n if (arg>0){\r\n var j = 0;\r\n var ext = new Array(' bytes',' Kb',' Mb',' Gb',' Tb');\r\n while (arg >= Math.pow(1024,j)) ++j;\r\n resul = (Math.round(arg/Math.pow(1024,j-1)*100)/100) + ext[j-1];\r\n } else resul = 0;\r\n return resul;\r\n }\r\n var sel_totalsize = 0;\r\n function update_sel_status(){\r\n var t = total_dirs_selected+' " . et('Dir_s') . " " . et('And') . " '+total_files_selected+' " . et('File_s') . " " . et('Selected_s') . " = '+format_size(sel_totalsize);\r\n //document.getElementById(\"sel_status\").innerHTML = t;\r\n window.status = t;\r\n }\r\n // Select all/none/inverse\r\n function selectANI(Butt){\r\n \tcancel_copy_move();\r\n for(var x=0;x<" . (int) count($entry_list) . ";x++){\r\n var Row = document.getElementById('entry'+x);\r\n var newClassName = null;\r\n switch (Butt.value){\r\n case '" . et('SelAll') . "':\r\n if (select(entry_list[Row.id])) newClassName = 'entrySelected';\r\n break;\r\n case '" . et('SelNone') . "':\r\n if (unselect(entry_list[Row.id])) newClassName = 'entryUnselected';\r\n break;\r\n case '" . et('SelInverse') . "':\r\n if (entry_list[Row.id].selected){\r\n if (unselect(entry_list[Row.id])) newClassName = 'entryUnselected';\r\n } else {\r\n if (select(entry_list[Row.id])) newClassName = 'entrySelected';\r\n }\r\n break;\r\n }\r\n if (newClassName) {\r\n Row.className = newClassName;\r\n }\r\n }\r\n if (Butt.value == '" . et('SelAll') . "'){\r\n for(var i=0;i<2;i++){\r\n document.getElementById('ANI'+i).value='" . et('SelNone') . "';\r\n }\r\n } else if (Butt.value == '" . et('SelNone') . "'){\r\n for(var i=0;i<2;i++){\r\n document.getElementById('ANI'+i).value='" . et('SelAll') . "';\r\n }\r\n }\r\n update_sel_status();\r\n return true;\r\n }\r\n function download(arg){\r\n parent.frame1.location.href='" . addslashes($path_info["basename"]) . "?action=3¤t_dir=" . addslashes($current_dir) . "&filename='+escape(arg);\r\n }\r\n function upload(){\r\n var w = 400;\r\n var h = 250;\r\n window.open('" . addslashes($path_info["basename"]) . "?action=10¤t_dir=" . addslashes($current_dir) . "', '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=no,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n }\r\n function execute_cmd(){\r\n var arg = prompt('" . et('TypeCmd') . ".');\r\n if(arg.length>0){\r\n if(confirm('" . et('ConfExec') . " \\' '+arg+' \\' ?')) {\r\n var w = 800;\r\n var h = 600;\r\n window.open('" . addslashes($path_info["basename"]) . "?action=6¤t_dir=" . addslashes($current_dir) . "&cmd='+escape(arg), '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n }\r\n }\r\n }\r\n function decompress(arg){\r\n if(confirm('" . uppercase(et('Decompress')) . " \\' '+arg+' \\' ?')) {\r\n document.form_action.action.value = 72;\r\n document.form_action.cmd_arg.value = arg;\r\n document.form_action.submit();\r\n }\r\n }\r\n function execute_file(arg){\r\n if(arg.length>0){\r\n if(confirm('" . et('ConfExec') . " \\' '+arg+' \\' ?')) {\r\n var w = 800;\r\n var h = 600;\r\n window.open('" . addslashes($path_info["basename"]) . "?action=11¤t_dir=" . addslashes($current_dir) . "&filename='+escape(arg), '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n }\r\n }\r\n }\r\n function edit_file(arg){\r\n var w = 1024;\r\n var h = 768;\r\n // if(confirm('" . uppercase(et('Edit')) . " \\' '+arg+' \\' ?'))\r\n window.open('" . addslashes($path_info["basename"]) . "?action=7¤t_dir=" . addslashes($current_dir) . "&filename='+escape(arg), '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=no,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n }\r\n function config(){\r\n var w = 650;\r\n var h = 400;\r\n window.open('" . addslashes($path_info["basename"]) . "?action=2', 'win_config', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n }\r\n function server_info(arg){\r\n var w = 800;\r\n var h = 600;\r\n window.open('" . addslashes($path_info["basename"]) . "?action=5', 'win_serverinfo', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n }\r\n function shell(){\r\n var w = 800;\r\n var h = 600;\r\n window.open('" . addslashes($path_info["basename"]) . "?action=9', '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n }\r\n function view(arg){\r\n var w = 800;\r\n var h = 600;\r\n if(confirm('" . uppercase(et('View')) . " \\' '+arg+' \\' ?')) window.open('" . addslashes($path_info["basename"]) . "?action=4¤t_dir=" . addslashes($current_dir) . "&filename='+escape(arg), '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=yes,toolbar=no,menubar=no,location=yes');\r\n }\r\n function rename(arg){\r\n var nome = '';\r\n if (nome = prompt('" . uppercase(et('Ren')) . " \\' '+arg+' \\' " . et('To') . " ...')) document.location.href='" . addslashes($path_info["basename"]) . "?frame=3&action=3¤t_dir=" . addslashes($current_dir) . "&old_name='+escape(arg)+'&new_name='+escape(nome);\r\n }\r\n function set_dir_dest(arg){\r\n document.form_action.dir_dest.value=arg;\r\n if (document.form_action.action.value.length>0) test(document.form_action.action.value);\r\n else alert('" . et('JSError') . ".');\r\n }\r\n function sel_dir(arg){\r\n document.form_action.action.value = arg;\r\n document.form_action.dir_dest.value='';\r\n if (!is_anything_selected()) alert('" . et('NoSel') . ".');\r\n else {\r\n if (!getCookie('sel_dir_warn')) {\r\n //alert('" . et('SelDir') . ".');\r\n document.cookie='sel_dir_warn'+'='+escape('true')+';';\r\n }\r\n set_sel_dir_warn(true);\r\n parent.frame2.set_flag(true);\r\n }\r\n }\r\n\t\tfunction set_sel_dir_warn(b){\r\n \tdocument.getElementById(\"sel_dir_warn\").style.display=(b?'':'none');\r\n\t\t}\r\n\t\tfunction cancel_copy_move(){\r\n \tset_sel_dir_warn(false);\r\n \tparent.frame2.set_flag(false);\r\n\t\t}\r\n function chmod_form(){\r\n cancel_copy_move();\r\n document.form_action.dir_dest.value='';\r\n document.form_action.chmod_arg.value='';\r\n if (!is_anything_selected()) alert('" . et('NoSel') . ".');\r\n else {\r\n var w = 280;\r\n var h = 180;\r\n window.open('" . addslashes($path_info["basename"]) . "?action=8', '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=no,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n }\r\n }\r\n function set_chmod_arg(arg){\r\n cancel_copy_move();\r\n if (!is_anything_selected()) alert('" . et('NoSel') . ".');\r\n else {\r\n \tdocument.form_action.dir_dest.value='';\r\n \tdocument.form_action.chmod_arg.value=arg;\r\n \ttest(9);\r\n\t\t\t}\r\n }\r\n function test_action(){\r\n if (document.form_action.action.value != 0) return true;\r\n else return false;\r\n }\r\n function test_prompt(arg){\r\n \tcancel_copy_move();\r\n\t\t\tvar erro='';\r\n var conf='';\r\n if (arg == 1){\r\n document.form_action.cmd_arg.value = prompt('" . et('TypeDir') . ".');\r\n } else if (arg == 2){\r\n document.form_action.cmd_arg.value = prompt('" . et('TypeArq') . ".');\r\n } else if (arg == 71){\r\n if (!is_anything_selected()) erro = '" . et('NoSel') . ".';\r\n else document.form_action.cmd_arg.value = prompt('" . et('TypeArqComp') . "');\r\n }\r\n if (erro!=''){\r\n document.form_action.cmd_arg.focus();\r\n alert(erro);\r\n } else if(document.form_action.cmd_arg.value.length>0) {\r\n document.form_action.action.value = arg;\r\n document.form_action.submit();\r\n }\r\n }\r\n function strstr(haystack,needle){\r\n var index = haystack.indexOf(needle);\r\n return (index==-1)?false:index;\r\n }\r\n function valid_dest(dest,orig){\r\n return (strstr(dest,orig)==false)?true:false;\r\n }\r\n // ArrayAlert - Selection debug only\r\n function aa(){\r\n var str = 'selected_dir_list:\\n';\r\n for (x=0;x<selected_dir_list.length;x++){\r\n str += selected_dir_list[x]+'\\n';\r\n }\r\n str += '\\nselected_file_list:\\n';\r\n for (x=0;x<selected_file_list.length;x++){\r\n str += selected_file_list[x]+'\\n';\r\n }\r\n alert(str);\r\n }\r\n function test(arg){\r\n \tcancel_copy_move();\r\n var erro='';\r\n var conf='';\r\n if (arg == 4){\r\n if (!is_anything_selected()) erro = '" . et('NoSel') . ".\\n';\r\n conf = '" . et('RemSel') . " ?\\n';\r\n } else if (arg == 5){\r\n if (!is_anything_selected()) erro = '" . et('NoSel') . ".\\n';\r\n else if(document.form_action.dir_dest.value.length == 0) erro = '" . et('NoDestDir') . ".';\r\n else if(document.form_action.dir_dest.value == document.form_action.current_dir.value) erro = '" . et('DestEqOrig') . ".';\r\n else if(!valid_dest(document.form_action.dir_dest.value,document.form_action.current_dir.value)) erro = '" . et('InvalidDest') . ".';\r\n conf = '" . et('CopyTo') . " \\' '+document.form_action.dir_dest.value+' \\' ?\\n';\r\n } else if (arg == 6){\r\n if (!is_anything_selected()) erro = '" . et('NoSel') . ".';\r\n else if(document.form_action.dir_dest.value.length == 0) erro = '" . et('NoDestDir') . ".';\r\n else if(document.form_action.dir_dest.value == document.form_action.current_dir.value) erro = '" . et('DestEqOrig') . ".';\r\n else if(!valid_dest(document.form_action.dir_dest.value,document.form_action.current_dir.value)) erro = '" . et('InvalidDest') . ".';\r\n conf = '" . et('MoveTo') . " \\' '+document.form_action.dir_dest.value+' \\' ?\\n';\r\n } else if (arg == 9){\r\n if (!is_anything_selected()) erro = '" . et('NoSel') . ".';\r\n else if(document.form_action.chmod_arg.value.length == 0) erro = '" . et('NoNewPerm') . ".';\r\n //conf = '" . et('AlterPermTo') . " \\' '+document.form_action.chmod_arg.value+' \\' ?\\n';\r\n }\r\n if (erro!=''){\r\n document.form_action.cmd_arg.focus();\r\n alert(erro);\r\n } else if(conf!='') {\r\n if(confirm(conf)) {\r\n document.form_action.action.value = arg;\r\n document.form_action.submit();\r\n } else {\r\n set_sel_dir_warn(false);\r\n\t\t\t\t}\r\n } else {\r\n document.form_action.action.value = arg;\r\n document.form_action.submit();\r\n }\r\n }\r\n //-->\r\n </script>"; $out .= "\r\n <form name=\"form_action\" action=\"" . $path_info["basename"] . "\" method=\"post\" onsubmit=\"return test_action();\">\r\n <input type=hidden name=\"frame\" value=3>\r\n <input type=hidden name=\"action\" value=0>\r\n <input type=hidden name=\"dir_dest\" value=\"\">\r\n <input type=hidden name=\"chmod_arg\" value=\"\">\r\n <input type=hidden name=\"cmd_arg\" value=\"\">\r\n <input type=hidden name=\"current_dir\" value=\"{$current_dir}\">\r\n <input type=hidden name=\"dir_before\" value=\"{$dir_before}\">\r\n <input type=hidden name=\"selected_dir_list\" value=\"\">\r\n <input type=hidden name=\"selected_file_list\" value=\"\">"; $out .= "\r\n <tr>\r\n <td bgcolor=\"#DDDDDD\" colspan=50><nobr>\r\n <input type=button onclick=\"config()\" value=\"" . et('Config') . "\">\r\n <input type=button onclick=\"server_info()\" value=\"" . et('ServerInfo') . "\">\r\n <input type=button onclick=\"test_prompt(1)\" value=\"" . et('CreateDir') . "\">\r\n <input type=button onclick=\"test_prompt(2)\" value=\"" . et('CreateArq') . "\">\r\n <input type=button onclick=\"execute_cmd()\" value=\"" . et('ExecCmd') . "\">\r\n <input type=button onclick=\"upload()\" value=\"" . et('Upload') . "\">\r\n <input type=button onclick=\"shell()\" value=\"" . et('Shell') . "\">\r\n <b>{$ip}</b>\r\n </nobr>"; $uplink = ""; if ($current_dir != $fm_current_root) { $mat = explode("/", $current_dir); $dir_before = ""; for ($x = 0; $x < count($mat) - 2; $x++) { $dir_before .= $mat[$x] . "/"; } $uplink = "<a href=\"" . $path_info["basename"] . "?frame=3¤t_dir={$dir_before}\"><<</a> "; } if ($entry_count) { $out .= "\r\n <tr bgcolor=\"#DDDDDD\"><td colspan=50><nobr>{$uplink} <a href=\"" . $path_info["basename"] . "?frame=3¤t_dir={$current_dir}\">{$current_dir}</a></nobr>\r\n <tr>\r\n <td bgcolor=\"#DDDDDD\" colspan=50><nobr>\r\n <input type=\"button\" style=\"width:80\" onclick=\"selectANI(this)\" id=\"ANI0\" value=\"" . et('SelAll') . "\">\r\n <input type=\"button\" style=\"width:80\" onclick=\"selectANI(this)\" value=\"" . et('SelInverse') . "\">\r\n <input type=\"button\" style=\"width:80\" onclick=\"test(4)\" value=\"" . et('Rem') . "\">\r\n <input type=\"button\" style=\"width:80\" onclick=\"sel_dir(5)\" value=\"" . et('Copy') . "\">\r\n <input type=\"button\" style=\"width:80\" onclick=\"sel_dir(6)\" value=\"" . et('Move') . "\">\r\n <input type=\"button\" style=\"width:100\" onclick=\"test_prompt(71)\" value=\"" . et('Compress') . "\">"; if ($islinux) { $out .= "\r\n <input type=\"button\" style=\"width:100\" onclick=\"resolveIDs()\" value=\"" . et('ResolveIDs') . "\">"; } $out .= "\r\n <input type=\"button\" style=\"width:100\" onclick=\"chmod_form()\" value=\"" . et('Perms') . "\">"; $out .= "\r\n </nobr></td>\r\n </tr>\r\n\t\t\t\t<tr>\r\n <td bgcolor=\"#DDDDDD\" colspan=50 id=\"sel_dir_warn\" style=\"display:none\"><nobr><font color=\"red\">" . et('SelDir') . "...</font></nobr></td>\r\n </tr>"; $file_count = 0; $dir_count = 0; $dir_out = array(); $file_out = array(); $max_opt = 0; foreach ($entry_list as $ind => $dir_entry) { $file = $dir_entry["name"]; if ($dir_entry["type"] == "dir") { $dir_out[$dir_count] = array(); $dir_out[$dir_count][] = "\r\n <tr ID=\"entry{$ind}\" class=\"entryUnselected\" onmouseover=\"selectEntry(this, 'over');\" onmousedown=\"selectEntry(this, 'click');\">\r\n <td><nobr><a href=\"JavaScript:go('" . addslashes($file) . "')\">{$file}</a></nobr></td>"; $dir_out[$dir_count][] = "<td>" . $dir_entry["p"] . "</td>"; if ($islinux) { $dir_out[$dir_count][] = "<td><nobr>" . $dir_entry["u"] . "</nobr></td>"; $dir_out[$dir_count][] = "<td><nobr>" . $dir_entry["g"] . "</nobr></td>"; } $dir_out[$dir_count][] = "<td><nobr>" . $dir_entry["sizet"] . "</nobr></td>"; $dir_out[$dir_count][] = "<td><nobr>" . $dir_entry["datet"] . "</nobr></td>"; if ($has_files) { $dir_out[$dir_count][] = "<td> </td>"; } // Opções de diretório if (is_writable($current_dir . $file)) { $dir_out[$dir_count][] = "\r\n <td align=center><a href=\"JavaScript:if(confirm('" . et('ConfRem') . " \\'" . addslashes($file) . "\\' ?')) document.location.href='" . addslashes($path_info["basename"]) . "?frame=3&action=8&cmd_arg=" . addslashes($file) . "¤t_dir=" . addslashes($current_dir) . "'\">" . et('Rem') . "</a>"; } if (is_writable($current_dir . $file)) { $dir_out[$dir_count][] = "\r\n <td align=center><a href=\"JavaScript:rename('" . addslashes($file) . "')\">" . et('Ren') . "</a>"; } if (count($dir_out[$dir_count]) > $max_opt) { $max_opt = count($dir_out[$dir_count]); } $dir_count++; } else { $file_out[$file_count] = array(); $file_out[$file_count][] = "\r\n <tr ID=\"entry{$ind}\" class=\"entryUnselected\" onmouseover=\"selectEntry(this, 'over');\" onmousedown=\"selectEntry(this, 'click');\">\r\n <td><nobr><a href=\"JavaScript:download('" . addslashes($file) . "')\">{$file}</a></nobr></td>"; $file_out[$file_count][] = "<td>" . $dir_entry["p"] . "</td>"; if ($islinux) { $file_out[$file_count][] = "<td><nobr>" . $dir_entry["u"] . "</nobr></td>"; $file_out[$file_count][] = "<td><nobr>" . $dir_entry["g"] . "</nobr></td>"; } $file_out[$file_count][] = "<td><nobr>" . $dir_entry["sizet"] . "</nobr></td>"; $file_out[$file_count][] = "<td><nobr>" . $dir_entry["datet"] . "</nobr></td>"; $file_out[$file_count][] = "<td>" . $dir_entry["extt"] . "</td>"; // Opções de arquivo if (is_writable($current_dir . $file)) { $file_out[$file_count][] = "\r\n <td align=center><a href=\"javascript:if(confirm('" . uppercase(et('Rem')) . " \\'" . addslashes($file) . "\\' ?')) document.location.href='" . addslashes($path_info["basename"]) . "?frame=3&action=8&cmd_arg=" . addslashes($file) . "¤t_dir=" . addslashes($current_dir) . "'\">" . et('Rem') . "</a>"; } else { $file_out[$file_count][] = "<td> </td>"; } if (is_writable($current_dir . $file)) { $file_out[$file_count][] = "\r\n <td align=center><a href=\"javascript:rename('" . addslashes($file) . "')\">" . et('Ren') . "</a>"; } else { $file_out[$file_count][] = "<td> </td>"; } if (is_readable($current_dir . $file) && strpos(".wav#.mp3#.mid#.avi#.mov#.mpeg#.mpg#.rm#.iso#.bin#.img#.dll#.psd#.fla#.swf#.class#.ppt#.tif#.tiff#.pcx#.jpg#.gif#.png#.wmf#.eps#.bmp#.msi#.exe#.com#.rar#.tar#.zip#.bz2#.tbz2#.bz#.tbz#.bzip#.gzip#.gz#.tgz#", $dir_entry["ext"] . "#") === false) { $file_out[$file_count][] = "\r\n <td align=center><a href=\"javascript:edit_file('" . addslashes($file) . "')\">" . et('Edit') . "</a>"; } else { $file_out[$file_count][] = "<td> </td>"; } if (is_readable($current_dir . $file) && strpos(".txt#.sys#.bat#.ini#.conf#.swf#.php#.php3#.asp#.html#.htm#.jpg#.gif#.png#.bmp#", $dir_entry["ext"] . "#") !== false) { $file_out[$file_count][] = "\r\n <td align=center><a href=\"javascript:view('" . addslashes($file) . "');\">" . et('View') . "</a>"; } else { $file_out[$file_count][] = "<td> </td>"; } if (is_readable($current_dir . $file) && strlen($dir_entry["ext"]) && strpos(".tar#.zip#.bz2#.tbz2#.bz#.tbz#.bzip#.gzip#.gz#.tgz#", $dir_entry["ext"] . "#") !== false) { $file_out[$file_count][] = "\r\n <td align=center><a href=\"javascript:decompress('" . addslashes($file) . "')\">" . et('Decompress') . "</a>"; } else { $file_out[$file_count][] = "<td> </td>"; } if (is_readable($current_dir . $file) && strlen($dir_entry["ext"]) && strpos(".exe#.com#.sh#.bat#", $dir_entry["ext"] . "#") !== false) { $file_out[$file_count][] = "\r\n <td align=center><a href=\"javascript:execute_file('" . addslashes($file) . "')\">" . et('Exec') . "</a>"; } else { $file_out[$file_count][] = "<td> </td>"; } if (count($file_out[$file_count]) > $max_opt) { $max_opt = count($file_out[$file_count]); } $file_count++; } } if ($dir_count) { $out .= "\r\n <tr>\r\n <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or1}¤t_dir={$current_dir}\">" . et('Name') . "</a></nobr></td>\r\n <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or2}¤t_dir={$current_dir}\">" . et('Perm') . "</a></nobr></td>"; if ($islinux) { $out .= "\r\n <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or3}¤t_dir={$current_dir}\">" . et('Owner') . "</a></td>\r\n <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or4}¤t_dir={$current_dir}\">" . et('Group') . "</a></nobr></td>"; } $out .= "\r\n <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or5}¤t_dir={$current_dir}\">" . et('Size') . "</a></nobr></td>\r\n <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or6}¤t_dir={$current_dir}\">" . et('Date') . "</a></nobr></td>"; if ($file_count) { $out .= "\r\n <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or7}¤t_dir={$current_dir}\">" . et('Type') . "</a></nobr></td>"; } $out .= "\r\n <td bgcolor=\"#DDDDDD\" colspan=50> </td>\r\n </tr>"; } foreach ($dir_out as $k => $v) { while (count($dir_out[$k]) < $max_opt) { $dir_out[$k][] = "<td> </td>"; } $out .= implode($dir_out[$k]); $out .= "</tr>"; } if ($file_count) { $out .= "\r\n <tr>\r\n <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or1}¤t_dir={$current_dir}\">" . et('Name') . "</a></nobr></td>\r\n <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or2}¤t_dir={$current_dir}\">" . et('Perm') . "</a></nobr></td>"; if ($islinux) { $out .= "\r\n <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or3}¤t_dir={$current_dir}\">" . et('Owner') . "</a></td>\r\n <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or4}¤t_dir={$current_dir}\">" . et('Group') . "</a></nobr></td>"; } $out .= "\r\n <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or5}¤t_dir={$current_dir}\">" . et('Size') . "</a></nobr></td>\r\n <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or6}¤t_dir={$current_dir}\">" . et('Date') . "</a></nobr></td>\r\n <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or7}¤t_dir={$current_dir}\">" . et('Type') . "</a></nobr></td>\r\n <td bgcolor=\"#DDDDDD\" colspan=50> </td>\r\n </tr>"; } foreach ($file_out as $k => $v) { while (count($file_out[$k]) < $max_opt) { $file_out[$k][] = "<td> </td>"; } $out .= implode($file_out[$k]); $out .= "</tr>"; } $out .= "\r\n <tr>\r\n <td bgcolor=\"#DDDDDD\" colspan=50><nobr>\r\n <input type=\"button\" style=\"width:80\" onclick=\"selectANI(this)\" id=\"ANI1\" value=\"" . et('SelAll') . "\">\r\n <input type=\"button\" style=\"width:80\" onclick=\"selectANI(this)\" value=\"" . et('SelInverse') . "\">\r\n <input type=\"button\" style=\"width:80\" onclick=\"test(4)\" value=\"" . et('Rem') . "\">\r\n <input type=\"button\" style=\"width:80\" onclick=\"sel_dir(5)\" value=\"" . et('Copy') . "\">\r\n <input type=\"button\" style=\"width:80\" onclick=\"sel_dir(6)\" value=\"" . et('Move') . "\">\r\n <input type=\"button\" style=\"width:100\" onclick=\"test_prompt(71)\" value=\"" . et('Compress') . "\">"; if ($islinux) { $out .= "\r\n <input type=\"button\" style=\"width:100\" onclick=\"resolveIDs()\" value=\"" . et('ResolveIDs') . "\">"; } $out .= "\r\n <input type=\"button\" style=\"width:100\" onclick=\"chmod_form()\" value=\"" . et('Perms') . "\">"; $out .= "\r\n </nobr></td>\r\n </tr>"; $out .= "\r\n </form>"; $out .= "\r\n <tr><td bgcolor=\"#DDDDDD\" colspan=50><b>{$dir_count} " . et('Dir_s') . " " . et('And') . " {$file_count} " . et('File_s') . " = " . format_size($total_size) . "</td></tr>"; if ($quota_mb) { $out .= "\r\n <tr><td bgcolor=\"#DDDDDD\" colspan=50><b>" . et('Partition') . ": " . format_size($quota_mb * 1024 * 1024) . " " . et('Total') . " - " . format_size($quota_mb * 1024 * 1024 - total_size($fm_current_root)) . " " . et('Free') . "</td></tr>"; } else { $out .= "\r\n <tr><td bgcolor=\"#DDDDDD\" colspan=50><b>" . et('Partition') . ": " . format_size(disk_total_space($current_dir)) . " " . et('Total') . " - " . format_size(disk_free_space($current_dir)) . " " . et('Free') . "</td></tr>"; } $tf = getmicrotime(); $tt = $tf - $ti; $out .= "\r\n <tr><td bgcolor=\"#DDDDDD\" colspan=50><b>" . et('RenderTime') . ": " . substr($tt, 0, strrpos($tt, ".") + 5) . " " . et('Seconds') . "</td></tr>"; $out .= "\r\n <script language=\"Javascript\" type=\"text/javascript\">\r\n <!--\r\n update_sel_status();\r\n //-->\r\n </script>"; } else { $out .= "\r\n <tr>\r\n <td bgcolor=\"#DDDDDD\" width=\"1%\">{$uplink}<td bgcolor=\"#DDDDDD\" colspan=50><nobr><a href=\"" . $path_info["basename"] . "?frame=3¤t_dir={$current_dir}\">{$current_dir}</a></nobr>\r\n <tr><td bgcolor=\"#DDDDDD\" colspan=50>" . et('EmptyDir') . ".</tr>"; } } else { $out .= "<tr><td><font color=red>" . et('IOError') . ".<br>{$current_dir}</font>"; } $out .= "</table>"; echo $out; }
function dir_list_form() { global $fm_root_atual, $dir_atual, $quota_mb, $resolveIDs, $order_dir_list_by, $islinux, $cmd_name, $ip, $is_reachable, $path_info, $fm_color; $ti = getmicrotime(); clearstatcache(); $out = "<table border=0 cellspacing=1 cellpadding=4 width=\"100%\" bgcolor=\"#eeeeee\">\n"; if ($opdir = @opendir($dir_atual)) { $entry_count = 0; $file_count = 0; $dir_count = 0; $total_size = 0; $uplink = ""; $entry_list = array(); $highlight_cols = 0; while ($file = readdir($opdir)) { if ($file != "." && $file != "..") { if (is_file($dir_atual . $file)) { $ext = strtolower(strrchr($file, ".")); $entry_list[$entry_count]["type"] = "file"; // Função filetype() returns only "file"... $entry_list[$entry_count]["size"] = filesize($dir_atual . $file); $entry_list[$entry_count]["sizet"] = getsize($dir_atual . $file); if (strstr($ext, ".")) { $entry_list[$entry_count]["ext"] = $ext; $entry_list[$entry_count]["extt"] = $ext; } else { $entry_list[$entry_count]["ext"] = ""; $entry_list[$entry_count]["extt"] = " "; } $file_count++; } elseif (is_dir($dir_atual . $file)) { // Recursive directory size disabled // $entry_list[$entry_count]["size"] = total_size($dir_atual.$file); $entry_list[$entry_count]["size"] = 0; $entry_list[$entry_count]["sizet"] = 0; $entry_list[$entry_count]["type"] = "dir"; $dir_count++; } $entry_list[$entry_count]["name"] = $file; $entry_list[$entry_count]["date"] = date("Ymd", filemtime($dir_atual . $file)); $entry_list[$entry_count]["time"] = date("his", filemtime($dir_atual . $file)); $entry_list[$entry_count]["datet"] = date("d/m/Y h:i:s", filemtime($dir_atual . $file)); if ($islinux && $resolveIDs) { $entry_list[$entry_count]["p"] = show_perms(fileperms($dir_atual . $file)); $entry_list[$entry_count]["u"] = getuser(fileowner($dir_atual . $file)); $entry_list[$entry_count]["g"] = getgroup(filegroup($dir_atual . $file)); } else { $entry_list[$entry_count]["p"] = base_convert(fileperms($dir_atual . $file), 10, 8); $entry_list[$entry_count]["p"] = substr($entry_list[$entry_count]["p"], strlen($entry_list[$entry_count]["p"]) - 3); $entry_list[$entry_count]["u"] = fileowner($dir_atual . $file); $entry_list[$entry_count]["g"] = filegroup($dir_atual . $file); } $total_size += $entry_list[$entry_count]["size"]; $entry_count++; } } closedir($opdir); if ($file_count) { $highlight_cols = $islinux ? 7 : 5; } else { $highlight_cols = $islinux ? 6 : 4; } if ($entry_count) { $or1 = "1A"; $or2 = "2D"; $or3 = "3A"; $or4 = "4A"; $or5 = "5A"; $or6 = "6D"; $or7 = "7D"; switch ($order_dir_list_by) { case "1A": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "name", SORT_STRING, SORT_ASC); $or1 = "1D"; break; case "1D": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "name", SORT_STRING, SORT_DESC); $or1 = "1A"; break; case "2A": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "p", SORT_STRING, SORT_ASC, "g", SORT_STRING, SORT_ASC, "u", SORT_STRING, SORT_ASC); $or2 = "2D"; break; case "2D": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "p", SORT_STRING, SORT_DESC, "g", SORT_STRING, SORT_ASC, "u", SORT_STRING, SORT_ASC); $or2 = "2A"; break; case "3A": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "u", SORT_STRING, SORT_ASC, "g", SORT_STRING, SORT_ASC); $or3 = "3D"; break; case "3D": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "u", SORT_STRING, SORT_DESC, "g", SORT_STRING, SORT_ASC); $or3 = "3A"; break; case "4A": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "g", SORT_STRING, SORT_ASC, "u", SORT_STRING, SORT_DESC); $or4 = "4D"; break; case "4D": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "g", SORT_STRING, SORT_DESC, "u", SORT_STRING, SORT_DESC); $or4 = "4A"; break; case "5A": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "size", SORT_NUMERIC, SORT_ASC); $or5 = "5D"; break; case "5D": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "size", SORT_NUMERIC, SORT_DESC); $or5 = "5A"; break; case "6A": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "date", SORT_STRING, SORT_ASC, "time", SORT_STRING, SORT_ASC, "name", SORT_STRING, SORT_ASC); $or6 = "6D"; break; case "6D": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "date", SORT_STRING, SORT_DESC, "time", SORT_STRING, SORT_DESC, "name", SORT_STRING, SORT_ASC); $or6 = "6A"; break; case "7A": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "ext", SORT_STRING, SORT_ASC, "name", SORT_STRING, SORT_ASC); $or7 = "7D"; break; case "7D": $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "ext", SORT_STRING, SORT_DESC, "name", SORT_STRING, SORT_ASC); $or7 = "7A"; break; } } $out .= "\r\n <script language=\"Javascript\" type=\"text/javascript\">\r\n <!--\r\n function getCookieVal (offset) {\r\n var endstr = document.cookie.indexOf (';', offset);\r\n if (endstr == -1) endstr = document.cookie.length;\r\n return unescape(document.cookie.substring(offset, endstr));\r\n }\r\n function getCookie (name) {\r\n var arg = name + '=';\r\n var alen = arg.length;\r\n var clen = document.cookie.length;\r\n var i = 0;\r\n while (i < clen) {\r\n var j = i + alen;\r\n if (document.cookie.substring(i, j) == arg) return getCookieVal (j);\r\n i = document.cookie.indexOf(' ', i) + 1;\r\n if (i == 0) break;\r\n }\r\n return null;\r\n }\r\n function setCookie (name, value) {\r\n var argv = SetCookie.arguments;\r\n var argc = SetCookie.arguments.length;\r\n var expires = (argc > 2) ? argv[2] : null;\r\n var path = (argc > 3) ? argv[3] : null;\r\n var domain = (argc > 4) ? argv[4] : null;\r\n var secure = (argc > 5) ? argv[5] : false;\r\n document.cookie = name + '=' + escape (value) +\r\n ((expires == null) ? '' : ('; expires=' + expires.toGMTString())) +\r\n ((path == null) ? '' : ('; path=' + path)) +\r\n ((domain == null) ? '' : ('; domain=' + domain)) +\r\n ((secure == true) ? '; secure' : '');\r\n }\r\n function delCookie (name) {\r\n var exp = new Date();\r\n exp.setTime (exp.getTime() - 1);\r\n var cval = GetCookie (name);\r\n document.cookie = name + '=' + cval + '; expires=' + exp.toGMTString();\r\n }\r\n function go(arg) {\r\n document.location.href='" . $path_info["basename"] . "?frame=3&dir_atual={$dir_atual}'+arg+'/';\r\n }\r\n function resolveIDs() {\r\n document.location.href='" . $path_info["basename"] . "?frame=3&set_resolveIDs=1&dir_atual={$dir_atual}';\r\n }\r\n var entry_list = new Array();\r\n // Custom object constructor\r\n function entry(name, type, size, selected){\r\n this.name = name;\r\n this.type = type;\r\n this.size = size;\r\n this.selected = false;\r\n }\r\n // Declare entry_list for selection procedures"; foreach ($entry_list as $i => $data) { $out .= "\nentry_list['entry{$i}'] = new entry('" . $data["name"] . "', '" . $data["type"] . "', " . $data["size"] . ", false);"; } $out .= "\r\n // Select/Unselect Rows OnClick/OnMouseOver\r\n var lastRows = new Array(null,null);\r\n function selectEntry(Row, Action){\r\n var MarkColor = '#" . $fm_color['Mark'] . "';\r\n var Cells = Row.getElementsByTagName('td');\r\n if (multipleSelection){\r\n // Avoid repeated onmouseover events from same Row ( cell transition )\r\n if (Row != lastRows[0]){\r\n if (Action == 'over') {\r\n if (entry_list[Row.id].selected){\r\n if (entry_list[Row.id].type == 'dir') DefaultColor = '#" . $fm_color['Dir'] . "';\r\n else DefaultColor = '#" . $fm_color['File'] . "';\r\n if (unselect(entry_list[Row.id])) {\r\n for (var c=0; c < " . (int) $highlight_cols . "; c++) {\r\n if (c == 0 && entry_list[Row.id].type=='file' && !entry_list[Row.id].selected) Cells[c].style.backgroundColor = '#" . $fm_color['FileFirstCell'] . "';\r\n else Cells[c].style.backgroundColor = DefaultColor;\r\n }\r\n }\r\n // Change the last Row when you change the movement orientation\r\n if (lastRows[0] != null && lastRows[1] != null){\r\n var LastRowID = lastRows[0].id;\r\n var LastRowDefaultColor;\r\n if (entry_list[LastRowID].type == 'dir') LastRowDefaultColor = '#" . $fm_color['Dir'] . "';\r\n else LastRowDefaultColor = '#" . $fm_color['File'] . "';\r\n if (Row.id == lastRows[1].id){\r\n var LastRowCells = lastRows[0].getElementsByTagName('td');\r\n if (unselect(entry_list[LastRowID])) {\r\n for (var c=0; c < " . (int) $highlight_cols . "; c++) {\r\n if (c == 0 && entry_list[LastRowID].type=='file' && !entry_list[LastRowID].selected) LastRowCells[c].style.backgroundColor = '#" . $fm_color['FileFirstCell'] . "';\r\n else LastRowCells[c].style.backgroundColor = LastRowDefaultColor;\r\n }\r\n }\r\n }\r\n }\r\n } else {\r\n if (select(entry_list[Row.id])){\r\n for (var c=0; c < " . (int) $highlight_cols . "; c++) {\r\n if (c == 0 && entry_list[Row.id].type=='file' && !entry_list[Row.id].selected) Cells[c].style.backgroundColor = '#" . $fm_color['FileFirstCell'] . "';\r\n else Cells[c].style.backgroundColor = MarkColor;\r\n }\r\n }\r\n // Change the last Row when you change the movement orientation\r\n if (lastRows[0] != null && lastRows[1] != null){\r\n var LastRowID = lastRows[0].id;\r\n if (Row.id == lastRows[1].id){\r\n var LastRowCells = lastRows[0].getElementsByTagName('td');\r\n if (select(entry_list[LastRowID])) {\r\n for (var c=0; c < " . (int) $highlight_cols . "; c++) {\r\n if (c == 0 && entry_list[LastRowID].type=='file' && !entry_list[LastRowID].selected) LastRowCells[c].style.backgroundColor = '#" . $fm_color['FileFirstCell'] . "';\r\n else LastRowCells[c].style.backgroundColor = MarkColor;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n lastRows[1] = lastRows[0];\r\n lastRows[0] = Row;\r\n }\r\n }\r\n } else {\r\n if (Action == 'click') {\r\n var newColor = null;\r\n if (entry_list[Row.id].selected){\r\n var DefaultColor;\r\n if (entry_list[Row.id].type == 'dir') DefaultColor = '#" . $fm_color['Dir'] . "';\r\n else DefaultColor = '#" . $fm_color['File'] . "';\r\n if (unselect(entry_list[Row.id])) newColor = DefaultColor;\r\n } else {\r\n if (select(entry_list[Row.id])) newColor = MarkColor;\r\n }\r\n if (newColor) {\r\n lastRows[0] = lastRows[1] = Row;\r\n for (var c=0; c < " . (int) $highlight_cols . "; c++) {\r\n if (c == 0 && entry_list[Row.id].type=='file' && !entry_list[Row.id].selected) Cells[c].style.backgroundColor = '#" . $fm_color['FileFirstCell'] . "';\r\n else Cells[c].style.backgroundColor = newColor;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n // Disable text selection and bind multiple selection flag\r\n var multipleSelection = false;\r\n if (is.ie) {\r\n document.onselectstart=new Function('return false');\r\n document.onmousedown=switch_flag_on;\r\n document.onmouseup=switch_flag_off;\r\n // Event mouseup is not generated over scrollbar.. curiously, mousedown is.. go figure.\r\n window.onscroll=new Function('multipleSelection=false');\r\n } else {\r\n if (document.layers) window.captureEvents(Event.MOUSEDOWN);\r\n if (document.layers) window.captureEvents(Event.MOUSEUP);\r\n window.onmousedown=switch_flag_on;\r\n window.onmouseup=switch_flag_off;\r\n }\r\n // Using same function and a ternary operator couses bug on double click\r\n function switch_flag_on(e) {\r\n lastRows[0] = lastRows[1] = null;\r\n if (is.ie){\r\n multipleSelection = (event.button == 1);\r\n } else {\r\n multipleSelection = (e.which == 1);\r\n }\r\n return false;\r\n }\r\n function switch_flag_off(e) {\r\n if (is.ie){\r\n multipleSelection = (event.button != 1);\r\n } else {\r\n multipleSelection = (e.which != 1);\r\n }\r\n return false;\r\n }\r\n var total_dirs_selected = 0;\r\n var total_files_selected = 0;\r\n function unselect(Entry){\r\n if (!Entry.selected) return false;\r\n Entry.selected = false;\r\n sel_totalsize -= Entry.size;\r\n if (Entry.type == 'dir') total_dirs_selected--;\r\n else total_files_selected--;\r\n update_sel_status();\r\n return true;\r\n }\r\n function select(Entry){\r\n if(Entry.selected) return false;\r\n Entry.selected = true;\r\n sel_totalsize += Entry.size;\r\n if(Entry.type == 'dir') total_dirs_selected++;\r\n else total_files_selected++;\r\n update_sel_status();\r\n return true;\r\n }\r\n function is_anything_selected(){\r\n var selected_dir_list = new Array();\r\n var selected_file_list = new Array();\r\n for(var x=0;x<" . (int) count($entry_list) . ";x++){\r\n if(entry_list['entry'+x].selected){\r\n if(entry_list['entry'+x].type == 'dir') selected_dir_list.push(entry_list['entry'+x].name);\r\n else selected_file_list.push(entry_list['entry'+x].name);\r\n }\r\n }\r\n document.form_action.selected_dir_list.value = selected_dir_list.join('<|*|>');\r\n document.form_action.selected_file_list.value = selected_file_list.join('<|*|>');\r\n return (total_dirs_selected>0 || total_files_selected>0);\r\n }\r\n function formatsize (arg) {\r\n var resul = '';\r\n if (arg>0){\r\n var j = 0;\r\n var ext = new Array(' bytes',' Kb',' Mb',' Gb',' Tb');\r\n while (arg >= Math.pow(1024,j)) ++j;\r\n resul = (Math.round(arg/Math.pow(1024,j-1)*100)/100) + ext[j-1];\r\n } else resul = '0 Mb';\r\n return resul;\r\n }\r\n var sel_totalsize = 0;\r\n function update_sel_status(){\r\n var t = total_dirs_selected+' " . et('Dir_s') . " " . et('And') . " '+total_files_selected+' " . et('File_s') . " " . et('Selected_s') . " = '+formatsize(sel_totalsize);\r\n document.getElementById(\"sel_status\").innerHTML = t;\r\n }\r\n // Select all/none/inverse\r\n function selectANI(Butt){\r\n var MarkColor = '#" . $fm_color['Mark'] . "';\r\n for(var x=0;x<" . (int) count($entry_list) . ";x++){\r\n if (entry_list['entry'+x].type == 'dir'){\r\n var DefaultColor = '#" . $fm_color['Dir'] . "';\r\n } else {\r\n var DefaultColor = '#" . $fm_color['File'] . "';\r\n }\r\n var Row = document.getElementById('entry'+x);\r\n var Cells = Row.getElementsByTagName('td');\r\n var newColor = null;\r\n switch (Butt.value){\r\n case '" . et('SelAll') . "':\r\n if (select(entry_list[Row.id])) newColor = MarkColor;\r\n break;\r\n case '" . et('SelNone') . "':\r\n if (unselect(entry_list[Row.id])) newColor = DefaultColor;\r\n break;\r\n case '" . et('SelInverse') . "':\r\n if (entry_list[Row.id].selected){\r\n if (unselect(entry_list[Row.id])) newColor = DefaultColor;\r\n } else {\r\n if (select(entry_list[Row.id])) newColor = MarkColor;\r\n }\r\n break;\r\n }\r\n if (newColor) {\r\n for (var c=0; c < " . (int) $highlight_cols . "; c++) {\r\n if (entry_list[Row.id].type=='file' && c==0 && !entry_list[Row.id].selected) Cells[c].style.backgroundColor = '#" . $fm_color['FileFirstCell'] . "';\r\n else Cells[c].style.backgroundColor = newColor;\r\n }\r\n }\r\n }\r\n if (Butt.value == '" . et('SelAll') . "'){\r\n Butt.value = '" . et('SelNone') . "';\r\n } else if (Butt.value == '" . et('SelNone') . "'){\r\n Butt.value = '" . et('SelAll') . "';\r\n }\r\n return true;\r\n }\r\n function download(arg){\r\n parent.frame1.location.href='" . $path_info["basename"] . "?action=3&dir_atual={$dir_atual}&filename='+escape(arg);\r\n }\r\n function upload(){\r\n var w = 400;\r\n var h = 200;\r\n window.open('" . $path_info["basename"] . "?action=10&dir_atual={$dir_atual}', '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=no,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n }\r\n function execute(){\r\n document.form_action.cmd_arg.value = prompt('" . et('TypeCmd') . ".');\r\n if(document.form_action.cmd_arg.value.length>0){\r\n if(confirm('" . et('ConfExec') . " \\' '+document.form_action.cmd_arg.value+' \\' ?')) {\r\n var w = 800;\r\n var h = 600;\r\n window.open('" . $path_info["basename"] . "?action=6&dir_atual={$dir_atual}&cmd='+escape(document.form_action.cmd_arg.value), '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n }\r\n }\r\n }\r\n function decompress(arg){\r\n if(confirm('" . strtoupper(et('Decompress')) . " \\' '+arg+' \\' ?')) {\r\n document.form_action.action.value = 72;\r\n document.form_action.cmd_arg.value = arg;\r\n document.form_action.submit();\r\n }\r\n }\r\n function edit_file(arg){\r\n var w = 800;\r\n var h = 600;\r\n if(confirm('" . strtoupper(et('Edit')) . " \\' '+arg+' \\' ?')) window.open('" . $path_info["basename"] . "?action=7&dir_atual={$dir_atual}&filename='+escape(arg), '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=no,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n }\r\n function config(){\r\n var w = 600;\r\n var h = 400;\r\n window.open('" . $path_info["basename"] . "?action=2', 'win_config', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n }\r\n function server_info(arg){\r\n var w = 800;\r\n var h = 600;\r\n window.open('" . $path_info["basename"] . "?action=5', 'win_serverinfo', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n }\r\n function shell(){\r\n var w = 800;\r\n var h = 600;\r\n window.open('" . $path_info["basename"] . "?action=9', '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n }\r\n function view(arg){\r\n var w = 800;\r\n var h = 600;\r\n if(confirm('" . strtoupper(et('View')) . " \\' '+arg+' \\' ?')) window.open('" . $path_info["basename"] . "?action=4&dir_atual={$dir_atual}&filename='+escape(arg), '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=yes,toolbar=no,menubar=no,location=yes');\r\n }\r\n function rename(arg){\r\n var nome = '';\r\n if (nome = prompt('" . strtoupper(et('Ren')) . " \\' '+arg+' \\' " . et('To') . " ...')) document.location.href='" . $path_info["basename"] . "?frame=3&action=3&dir_atual={$dir_atual}&old_name='+escape(arg)+'&new_name='+escape(nome);\r\n }\r\n function set_dir_dest(arg){\r\n document.form_action.dir_dest.value=arg;\r\n if (document.form_action.action.value.length>0) test(document.form_action.action.value);\r\n else alert('" . et('JSError') . ".');\r\n }\r\n function sel_dir(arg){\r\n document.form_action.action.value = arg;\r\n document.form_action.dir_dest.value='';\r\n if (!is_anything_selected()) alert('" . et('NoSel') . ".');\r\n else {\r\n if (!getCookie('sel_dir_warn')) {\r\n alert('" . et('SelDir') . ".');\r\n document.cookie='sel_dir_warn'+'='+escape('true')+';';\r\n }\r\n parent.frame2.set_flag(true);\r\n }\r\n }\r\n function set_chmod_arg(arg){\r\n document.form_action.chmod_arg.value=arg;\r\n if (document.form_action.action.value.length>0) test(document.form_action.action.value);\r\n else alert('" . et('JSError') . "');\r\n }\r\n function chmod(arg){\r\n document.form_action.action.value = arg;\r\n document.form_action.dir_dest.value='';\r\n document.form_action.chmod_arg.value='';\r\n if (!is_anything_selected()) alert('" . et('NoSel') . ".');\r\n else {\r\n var w = 280;\r\n var h = 180;\r\n window.open('" . $path_info["basename"] . "?action=8', '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=no,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n }\r\n }\r\n function test_action(){\r\n if (document.form_action.action.value != 0) return true;\r\n else return false;\r\n }\r\n function test_prompt(arg){\r\n var erro='';\r\n var conf='';\r\n if (arg == 1){\r\n document.form_action.cmd_arg.value = prompt('" . et('TypeDir') . ".');\r\n } else if (arg == 2){\r\n document.form_action.cmd_arg.value = prompt('" . et('TypeArq') . ".');\r\n } else if (arg == 71){\r\n if (!is_anything_selected()) erro = '" . et('NoSel') . ".';\r\n else document.form_action.cmd_arg.value = prompt('" . et('TypeArqComp') . "');\r\n }\r\n if (erro!=''){\r\n document.form_action.cmd_arg.focus();\r\n alert(erro);\r\n } else if(document.form_action.cmd_arg.value.length>0) {\r\n document.form_action.action.value = arg;\r\n document.form_action.submit();\r\n }\r\n }\r\n function strstr(haystack,needle){\r\n var index = haystack.indexOf(needle);\r\n return (index==-1)?false:index;\r\n }\r\n function valid_dest(dest,orig){\r\n return (strstr(dest,orig)==false)?true:false;\r\n }\r\n // ArrayAlert - Selection debug only\r\n function aa(){\r\n var str = 'selected_dir_list:\\n';\r\n for (x=0;x<selected_dir_list.length;x++){\r\n str += selected_dir_list[x]+'\\n';\r\n }\r\n str += '\\nselected_file_list:\\n';\r\n for (x=0;x<selected_file_list.length;x++){\r\n str += selected_file_list[x]+'\\n';\r\n }\r\n alert(str);\r\n }\r\n function test(arg){\r\n var erro='';\r\n var conf='';\r\n if (arg == 4){\r\n if (!is_anything_selected()) erro = '" . et('NoSel') . ".\\n';\r\n conf = '" . et('RemSel') . " ?\\n';\r\n } else if (arg == 5){\r\n if (!is_anything_selected()) erro = '" . et('NoSel') . ".\\n';\r\n else if(document.form_action.dir_dest.value.length == 0) erro = '" . et('NoDestDir') . ".';\r\n else if(document.form_action.dir_dest.value == document.form_action.dir_atual.value) erro = '" . et('DestEqOrig') . ".';\r\n else if(!valid_dest(document.form_action.dir_dest.value,document.form_action.dir_atual.value)) erro = '" . et('InvalidDest') . ".';\r\n conf = '" . et('CopyTo') . " \\' '+document.form_action.dir_dest.value+' \\' ?\\n';\r\n } else if (arg == 6){\r\n if (!is_anything_selected()) erro = '" . et('NoSel') . ".';\r\n else if(document.form_action.dir_dest.value.length == 0) erro = '" . et('NoDestDir') . ".';\r\n else if(document.form_action.dir_dest.value == document.form_action.dir_atual.value) erro = '" . et('DestEqOrig') . ".';\r\n else if(!valid_dest(document.form_action.dir_dest.value,document.form_action.dir_atual.value)) erro = '" . et('InvalidDest') . ".';\r\n conf = '" . et('MoveTo') . " \\' '+document.form_action.dir_dest.value+' \\' ?\\n';\r\n } else if (arg == 9){\r\n if (!is_anything_selected()) erro = '" . et('NoSel') . ".';\r\n else if(document.form_action.chmod_arg.value.length == 0) erro = '" . et('NoNewPerm') . ".';\r\n conf = '" . et('AlterPermTo') . " \\' '+document.form_action.chmod_arg.value+' \\' ?\\n';\r\n }\r\n if (erro!=''){\r\n document.form_action.cmd_arg.focus();\r\n alert(erro);\r\n } else if(conf!='') {\r\n if(confirm(conf)) {\r\n document.form_action.action.value = arg;\r\n document.form_action.submit();\r\n }\r\n } else {\r\n document.form_action.action.value = arg;\r\n document.form_action.submit();\r\n }\r\n }\r\n //-->\r\n </script>"; $out .= "\r\n <form name=\"form_action\" action=\"" . $path_info["basename"] . "\" method=\"post\" onsubmit=\"return test_action();\">\r\n <input type=hidden name=\"frame\" value=3>\r\n <input type=hidden name=\"action\" value=0>\r\n <input type=hidden name=\"dir_dest\" value=\"\">\r\n <input type=hidden name=\"chmod_arg\" value=\"\">\r\n <input type=hidden name=\"cmd_arg\" value=\"\">\r\n <input type=hidden name=\"dir_atual\" value=\"{$dir_atual}\">\r\n <input type=hidden name=\"dir_antes\" value=\"{$dir_antes}\">\r\n <input type=hidden name=\"selected_dir_list\" value=\"\">\r\n <input type=hidden name=\"selected_file_list\" value=\"\">"; $out .= "\r\n <tr>\r\n <td bgcolor=\"#DDDDDD\" colspan=20><nobr>\r\n <input type=button onclick=\"config()\" value=\"" . et('Config') . "\">\r\n <input type=button onclick=\"server_info()\" value=\"" . et('ServerInfo') . "\">\r\n <input type=button onclick=\"test_prompt(1)\" value=\"" . et('CreateDir') . "\">\r\n <input type=button onclick=\"test_prompt(2)\" value=\"" . et('CreateArq') . "\">\r\n <input type=button onclick=\"execute()\" value=\"" . et('ExecCmd') . "\">\r\n <input type=button onclick=\"upload()\" value=\"" . et('Upload') . "\">\r\n <input type=button onclick=\"shell()\" value=\"" . et('Shell') . "\">\r\n <b>{$ip}</b>\r\n </nobr>"; if ($dir_atual != $fm_root_atual) { $mat = explode("/", $dir_atual); $dir_antes = ""; for ($x = 0; $x < count($mat) - 2; $x++) { $dir_antes .= $mat[$x] . "/"; } $uplink = "<a href=\"" . $path_info["basename"] . "?frame=3&dir_atual={$dir_antes}\"><<</a> "; } if ($entry_count) { $out .= "\r\n <tr><td bgcolor=\"#DDDDDD\" colspan=20><nobr>{$uplink} <a href=\"" . $path_info["basename"] . "?frame=3&dir_atual={$dir_atual}\">{$dir_atual}</a></nobr>\r\n <tr>\r\n <td bgcolor=\"#DDDDDD\" colspan=20><nobr>\r\n <input type=\"button\" style=\"width:60\" onclick=\"selectANI(this)\" value=\"" . et('SelAll') . "\">\r\n <input type=\"button\" style=\"width:60\" onclick=\"selectANI(this)\" value=\"" . et('SelInverse') . "\">\r\n <input type=\"button\" style=\"width:60\" onclick=\"test(4)\" value=\"" . et('Rem') . "\">\r\n <input type=\"button\" style=\"width:60\" onclick=\"sel_dir(5)\" value=\"" . et('Copy') . "\">\r\n <input type=\"button\" style=\"width:60\" onclick=\"sel_dir(6)\" value=\"" . et('Move') . "\">\r\n <input type=\"button\" style=\"width:100\" onclick=\"test_prompt(71)\" value=\"" . et('Compress') . "\">"; if ($islinux) { $out .= "\r\n <input type=\"button\" style=\"width:100\" onclick=\"resolveIDs()\" value=\"" . et('ResolveIDs') . "\">"; } $out .= "\r\n <input type=\"button\" style=\"width:100\" onclick=\"chmod(9)\" value=\"" . et('Perms') . "\">"; $out .= "\r\n </nobr>\r\n <tr><td bgcolor=\"#DDDDDD\" colspan=20><DIV ID=\"sel_status\"></DIV></td></tr>"; $dir_out = ""; $file_out = ""; foreach ($entry_list as $ind => $dir_entry) { $file = $dir_entry["name"]; if ($dir_entry["type"] == "dir") { $dir_out .= "\r\n <tr ID=\"entry{$ind}\" onmouseover=\"selectEntry(this, 'over');\" onmousedown=\"selectEntry(this, 'click');\">\r\n <td align=left bgcolor=\"#" . $fm_color['Dir'] . "\"><nobr><a href=\"JavaScript:go('{$file}')\">{$file}</a></nobr>\r\n <td bgcolor=\"#" . $fm_color['Dir'] . "\">" . $dir_entry["p"]; if ($islinux) { $dir_out .= "<td bgcolor=\"#" . $fm_color['Dir'] . "\">" . $dir_entry["u"] . "<td bgcolor=\"#" . $fm_color['Dir'] . "\">" . $dir_entry["g"]; } $dir_out .= "\r\n <td bgcolor=\"#" . $fm_color['Dir'] . "\">" . $dir_entry["sizet"] . "\r\n <td bgcolor=\"#" . $fm_color['Dir'] . "\">" . $dir_entry["datet"]; if ($file_count) { $dir_out .= "\r\n <td bgcolor=\"#" . $fm_color['Dir'] . "\" align=center>"; } // Opções de diretório if (is_writable($dir_atual . $file)) { $dir_out .= "\r\n <td bgcolor=\"#FFFFFF\" align=center><a href=\"JavaScript:if(confirm('" . et('ConfRem') . " \\'" . $file . "\\' ?')) document.location.href='" . $path_info["basename"] . "?frame=3&action=8&cmd_arg=" . $file . "&dir_atual={$dir_atual}'\">" . et('Rem') . "</a>\r\n <td bgcolor=\"#FFFFFF\" align=center><a href=\"JavaScript:rename('{$file}')\">" . et('Ren') . "</a>"; } $dir_out .= "\r\n </tr>"; } else { $file_out .= "\r\n <tr ID=\"entry{$ind}\" onmouseover=\"selectEntry(this, 'over');\" onmousedown=\"selectEntry(this, 'click');\">\r\n <td align=left bgcolor=\"#FFFFFF\"><nobr><a href=\"JavaScript:download('{$file}')\">{$file}</a></nobr>\r\n <td bgcolor=\"#" . $fm_color['File'] . "\">" . $dir_entry["p"]; if ($islinux) { $file_out .= "<td bgcolor=\"#" . $fm_color['File'] . "\">" . $dir_entry["u"] . "<td bgcolor=\"#" . $fm_color['File'] . "\">" . $dir_entry["g"]; } $file_out .= "\r\n <td bgcolor=\"#" . $fm_color['File'] . "\">" . $dir_entry["sizet"] . "\r\n <td bgcolor=\"#" . $fm_color['File'] . "\">" . $dir_entry["datet"] . "\r\n <td bgcolor=\"#" . $fm_color['File'] . "\">" . $dir_entry["extt"]; // Opções de arquivo if (is_writable($dir_atual . $file)) { $file_out .= "\r\n <td bgcolor=\"#FFFFFF\" align=center><a href=\"javascript:if(confirm('" . strtoupper(et('Rem')) . " \\'" . $file . "\\' ?')) document.location.href='" . $path_info["basename"] . "?frame=3&action=8&cmd_arg=" . $file . "&dir_atual={$dir_atual}'\">" . et('Rem') . "</a>\r\n <td bgcolor=\"#FFFFFF\" align=center><a href=\"javascript:rename('{$file}')\">" . et('Ren') . "</a>"; } if (is_readable($dir_atual . $file) && strpos(".wav#.mp3#.mid#.avi#.mov#.mpeg#.mpg#.rm#.iso#.bin#.img#.dll#.psd#.fla#.swf#.class#.ppt#.jpg#.gif#.png#.wmf#.eps#.bmp#.msi#.exe#.com#.rar#.tar#.zip#.bz2#.tbz2#.bz#.tbz#.bzip#.gzip#.gz#.tgz#", $dir_entry["ext"] . "#") === false) { $file_out .= "\r\n <td bgcolor=\"#FFFFFF\" align=center><a href=\"javascript:edit_file('{$file}')\">" . et('Edit') . "</a>"; } if (is_readable($dir_atual . $file) && strlen($dir_entry["ext"]) && strpos(".tar#.zip#.bz2#.tbz2#.bz#.tbz#.bzip#.gzip#.gz#.tgz#", $dir_entry["ext"] . "#") !== false) { $file_out .= "\r\n <td bgcolor=\"#FFFFFF\" align=center><a href=\"javascript:decompress('{$file}')\">" . et('Decompress') . "</a>"; } if ($is_reachable && is_readable($dir_atual . $file) && strpos(".txt#.sys#.bat#.ini#.conf#.swf#.php#.php3#.asp#.html#.htm#.jpg#.gif#.png#.bmp#", $dir_entry["ext"] . "#") !== false) { $file_out .= "\r\n <td bgcolor=\"#FFFFFF\" align=center><a href=\"javascript:view('{$file}');\">" . et('View') . "</a>"; } $file_out .= "</tr>"; } } $out .= $dir_out; if ($entry_count) { $out .= "\r\n <tr>\r\n <td bgcolor=\"#DDDDDD\"><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or1}&dir_atual={$dir_atual}\">" . et('Name') . "</a>\r\n <td bgcolor=\"#DDDDDD\"><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or2}&dir_atual={$dir_atual}\">" . et('Perms') . "</a>"; if ($islinux) { $out .= "<td bgcolor=\"#DDDDDD\"><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or3}&dir_atual={$dir_atual}\">" . et('Owner') . "</a><td bgcolor=\"#DDDDDD\"><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or4}&dir_atual={$dir_atual}\">" . et('Group') . "</a>"; } $out .= "\r\n <td bgcolor=\"#DDDDDD\"><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or5}&dir_atual={$dir_atual}\">" . et('Size') . "</a>\r\n <td bgcolor=\"#DDDDDD\"><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or6}&dir_atual={$dir_atual}\">" . et('Date') . "</a>"; if ($file_count) { $out .= "\r\n <td bgcolor=\"#DDDDDD\"><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or7}&dir_atual={$dir_atual}\">" . et('Type') . "</a>"; } $out .= "\r\n <td bgcolor=\"#DDDDDD\" colspan=20>"; } $out .= $file_out; $out .= "\r\n <tr>\r\n <td bgcolor=\"#DDDDDD\" colspan=20><nobr>\r\n <input type=\"button\" style=\"width:60\" onclick=\"selectANI(this)\" value=\"" . et('SelAll') . "\">\r\n <input type=\"button\" style=\"width:60\" onclick=\"selectANI(this)\" value=\"" . et('SelInverse') . "\">\r\n <input type=\"button\" style=\"width:60\" onclick=\"test(4)\" value=\"" . et('Rem') . "\">\r\n <input type=\"button\" style=\"width:60\" onclick=\"sel_dir(5)\" value=\"" . et('Copy') . "\">\r\n <input type=\"button\" style=\"width:60\" onclick=\"sel_dir(6)\" value=\"" . et('Move') . "\">\r\n <input type=\"button\" style=\"width:100\" onclick=\"test_prompt(71)\" value=\"" . et('Compress') . "\">"; if ($islinux) { $out .= "\r\n <input type=\"button\" style=\"width:100\" onclick=\"resolveIDs()\" value=\"" . et('ResolveIDs') . "\">"; } $out .= "\r\n <input type=\"button\" style=\"width:100\" onclick=\"chmod(9)\" value=\"" . et('Perms') . "\">"; $out .= "\r\n </nobr></td>\r\n </tr>"; $out .= "\r\n </form>"; $out .= "\r\n <tr><td bgcolor=\"#DDDDDD\" colspan=20>{$dir_count} " . et('Dir_s') . " " . et('And') . " {$file_count} " . et('File_s') . " = " . formatsize($total_size) . "</td></tr>"; if ($quota_mb) { $out .= "\r\n <tr><td bgcolor=\"#DDDDDD\" colspan=20>" . et('Partition') . ": " . formatsize($quota_mb * 1024 * 1024) . " " . et('Total') . " - " . formatsize($quota_mb * 1024 * 1024 - total_size($fm_root_atual)) . " " . et('Free') . "</td></tr>"; } else { $out .= "\r\n <tr><td bgcolor=\"#DDDDDD\" colspan=20>" . et('Partition') . ": " . formatsize(disk_total_space($dir_atual)) . " " . et('Total') . " - " . formatsize(disk_free_space($fm_root_atual)) . " " . et('Free') . "</td></tr>"; } $tf = getmicrotime(); $tt = $tf - $ti; $out .= "\r\n <tr><td bgcolor=\"#DDDDDD\" colspan=20>" . et('RenderTime') . ": " . substr($tt, 0, strrpos($tt, ".") + 5) . " " . et('Seconds') . "</td></tr>"; $out .= "\r\n <script language=\"Javascript\" type=\"text/javascript\">\r\n <!--\r\n update_sel_status();\r\n //-->\r\n </script>"; } else { $out .= "\r\n <tr>\r\n <td bgcolor=\"#DDDDDD\" width=\"1%\">{$uplink}<td bgcolor=\"#DDDDDD\" colspan=20><nobr><a href=\"" . $path_info["basename"] . "?frame=3&dir_atual={$dir_atual}\">{$dir_atual}</a></nobr>\r\n <tr><td bgcolor=\"#DDDDDD\" colspan=20>" . et('EmptyDir') . ".</tr>"; } } else { $out .= "<tr><td><font color=red>" . et('IOError') . ".<br>{$dir_atual}</font>"; } $out .= "</table>"; echo $out; }
function ModulePage() { global $PMS, $PIO, $FileIO; if (!adminAuthenticate('check')) { die('[Error] Access Denied.'); } $content = ''; // POST if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') { // 刪除 $del = isset($_POST['del']) ? $_POST['del'] : null; if ($del != null) { $files = $PIO->removePosts($del); $delta_totalsize = 0; if (count($files)) { $delta_totalsize -= $FileIO->deleteImage($files); } if ($delta_totalsize != 0) { total_size($delta_totalsize); } foreach ($del as $n) { if ($oldCaches = glob('./cache/' . $n . '-*')) { foreach ($oldCaches as $o) { @unlink($o); } } } } // 對 host 作 search $filter = isset($_POST['filter']) ? CleanStr($_POST['filter']) : ''; if ($filter != '') { $res = $PIO->searchPost($filter, '`host`', 'AND'); foreach ($res as $p) { $no = $p['no']; $now = $p['now']; $host = $p['host']; $com = htmlspecialchars(str_cut(str_replace('<br />', ' ', $p['com']), 50)); $content .= <<<HERE <tr> \t<td><input type="checkbox" name="del[]" value="{$no}" /></td> \t<td>{$no}</td> \t<td>{$now}</td> \t<td>{$com}</td> \t<td>{$host}</td> </tr> HERE; } // 沒結果 if (count($res) == 0) { $content = '<tr><td rows="5">Not Found</td></tr>'; } } // AJAX 要求在此即停止,一般要求則繼續印出頁面 if (isset($_POST['ajax'])) { echo $content; return; } } // 顯示表單 $dat = ''; head($dat); $dat .= '<div class="bar_admin">搜尋 IP</div> <div id="content"> <form action="' . $this->SELF . '" method="post"> <div id="ipconfig"> Filter: <input type="text" name="filter" size="30" /> <input type="submit" value="搜尋" onclick="return search(this.form);" /><br /> <table border="0" width="100%"> <tr><th>Delete</th><th>No.</th><th>Date</th><th>Comment</th><th>Host</th></tr> ' . $content . ' </table> <input type="submit" value="刪除" /> </div> </form> <hr /> </div> <script type="text/javascript"> // <![CDATA[ function search(form){ var f = form.filter.value; $.post("' . str_replace('&', '&', $this->SELF) . '", {filter: f, ajax: true}, function(d){ $("table", form) // Remove all items except header .find("tr:gt(0)").remove() // Fill the results .end().append(d); }); return false; } // ]]> </script> '; foot($dat); echo $dat; }