Exemplo n.º 1
0
function king_view()
{
    global $king;
    $king->access('portal_comment');
    $cid = kc_get('cid', 2);
    $sql = "cid,kcontent,username,nip,ndate";
    if (empty($cid)) {
        kc_error($king->lang->get('system/error/param'));
    } else {
        if (!($rs = $king->db->getRows_one("select {$sql} from %s_comment where cid={$cid}"))) {
            kc_error($king->lang->get('system/error/notrecord'));
        }
        foreach ($rs as &$r) {
            $r = htmlspecialchars($r);
        }
        $rs['kcontent'] = nl2br($rs['kcontent']);
        $s = $king->openForm($king->lang->get('portal/title/comment'), '', 'comment_view');
        $s .= $king->htmForm($king->lang->get('portal/label/author'), $rs['username']);
        $s .= $king->htmForm($king->lang->get('portal/label/content'), $rs['kcontent']);
        $s .= $king->htmForm($king->lang->get('portal/label/date'), kc_formatdate($rs['ndate']));
        $but = '<input type="button" onclick="javascript:history.back(-1)" value="' . $king->lang->get('system/common/back') . '[B]" class="big" accesskey="b"/>';
        $s .= $king->htmForm(null, $but);
        $s .= $king->closeForm('none');
    }
    list($left, $right) = inc_menu();
    $king->skin->output($king->lang->get('portal/title/comment'), $left, $right, $s);
}
Exemplo n.º 2
0
function kc_grab_get($imgpath)
{
    global $king;
    if ($img = file_get_contents($imgpath)) {
        $fext = kc_f_ext($imgpath);
        //扩展名
        $date = kc_formatdate(time(), 'Y-m-d h:i');
        list($msec, $sec) = explode(' ', microtime());
        $path = $king->config('uppath') . '/image/' . kc_formatdate(time(), 'Y/m/d/h/i') . '/' . kc_random(3) . round($msec * 1000000.0) . '.' . $fext;
        if (kc_f_put_contents($path, $img)) {
            //写文件成功
            return $path;
        } else {
            return $imgpath;
        }
    } else {
        return False;
    }
}
Exemplo n.º 3
0
 /**
 	格式化字符串
 
 	@param string $s    : 字符模板
 	@paran string $attrib : 字符串属性,应该是size="20"这种类型的,具体做的时候还得进行输出判断,attrib可能的取值如下
 		width,height : 如果有这两个或一个属性,则对$str进行文件判断,如果是则进行相关图片处理操作
 		replace      : 字符串替换,replace="A|B",A替换为B
 		size         : 字符长度设置
 		code         : 字符转换js/html
 		none         : 空值替换属性
 */
 private function str_format($s, $attrib)
 {
     if (empty($attrib)) {
         return $s;
     }
     //如果是空值,则直接返回s值
     //转换
     if (array_key_exists('formatstr', $attrib)) {
         $code = $attrib['formatstr'];
         if (isset($code[0])) {
             switch (strtolower($code)) {
                 case 'javascript':
                     $s = str_replace(array('\'', "\n", chr(13)), array('\\\'', '\\n', ''), $s);
                     break;
                 case 'urlencode':
                     $s = urlencode($s);
                     break;
                 case 'addslashes':
                     $s = addslashes($s);
                     break;
                 case 'md5':
                     $s = md5($s);
                     break;
             }
         }
     }
     //应用函数
     if (array_key_exists('fun', $attrib)) {
         $fun = $attrib['fun'];
         $funs = explode(',', $fun);
         $array = array(1 => $s);
         foreach ($funs as $fun) {
             if (function_exists($fun)) {
                 //如果有指定的函数,则应用
                 $array1 = array_map($fun, $array);
             }
         }
         $s = $array1[1];
     }
     //替换
     if (array_key_exists('replace', $attrib)) {
         $replace = $attrib['replace'];
         if (is_array($replace)) {
             foreach ($replace as $key => $val) {
                 $s = str_replace($key, $val, $s);
             }
         }
         /*
         		if(isset($replace{0})){
         			list($find,$new)=kc_explode('|',$replace,2);
         			$s=str_replace($find,$new,$s);
         		}
         */
     }
     //长度
     if (array_key_exists('size', $attrib)) {
         $size = $attrib['size'];
         if ($size) {
             if (kc_validate($size, 2)) {
                 $s = kc_substr($s, 0, $size);
             }
         }
     }
     //日期格式化
     if (array_key_exists('formatdate', $attrib)) {
         $format = $attrib['formatdate'];
         if (kc_validate($s, 2)) {
             //默认的时间是int类型的
             $s = kc_formatdate($s, $format);
         } elseif (kc_validate($s, 9)) {
             //日期类型 2008-11-9这种格式
             list($yy, $mm, $dd) = explode('-', $s);
             $s = kc_formatdate(gmmktime(0, 0, 0, $mm, $dd, $yy), $format);
             //需要转换一下字符
         }
     }
     //数字格式化
     if (array_key_exists('formatnumber', $attrib)) {
         if (kc_validate($attrib['formatnumber'], 2)) {
             $s = number_format($s, $attrib['formatnumber']);
         }
     }
     //缩略图
     if (array_key_exists('width', $attrib) || array_key_exists('height', $attrib)) {
         if (array_key_exists('width', $attrib)) {
             $width = $attrib['width'];
         }
         if (array_key_exists('height', $attrib)) {
             $height = $attrib['height'];
         }
         if (($width || $height) && isset($s[0])) {
             $s = kc_image($s, $attrib);
         }
     }
     //默认填充
     if (array_key_exists('none', $attrib)) {
         $none = $attrib['none'];
         if (!isset($s[0])) {
             $s = $none;
         }
     }
     //前面插入
     if (array_key_exists('before', $attrib)) {
         $before = $attrib['before'];
         if (isset($before[0]) && isset($s[0])) {
             $s = $before . $s;
         }
     }
     //后面插入,条件是$s不能为空
     if (array_key_exists('after', $attrib)) {
         $after = $attrib['after'];
         if (isset($after[0]) && isset($s[0])) {
             $s .= $after;
         }
     }
     return $s;
 }
Exemplo n.º 4
0
function king_def()
{
    global $king, $action;
    $king->access("portal_orders");
    switch ($action) {
        case '':
            $time = time() - 86400 * 30;
            //最近一个月
            $where = "ndate>{$time}";
            break;
        case 'paid':
            $where = "nstatus=3";
            break;
        case 'all':
            $where = "";
            break;
    }
    $sql_where = isset($where[0]) ? " where {$where}" : '';
    $_sql = "select oid,ono,nstatus,kname,userid,nnumber,nip,ndate,paymethod,buyer_id,ntotal,nexpress from %s_orders {$sql_where} order by oid desc";
    if (!($res = $king->db->getRows($_sql, 1))) {
        $res = array();
    }
    //准备开始列表
    $_cmd = array('delete' => $king->lang->get('system/common/del'));
    $manage = "'<a href=\"javascript:;\" class=\"k_ajax\" rel=\"{CMD:\\'express\\',oid:'+K[0]+',METHOD:\\'GET\\'}\">'+\$.kc_icon('j6','" . $king->lang->get('portal/express/pub') . "')+'</a>'";
    $manage .= "+'<a href=\"manage.orders.php?action=edt&oid='+K[0]+'\">'+\$.kc_icon('p4','" . $king->lang->get('system/common/edit') . "')+'</a>'";
    $manage .= "+'<a href=\"javascript:;\" class=\"k_ajax\" rel=\"{CMD:\\'delete\\',list:'+K[0]+'}\">'+\$.kc_icon('p3','" . $king->lang->get('system/common/del') . "')+'</a>'";
    $_js = array("\$.kc_list(K[0],K[1],'manage.orders.php?action=edt&oid='+K[0])", $manage, "'<i class=\"c'+K[2]+'\">'+orders_status[K[2]]+'</i>'", "'<i>'+K[3]+'</i>'", "'<i>'+K[4]+'</i>'", "K[5]", "'<b>'+K[7]+'</b>'", "'<b>'+K[8]+'</b>'", "'<b>'+K[9]+'</b>'", "K[6]");
    $s = $king->openList($_cmd, '', $_js, $king->db->pagelist('manage.orders.php?pid=PID&rn=RN', $king->db->getRows_number('%s_orders', $where)));
    $status = array();
    for ($i = 1; $i <= 11; $i++) {
        $status[$i] = $king->lang->get("portal/orders/status/s{$i}");
    }
    $s .= kc_js2array('orders_status', $status);
    $s .= "ll('" . $king->lang->get('portal/orders/no') . "','manage','<i>" . $king->lang->get('portal/orders/statu') . "</i>','" . $king->lang->get('portal/orders/name') . "','<i>" . $king->lang->get('portal/orders/number') . "</i>','" . $king->lang->get('portal/orders/paymethod') . "','<b>" . $king->lang->get('portal/orders/prod') . "</b>','<b>" . $king->lang->get('portal/orders/express') . "</b>','<b>" . $king->lang->get('portal/orders/total') . "</b>','" . $king->lang->get('portal/orders/date') . "',1);";
    foreach ($res as $rs) {
        //td
        $s .= 'll(' . $rs['oid'] . ',\'' . $rs['ono'] . '\',\'' . $rs['nstatus'] . '\',\'' . $rs['kname'] . '\',' . $rs['nnumber'] . ',\'' . ($rs['paymethod'] ? $king->lang->get('portal/orders/method/' . $rs['paymethod']) : '--') . '\',\'' . kc_formatdate($rs['ndate']) . '\',\'' . number_format($rs['ntotal'], 2) . '\',\'' . number_format($rs['nexpress'], 2) . '\',\'' . number_format($rs['ntotal'] + $rs['nexpress'], 2) . '\',0);';
    }
    //结束列表
    $s .= $king->closeList();
    $left = array('' => array('href' => 'manage.orders.php', 'ico' => 'q5', 'title' => $king->lang->get('portal/title/ordersdef')), 'paid' => array('href' => 'manage.orders.php?action=paid', 'ico' => 'q6', 'title' => $king->lang->get('portal/title/orderspaid')), 'all' => array('href' => 'manage.orders.php?action=all', 'ico' => 'q4', 'title' => $king->lang->get('portal/title/ordersall')));
    $right = array(array('href' => 'manage.express.php', 'title' => $king->lang->get('portal/title/express'), 'ico' => 'j6'), array('href' => 'manage.php', 'title' => $king->lang->get('portal/title/list'), 'ico' => 'a1'));
    $king->skin->output($king->lang->get('portal/title/orders'), $left, $right, $s);
}
Exemplo n.º 5
0
function king_event()
{
    global $king;
    $king->access('#event');
    $s = '';
    $_sql = 'select kid,kfile,nline,ntype,kmsg,kurl,ndate from %s_event order by kid desc';
    if (!($_res = $king->db->getRows($_sql, 1))) {
        $_res = array();
    }
    //准备开始列表
    $_cmd = array('delete_event' => $king->lang->get('system/common/del'), 'clear_event' => $king->lang->get('system/common/clear'));
    /*
    id      ID
    tit     标题
    link    链接
    is      是否显示id
    isgray  是否灰度
    ico     图标
    space   缩进
    listico 列表页专用的前置ico
    		"$.kc_list(K[0],K[1],'../'+K[2]+'/manage.php',0,1,islock(K[5]))",//'<a href=\"manage.php?action=admin_edt&adminid='+K[0]+'\">'+K[1]+'</a>'
    */
    $_js = array("\$.kc_list(K[0],K[1]+'- Line: <strong>'+K[2]+'</strong>',0,0,1,'g9')", "'<i>'+K[3]+'</i>'", "'<a href=\"javascript:;\" class=\"k_ajax\" rel=\"{CMD:\\'view_event\\',kid:'+K[0]+'}\">'+K[4]+'</a>'", "K[6]", "K[5]");
    $s = $king->openList($_cmd, '', $_js, $king->db->pagelist('manage.php?action=event&pid=PID&rn=RN', $king->db->getRows_number('%s_event')));
    //'select count(*) from %s_event;'
    $s .= 'll(\'' . $king->lang->get('system/event/file') . '\',\'<i>' . $king->lang->get('system/event/type') . '</i>\',\'' . $king->lang->get('system/event/msg') . '\',\'' . $king->lang->get('system/event/url') . '\',\'' . $king->lang->get('system/common/date') . '\',1);';
    //th
    foreach ($_res as $_rs) {
        //td
        $s .= 'll(' . $_rs['kid'] . ',\'' . addslashes($_rs['kfile']) . '\',' . $_rs['nline'] . ',' . $_rs['ntype'] . ',\'' . addslashes(kc_short($_rs['kmsg'], 70, 20)) . '\',\'' . kc_formatdate($_rs['ndate']) . '\',\'' . $_rs['kurl'] . '\',0);';
    }
    //结束列表
    $s .= $king->closeList();
    $king->skin->output($king->lang->get('system/title/event'), '', '', $s);
}
Exemplo n.º 6
0
function king_ajax_orders()
{
    global $king;
    //显示物流方式选择页,并显示对应的物流费用
    //订单insert到数据库,并返回订单号。以便客户查询订单,也为邮政付款的用户提供收据上传功能
    //清空购物记录
    $king->Load('user');
    $tip = ($user = $king->user->checkLogin()) ? '' : '<a href="javascript:;" class="k_user_login">' . $king->lang->get('portal/user/nologin') . '</a> <a href="javascript:;" class="k_user_register">' . $king->lang->get('portal/user/regshop') . '</a>';
    $array_sql = array('usermail', 'realname', 'useraddress', 'userpost', 'usertel', 'kfeedback');
    if ($GLOBALS['ismethod']) {
        $data = $_POST;
    } else {
        $data = array();
        if (is_array($user)) {
            //用户已登录
            foreach ($array_sql as $val) {
                $data[$val] = kc_val($user, $val);
            }
        }
    }
    $data = kc_data($array_sql, $data);
    //kconsignee
    $array = array(array('realname', 0, 2, 30));
    $s = $king->htmForm($king->lang->get('portal/orders/realname'), kc_htm_input('realname', $data['realname'], 30, 100), $array, null, $tip);
    //ktel
    $array = array(array('usertel', 0, 6, 30));
    $s .= $king->htmForm($king->lang->get('portal/orders/tel'), kc_htm_input('usertel', $data['usertel'], 30, 200), $array);
    //kmail
    $array = array(array('usermail', 0, 6, 32), array('usermail', 5));
    $s .= $king->htmForm($king->lang->get('portal/orders/mail'), kc_htm_input('usermail', $data['usermail'], 32, 200), $array);
    //kaddress
    $array = array(array('useraddress', 0, 5, 250));
    $s .= $king->htmForm($king->lang->get('portal/orders/address'), '<textarea cols="10" id="useraddress" name="useraddress" rows="3" class="k_in w400">' . htmlspecialchars($data['useraddress']) . '</textarea>', $array);
    //kpost
    $array = array(array('userpost', 0, 6, 6), array('userpost', 2));
    $s .= $king->htmForm($king->lang->get('portal/orders/post'), kc_htm_input('userpost', $data['userpost'], 6, 50), $array);
    //kfeedback
    $array = array(array('kfeedback', 0, 0, 255));
    $s .= $king->htmForm($king->lang->get('portal/orders/feedback'), '<textarea cols="10" rows="4" name="kfeedback" id="kfeedback" class="k_in w400">' . htmlspecialchars($data['kfeedback']) . '</textarea>', $array);
    if ($GLOBALS['ischeck']) {
        $cart = kc_cookie('KingCMS_Cart');
        $eid = kc_post('eid');
        if (!($cart && isset($eid))) {
            kc_error($king->lang->get('system/error/param'));
        }
        $weight = 0;
        $total = 0;
        $nnum = 0;
        $cart_array = unserialize($cart);
        //要过滤掉的内容
        $array_black = str_split('<>\'"%');
        foreach ($cart_array as $key => $number) {
            list($listid, $kid) = explode('-', $key);
            $ID = $king->portal->infoID($listid, $kid);
            if ($total === 0) {
                //第一次运算
                $mch_name = kc_substr(str_replace($array_black, '', $ID['ktitle']), 0, 16);
            }
            $weight += $number * $ID['nweight'];
            $total += $number * $ID['nprice'];
            $nnum += $number;
        }
        $nexpress = 0;
        //运费
        if ($weight !== 0) {
            $express = $king->portal->getExpress();
            $nexpress = $express[$eid]['nsprice'] + $express[$eid]['niprice'] * ceil($weight > 500 ? $weight / 500 - 1 : 0);
        }
        $ono = kc_formatdate(time(), 'Ymd') . sprintf("%08.0d", $king->db->neworder('%s_orders', '', 'oid'));
        $array = array('kname' => $mch_name, 'userid' => is_array($user) ? $user['userid'] : 0, 'kcontent' => $cart, 'ndate' => time(), 'nip' => kc_getip(), 'eid' => $eid, 'ntotal' => round($total, 2), 'ono' => $ono, 'nnumber' => $nnum, 'kfeedback' => $data['kfeedback'], 'nweight' => $weight, 'nexpress' => $nexpress);
        foreach ($array_sql as $val) {
            $array[$val] = kc_val($data, $val);
        }
        $oid = $king->db->insert('%s_orders', $array);
        setcookie('KingCMS_Cart', '', -86400000, $king->config('inst'));
        $js = "\$.kc_ajax('{URL:\\'" . $king->config('inst') . "portal/cart.php\\',CMD:\\'payment\\',IS:1,oid:{$oid}}')";
        kc_ajax('', '', '', $js);
    }
    $but = kc_htm_a($king->lang->get('portal/cart/backcart'), "{URL:'" . $king->config('inst') . "portal/cart.php',CMD:'buy',IS:1}");
    $but .= kc_htm_a($king->lang->get('portal/cart/suborders'), "{URL:'" . $king->config('inst') . "portal/cart.php',CMD:'orders',eid:" . kc_post('eid') . ",IS:1}");
    kc_ajax($king->lang->get('portal/cart/suborders'), $s, $but, '', 600, 350 + $GLOBALS['check_num'] * 15);
}
Exemplo n.º 7
0
 /**
 	读取文件缓存信息
 	@param string $path  路径
 	@return string
 */
 public function info($path)
 {
     global $king;
     $s = '<table class="k_cache"><tr><td class="l">' . kc_icon('n1') . ' ' . $king->lang->get('system/time/cache') . ': ';
     $filename = ROOT . PATH_CACHE . '/' . $path . $this->ext;
     $filemtime = is_file($filename) ? filemtime($filename) : 0;
     $s .= kc_formatdate($filemtime);
     $s .= ' -&gt; (' . kc_formattime(time() - $filemtime);
     $s .= ')</td><td class="c w100"><a class="k_ajax" rel="{URL:\'../system/manage.php\',CMD:\'close_cachetip\'}">';
     $s .= $king->lang->get('system/time/cacheclose');
     $s .= '</a></td></tr></table>';
     return $s;
 }
Exemplo n.º 8
0
 /**
 	对king:portal.comment的解析
 	Code By: CiBill
 	@param
 	@return
 */
 private function tag_comment($inner, $attrib)
 {
     global $king;
     //读取数量
     $number = kc_val($attrib, 'number', 30);
     $number = kc_validate($number, 2) ? $number : 30;
     //跳过条数
     $skip = kc_val($attrib, 'skip', 0);
     $skip = kc_validate($skip, 2) ? $skip : 0;
     //查询条件
     $whereArray = array();
     $modelid = kc_val($attrib, 'modelid');
     //modelid
     if (!kc_validate($modelid, 2)) {
         //如果没有modelid传入,则通过listid获取modelid
         $listid = kc_val($attrib, 'listid');
         //listid
         if (kc_validate($listid, 2)) {
             //listid为数字时,读取单个modelid
             if ($list = $king->portal->infoList($listid)) {
                 $modelid = $list['modelid'];
                 $whereArray[] = "modelid={$modelid}";
             } else {
                 return false;
             }
         } elseif (kc_validate($listid, 3)) {
             $listid = explode(',', $listid);
             $modelid = array();
             foreach ($listid as $val) {
                 if ($list = $king->portal->infoList($val)) {
                     $modelid[] = $list['modelid'];
                 }
             }
             if ($modelid) {
                 $modelid = implode(',', $modelid);
                 $whereArray[] = "modelid in ({$modelid})";
             } else {
                 return false;
             }
         }
     }
     $kid = kc_val($attrib, 'kid');
     //文章id
     if (kc_validate($kid, 2)) {
         $whereArray[] = "kid={$kid}";
     } elseif (kc_validate($kid, 3)) {
         $whereArray[] = "kid in ({$kid})";
     }
     $orderby = isset($attrib['orderby']) ? ' ORDER BY ' . $attrib['orderby'] : ' ORDER BY cid desc';
     $where = $whereArray ? 'where ' . implode(' and ', $whereArray) : '';
     $limit = 'limit ' . $skip . ',' . $number;
     $tmp = new KC_Template_class();
     /*if($skip==0 && $number==30 && kc_validate($kid,2) && kc_validate($modelid,2)){
     		$comment=$king->portal->infoComment($modelid,$kid);
     		if(!$comment)return false;
     	}else*/
     if (!($comment = $king->db->getRows("select * from %s_comment {$where} {$orderby} {$limit}"))) {
         return false;
     }
     $s = '';
     foreach ($comment as $rs) {
         $tmp->assign('id', $rs['cid']);
         $tmp->assign('kid', $rs['kid']);
         $tmp->assign('modelid', $rs['modelid']);
         $tmp->assign('username', $rs['username']);
         $content = $rs['kcontent'];
         if (substr($content, 0, 7) == '[quote]') {
             $rid = intval(substr($content, 7, 10));
             if ($r = $king->db->getRows_One("select * from %s_comment where cid={$rid}")) {
                 $r['kcontent'] = preg_replace("/\\[quote].*\\[\\/quote]/siU", '', $r['kcontent']);
                 $ypost = "Originally posted by <i><b>" . ($r['username'] != '' ? $r['username'] : '******') . "</b></i> at " . kc_formatdate($r['ndate'], 'Y-m-d') . ":<br>";
                 $include = "<table border=0 width='100%' cellspacing=1 cellpadding=10 bgcolor='#cccccc'><tr><td width='100%' bgcolor='#FFFFFF' style='word-break:break-all'>" . $ypost . $r['kcontent'] . "</td></tr></table>";
                 $content = str_replace("[quote]" . $rid . "[/quote]", $include, $content);
             }
         }
         $tmp->assign('content', $content);
         $tmp->assign('ip', long2ip($rs['nip']));
         $tmp->assign('date', $rs['ndate']);
         $s .= $tmp->output($inner);
     }
     return $s;
 }
Exemplo n.º 9
0
function king_view()
{
    global $king;
    $king->access('feedback');
    $kid = kc_get('kid', 2);
    $sql = "kid,ktitle,kname,kemail,kqq,kphone,kcontent,ndate";
    if (!($res = $king->db->getRows("select {$sql} from %s_feedback where kid={$kid}"))) {
        $res = array();
    }
    if (empty($kid)) {
        kc_error($king->lang->get('system/error/param'));
    } else {
        if (!($rs = $king->db->getRows_one("select {$sql} from %s_feedback where kid={$kid} order by norder asc"))) {
            kc_error($king->lang->get('system/error/notrecord'));
        }
        foreach ($rs as &$r) {
            $r = htmlspecialchars($r);
        }
        $rs['kcontent'] = nl2br($rs['kcontent']);
        $s = $king->openForm($king->lang->get('feedback/name'), '', 'feedback_edt');
        $s .= $king->htmForm($king->lang->get('feedback/label/title'), $rs['ktitle']);
        $s .= $king->htmForm($king->lang->get('feedback/label/name'), $rs['kname']);
        $s .= $king->htmForm($king->lang->get('feedback/label/email'), '<a href="mailto:' . $rs['kemail'] . '" title="' . $king->lang->get('feedback/list/sendmail') . $rs['kname'] . '">' . $rs['kemail'] . '</a>');
        $s .= $king->htmForm($king->lang->get('feedback/label/qq'), $rs['kqq']);
        $s .= $king->htmForm($king->lang->get('feedback/label/phone'), $rs['kphone']);
        $s .= $king->htmForm($king->lang->get('feedback/label/content'), $rs['kcontent']);
        $s .= $king->htmForm($king->lang->get('feedback/label/date'), kc_formatdate($rs['ndate']));
        $but = '<input type="button" onclick="javascript:history.back(-1)" value="' . $king->lang->get('system/common/back') . '[B]" class="big" accesskey="b"/>';
        $s .= $king->htmForm(null, $but);
        $s .= $king->closeForm('none');
    }
    //设置为已读状态
    $king->db->update('%s_feedback', array('nread' => 1), 'kid=' . $kid);
    list($left, $right) = inc_menu();
    $king->skin->output($king->lang->get('feedback/title/center'), $left, $right, $s);
}
Exemplo n.º 10
0
/**
	重命名文件或文件夹
*/
function king_ajax_rename()
{
    global $king;
    $king->access('webftp_rename');
    $isdir = kc_post('isdir', 2, 1);
    $path = kc_post('path');
    $file = kc_post('file', 0, 1);
    $id = kc_post('id');
    $new = kc_post($id);
    if (!kc_validate($new, '/^[A-Za-z0-9\\.\\_]+$/')) {
        kc_ajax('', kc_icon('a1'), '', "alert('" . $king->lang->get('webftp/error/newname') . "')");
    }
    kc_f_rename($path . $file, $path . $new);
    $s = "<a rel=\"{CMD:'right',path:'{$path}{$new}/',ID:'ftp_root',leftopen:1,IS:2}\" class=\"k_ajax\" href=\"javascript:;\">{$new}</a>";
    $js = '';
    $oldID = 'k_brow_right_' . _path2id($path . $file);
    $newID = 'k_brow_right_' . _path2id($path . $new);
    if ($isdir) {
        //目录
        //在原有的项目下面添加一个新的,并在下面中删除掉老的
        $js .= "\$('#{$oldID}').after(iii('b1','{$path}','{$new}','--','" . kc_formatdate(kc_f_mtime($path . $new)) . "'));";
    } else {
        $js .= "\$('#{$oldID}').after(iii('" . kc_f_ico($new) . "','{$path}','{$new}','" . kc_f_size(kc_f_filesize($path . $new)) . "','" . kc_formatdate(kc_f_mtime($path . $new)) . "'));";
    }
    $js .= "\$.kc_ready('#{$newID}');";
    $js .= "\$('#{$oldID}').remove();";
    $cachepath = "system/filemanage/{$path}index";
    $king->cache->del($cachepath);
    //清理缓存
    $js .= "\$.kc_close();";
    kc_ajax('', '', '', $js);
}