Beispiel #1
0
/**
	右侧列表
*/
function king_ajax_brow_right()
{
    global $king;
    $filetype = '';
    $is = '';
    $jsfun = '';
    $path = '';
    $info = inc_brow();
    extract($info);
    $s = "<table cellspacing=\"0\">";
    $s .= "<tr id=\"brow_top\"><th>";
    $s .= "<a href=\"javascript:;\" id=\"a_brow_upfile\" class=\"k_ajax fr\" rel=\"{{$verbs},CMD:'brow_upfile',isopen:1,path:'{$path}',IS:1,ID:'brow_top'}\">";
    $s .= kc_icon('j4') . $king->lang->get('system/common/upfile') . "</a>";
    $s .= "<a href=\"javascript:;\" id=\"a_brow_md\" class=\"k_ajax fr\" rel=\"{{$verbs},CMD:'brow_md',path:'{$path}',isopen:1,IS:1,ID:'brow_top'}\">";
    $s .= kc_icon('h1') . $king->lang->get('system/common/md') . "</a>";
    $s .= "<tt title=\"{$path}\">" . kc_icon('b1') . "/" . kc_short($path, 12, 15) . "</tt>";
    $s .= "</th></tr></table>";
    $s .= "<table cellspacing=\"0\">";
    $s .= "<tr>";
    $s .= $filetype == 0 ? '<th class="line">&nbsp;Image</th>' : '';
    $s .= "<th class=\"l line\">&nbsp;FileName</th><th class=\"line r\">Size&nbsp;</th><th class=\"line r\"></th></tr>";
    $i = 0;
    kc_f_md($path);
    $folders = kc_f_getdir($path, $king->getfext($filetype));
    foreach ($folders as $val) {
        $s .= "<tr class=\"bg" . $i++ % 2 . "\">";
        //插入
        $insert = "onClick=\"\$('#{$id}').val('{$path}{$val}');";
        $insert .= $is ? $jsfun : "\$.kc_close()";
        $insert .= "\" title=\"" . $king->lang->get('system/common/insert') . "\"";
        if ($filetype == 0) {
            //图片
            $s .= "<td><span><a {$insert} href=\"javascript:;\" class=\"img\"><img src=\"../{$path}{$val}\" /></a></span></td>";
            $s .= "<td><a href=\"../{$path}{$val}\" target=\"_blank\" >" . kc_short($val) . "</a></td>";
        } else {
            $s .= "<td {$insert}><label>" . kc_f_kc_icon($val) . kc_short($val) . '</label></td>';
        }
        $s .= '<td class="r">' . kc_f_size(kc_f_filesize($path . $val)) . '</td>';
        $s .= '<td class="r">';
        $s .= "<a href=\"javascript:;\" {$insert}>" . kc_icon('l4') . "</a>";
        //删除文件
        $s .= "<a href=\"javascript:;\" class=\"k_ajax\" rel=\"{{$verbs},CMD:'delete_browfile',path:'{$path}',file:'{$val}',IS:1}\">" . kc_icon('j2', $king->lang->get('system/common/delete')) . "</a>";
        /*
        */
        $s .= '</td></tr>';
    }
    $s .= '</table>';
    $js = "\$('#browleft>p>a>em').removeClass('sel');\$('#k_brow_sub_" . _path2id(substr($path, 0, -1)) . "').addClass('sel')";
    kc_ajax('', $s, '', $js);
}
Beispiel #2
0
/**
	删除文件或文件夹
*/
function king_ajax_delete()
{
    global $king;
    $king->access('webftp_delete');
    $isdir = kc_post('isdir', 2, 1);
    $path = kc_post('path');
    $file = kc_post('file', 0, 1);
    if ($isdir) {
        kc_f_rd($path . $file);
    } else {
        kc_f_delete($path . $file);
    }
    $js = "\$('#k_brow_right_" . _path2id($path . $file) . "').remove();";
    //删除右侧内容
    $js .= "\$('#k_brow_obj_" . _path2id($path . $file) . "').remove();";
    //同步删除左侧显示内容
    $cachepath = "system/filemanage/{$path}index";
    $king->cache->del($cachepath);
    //清理缓存
    kc_ajax('', kc_icon('a1'), '', $js);
}