Esempio n. 1
0
function king_ajax_read()
{
    global $king;
    $king->access('feedback_edt');
    $kid = kc_get('list', 2, 1);
    $value = kc_get('value', 2, 1);
    $king->db->query("update %s_feedback set nread={$value} where kid={$kid};");
    $value ? $ico = 'n2' : ($ico = 'n1');
    kc_ajax('', kc_icon($ico, $value ? $king->lang->get('feedback/list/unread') : $king->lang->get('feedback/list/read')), 0, "\$('#nread_{$kid}').attr('rel','{CMD:\\'read\\',value:" . (1 - $value) . ",ID:\\'nread_{$kid}\\',list:\\'{$kid}\\',IS:2}')");
}
Esempio n. 2
0
function king_ajax_commend()
{
    global $king;
    $king->access('portal_tag_edt');
    $kid = kc_get('kid', 2, 1);
    $is = kc_get('is', 2, 1);
    $ico = $is ? 'n1' : 'n2';
    $king->db->update('%s_tag', array('iscommend' => $is), "kid={$kid}");
    kc_ajax('', kc_icon($ico), '', "\$('#commend_{$kid}').attr('rel','{CMD:\\'commend\\',ID:\\'commend_{$kid}\\',is:" . (1 - $is) . ",kid:{$kid},IS:2}')");
    //{CMD:\commend\',is:'+is+',ID:\'commend_'+id+'\',kid:'+id+',IS:2}
}
Esempio n. 3
0
/**
	调用文件浏览器的图片按钮
	@param string $id         获得返回值的表单ID
	@param string $path       起始打开的目录地址,相对于安装目录,如果有$file值,则
	@param string $filetype   可上传的文件类型 默认0:图片类型,1:文件类型,2:模板类型
	@param bool   $is         插入方式
		0: 选择插入后关闭文件浏览器
		1: 选择插入后不关闭文件浏览器,并继续点击的时候追加插入,用在多列表模式
	@param string $jsfun      插入结束后调用执行的javascript函数
	@param string $file       如果有文件,则显示文件
	@return string
*/
function kc_f_brow($id, $path, $filetype = 0, $is = 0, $jsfun = '', $file = '')
{
    global $king;
    $s = '';
    //模板类型的时候,增加一个快速插入
    if ($filetype == 2 && is_dir(ROOT . $path)) {
        if ($array = kc_f_getdir($path, $king->config('templateext'))) {
            $array_setvalue = array();
            foreach ($array as $val) {
                $array_setvalue[$path . '/' . $val] = $val;
            }
            $s = kc_htm_setvalue($id, $array_setvalue);
        }
    }
    if (substr($path, -1) != '/') {
        //老版本的没有写/来区分文件和目录,所以设置自动补充
        $path .= '/';
    }
    $s .= "<a href=\"javascript:;\" class=\"k_ajax\" ";
    $s .= "rel=\"{URL:'../system/manage.php',CMD:'brow',id:'{$id}',path_def:'{$path}',jsfun:'{$jsfun}',is:{$is},filetype:{$filetype},VAL:'{$id}'}\">";
    $s .= kc_icon('a9', $king->lang->get('system/common/browserver')) . "</a>";
    /*
    	if($is){
    		$s.='<a class="k_ajax" rel="{URL:\'../system/manage.php\',CMD:\'brow\',id:\''.$id.'\',path:\''.urlencode($path).'\',jsfun:\''.urlencode($jsfun).'\',is:1,filetype:\''.$filetype.'\',path_def:\''.$path.'\'}">'.kc_icon('a9',$king->lang->get('system/common/browserver')).'</a>';
    	}else{
    		$s.='<a class="k_ajax" rel="{URL:\'../system/manage.php\',CMD:\'brow\',id:\''.$id.'\',path:($(\'#'.$id.'\').val()==\'\'?\''.$path.'\':$(\'#'.$id.'\').val()),is:0,jsfun:\''.urlencode($jsfun).'\',filetype:\''.$filetype.'\',path_def:\''.$path.'\'}">'.kc_icon('a9',$king->lang->get('system/common/browserver')).'</a>';
    	}
    */
    return $s;
}
Esempio n. 4
0
/**
手工指定相关文章
*/
function king_ajax_hrelate()
{
    global $king;
    $king->access('portal_content_edt');
    $s = '';
    $info = $king->portal->infoList();
    $model = $king->portal->infoModel($info['modelid']);
    $kquery = kc_post('kquery');
    if (isset($kquery[0])) {
        //如果kquery有值,则读取数据库
        $insql = kc_likey($kquery, 'ktitle');
        if (isset($insql[0])) {
            $insql = ' and ' . $insql;
        } else {
            $insql = ' and isshow=2 ';
        }
        $krelate = kc_get('krelate', 3);
        if (isset($krelate[0])) {
            //如果已经有关键字,则不让在搜索列表里显示
            $insql .= " and kid not in ({$krelate})";
        }
        $kid = kc_get('kid');
        if (isset($kid[0])) {
            $insql .= " and kid<>{$kid}";
        }
        $sql = "select kid,ktitle,kpath from %s__{$model['modeltable']} where nshow=1 {$insql} limit 20;";
        $s = '<div id="kqueryshow" class="k_in w400">';
        if ($res = $king->db->getRows($sql)) {
            foreach ($res as $rs) {
                $id = isset($krelate[0]) ? $krelate . ',' . $rs['kid'] : $rs['kid'];
                $s .= "<p>" . kc_icon('c5') . "<a href=\"javascript:;\" onclick=\"\$('#krelate').val('{$id}');krelateshow();\$.kc_ajax('{CMD:\\'hrelate\\',VAL:\\'krelate,listid,kid,kquery\\',IS:1}')\">" . htmlspecialchars($rs['ktitle']) . '</a></p>';
            }
            //$kc_ajax(\'manage.content.php?action=ajax\',\'k_ajax\',\'cmd=hrelate&\'+kc_getvalue(\'krelate,listid,kid,kquery\'),1)"
        } else {
            $s .= '<p>' . $king->lang->get('system/error/notre') . '</p>';
        }
        $s .= '</div>';
    }
    //$.kc_ajax(\'manage.content.php?action=ajax\',\'k_ajax\',\'cmd=hrelate&\'+kc_getvalue(\'krelate,listid,kid,kquery\'),1)
    $content = '<input value="' . htmlspecialchars($kquery) . '" id="kquery" type="text" class="k_in w350"/><a href="javascript:;" class="k_ajax" rel="{CMD:\'hrelate\',VAL:\'krelate,listid,kid,kquery\',IS:1}">' . kc_icon('m1') . '</a>' . $s;
    $s = $king->htmForm($king->lang->get('portal/label/find'), $content);
    kc_ajax($king->lang->get('portal/title/relate'), $s, 0, '', 435, 360);
}
Esempio n. 5
0
 /**
 列表 - 开始
 @param array $_cmd     命令列表
 	array(
 		$key=>$value,
 		'delete'=>'删除',
 		'-',
 		'create'=>'生成',
 	)
 @param array $right    右键菜单
 	array(
 		
 	);
 @param array $_js      构造javascript函数function ll()
 	array(
 	$value,
 	每个值对应的是一个HTML标签:<td>$value</td>
 	)
 @param string $_plist  分页HTML代码
 @param array  $_val    预设的隐藏域 及值
 @return string
 */
 public function openList($_cmd = null, $right = array(), $_js = null, $_plist = null, $_ext = array())
 {
     $i = 0;
     $fly = '';
     $s = '<form id="k_form_list" name="k_form_list">' . kc_htm_hidden($_ext) . '<script type="text/javascript">var REQUEST_URL=\'' . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'] . '\';';
     $s .= 'function kc_button(){var I1=\'';
     $s .= '<table cellspacing="0" class="k_button"><tr><td><div class="k_submit">';
     if (is_array($_cmd)) {
         $s_but = '<span class="select"><a href="javascript:;" class="k_aselect" >' . addslashes($this->lang->get('system/common/aselect')) . '</a>/';
         //onClick="kc_aselect()"
         $s_but .= '<a href="javascript:;" class="k_rselect">' . addslashes($this->lang->get('system/common/rselect')) . '</a></span>';
         $but = '';
         $cmd = "<a href=\"javascript:;\" class=\"k_cmd\">" . $this->lang->get('system/common/morecmd') . "</a>";
         $fly = '<ul id="k_cmd_Fly" style="display:none;">';
         $is = False;
         foreach ($_cmd as $key => $val) {
             if (kc_validate($key, 2)) {
                 if ($val == '-') {
                     $is = True;
                 } else {
                     $fly .= '<li class="hr2">' . $val . '</li>';
                 }
             } else {
                 $fly .= '<li' . ($is ? ' class="hr1"' : '') . '><a href="javascript:;" class="k_ajax" rel="{CMD:\'' . $key . '\',FORM:\'k_form_list\'}">' . $val . '</a></li>';
                 $is = 0;
                 if ($key == 'create') {
                     //有create的时候,设置but
                     $but .= '<a href="javascript:;" class="button k_ajax" rel="{CMD:\\\'' . $key . '\\\',FORM:\\\'k_form_list\\\'}">' . addslashes($this->lang->get('system/common/create')) . '</a>';
                 }
                 if ($key == 'delete' || substr($key, 0, 7) == 'delete_') {
                     //有delete的时候,设置but
                     $but .= '<a href="javascript:;" class="button k_ajax" rel="{CMD:\\\'' . $key . '\\\',FORM:\\\'k_form_list\\\'}">' . addslashes($this->lang->get('system/common/del')) . '</a>';
                 }
             }
         }
         $fly .= '</ul>';
         $s .= $s_but . $but . (count($_cmd) == 1 && isset($but[0]) ? '' : $cmd);
     }
     if (is_array($right)) {
         $fly .= "<div id=\"k_list_right_Fly\" class=\"none\" onClick=\"\$(this).fadeOut(300)\">";
         foreach ($right as $key => $val) {
             if ($val == '-') {
                 $fly .= '<i></i>';
             } else {
                 if (is_array($val)) {
                     $ico = kc_val($val, 'ico');
                     $href = kc_val($val, 'href');
                 } else {
                     $ico = '';
                     $href = $val;
                 }
                 if (substr($href, 0, 1) == '{' || substr($href, -1, 1) == '}') {
                     //ajax操作
                     $fly .= "<a href=\"javascript:;\" class=\"k_ajax\" rel=\"{$href}\">" . kc_icon($ico) . $key . "</a>";
                 } else {
                     $fly .= "<a href=\"{$href}\">" . kc_icon($ico) . $key . "</a>";
                 }
             }
         }
         $fly .= "<i></i>";
         $fly .= "<a href=\"javascript:;\" onClick=\"\$('k_list_right_Fly').fadeOut(300)\">" . kc_icon('k8') . $this->lang->get('system/common/cancel') . "</a>";
         $fly .= "</div>";
     }
     $s .= '</div></td>\'';
     //</div>
     if ($_plist != null) {
         $s .= '+\'<td>' . addslashes($_plist) . '</td>\'';
     }
     $s .= '+\'</tr></table>\';return I1;};document.write(kc_button());';
     $s .= 'function ll(){var K=ll.arguments;if(K[K.length-1]==1){for(i=0;i<K.length-1;i++){if(K[i]!=\'manage\'){document.write(\'<th class="th\'+i+\'">\'+K[i]+\'</th>\')}else{document.write(\'<th class="th\'+i+\'">' . $this->lang->get('system/common/manage') . '</th>\')}}}else{var II=\'<tr id="tr_\'+K[0]+\'">\'' . NL;
     if (is_array($_js)) {
         foreach ($_js as $_value) {
             $s .= '+\'<td id="td_\'+K[0]+\'_' . ++$i . '">\'+$.kc_nbsp(' . $_value . ')+\'</td>\'' . NL;
         }
     }
     $s .= '+\'</tr>\';if(K[K.length-1]==0){document.write(II)}else{return II}}};' . NL;
     $s .= 'document.write(\'<table class="k_table_list" cellspacing="0" id="k_table_list">\');' . NL;
     $this->mList = NL . 'document.write(\'</table>\'+kc_button());';
     $this->mList .= '</script></form>' . $fly;
     //灰调显示按钮
     return $s;
 }
Esempio n. 6
0
/**
	编辑详细信息
*/
function king_edt()
{
    global $king;
    $king->access('portal_orders_edt');
    $oid = kc_get('oid', 2, 1);
    $sql = "kname,nstatus,realname,useraddress,userpost,usertel,usermail,ntotal,nexpress,kremark";
    if ($GLOBALS['ismethod']) {
        $data = $_POST;
    } else {
        if (!($data = $king->db->getRows_one("select {$sql},ono,userid,kcontent from %s_orders where oid={$oid}"))) {
            kc_error($king->lang->get('system/error/notre'));
        }
    }
    $s = $king->openForm('manage.orders.php?action=edt', $king->lang->get('portal/orders/odinfo'));
    //ono
    $s .= $king->htmForm($king->lang->get('portal/orders/no'), kc_htm_input('ono', $data['ono'], 16, 150, 'readonly="true"'));
    //kname
    $array = array(array('kname', 0, 1, 30));
    $s .= $king->htmForm($king->lang->get('portal/orders/name'), kc_htm_input('kname', $data['kname'], 30, 300), $array);
    //nstatus
    $array_statu = array();
    for ($i = 1; $i <= 11; $i++) {
        $array_statu[$i] = $king->lang->get("portal/orders/status/s{$i}");
    }
    $array = array(array('nstatus', 2));
    $s .= $king->htmForm($king->lang->get('portal/orders/statu'), kc_htm_select('nstatus', $array_statu, $data['nstatus']), $array);
    //ntotal
    $array = array(array('ntotal', 3));
    $s .= $king->htmForm($king->lang->get('portal/orders/total'), kc_htm_input('ntotal', $data['ntotal'], 14, 100) . $king->lang->get('portal/common/y'), $array);
    //nexpress
    $array = array(array('nexpress', 3));
    $s .= $king->htmForm($king->lang->get('portal/orders/express'), kc_htm_input('nexpress', $data['nexpress'], 14, 100) . $king->lang->get('portal/common/y'), $array);
    //nalltotal
    $s .= $king->htmForm($king->lang->get('portal/list/alltotal'), '<span>' . number_format($data['ntotal'] + $data['nexpress'], 2) . $king->lang->get('portal/common/y') . '</span>');
    $s .= $king->splitForm();
    $contents = unserialize($data['kcontent']);
    $list = "<table class=\"k_side\">";
    foreach ($contents as $key => $num) {
        list($listid, $kid) = explode('-', $key);
        $info = $king->portal->infoList($listid);
        $id = $king->portal->infoID($listid, $kid);
        $kpath = $king->portal->pathPage($info, $id['kid'], $id['kpath']);
        $list .= "<tr><td><a target=\"_blank\" href=\"manage.content.php?action=edt&listid={$listid}&kid={$kid}\">" . kc_icon('e5', $king->lang->get('system/common/edit')) . "</a>";
        $list .= "<a target=\"_blank\" href=\"{$kpath}\">{$id['ktitle']}</a></td>";
        $list .= "<td>" . kc_icon('q1') . number_format($id['nprice'], 2) . " x {$num}</tr>";
    }
    $list .= "</table>";
    $s .= $king->htmForm($king->lang->get('portal/orders/value'), $list);
    $s .= $king->splitForm($king->lang->get('portal/orders/userinfo'));
    $king->Load('user');
    $user = $king->user->infoUser($data['userid']);
    $s .= $king->htmForm($king->lang->get('portal/user/name'), $user['username']);
    //realname
    $array = array(array('realname', 0, 1, 30));
    $s .= $king->htmForm($king->lang->get('portal/orders/realname'), kc_htm_input('realname', $data['realname'], 30, 100), $array);
    //useraddress
    $array = array(array('useraddress', 0, 1, 30));
    $s .= $king->htmForm($king->lang->get('portal/orders/address'), '<textarea name="useraddress" id="useraddress" rows="4" cols="100" class="k_in w400">' . htmlspecialchars($data['useraddress']) . '</textarea>', $array);
    //userpost
    $array = array(array('userpost', 0, 6, 6));
    $s .= $king->htmForm($king->lang->get('portal/orders/post'), kc_htm_input('userpost', $data['userpost'], 6, 100), $array);
    //usertel
    $array = array(array('usertel', 0, 1, 30));
    $s .= $king->htmForm($king->lang->get('portal/orders/tel'), kc_htm_input('usertel', $data['usertel'], 30, 200), $array);
    //usermail
    $array = array(array('usermail', 0, 5, 32), array('usermail', 5));
    $s .= $king->htmForm($king->lang->get('portal/orders/mail'), kc_htm_input('usermail', $data['usermail'], 32, 200), $array);
    $s .= $king->splitForm($king->lang->get('portal/common/remark'));
    //kremark
    $array = array(array('kremark', 0, 0, 3000));
    $s .= $king->htmForm($king->lang->get('portal/common/remark'), '<textarea name="kremark" id="kremark" rows="8" cols="100" class="k_in w400">' . htmlspecialchars($data['kremark']) . '</textarea>', $array);
    //隐藏域
    $s .= kc_htm_hidden(array('oid' => $oid, 'userid' => $data['userid'], 'ono' => $data['ono'], 'kcontent' => $data['kcontent']));
    $s .= $king->closeForm('save');
    if ($GLOBALS['ischeck']) {
        $array_sql = explode(',', $sql);
        $array = array();
        foreach ($array_sql as $val) {
            $array[$val] = $data[$val];
        }
        $king->db->update('%s_orders', $array, "oid={$oid}");
        kc_goto($king->lang->get('system/goto/saveok'), "manage.orders.php?action=edt&oid={$oid}");
    }
    $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')), 'edt' => array('href' => 'manage.orders.php?action=edt&oid=' . $oid, 'ico' => 'e7', 'title' => $king->lang->get('system/common/edit')));
    $right = array(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);
}
Esempio n. 7
0
 /**
 	tagmenu的管理
 */
 public function tagmenu()
 {
     global $king;
     $cachepath = 'skin/tagmenu/' . $king->admin['adminid'];
     $number = kc_get('number', 2);
     $title = kc_post('title');
     $url = kc_post('url');
     if (!$number) {
         $number = 7;
     }
     $pid = kc_get('pid', 2);
     if (!$pid) {
         $pid = 1;
     }
     if (!($array = $king->cache->get($cachepath))) {
         $array = array();
     }
     if (isset($title[0])) {
         //如果有title,则是要删除对应的键值
         $array = array_diff_key($array, array($title => ''));
         $king->cache->put($cachepath, $array);
     }
     $count = count($array);
     //删除menu后,可能出现pid大于总页数的情况,则做如下判断
     if ($pid - 1 >= $count / $number) {
         $pid--;
     }
     $array_new = array_chunk($array, $number, True);
     if (!($array_new1 = $array_new[$pid - 1])) {
         $array_new1 = array();
     }
     $s = '';
     if ($pid > 1) {
         $s .= '<a class="k_ajax" rel="{URL:\'../system/manage.php\',CMD:\'tagmenu\',ID:\'k_tagmenu\',number:' . $number . ',pid:' . ($pid - 1) . ',url:\'' . urlencode($url) . '\'}">' . kc_icon('c9') . '</a>';
     }
     foreach ($array_new1 as $key => $val) {
         $val == $url ? $s .= '<span class="red"><a href="' . $val . '">' . htmlspecialchars($key) . '</a>' : ($s .= '<span><a href="' . $val . '">' . htmlspecialchars($key) . '</a>');
         $s .= "<img src=\"../system/images/white.gif\" class=\"k_ajax k8 os\" rel=\"{URL:'../system/manage.php',ID:'k_tagmenu',CMD:'tagmenu',number:{$number},url:" . urlencode($url) . ",pid:{$pid},title:\\'" . urlencode($key) . "\\'}\"/></span>";
     }
     if ($count / $number > $pid) {
         $s .= '<a class="k_ajax" rel="{URL:\'../system/manage.php\',ID:\'k_tagmenu\',CMD:\'tagmenu\',number:' . $number . ',pid:' . ($pid + 1) . ',url:\'' . urlencode($url) . '\'}">' . kc_icon('d9') . '</a>';
     }
     kc_ajax('', $s);
 }
Esempio n. 8
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);
}
Esempio n. 9
0
function king_ajax_buy()
{
    global $king;
    $cart = isset($_COOKIE['KingCMS_Cart']) ? unserialize($_COOKIE['KingCMS_Cart']) : array();
    $listid = kc_get('listid', 2);
    if ($listid) {
        //当有listid和kid值的时候,更新Cookie
        $kid = kc_get('kid', 2, 1);
        if (kc_post('number')) {
            if (!kc_validate(kc_post('number'), 2)) {
                $js = "alert('" . $king->lang->get('portal/error/number') . "');\$.kc_ajax('{URL:\\'" . $king->config('inst') . "portal/cart.php\\',CMD:\\'buy\\',IS:1}')";
                kc_ajax('', '', '', $js);
            }
        }
        $num = isset($cart[$listid . '-' . $kid]) ? $cart[$listid . '-' . $kid] : 1;
        if (kc_post('number')) {
            $num = kc_post('number');
        }
        //		$num=kc_post('number') ? kc_post('number') : $cart[$listid.'-'.$kid];
        $cart[$listid . '-' . $kid] = $num ? $num : 1;
        setcookie('KingCMS_Cart', serialize($cart), time() + 86400000, $king->config('inst'));
    }
    if (!$cart) {
        //如果购物车为空,则输出错误提示
        kc_ajax($king->lang->get('system/common/error'), '<p class="k_err">' . $king->lang->get('portal/cart/not') . '</p>');
    }
    $s = '<table class="k_table_list" cellspacing="0">';
    $s .= '<tr><th class="c">ID</th><th>' . $king->lang->get('portal/list/prodname') . '</th><th class="c">' . $king->lang->get('portal/list/unitprice') . '</th><th>' . $king->lang->get('system/common/number') . '</th><th class="c">' . $king->lang->get('system/common/subtotal') . '</th><th class="c">' . $king->lang->get('system/common/del') . '</th></tr>';
    $weight = 0;
    //总重
    $total = 0;
    //物品费用
    $i = 0;
    foreach ($cart as $key => $number) {
        list($listid, $kid) = explode('-', $key);
        $ID = $king->portal->infoID($listid, $kid);
        $s .= '<tr><td class="c">' . $kid . '</td><td title="' . addslashes($ID['ktitle']) . '">' . kc_substr($ID['ktitle'], 0, 40) . '</td>';
        $s .= '<td class="c">' . number_format($ID['nprice'], 2) . '</td>';
        $s .= "<td><input id=\"k_orders_{$i}\" type=\"text\" class=\"k_in w50\" size=\"2\" maxlength=\"6\" value=\"{$number}\" onKeydown=\"if(event.keyCode==13){\$.kc_ajax('{URL:\\'" . $king->config('inst') . "portal/cart.php\\',CMD:\\'buy\\',number:\\''+\$(this).val()+'\\',listid:{$listid},kid:{$kid}}');}\"/>";
        $s .= "<a href=\"javascript:;\" class=\"k_ajax\" rel=\"{URL:'" . $king->config('inst') . "portal/cart.php',CMD:'buy',number:\$('#k_orders_{$i}').val(),listid:{$listid},kid:{$kid},IS:1}\">" . kc_icon('o7', $king->lang->get('system/common/up')) . "</a></td>";
        $s .= '<td class="c">' . number_format($number * $ID['nprice'], 2) . '</td>';
        $s .= "<td class=\"c\"><a href=\"javascript:;\" class=\"k_ajax\" rel=\"{URL:'" . $king->config('inst') . "portal/cart.php',CMD:'delete_prod',listid:{$listid},kid:{$kid},IS:1}\">" . kc_icon('j2') . "</a></td></tr>";
        $weight += $number * $ID['nweight'];
        $total += $number * $ID['nprice'];
        $i++;
    }
    $s .= '</table><br/>';
    $array = array();
    $express = $king->portal->getExpress();
    $default = isset($_COOKIE['orders_express_default']) ? $_COOKIE['orders_express_default'] : 1;
    $_array = array();
    foreach ($express as $eid => $rs) {
        $price = $rs['nsprice'] + $rs['niprice'] * ceil($weight > 500 ? $weight / 500 - 1 : 0);
        $array[$eid] = htmlspecialchars($rs['kname']) . '(' . $price . '元)';
        $_array[$eid] = $price;
    }
    $s .= '<script type="text/javascript" charset="UTF-8">' . kc_js2array('K_ORDERS_EXPRESS', $_array) . '</script>';
    $s .= '<table class="k_table_list" cellspacing="0">';
    $s .= '<tr><th class="w150">' . $king->lang->get('portal/list/total') . '</th><td>' . number_format($total, 2) . '<input type="hidden" id="k_orders_total" value="' . $total . '"/></td></tr>';
    if ($weight === 0) {
        //若重量为0,无需物流
        $s .= '<tr><th>' . $king->lang->get('portal/list/selexpress') . '</th><td>' . $king->lang->get('portal/list/notexpress') . kc_htm_hidden(array('eid' => 0)) . '</td></tr>';
        $s .= '<tr><th>' . $king->lang->get('portal/list/alltotal') . '</th><td>' . number_format($total, 2) . '</td></tr>';
        $js = '';
    } else {
        $s .= '<tr><th>' . $king->lang->get('portal/list/selexpress') . '</th><td>' . kc_htm_select('eid', $array, $default, "onChange=\"\$('#k_orders_alltotal').text(\$.number_format(\$('#k_orders_total').val()*1+K_ORDERS_EXPRESS[\$(this).val()]*1,2));\$.setCookie('orders_express_default',\$(this).val())\"") . '</td></tr>';
        $js = '$(\'#k_orders_alltotal\').text($.number_format($(\'#k_orders_total\').val()*1 + K_ORDERS_EXPRESS[$(\'#eid\').val()]*1,2));';
        $js .= '$.setCookie(\'orders_express_default\',$(\'#eid\').val())';
        $s .= '<tr><th>' . $king->lang->get('portal/list/alltotal') . '</th><td id="k_orders_alltotal"></td></tr>';
    }
    $s .= '</table>';
    $s .= '<p>';
    $s .= '<a href="javascript:;" class="k_ajax" rel="{URL:\'' . $king->config('inst') . 'portal/cart.php\',CMD:\'buy\',IS:1}">' . kc_icon('o3') . $king->lang->get('portal/cart/refresh') . '</a>';
    $s .= '<a href="javascript:;" class="k_ajax" rel="{URL:\'' . $king->config('inst') . 'portal/cart.php\',CMD:\'clear_cookie\',IS:1}">' . kc_icon('p3') . $king->lang->get('portal/cart/clear') . '</a>';
    $s .= '<a href="javascript:;" class="k_ajax" rel="{URL:\'' . $king->config('inst') . 'portal/cart.php\',CMD:\'orders\',METHOD:\'GET\',IS:1}">' . kc_icon('q3') . $king->lang->get('portal/cart/checkout') . '</a>';
    $s .= '</p>';
    $but = kc_htm_a($king->lang->get('portal/cart/checkout'), '{URL:\'' . $king->config('inst') . 'portal/cart.php\',CMD:\'orders\',METHOD:\'GET\',IS:1}');
    kc_ajax($king->lang->get('portal/title/mycart'), $s, $but, $js, 600, 350);
}
Esempio n. 10
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;
 }
Esempio n. 11
0
 /**
 	解析表单项目
 	@param array  $rs    当前对象的数组
 	@param array  $data  表单值
 	@param array  $info  模型及字段相关信息,由listid值获取
 	@param int    $is    默认为1后台,0的时候是前台调用
 	@param int    $at    默认为1首页,2的时候是次页调用
 	@param int    $group 默认为1非组,0的时候是[组]调用
 */
 public function formDeCode($rs, $data, $info, $is = 1, $at = 1, $group = 1)
 {
     /*
     $sql='ktitle,kfield,ntype,nvalidate,nsizemin,nsizemax,kdefault,koption,nstylewidth,nstyleheight,nupfile,issearch,isshow';
     */
     global $king;
     $model = $this->infoModel($info['modelid']);
     $s = '';
     $h = '';
     $c = array();
     $f = $rs['kfield'];
     switch ($rs['ntype']) {
         case 0:
             //系统字段
             switch ($f) {
                 case 'ktitle':
                     if ($at == 1) {
                         //首页必填
                         $c[] = array($f, 0, 1, 100);
                     } else {
                         //次页可选择不填
                         $c[] = array($f, 0, 0, 100);
                     }
                     $s = '<input type="text" id="' . $f . '" name="' . $f . '" value="' . htmlspecialchars($data[$f]) . '" class="k_in w400" maxlength="100" />';
                     $h = '<a id="cktitle" class="k_ajax" rel="{URL:\'manage.content.php\',CMD:\'ckre\',obj:\'ktitle\',listid:' . $info['listid'] . ',kid:\'' . $data['kid'] . '\',ID:\'cktitle\',IS:2,ktitle:$(\'#ktitle\').val()}" >';
                     $h .= kc_icon('a7', $king->lang->get('system/common/ckre')) . '</a>';
                     break;
                 case 'ksubtitle':
                     $c = $data[$f] != '' ? array(array($f, 0, 4, 20)) : array();
                     $s = '<input type="text" id="' . $f . '" name="' . $f . '" value="' . htmlspecialchars($data[$f]) . '" class="k_in w300" maxlength="20" />';
                     break;
                 case 'kkeywords':
                     $c[] = array($f, 0, 0, 100);
                     $s = '<input type="text" id="' . $f . '" name="' . $f . '" value="' . htmlspecialchars($data[$f]) . '" class="k_in w400" maxlength="100" />';
                     $h = '<a class="k_ajax" rel="{URL:\'manage.content.php\',CMD:\'keywords\',VAL:\'' . $f . ',ktitle,listid\'}" >';
                     $h .= kc_icon('d7', $king->lang->get('portal/label/insert')) . '</a>' . kc_help('portal/help/comma', 350, 100);
                     break;
                 case 'ktag':
                     $c[] = array($f, 0, 0, 100);
                     $s = '<input type="text" id="' . $f . '" name="' . $f . '" value="' . htmlspecialchars($data[$f]) . '" class="k_in w400" maxlength="100" />';
                     $h = '<a class="k_ajax" rel="{URL:\'manage.content.php\',CMD:\'tag\',VAL:\'' . $f . ',ktitle,listid\'}" >';
                     $h .= kc_icon('d7', $king->lang->get('portal/label/insert')) . '</a>';
                     $h .= '<a href="manage.tag.php" target="_blank">' . kc_icon('e7', $king->lang->get('system/common/manage')) . '</a>' . kc_help('portal/help/comma', 350, 100);
                     break;
                 case 'kimage':
                     $c[] = array($f, 0, 0, 255);
                     $c[] = array($f, 15, null, $king->config('upimg'));
                     $s = '<input type="text" id="' . $f . '" name="' . $f . '" value="' . htmlspecialchars($data[$f]) . '" class="k_in w400" maxlength="100" />';
                     $h = kc_f_brow('kimage', $king->config('uppath') . '/image/', 0);
                     break;
                 case 'kpath':
                     if ($info['npage'] == 0 && $king->admin['adminmode'] != 0) {
                         //如果生成静态,则
                         $c[] = array($f, 0, 1, 255);
                         $c[] = array($f, 15);
                         if ($data['kid']) {
                             $c[] = array($f, 12, $king->lang->get('portal/tip/isexist1'), $king->db->getRows_one("select kpath from %s__{$model['modeltable']} where kpath='" . $king->db->escape($data['kpath']) . "' and kid<>{$data['kid']};"));
                         } else {
                             $c[] = array($f, 12, $king->lang->get('portal/tip/isexist1'), $king->db->getRows_one("select kpath from %s__{$model['modeltable']} where kpath='" . $king->db->escape($data['kpath']) . "';"));
                         }
                         $s = '<input type="text" id="' . $f . '" name="' . $f . '" value="' . htmlspecialchars($data[$f]) . '" class="k_in w400" maxlength="100" />';
                         $h = '<a id="ckpath" class="k_ajax" rel="{URL:\'manage.content.php\',ID:\'ckpath\',CMD:\'ckre\',obj:\'kpath\',listid:' . $info['listid'] . ',kid:\'' . $data['kid'] . '\',' . $f . ':$(\'#' . $f . '\').val()}" >';
                         $h .= kc_icon('a7', $king->lang->get('system/common/ckre')) . '</a>';
                     } else {
                         return;
                         //						$s=kc_htm_hidden(array($f=>htmlspecialchars($data[$f])));
                     }
                     break;
                 case 'nattrib':
                     $kid = $rs['kid'];
                     $isshow = $is == 1 ? "isadmin{$at}" : "isuser{$at}";
                     if (!($res2 = $king->db->getRows("select * from %s_field where modelid={$info['modelid']} and {$isshow}=1 and kid1={$kid} order by norder,kid;"))) {
                         //全部调用
                         return;
                     }
                     //如果没有可见项,则返回空值
                     $s = '';
                     $c2 = array();
                     $h2 = '';
                     //($s,$c,$h)
                     foreach ($res2 as $rs2) {
                         list($s2, $c2, $h2) = $this->formdecode($rs2, $data, $info, $is, $at, 0);
                         $s .= '<span class="k_field">';
                         if ($rs2['istitle']) {
                             $s .= '<label>' . addslashes($rs2['ktitle']) . '</label>';
                         }
                         $s .= $s2 . '</span>';
                         $c = array_merge($c, $c2);
                         $h .= $h2;
                     }
                     break;
                 case 'kcontent':
                     $c[] = array($f, 0, $rs['nsizemin'], $rs['nsizemax']);
                     $c[] = array($f, 21);
                     if ($is) {
                         $s .= '<span><input type="checkbox" id="isgrab" name="isgrab" ' . (kc_post('isgrab') ? 'checked="true"' : '') . '/><label for="isgrab">' . $king->lang->get('system/common/grab') . '</label>';
                         $s .= '<input type="checkbox" id="isoneimage" name="isoneimage" ' . (kc_post('isoneimage') ? 'checked="true"' : '') . '/><label for="isoneimage">' . $king->lang->get('portal/remove/oneimage') . '</label></span>';
                         //$s.='<input type="checkbox" id="isreplacetag" name="isreplacetag" '.(kc_post('isreplacetag')?'checked="true"':'').'/><label for="isreplacetag">'.$king->lang->get('portal/remove/replacetag').'</label></span>';
                         $s .= '<span><img src="../system/images/white.gif" class="os n4"/>' . $king->lang->get('system/common/filtercode') . '[<input type="checkbox" id="isremovea" name="isremovea" ' . (kc_post('isremovea') ? 'checked="true"' : '') . '/><label for="isremovea">' . $king->lang->get('portal/remove/a') . '</label>';
                         $s .= '<input type="checkbox" id="isremovetable" name="isremovetable" ' . (kc_post('isremovetable') ? 'checked="true"' : '') . '/><label for="isremovetable">' . $king->lang->get('portal/remove/table') . '</label>';
                         $s .= '<input type="checkbox" id="isremovestyle" name="isremovestyle" ' . (kc_post('isremovestyle') ? 'checked="true"' : '') . '/><label for="isremovestyle">' . $king->lang->get('portal/remove/style') . '</label>';
                         $s .= '<input type="checkbox" id="isremoveid" name="isremoveid" ' . (kc_post('isremoveid') ? 'checked="true"' : '') . '/><label for="isremoveid">' . $king->lang->get('portal/remove/id') . '</label>';
                         $s .= '<input type="checkbox" id="isremoveclass" name="isremoveclass" ' . (kc_post('isremoveclass') ? 'checked="true"' : '') . '/><label for="isremoveclass">' . $king->lang->get('portal/remove/class') . '</label>]</span><br/>';
                     }
                     $s .= kc_htm_editor($f, $data[$f], $rs['nstylewidth'], $rs['nstyleheight']);
                     break;
                 case 'krelate':
                     $c = $data[$f] ? array(array($f, 3)) : array();
                     $s = '<input type="hidden" id="' . $f . '" name="' . $f . '" value="' . htmlspecialchars($data[$f]) . '"/>';
                     $s .= '<table class="k_side" cellspacing="0"><tr><td id="krelateshow" class="k_in">';
                     $s .= 'Loading...';
                     $s .= '</td><td>';
                     $s .= '<a class="k_ajax" rel="{URL:\'manage.content.php\',CMD:\'hrelate\',VAL:\'krelate,listid,kid\'}" >' . kc_icon('b7', $king->lang->get('portal/label/relate1')) . '</a>';
                     //手动匹配
                     $s .= '<a class="k_ajax" rel="{URL:\'manage.content.php\',ID:\'krelateshow\',CMD:\'relate\',VAL:\'ktitle,listid,kid\'}">' . kc_icon('c7', $king->lang->get('portal/label/relate0')) . '</a>';
                     //自动匹配
                     $s .= kc_help('portal/help/relate');
                     $s .= '</td></tr></table>';
                     $s .= "<script>function krelateshow(){\$.kc_ajax('{URL:\\'manage.content.php\\',CMD:\\'relateload\\',ID:\\'krelateshow\\',VAL:\\'krelate,listid\\'}')};krelateshow();</script>";
                     break;
                 case 'kdescription':
                     $c[] = array($f, 0, 0, 255);
                     $s = '<textarea rows="4" cols="100" class="k_in w400" name="' . $f . '" maxlength="255" >' . htmlspecialchars($data[$f]) . '</textarea>';
                     break;
                 case 'nprice':
                     $c[] = array($f, 0, 1, 11);
                     $c[] = array($f, 3);
                     $s = '<input type="text" id="' . $f . '" name="' . $f . '" value="' . htmlspecialchars($data[$f]) . '" class="k_in w100" maxlength="11" />';
                     $h = kc_htm_setvalue_nl($f, $rs['koption']);
                     break;
                 case 'nweight':
                     $c[] = array($f, 0, 1, 11);
                     $c[] = array($f, 2);
                     $s = '<input type="text" id="' . $f . '" name="' . $f . '" value="' . htmlspecialchars($data[$f]) . '" class="k_in w100" maxlength="11" />';
                     $h = kc_htm_setvalue_nl($f, $rs['koption']) . kc_help('portal/help/weight');
                     break;
                 case 'nnumber':
                     $c[] = array($f, 0, 1, 11);
                     $c[] = array($f, 2);
                     $s = '<input type="text" id="' . $f . '" name="' . $f . '" value="' . htmlspecialchars($data[$f]) . '" class="k_in w100" maxlength="11" />';
                     $h = kc_htm_setvalue_nl($f, $rs['koption']);
                     break;
                 default:
                     if (in_array($f, array('nshow', 'nhead', 'ncommend', 'nup', 'nfocus', 'nhot'))) {
                         $c[] = array($f, 20, null, array(0, 1));
                         //						kc_error(print_r($data,1));
                         $checked = empty($data[$f]) ? '' : ' checked="checked"';
                         $s = '<input' . $checked . ' type="checkbox" id="' . $f . '" name="' . $f . '" value="1" />';
                         $s .= '<label for="' . $f . '">' . htmlspecialchars($rs['ktitle']) . '</label>';
                     }
             }
             break;
             //value="'.htmlspecialchars($data[$f]).'"
             //$rs='ktitle,kfield,ntype,nvalidate,nsizemin,nsizemax,kdefault,koption,nstylewidth,nstyleheight,nupfile,issearch,isshow';
         //value="'.htmlspecialchars($data[$f]).'"
         //$rs='ktitle,kfield,ntype,nvalidate,nsizemin,nsizemax,kdefault,koption,nstylewidth,nstyleheight,nupfile,issearch,isshow';
         case 1:
             //单行文本
             $c[] = array($f, 0, $rs['nsizemin'], $rs['nsizemax']);
             if ($rs['nvalidate'] != 0) {
                 $c[] = array($f, $rs['nvalidate']);
             }
             $s = '<input type="text" name="' . $f . '" id="' . $f . '" value="' . htmlspecialchars($data[$f]) . '" class="k_in" style="width:' . $rs['nstylewidth'] . 'px;" maxlength="' . $rs['nsizemax'] . '" />';
             $h = $this->help($rs['kid'], $rs['khelp']) . kc_htm_setvalue_nl($f, $rs['koption']);
             break;
         case 2:
             //多行文本 (不支持编辑器)
             $c[] = array($f, 0, $rs['nsizemin'], $rs['nsizemax']);
             $s = '<table class="k_side" cellspacing="0"><tr><td><textarea name="' . $f . '" class="k_in" style="width:' . $rs['nstylewidth'] . 'px;height:' . $rs['nstyleheight'] . 'px;" >' . htmlspecialchars($data[$f]) . '</textarea></td><td>' . $this->help($rs['kid'], $rs['khelp']) . '</td></tr></table>';
             break;
         case 3:
             //多行文本 (支持编辑器)
             $c[] = array($f, 0);
             $c[] = array($f, 21);
             $s = '<table class="k_side" cellspacing="0"><tr><td>' . kc_htm_editor($f, $data[$f]) . '</td><td>' . $this->help($rs['kid'], $rs['khelp']) . '</td></tr></table>';
             break;
         case 4:
             //单选 (下拉列表)
             $c[] = array($f, 0, 0, 255);
             $array_def = explode(NL, $rs['koption']);
             $array_select = array();
             foreach ($array_def as $val) {
                 if (isset($val[0])) {
                     //不能为空值
                     $array_val = explode('|', $val, 2);
                     if (count($array_val) > 1) {
                         //有分割符号
                         $array_select[$array_val[0]] = $array_val[1];
                     } else {
                         $array_select[$val] = $val;
                     }
                 }
             }
             $c[] = array($f, 20, null, array_keys($array_select));
             $s = kc_htm_select($f, $array_select, $data[$f]);
             $h = $this->help($rs['kid'], $rs['khelp']);
             break;
         case 5:
             //单选 (radio)
             $c[] = array($f, 0, 0, 255);
             $array_def = explode(NL, $rs['koption']);
             $array_radio = array();
             foreach ($array_def as $val) {
                 if (isset($val[0])) {
                     //不能为空值
                     $array_val = explode('|', $val, 2);
                     if (count($array_val) > 1) {
                         //有分割符号
                         $array_radio[$array_val[0]] = $array_val[1];
                     } else {
                         $array_radio[$val] = $val;
                     }
                 }
             }
             $c[] = array($f, 20, null, array_keys($array_radio));
             $s = kc_htm_radio($f, $array_radio, $data[$f]);
             $h = $this->help($rs['kid'], $rs['khelp']);
             break;
         case 6:
             //多选 (多选列表)
             $c[] = array($f, 0, 0, 255);
             $array_def = explode(NL, $rs['koption']);
             $array_select = array();
             foreach ($array_def as $val) {
                 if (isset($val[0])) {
                     //不能为空值
                     $array_val = explode('|', $val, 2);
                     if (count($array_val) > 1) {
                         //有分割符号
                         $array_select[$array_val[0]] = $array_val[1];
                     } else {
                         $array_select[$val] = $val;
                     }
                 }
             }
             $array_keys = array_keys($array_select);
             //可选值,但需要再加一个空值进去
             $array_keys[''] = '';
             $c[] = array($f, 23, null, $array_keys);
             $s = kc_htm_select($f, $array_select, $data[$f], ' multiple="multiple" style="width:' . $rs['nstylewidth'] . 'px;height:' . $rs['nstyleheight'] . 'px;"');
             $h = $this->help($rs['kid'], $rs['khelp']);
             break;
         case 7:
             //复选框
             $c[] = array($f, 0, 0, 255);
             $array_def = explode(NL, $rs['koption']);
             $array_radio = array();
             foreach ($array_def as $val) {
                 if (isset($val[0])) {
                     //不能为空值
                     $array_val = explode('|', $val, 2);
                     if (count($array_val) > 1) {
                         //有分割符号
                         $array_radio[$array_val[0]] = $array_val[1];
                     } else {
                         $array_radio[$val] = $val;
                     }
                 }
             }
             $array_keys = array_keys($array_radio);
             //可选值,但需要再加一个空值进去
             $array_keys[''] = '';
             $c[] = array($f, 23, null, $array_keys);
             $s = kc_htm_checkbox($f, $array_radio, $data[$f]);
             $h = $this->help($rs['kid'], $rs['khelp']);
             break;
         case 8:
             //文件上传(图片类型)
             $c[] = array($f, 0, $rs['nsizemin'], $rs['nsizemax']);
             $s = '<input type="text" name="' . $f . '" id="' . $f . '" value="' . htmlspecialchars($data[$f]) . '" class="k_in" style="width:' . $rs['nstylewidth'] . 'px;" maxlength="' . $rs['nsizemax'] . '" />';
             $h = kc_f_brow($f, $king->config('uppath') . '/image', 0) . $this->help($rs['kid'], $rs['khelp']) . kc_htm_setvalue_nl($f, $rs['koption']);
             break;
         case 9:
             //图片列表
             $c[] = array($f, 0, $rs['nsizemin'], $rs['nsizemax']);
             // class="w800"
             $s = kc_htm_hidden(array($f => $data[$f]));
             $src = $king->lang->get('portal/label/imgsrc');
             $alt = $king->lang->get('portal/label/imgalt');
             $s .= kc_htm_input("S{$f}", $src, 400, 400, " onClick=\"\$(this).val(this.value=='{$src}'?'':this.value)\"") . "<br/>";
             $s .= kc_htm_input("A{$f}", $alt, 400, 300, " onClick=\"\$(this).val(this.value=='{$alt}'?'':this.value)\"");
             $s .= " <input type=\"button\" value=\"" . $king->lang->get('system/common/add') . "\" id=\"B{$f}\" />";
             // onClick=\"F$f()\"
             $s .= "<div id=\"W{$f}\" class=\"imglist\" style=\"width:{$rs['nstylewidth']}px\"></div>";
             //JavaScript中判断Src值是否为远程图像,如果是的话,则直接抓取图片到本地
             $s .= "<script>\r\n\t\t\t\t//点击“添加”按钮的时候的效果\r\n\t\t\t\tfunction F{$f}(){\r\n\t\t\t\t\tvar t=String.fromCharCode(9);\r\n\t\t\t\t\tvar S=\$('#S{$f}').val().replace(t,'');\r\n\t\t\t\t\tvar A=\$('#A{$f}').val().replace(t,'');\r\n\t\t\t\t\t//判断是否填写图片地址\r\n\t\t\t\t\tif(S=='' || S=='{$src}'){\r\n\t\t\t\t\t\talert('" . $king->lang->get('portal/error/notimgsrc') . "');\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif(A=='' || A=='{$alt}') A=S;\r\n\t\t\t\t\tvar s=S+t+A;\r\n\t\t\t\t\tvar ss=\$('#{$f}').val();\r\n\t\t\t\t\t//如果S为空,则提示错误\r\n\t\t\t\t\tif(ss==''){\r\n\t\t\t\t\t\t\$('#{$f}').val(s);\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\t//判断图片是否已经存在\r\n\t\t\t\t\t\tvar ss_1=ss.split(t+t);\r\n\t\t\t\t\t\tvar ss_2,src;\r\n\t\t\t\t\t\tfor(i=0;i<ss_1.length;i++){\r\n\t\t\t\t\t\t\tss_2=ss_1[i].split(t);\r\n\t\t\t\t\t\t\tsrc=ss_2[0];\r\n\t\t\t\t\t\t\tif(src==S){\r\n\t\t\t\t\t\t\t\talert('" . $king->lang->get('portal/error/retimgsrc') . "');\r\n\t\t\t\t\t\t\t\t\$('#S{$f}').val('');\r\n\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\$('#{$f}').val(ss+t+t+s);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\$('#S{$f}').val('');\r\n\t\t\t\t\t\$('#A{$f}').val('');\r\n\t\t\t\t\tS{$f}();\r\n\t\t\t\t}\r\n\t\t\t\t//显示数据\r\n\t\t\t\tfunction S{$f}(){\r\n\t\t\t\t\tvar t=String.fromCharCode(9);\r\n\t\t\t\t\tvar ss=\$('#{$f}').val();\r\n\t\t\t\t\tif(ss==''){\r\n\t\t\t\t\t\t\$('#W{$f}').html('');\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar s='';\r\n\t\t\t\t\tvar ss_1=ss.split(t+t);\r\n\t\t\t\t\tvar ss_2,alt,src;\r\n\t\t\t\t\tfor(i=0;i<ss_1.length;i++){\r\n\t\t\t\t\t\tss_2=ss_1[i].split(t);\r\n\t\t\t\t\t\tsrc=ss_2[0];\r\n\t\t\t\t\t\talt=ss_2[1];\r\n\r\n\t\t\t\t\t\ts+='<span class=\"img\" title=\"'+alt+'\">';\r\n\t\t\t\t\t\ts+='<a href=\"javascript:;\" onClick=\"E{$f}('+i+')\" class=\"img\" title=\"" . $king->lang->get('system/common/edit') . "\">';\r\n\t\t\t\t\t\ts+='<img class=\"img\" src=\"'+(ss_2[0].match(/^[a-zA-Z]{3,10}:\\/\\/[^\\s]+\$/) ? ss_2[0] : '../'+ss_2[0])+'\"/>';\r\n\t\t\t\t\t\ts+='</a>';\r\n\r\n\t\t\t\t\t\ts+='<a class=\"title\" href=\"javascript:;\" onClick=\"D{$f}('+i+')\" title=\"" . $king->lang->get('system/common/del') . "\">';\r\n\t\t\t\t\t\ts+=\$.kc_icon('j2')+alt;\r\n\t\t\t\t\t\ts+='</a>';\r\n\t\t\t\t\t\ts+='</span>';\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\$('#W{$f}').html(s);\r\n\t\t\t\t}\r\n\t\t\t\t//删除图片\r\n\t\t\t\tfunction D{$f}(num){\r\n\t\t\t\t\tvar t=String.fromCharCode(9);\r\n\t\t\t\t\tvar ss=\$('#{$f}').val();\r\n\t\t\t\t\tif(ss==''){\r\n\t\t\t\t\t\t\$('#W{$f}').html('');\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar ss_1=ss.split(t+t);\r\n\t\t\t\t\t\r\n\t\t\t\t\tss_1.splice(num,1);\r\n\r\n\t\t\t\t\t\$('#{$f}').val(ss_1.join(t+t));\r\n\r\n\t\t\t\t\tS{$f}();\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t//编辑图片\r\n\t\t\t\tfunction E{$f}(num){\r\n\t\t\t\t\tvar t=String.fromCharCode(9);\r\n\t\t\t\t\tvar ss=\$('#{$f}').val();\r\n\t\t\t\t\tif(ss=='') return;\r\n\t\t\t\t\tvar ss_1=ss.split(t+t);\r\n\r\n\t\t\t\t\tvar ss_num=ss_1.slice(num,num+1);\r\n\t\t\t\t\tvar ss_2=ss_num[0].split(t);\r\n\r\n\t\t\t\t\t\$('#S{$f}').val(ss_2[0]);\r\n\t\t\t\t\t\$('#A{$f}')\r\n\t\t\t\t\t\t.val(ss_2[1])\r\n\t\t\t\t\t\t.width(250);\r\n\r\n\t\t\t\t\t\$('#B{$f}')\r\n\t\t\t\t\t\t.val('" . $king->lang->get('system/common/up') . "')\r\n\t\t\t\t\t\t.unbind('click')\r\n\t\t\t\t\t\t.click(function(){U{$f}(num)});\r\n\t\t\t\t\tif(!\$('#B{$f}').next('input').length){\r\n\t\t\t\t\t\t\$('#B{$f}').after('<input type=\"button\" value=\"" . $king->lang->get('system/common/cancel') . "\" onClick=\"C{$f}()\"/>');\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t//提交编辑结果\r\n\t\t\t\tfunction U{$f}(num){\r\n\t\t\t\t\tvar t=String.fromCharCode(9);\r\n\t\t\t\t\tvar ss=\$('#{$f}').val();\r\n\r\n\t\t\t\t\tvar S=\$('#S{$f}').val().replace(t,'');\r\n\t\t\t\t\tvar A=\$('#A{$f}').val().replace(t,'');\r\n\r\n\t\t\t\t\t//判断是否填写图片地址\r\n\t\t\t\t\tif(S=='' || S=='{$src}'){\r\n\t\t\t\t\t\talert('" . $king->lang->get('portal/error/notimgsrc') . "');\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tvar ss_1=ss.split(t+t);\r\n\t\t\t\t\tss_1.splice(num,1,S+t+A);\r\n\r\n\t\t\t\t\t\$('#{$f}').val(ss_1.join(t+t));\r\n\r\n\t\t\t\t\t\$('#S{$f}').val('');\r\n\t\t\t\t\t\$('#A{$f}').val('')\r\n\t\t\t\t\t\t.width(300);\r\n\r\n\t\t\t\t\t\$('#B{$f}').val('" . $king->lang->get('system/common/add') . "')\r\n\t\t\t\t\t\t.unbind('click')\r\n\t\t\t\t\t\t.click(function(){F{$f}()})\r\n\t\t\t\t\t\t.next('input').remove();\r\n\r\n\t\t\t\t\tS{$f}();\r\n\r\n\t\t\t\t}\r\n\t\t\t\t//取消按钮\r\n\t\t\t\tfunction C{$f}(){\r\n\r\n\t\t\t\t\t\$('#S{$f}').val('');\r\n\t\t\t\t\t\$('#A{$f}').val('')\r\n\t\t\t\t\t\t.width(300);\r\n\r\n\t\t\t\t\t\$('#B{$f}').val('" . $king->lang->get('system/common/add') . "')\r\n\t\t\t\t\t\t.unbind('click')\r\n\t\t\t\t\t\t.click(function(){F{$f}()})\r\n\t\t\t\t\t\t.next('input').remove();\r\n\r\n\t\t\t\t}\r\n\t\t\t\tS{$f}();\r\n\t\t\t\t\$('#B{$f}').click(function(){F{$f}()});\r\n\t\t\t\t</script>";
             $h = kc_f_brow("S{$f}", $king->config('uppath') . '/image/', 0, 1, "F{$f}()");
             $h .= $this->help($rs['kid'], $rs['khelp']);
             break;
         case 10:
             //文件上传(文件类型)
             $c[] = array($f, 0, $rs['nsizemin'], $rs['nsizemax']);
             $s = '<input type="text" name="' . $f . '" id="' . $f . '" value="' . htmlspecialchars($data[$f]) . '" class="k_in" style="width:' . $rs['nstylewidth'] . 'px;" maxlength="' . $rs['nsizemax'] . '" />';
             $h = kc_f_brow($f, $king->config('uppath') . '/file/', 1) . $this->help($rs['kid'], $rs['khelp']) . kc_htm_setvalue_nl($f, $rs['koption']);
             break;
         case 11:
             //文件列表
             $c[] = array($f, 0, $rs['nsizemin'], $rs['nsizemax']);
             $s = kc_htm_hidden(array($f => $data[$f]));
             $src = $king->lang->get('portal/label/filesrc');
             $alt = $king->lang->get('portal/label/filealt');
             $s .= kc_htm_input("S{$f}", $src, 400, 400, " onClick=\"\$(this).val(this.value=='{$src}'?'':this.value)\"") . "<br/>";
             $s .= kc_htm_input("A{$f}", $alt, 400, 300, " onClick=\"\$(this).val(this.value=='{$alt}'?'':this.value)\"");
             $s .= " <input type=\"button\" value=\"" . $king->lang->get('system/common/add') . "\" id=\"B{$f}\" />";
             $s .= "<div id=\"W{$f}\" class=\"filelist\" style=\"width:{$rs['nstylewidth']}px\"></div>";
             $s .= "<script>\r\n\t\t\t\t//点击“添加”按钮的时候的效果\r\n\t\t\t\tfunction F{$f}(){\r\n\t\t\t\t\tvar t=String.fromCharCode(9);\r\n\t\t\t\t\tvar S=\$('#S{$f}').val().replace(t,'');\r\n\t\t\t\t\tvar A=\$('#A{$f}').val().replace(t,'');\r\n\t\t\t\t\t//判断是否填写文件地址\r\n\t\t\t\t\tif(S=='' || S=='{$src}'){\r\n\t\t\t\t\t\talert('" . $king->lang->get('portal/error/notimgsrc') . "');\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif(A=='' || A=='{$alt}') A=S;\r\n\t\t\t\t\tvar s=S+t+A;\r\n\t\t\t\t\tvar ss=\$('#{$f}').val();\r\n\t\t\t\t\t//如果S为空,则提示错误\r\n\t\t\t\t\tif(ss==''){\r\n\t\t\t\t\t\t\$('#{$f}').val(s);\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\t//判断文件是否已经存在\r\n\t\t\t\t\t\tvar ss_1=ss.split(t+t);\r\n\t\t\t\t\t\tvar ss_2,src;\r\n\t\t\t\t\t\tfor(i=0;i<ss_1.length;i++){\r\n\t\t\t\t\t\t\tss_2=ss_1[i].split(t);\r\n\t\t\t\t\t\t\tsrc=ss_2[0];\r\n\t\t\t\t\t\t\tif(src==S){\r\n\t\t\t\t\t\t\t\talert('" . $king->lang->get('portal/error/retfilesrc') . "');\r\n\t\t\t\t\t\t\t\t\$('#S{$f}').val('');\r\n\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\$('#{$f}').val(ss+t+t+s);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\$('#S{$f}').val('');\r\n\t\t\t\t\t\$('#A{$f}').val('');\r\n\t\t\t\t\tS{$f}();\r\n\t\t\t\t}\r\n\t\t\t\t//显示数据\r\n\t\t\t\tfunction S{$f}(){\r\n\t\t\t\t\tvar t=String.fromCharCode(9);\r\n\t\t\t\t\tvar ss=\$('#{$f}').val();\r\n\t\t\t\t\tif(ss==''){\r\n\t\t\t\t\t\t\$('#W{$f}').html('');\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar s='';\r\n\t\t\t\t\tvar ss_1=ss.split(t+t);\r\n\t\t\t\t\tvar ss_2,alt,src;\r\n\t\t\t\t\tfor(i=0;i<ss_1.length;i++){\r\n\t\t\t\t\t\tss_2=ss_1[i].split(t);\r\n\t\t\t\t\t\tsrc=ss_2[0];\r\n\t\t\t\t\t\talt=ss_2[1];\r\n\r\n\t\t\t\t\t\ts+='<span class=\"file\" title=\"'+alt+'\">';\r\n\r\n\t\t\t\t\t\ts+='<a href=\"javascript:;\" class=\"icon\" onClick=\"D{$f}('+i+')\" title=\"" . $king->lang->get('system/common/del') . "\">';\r\n\t\t\t\t\t\ts+=\$.kc_icon('j2','" . $king->lang->get('system/common/del') . "')+'</a>';\r\n\r\n\t\t\t\t\t\ts+='<a href=\"javascript:;\" onClick=\"E{$f}('+i+')\" class=\"title\" title=\"" . $king->lang->get('system/common/edit') . "\">';\r\n\t\t\t\t\t\ts+=alt;\r\n\t\t\t\t\t\t//s+='<img class=\"file\" src=\"'+(ss_2[0].match(/^[a-zA-Z]{3,10}:\\/\\/[^\\s]+\$/) ? ss_2[0] : '../'+ss_2[0])+'\"/>';\r\n\t\t\t\t\t\ts+='</a>';\r\n\r\n\t\t\t\t\t\ts+='<a title=\"" . $king->lang->get('system/common/down') . "\" class=\"src\" href=\"'+(ss_2[0].match(/^[a-zA-Z]{3,10}:\\/\\/[^\\s]+\$/) ? ss_2[0] : '../'+ss_2[0])+'\">';\r\n\t\t\t\t\t\ts+=\$.kc_icon('e3','" . $king->lang->get('system/common/down') . "');\r\n\t\t\t\t\t\ts+=src+'</a>';\r\n\t\t\t\t\t\ts+='</span>';\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\$('#W{$f}').html(s);\r\n\t\t\t\t}\r\n\t\t\t\t//删除文件\r\n\t\t\t\tfunction D{$f}(num){\r\n\t\t\t\t\tvar t=String.fromCharCode(9);\r\n\t\t\t\t\tvar ss=\$('#{$f}').val();\r\n\t\t\t\t\tif(ss==''){\r\n\t\t\t\t\t\t\$('#W{$f}').html('');\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar ss_1=ss.split(t+t);\r\n\t\t\t\t\t\r\n\t\t\t\t\tss_1.splice(num,1);\r\n\r\n\t\t\t\t\t\$('#{$f}').val(ss_1.join(t+t));\r\n\r\n\t\t\t\t\tS{$f}();\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t//编辑图片\r\n\t\t\t\tfunction E{$f}(num){\r\n\t\t\t\t\tvar t=String.fromCharCode(9);\r\n\t\t\t\t\tvar ss=\$('#{$f}').val();\r\n\t\t\t\t\tif(ss=='') return;\r\n\t\t\t\t\tvar ss_1=ss.split(t+t);\r\n\r\n\t\t\t\t\tvar ss_num=ss_1.slice(num,num+1);\r\n\t\t\t\t\tvar ss_2=ss_num[0].split(t);\r\n\r\n\t\t\t\t\t\$('#S{$f}').val(ss_2[0]);\r\n\t\t\t\t\t\$('#A{$f}')\r\n\t\t\t\t\t\t.val(ss_2[1])\r\n\t\t\t\t\t\t.width(250);\r\n\r\n\t\t\t\t\t\$('#B{$f}')\r\n\t\t\t\t\t\t.val('" . $king->lang->get('system/common/up') . "')\r\n\t\t\t\t\t\t.unbind('click')\r\n\t\t\t\t\t\t.click(function(){U{$f}(num)});\r\n\t\t\t\t\tif(!\$('#B{$f}').next('input').length){\r\n\t\t\t\t\t\t\$('#B{$f}').after('<input type=\"button\" value=\"" . $king->lang->get('system/common/cancel') . "\" onClick=\"C{$f}()\"/>');\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t//提交编辑结果\r\n\t\t\t\tfunction U{$f}(num){\r\n\t\t\t\t\tvar t=String.fromCharCode(9);\r\n\t\t\t\t\tvar ss=\$('#{$f}').val();\r\n\r\n\t\t\t\t\tvar S=\$('#S{$f}').val().replace(t,'');\r\n\t\t\t\t\tvar A=\$('#A{$f}').val().replace(t,'');\r\n\r\n\t\t\t\t\t//判断是否填写图片地址\r\n\t\t\t\t\tif(S=='' || S=='{$src}'){\r\n\t\t\t\t\t\talert('" . $king->lang->get('portal/error/notfilesrc') . "');\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tvar ss_1=ss.split(t+t);\r\n\t\t\t\t\tss_1.splice(num,1,S+t+A);\r\n\r\n\t\t\t\t\t\$('#{$f}').val(ss_1.join(t+t));\r\n\r\n\t\t\t\t\t\$('#S{$f}').val('');\r\n\t\t\t\t\t\$('#A{$f}').val('')\r\n\t\t\t\t\t\t.width(300);\r\n\r\n\t\t\t\t\t\$('#B{$f}').val('" . $king->lang->get('system/common/add') . "')\r\n\t\t\t\t\t\t.unbind('click')\r\n\t\t\t\t\t\t.click(function(){F{$f}()})\r\n\t\t\t\t\t\t.next('input').remove();\r\n\r\n\t\t\t\t\tS{$f}();\r\n\r\n\t\t\t\t}\r\n\t\t\t\t//取消按钮\r\n\t\t\t\tfunction C{$f}(){\r\n\r\n\t\t\t\t\t\$('#S{$f}').val('');\r\n\t\t\t\t\t\$('#A{$f}').val('')\r\n\t\t\t\t\t\t.width(300);\r\n\r\n\t\t\t\t\t\$('#B{$f}').val('" . $king->lang->get('system/common/add') . "')\r\n\t\t\t\t\t\t.unbind('click')\r\n\t\t\t\t\t\t.click(function(){F{$f}()})\r\n\t\t\t\t\t\t.next('input').remove();\r\n\r\n\t\t\t\t}\r\n\t\t\t\tS{$f}();\r\n\t\t\t\t\$('#B{$f}').click(function(){F{$f}()});\r\n\t\t\t\t</script>";
             /*
             $s='<input type="hidden" id="'.$f.'" name="'.$f.'" value="'.htmlspecialchars($data[$f]).'"/><br/>';
             $s.='<input type="hidden" id="'.$f.'_temp" name="'.$f.'_temp"/>';
             $s.='<table class="k_side" cellspacing="0"><tr><td id="k'.$f.'show" class="k_in filelist" style="width:'.$rs['nstylewidth'].'px;height:'.$rs['nstyleheight'].'px;">';
             $s.='Loading...';
             $s.='</td></tr></table>';
             $h=kc_f_brow($f.'_temp',$king->config('uppath').'/file/',1,1,$jsfun='k'.$f.'show();');
             
             $s.="<script>function k{$f}js(title,file,label){var s='<span class=\"file\" title=\"'+title+'\">";
             $s.="<a class=\"img k_ajax\" href=\"javascript:;\" rel=\"{CMD:\'filetitle\',file:\''+file+'\',label:\''+label+'\',VAL:\''+label+','+label+'_temp,listid\',METHOD:\'GET\'}\">";
             $s.="<img class=\"file\" src=\"../'+file+'\"/></a>";
             $s.="<em class=\"title\">";
             $s.="<a class=\"k_ajax\" href=\"javascript:;\" rel=\"{CMD:\'filesdel\',delfile:\''+file+'\',label:\''+label+'\',VAL:\''+label+','+label+'_temp,listid\',IS:1}\">";
             $s.="'+\$.kc_icon('j2')+'</a>'+title+'</em></span>';return s;};";
             
             $s.="function k{$f}show(){\$.kc_ajax('{URL:\'manage.content.php\',ID:\'k{$f}show\',CMD:\'filesload\',label:\'{$f}\',VAL:\'{$f}_temp,{$f},listid\'}')};k{$f}show();</script>";
             */
             $h = kc_f_brow("S{$f}", $king->config('uppath') . '/file/', 1, 1, "F{$f}()");
             $h .= $this->help($rs['kid'], $rs['khelp']);
             break;
         case 12:
             //颜色框
             $c[] = array($f, 0, 7, 7);
             $c[] = array($f, 13);
             //			$s='<table class="k_side" cellspacing="0"><tr><td><input class="k_in k_color" type="text" id="'.$f.'" name="'.$f.'" value="'.htmlspecialchars($data[$f]).'" '.(kc_validate($data[$f],13)?' style="background:'.$data[$f].'"':'').' maxlength="7" /></td>';
             //			$s.='<td>'.kc_f_color($f).'</td></tr></table>';
             $s = '<input class="k_in w50" type="text" id="' . $f . '" name="' . $f . '" value="' . htmlspecialchars($data[$f]) . '" ' . (kc_validate($data[$f], 13) ? ' style="background:' . $data[$f] . '"' : '') . ' maxlength="7" />';
             $s .= kc_f_color($f);
             //"<a href=\"javascript:;\" class=\"k_color\" rel=\"{id:'{$f}'}\"><img src=\"../system/images/white.gif\" class=\"os a8\"/></a>";
             break;
         case 13:
             //是/否
             $c[] = array($f, 20, null, array('', 1));
             $checked = $data[$f] ? ' checked="checked"' : '';
             $s = '<input' . $checked . ' type="checkbox" id="' . $f . '" name="' . $f . '" value="1" />';
             $s .= '<label for="' . $f . '">' . ($group ? $king->lang->get('system/common/selectyes') : htmlspecialchars($rs['ktitle'])) . '</label>';
             break;
         case 14:
             //日期
             //			$c[]=array($f,9);
             $c[] = array($f, 0, $rs['nsizemin'], $rs['nsizemax']);
             if ($rs['nvalidate'] != 0) {
                 $c[] = array($f, $rs['nvalidate']);
             }
             $date = $data[$f] == 'TODAY' ? kc_formatdate(time(), "Y-m-d") : $data[$f];
             $s = kc_htm_input($f, $date, 30, 100);
             $s .= "<a href=\"javascript:;\" class=\"k_calendar\" rel=\"{id:'{$f}'}\"><img src=\"../system/images/white.gif\" class=\"os k9\"/></a>";
             /*
             $h="<script>";//<script type=\"text/javascript\" src=\"../system/js/calendar.js\"></script>
             for($i=0;$i<7;$i++){
             	$h.="k_lang['week{$i}']='".$king->lang->get('system/time/week'.$i)."';";
             }
             $h.="$.kc_calendar('{$f}')</script>";
             */
             break;
         case 99:
             $kid = $rs['kid'];
             $isshow = $is == 1 ? "isadmin{$at}" : "isuser{$at}";
             if (!($res2 = $king->db->getRows("select * from %s_field where modelid={$info['modelid']} and {$isshow}=1 and kid1={$kid} order by norder,kid;"))) {
                 //全部调用
                 return;
             }
             //若没有可见项,返回空值
             $s = '';
             $c2 = array();
             $h2 = '';
             //($s,$c,$h)
             foreach ($res2 as $rs2) {
                 list($s2, $c2, $h2) = $this->formdecode($rs2, $data, $info, $is, $at, 2);
                 $s .= '<span class="k_field">';
                 if ($rs2['istitle']) {
                     $s .= '<label>' . addslashes($rs2['ktitle']) . '</label>';
                 }
                 $s .= $s2 . '</span>';
                 $c = array_merge($c, $c2);
                 $h .= $h2;
             }
             break;
         default:
             $s = $rs['ktitle'] . '=' . $rs['ntype'];
     }
     if ($group == 1) {
         if ($is == 1) {
             //后台调用
             if ($rs['ntype'] == 0 && $f == 'nattrib' || $rs['ntype'] == 99) {
                 //组输出,不需要标签
                 return $king->htmForm($rs['ktitle'], $s, $c, '', $h);
             } else {
                 return $king->htmForm($rs['ktitle'], $s, $c, substr($f, 1), $h);
             }
         } else {
             return $king->htmForm($rs['ktitle'], $s, $c);
         }
     } else {
         //组调用
         if ($is == 1) {
             return array($s, $c, $h);
         } else {
             return array($s, $c, '');
         }
     }
     //	return $htmlForm;
 }
Esempio n. 12
0
function king_ajax_isshow()
{
    global $king;
    $king->access('portal_field_edt');
    $kid = kc_get('kid', 2, 1);
    $field = kc_post('field');
    $is = kc_get('is', 2, 1) ? 1 : 0;
    $modelid = kc_get('modelid', 22, 1);
    $array_is = array('isadmin1', 'isadmin2', 'isuser1', 'isuser2', 'islist', 'issearch', 'isrelate');
    if (!in_array($field, $array_is)) {
        //防止非法输入
        kc_error($king->lang->get('system/error/param'));
    }
    if ($res = $king->db->getRows_one("select ktitle from %s_field where kid={$kid} and kfield='ktitle'")) {
        kc_ajax('', kc_icon($is ? 'n2' : 'n1'), 0, "alert('" . $king->lang->get('portal/tip/noedt') . ": {$res['ktitle']}')");
    }
    $array = array($field => $is);
    $king->db->update('%s_field', $array, "kid={$kid}");
    $king->cache->del('portal/model/model' . $modelid);
    $s = kc_icon($is ? 'n1' : 'n2');
    $js = "\$('#{$field}_{$kid}').attr('rel','{CMD:\\'isshow\\',field:\\'{$field}\\',modelid:{$modelid},kid:{$kid},is:" . (1 - $is) . ",ID:\\'{$field}_{$kid}\\',IS:2}')";
    kc_ajax('', $s, 0, $js);
}
Esempio n. 13
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);
}
Esempio n. 14
0
function king_edt()
{
    global $king;
    $king->access("portal_list_edt");
    $array_static = array(3 => $king->lang->get('portal/static/t3'), 0 => $king->lang->get('portal/static/t0'), 1 => $king->lang->get('portal/static/t1'), 2 => $king->lang->get('portal/static/t2'));
    $listid = kc_get('listid', 2);
    $modelid = kc_get('modelid', 22);
    $modeltables = $king->portal->getModelTables();
    $line = $king->config('pidline');
    $_sql = 'modelid,listid1,siteid,klistname,ktitle,kkeywords,kdescription,kimage,isblank,iscontent,kcontent,klistpath,ktemplatelist1,ktemplatelist2,kpathmode,ktemplatepage1,ktemplatepage2,ispublish1,ispublish2,klanguage,ismenu1,ismenu2,ismenu3,ismenu4,ismenu5,ismap,nlistnumber,npagenumber,nlist,npage,gid,gidpublish';
    if ($GLOBALS['ismethod'] || $listid == '') {
        //POST过程或新添加的过程
        $data = $_POST;
        if (!$GLOBALS['ismethod']) {
            //初始化新添加的数据
            $data['klanguage'] = $_COOKIE['language'];
            $data['siteid'] = 0;
            $data['ismap'] = 1;
            $data['ismenu1'] = 1;
            $data['ismenu2'] = 1;
            $data['listid1'] = 0;
            $newlistid = $king->db->neworder('%s_list', null, 'listid');
            $data['gid'] = -1;
            $data['nlist'] = 1;
            $data['npage'] = 0;
            $tpath = $king->config('templatepath');
            $tdefa = $king->config('templatedefault');
            switch ($modelid) {
                case 0:
                    $data['klistpath'] = "list{$line}{$newlistid}" . $king->config('rewriteend');
                    $data['iscontent'] = 1;
                    $data['ismenu3'] = 1;
                    //默认模板
                    $ktemplatelist1 = $tpath . '/' . $tdefa;
                    $data['ktemplatelist1'] = is_file(ROOT . $ktemplatelist1) ? $ktemplatelist1 : '';
                    $ktemplatelist2 = $tpath . '/inside/onepage/' . $tdefa;
                    $data['ktemplatelist2'] = is_file(ROOT . $ktemplatelist2) ? $ktemplatelist2 : '';
                    break;
                case -1:
                    $data['klistpath'] = 'http://';
                    break;
                default:
                    $data['kpathmode'] = "page{$line}{$newlistid}{$line}ID" . $king->config('rewriteend');
                    $data['klistpath'] = "list{$line}{$newlistid}{$line}PID" . $king->config('rewriteend');
                    $model = $king->portal->infoModel($modelid);
                    $data['ispublish1'] = $model['ispublish1'];
                    $data['ispublish2'] = $model['ispublish2'];
                    $data['npagenumber'] = $model['npagenumber'];
                    $data['nlistnumber'] = $model['nlistnumber'];
                    //默认模板
                    $ktemplatelist1 = $tpath . '/' . $tdefa;
                    $data['ktemplatelist1'] = is_file(ROOT . $ktemplatelist1) ? $ktemplatelist1 : '';
                    $data['ktemplatepage1'] = is_file(ROOT . $ktemplatelist1) ? $ktemplatelist1 : '';
                    $ktemplatelist2 = $tpath . '/inside/' . $model['modeltable'] . '[list]/' . $tdefa;
                    $data['ktemplatelist2'] = is_file(ROOT . $ktemplatelist2) ? $ktemplatelist2 : '';
                    $ktemplatepage2 = $tpath . '/inside/' . $model['modeltable'] . '[page]/' . $tdefa;
                    $data['ktemplatepage2'] = is_file(ROOT . $ktemplatepage2) ? $ktemplatepage2 : '';
            }
        }
    } else {
        //编辑数据,从数据库读出
        if (!($data = $king->db->getRows_one('select ' . $_sql . ' from %s_list where listid=' . $listid . ' limit 1;'))) {
            kc_error($king->lang->get('system/error/param') . '<br/>File:' . basename(__FILE__) . ';Line:' . __LINE__ . '<br/>' . $_sql);
        }
        if (isset($modelid[0])) {
            //当有URL形式指定的modelid的时候,比较一下,如果modelid值不同,则重新设置默认值
            if ($modelid != $data['modelid']) {
                if (!isset($data['klanguage'][0])) {
                    $data['klanguage'] = $_COOKIE['language'];
                }
                switch ($modelid) {
                    case 0:
                        //单页
                        $data['klistpath'] = "onepage/list{$line}{$listid}" . $king->config('rewriteend');
                        break;
                    case -1:
                        //超链
                        $data['klistpath'] = 'http://';
                        break;
                    default:
                        $data['klistpath'] = "list{$line}{$listid}{$line}PID" . $king->config('rewriteend');
                        if (!isset($data['kpathmode'][0])) {
                            $data['kpathmode'] = "page{$line}{$listid}{$line}ID" . $king->config('rewriteend');
                        }
                }
            }
        } else {
            $modelid = $data['modelid'];
        }
    }
    $fields = explode(',', $_sql);
    $data = kc_data($fields, $data);
    //这个必须要放在下面,不然无法正常获取modelid值
    $modeltable = isset($modeltables[$modelid]) ? $modeltables[$modelid] : '';
    $s = $king->openForm('manage.php?action=edt', $king->lang->get('portal/caption/basic'));
    ////modelid 选择模型
    if (!($res = $king->db->getRows("select modelid,modelname from %s_model"))) {
        $res = array();
    }
    $_array_select = array(0 => $king->lang->get('portal/label/onepage'), -1 => $king->lang->get('portal/label/hyperlink'));
    foreach ($res as $rs) {
        $_array_select += array($rs['modelid'] => $rs['modelname']);
    }
    if ($listid) {
        //如果是编辑列表,则不让修改栏目类型
        if (in_array($modelid, array(0, -1))) {
            //超链和单页允许修改类型
            $s .= $king->htmForm($king->lang->get('portal/label/model'), kc_htm_select('modelid', $_array_select, $modelid, ' onChange="jumpmenu(this);"'), null, 'modelid');
        } else {
            $s .= kc_htm_hidden(array('listid' => $listid));
            $s .= $king->htmForm($king->lang->get('portal/label/model'), '<select><option>' . $_array_select[$modelid] . '</option></select>', null, 'modelid');
        }
    } else {
        $s .= $king->htmForm($king->lang->get('portal/label/model'), kc_htm_select('modelid', $_array_select, $modelid, ' onChange="jumpmenu(this);"'), null, 'modelid', kc_help('portal/help/model', 320, 120));
    }
    $s .= '<script type="text/javascript">';
    $s .= 'function jumpmenu(obj){eval("parent.location=\'manage.php?action=edt&listid=' . $listid . '&modelid="+obj.options[obj.selectedIndex].value+"\'");}';
    $s .= '</script>';
    //listid1
    $s .= $king->htmForm($king->lang->get('portal/label/listid1'), $king->portal->LinkAge('listid1', $data['listid1'], 0, $listid), null, 'Listid1');
    //siteid
    if (!($res = $king->db->getRows("select siteid,sitename from %s_site;"))) {
        kc_error($king->lang->get('system/error/notre'));
    }
    $_array_select = array();
    foreach ($res as $rs) {
        $_array_select += array($rs['siteid'] => htmlspecialchars($rs['sitename']));
    }
    if ($modelid != -1) {
        if ($king->acc('portal_site_edt')) {
            $manage = '<a class="k_ajax" rel="{CMD:\'site\',is:1,METHOD:\'GET\'}">' . kc_icon('f7', $king->lang->get('portal/common/addsite')) . '</a>';
        }
        $s .= $king->htmForm($king->lang->get('portal/label/siteid'), kc_htm_select('siteid', $_array_select, $data['siteid']) . $manage, null, 'Siteid', kc_help('portal/help/site', 320, 150));
    } else {
        $s .= kc_htm_hidden(array('siteid' => $res[0]['siteid']));
    }
    $s .= "<script>function addsite(siteid,sitename){var site=document.getElementsByName('siteid');var opt=document.createElement('option');opt.innerHTML=sitename;opt.value=siteid;opt.selected='selected';site[0].appendChild(opt);};</script>";
    //klistname
    $_array = array(array('klistname', 0, 1, 100));
    $s .= $king->htmForm($king->lang->get('portal/label/listname') . ' (1-100)', '<input class="k_in w300" type="text" name="klistname" value="' . htmlspecialchars($data['klistname']) . '" maxlength="100" />', $_array, 'ListName');
    //ktitle
    $_array = array(array('ktitle', 0, 1, 100));
    $s .= $king->htmForm($king->lang->get('portal/label/listtitle') . ' (1-100, ' . $king->lang->get('portal/label/listtitle1') . ')', '<input class="k_in w300" type="text" name="ktitle" value="' . htmlspecialchars($data['ktitle']) . '" maxlength="100" />', $_array, 'ListTitle');
    //kkeywords
    $_array = array(array('kkeywords', 0, 0, 100));
    $s .= $king->htmForm($king->lang->get('system/common/keywords') . ' (0-100)', '<input class="k_in w400" type="text" name="kkeywords" value="' . htmlspecialchars($data['kkeywords']) . '" maxlength="100" />', $_array, 'Keywords');
    //kdescription
    $_array = array(array('kdescription', 0, 0, 255));
    $s .= $king->htmForm($king->lang->get('system/common/description') . ' (0-255)', '<textarea rows="4" cols="100" class="k_in w400" name="kdescription" maxlength="255" >' . htmlspecialchars($data['kdescription']) . '</textarea>', $_array, 'Description');
    //kimage
    if ($data['kimage']) {
        $_array = array(array('kimage', 0, 0, 255), array('kimage', 7));
    }
    $s .= $king->htmForm($king->lang->get('system/common/image') . ' (0-255)', '<input class="k_in w400" type="text" id="kimage" name="kimage" value="' . htmlspecialchars($data['kimage']) . '" maxlength="255" />' . kc_f_brow('kimage', $king->config('uppath') . '/image', 0), $_array, 'Image');
    //klanguage
    $s .= $king->htmForm($king->lang->get('system/common/language'), kc_htm_select('klanguage', kc_htm_selectlang(), $data['klanguage']), null, 'Language');
    //gid
    if ($modelid > 0) {
        $king->Load('user');
        $array_group = $king->user->getGroup();
        $array_group[-1] = $king->lang->get('user/group/open');
        $s .= $king->htmForm($king->lang->get('user/label/access'), kc_htm_select('gid', $array_group, $data['gid']), null, 'gid', kc_help('user/help/access'));
    }
    $s .= $king->splitForm($king->lang->get('portal/caption/list'));
    switch ($modelid) {
        case 0:
            //单页
            //nlist
            $s .= $king->htmForm($king->lang->get('portal/label/onetype'), kc_htm_select('nlist', $array_static, $data['nlist']));
            //klistpath
            $_array = array(array('klistpath', 0, 0, 255), array('klistpath', 15));
            //判断(编辑/添加)状态
            if ($listid) {
                //edt
                if (isset($data['klistpath'][0])) {
                    array_push($_array, array('klistpath', 12, $king->lang->get('system/check/none'), $king->db->getRows_one("select listid from %s_list where klistpath='" . $king->db->escape($data['klistpath']) . "' and listid<>{$listid} and modelid<>1;")));
                } else {
                    //如果是空值,则比较同一siteid下面是否有两个
                    array_push($_array, array('klistpath', 12, $king->lang->get('system/check/none'), $king->db->getRows_one("select listid from %s_list where klistpath='' and siteid=" . $king->db->escape($data['siteid']) . " and modelid=0 and listid<>{$listid};")));
                }
            } else {
                //add
                if (isset($data['klistpath'][0])) {
                    array_push($_array, array('klistpath', 12, $king->lang->get('system/check/none'), $king->db->getRows_one("select listid from %s_list where klistpath='" . $king->db->escape($data['klistpath']) . "' and modelid<>1;")));
                } else {
                    array_push($_array, array('klistpath', 12, $king->lang->get('system/check/none'), $king->db->getRows_one("select listid from %s_list where klistpath='' and siteid=" . $king->db->escape($data['siteid']) . " and modelid=0;")));
                }
            }
            if (in_array($modelid, array(0))) {
                //单页
                $s .= $king->htmForm($king->lang->get('portal/label/path') . ' (0-255)', '<input class="k_in w400" type="text" name="klistpath" value="' . htmlspecialchars($data['klistpath']) . '" maxlength="255" />', $_array, 'Path', kc_help('portal/help/path', 320, 120));
                //ktemplatelist1
                if ($modelid == 0) {
                    $_array = array(array('ktemplatelist1', 0, 5, 255), array('ktemplatelist1', 15));
                } else {
                    $_array = array();
                }
                $s .= $king->htmForm($king->lang->get('portal/label/template1') . ' (5-255)', '<input class="k_in w400" type="text" id="ktemplatelist1" name="ktemplatelist1" value="' . htmlspecialchars($data['ktemplatelist1']) . '" maxlength="255" />' . kc_f_brow('ktemplatelist1', $king->config('templatepath'), 2), $_array, null, kc_help('portal/help/template', 455, 455));
                //ktemplatelist2
                $_array = array(array('ktemplatelist2', 0, 0, 255), array('ktemplatelist2', 15));
                $s .= $king->htmForm($king->lang->get('portal/label/template2') . ' (0-255)', '<input class="k_in w400" type="text" id="ktemplatelist2" name="ktemplatelist2" value="' . htmlspecialchars($data['ktemplatelist2']) . '" maxlength="255" />' . kc_f_brow('ktemplatelist2', $king->config('templatepath') . '/inside/onepage', 2), $_array);
            }
            break;
        case -1:
            //超链
            //klistpath + islink
            $_array = array(array('klistpath', 0, 1, 255));
            $data['isblank'] == 1 ? $checked = ' checked="checked"' : ($checked = '');
            $s .= $king->htmForm($king->lang->get('portal/label/linkpath') . ' (1-255)', '<input class="k_in w500" type="text" name="klistpath" value="' . htmlspecialchars($data['klistpath']) . '" maxlength="255" /><br/><span><input type="checkbox" name="isblank" id="isblank" value="1" ' . $checked . '/><label for="isblank">' . $king->lang->get('portal/label/isblank') . '</label></span>', $_array, 'ListPath');
            break;
        default:
            //nlist
            if ($data['gid'] == -1) {
                $_array = array();
            } else {
                $_array = array(array('nlist', 12, $king->lang->get('user/check/access'), $data['nlist'] == 0));
            }
            $array_static_list = $array_static;
            $array_static_list[4] = $king->lang->get('portal/static/t4');
            $s .= $king->htmForm($king->lang->get('portal/label/nlist'), kc_htm_select('nlist', $array_static_list, $data['nlist']), $_array);
            //klistpath
            $_array = array(array('klistpath', 0, 1, 255), array('klistpath', 15));
            $s .= $king->htmForm($king->lang->get('portal/label/listpath') . ' (1-255)', '<input class="k_in w400" type="text" name="klistpath" value="' . htmlspecialchars($data['klistpath']) . '" maxlength="255" />', $_array, 'ListPath', kc_help('portal/help/listpath'));
            //ktemplatelist1
            $_array = array(array('ktemplatelist1', 0, 5, 255), array('ktemplatelist1', 15));
            $s .= $king->htmForm($king->lang->get('portal/label/templatelist1') . ' (5-255)', '<input class="k_in w400" type="text" name="ktemplatelist1" id="ktemplatelist1" value="' . htmlspecialchars($data['ktemplatelist1']) . '" maxlength="255" />', $_array, null, kc_f_brow('ktemplatelist1', $king->config('templatepath'), 2) . kc_help('portal/help/template', 455, 455));
            //ktemplatelist2
            $_array = array(array('ktemplatelist2', 0, 0, 255), array('ktemplatelist2', 15));
            $s .= $king->htmForm($king->lang->get('portal/label/templatelist2') . ' (0-255)', '<input class="k_in w400" type="text" name="ktemplatelist2" id="ktemplatelist2" value="' . htmlspecialchars($data['ktemplatelist2']) . '" maxlength="255" />', $_array, null, kc_f_brow('ktemplatelist2', $king->config('templatepath') . '/inside/' . $modeltable . '[list]', 2));
            //nlistnumber
            $_array = array(array('nlistnumber', 2), array('nlistnumber', 16, $king->lang->get('portal/error/listnumber'), 1, 100));
            $s .= $king->htmForm($king->lang->get('portal/label/listnumber') . ' (≤100)', '<input class="k_in w50" type="text" name="nlistnumber" id="nlistnumber" value="' . htmlspecialchars($data['nlistnumber']) . '" maxlength="3" />', $_array);
            $s .= $king->splitForm($king->lang->get('portal/caption/page'));
            //npage
            if ($data['gid'] == -1) {
                $_array = array();
            } else {
                $_array = array(array('npage', 12, $king->lang->get('user/check/access'), $data['npage'] == 0));
            }
            $s .= $king->htmForm($king->lang->get('portal/label/npage'), kc_htm_select('npage', $array_static, $data['npage']), $_array);
            //kpathmode
            $_array = array(array('kpathmode', 0, 1, 100), array('kpathmode', 15));
            $s .= $king->htmForm($king->lang->get('portal/label/pathmode') . ' (1-100)', '<input class="k_in w400" type="text" name="kpathmode" value="' . htmlspecialchars($data['kpathmode']) . '" maxlength="100" />', $_array, null, kc_help('portal/help/kpathmode', 300, 350));
            //ktemplatepage1
            $_array = array(array('ktemplatepage1', 0, 5, 255), array('ktemplatepage1', 15));
            $s .= $king->htmForm($king->lang->get('portal/label/templatepage1') . ' (5-255)', '<input class="k_in w400" type="text" name="ktemplatepage1" id="ktemplatepage1" value="' . htmlspecialchars($data['ktemplatepage1']) . '" maxlength="255" />', $_array, null, kc_f_brow('ktemplatepage1', $king->config('templatepath'), 2) . kc_help('portal/help/template', 455, 455));
            //ktemplatepage2
            $_array = array(array('ktemplatepage2', 0, 0, 255), array('ktemplatepage2', 15));
            $s .= $king->htmForm($king->lang->get('portal/label/templatepage2') . ' (0-255)', '<input class="k_in w400" type="text" name="ktemplatepage2" id="ktemplatepage2" value="' . htmlspecialchars($data['ktemplatepage2']) . '" maxlength="255" />', $_array, null, kc_f_brow('ktemplatepage2', $king->config('templatepath') . '/inside/' . $modeltable . '[page]', 2));
            //npagenumber
            $_array = array(array('npagenumber', 2), array('npagenumber', 16, $king->lang->get('portal/error/listnumber'), 1, 100));
            $s .= $king->htmForm($king->lang->get('portal/label/pagenumber') . ' (≤100)', '<input class="k_in w50" type="text" name="npagenumber" id="npagenumber" value="' . htmlspecialchars($data['npagenumber']) . '" maxlength="3" />', $_array, null, kc_help('portal/help/pagenumber', 300, 160));
    }
    if ($modelid > 0) {
        $s .= $king->splitForm($king->lang->get('portal/caption/access'));
        //gidpublish
        $_array = array(array('gidpublish', 0, 1, 6), array('gidpublish', 22));
        $s .= $king->htmForm($king->lang->get('user/label/publish'), kc_htm_select('gidpublish', $array_group, $data['gidpublish']), $_array, 'gidpublish');
        //ispublish1
        $_array_radio = array(0 => $king->lang->get('portal/label/pub0'), 1 => $king->lang->get('portal/label/pub1'), 2 => $king->lang->get('portal/label/pub2'));
        $s .= $king->htmForm($king->lang->get('portal/label/publish1'), kc_htm_radio('ispublish1', $_array_radio, $data['ispublish1']));
        //ispublish2
        $_array_radio = array(0 => $king->lang->get('portal/label/pub0'), 1 => $king->lang->get('portal/label/pub1'), 2 => $king->lang->get('portal/label/pub2'));
        $s .= $king->htmForm($king->lang->get('portal/label/publish2'), kc_htm_radio('ispublish2', $_array_radio, $data['ispublish2']));
    }
    $s .= $king->splitForm($king->lang->get('portal/caption/other'));
    if ($modelid != -1) {
        //iscontent
        $data['iscontent'] == 1 ? $checked = ' checked="checked"' : ($checked = '');
        $_checkbox = '<span><input type="checkbox" id="iscontent" name="iscontent" value="1" onclick="javascript:seiscontent()" ' . $checked . '/><label for="iscontent">' . $king->lang->get('portal/label/havecontent') . '</label><var><i onClick="window.clipboardData.setData(\'Text\',\'{king:content/}\');">{king:content/}</i></var></span>';
        //		$s.=$king->htmForm($_checkbox.$king->lang->get('system/common/content'),null,array(),'Content');
        //kcontent
        if ($data['iscontent'] == 1) {
            $_array = array(array('kcontent', 0), array('kcontent', 21));
        } else {
            $_array = array();
        }
        $s .= $king->htmForm($king->lang->get('system/common/content'), $_checkbox . '<div id="iscontent1">' . kc_htm_editor('kcontent', $data['kcontent']) . '</div>', $_array);
        $s .= "<script>";
        $s .= "function seiscontent(){var obj=\$('#iscontent');if(obj.attr('checked')==true){\$('#iscontent1').show();}else{\$('#iscontent1').hide()}};seiscontent();";
        $s .= "</script>";
    }
    //菜单设置
    $_menu = '<span>';
    for ($i = 1; $i <= 5; ++$i) {
        $data['ismenu' . $i] == 1 ? $checked = ' checked="checked"' : ($checked = '');
        if ($i >= 3) {
            $_menu .= '<br/><a href="manage.php?action=menu' . $i . '" target="_blank">' . kc_icon('e7', $king->lang->get('portal/common/edtmenu')) . '</a>';
        }
        $_menu .= '<input type="checkbox" name="ismenu' . $i . '" id="ismenu' . $i . '" value="1"' . $checked . '/><label for="ismenu' . $i . '">' . $king->lang->get('portal/label/menu' . $i) . '</label> ';
    }
    $_menu .= '</span>';
    $_menu .= '';
    $s .= $king->htmForm($king->lang->get('portal/label/setmenu'), $_menu);
    //地图显示设置
    $data['ismap'] == 1 ? $checked = ' checked="checked"' : ($checked = '');
    $s .= $king->htmForm($king->lang->get('portal/label/map'), '<span><input type="checkbox" name="ismap" id="ismap" value="1"' . $checked . '/><label for="ismap">' . $king->lang->get('portal/label/maps') . '</label></span>');
    $s .= kc_htm_hidden(array('modelid' => $modelid, 'listid' => $listid));
    $s .= $king->closeForm('save');
    if ($GLOBALS['ischeck']) {
        $_array_sql = array('isblank', 'iscontent', 'ismap');
        foreach ($_array_sql as $_value) {
            $data[$_value] = $data[$_value] ? 1 : 0;
        }
        for ($i = 1; $i <= 5; $i++) {
            $data['ismenu' . $i] = $data['ismenu' . $i] ? 1 : 0;
        }
        $_array = array('modelid' => $modelid ? $modelid : 0, 'listid1' => $data['listid1'], 'klistname' => $data['klistname'], 'ktitle' => $data['ktitle'], 'kkeywords' => $data['kkeywords'], 'kdescription' => $data['kdescription'], 'kimage' => $data['kimage'], 'ismenu1' => $data['ismenu1'], 'ismenu2' => $data['ismenu2'], 'ismenu3' => $data['ismenu3'], 'ismenu4' => $data['ismenu4'], 'ismenu5' => $data['ismenu5'], 'ismap' => $data['ismap'], 'siteid' => $data['siteid'], 'klanguage' => $data['klanguage'], 'klistpath' => $data['klistpath'], 'gid' => !empty($data['gid']) ? $data['gid'] : -1, 'gidpublish' => isset($data['gidpublish']) ? intval($data['gidpublish']) : -1);
        switch ($modelid) {
            case 0:
                //单页
                $_array += array('ktemplatelist1' => $data['ktemplatelist1'], 'ktemplatelist2' => $data['ktemplatelist2'], 'iscontent' => $data['iscontent'], 'kcontent' => $data['kcontent'], 'nlist' => $data['nlist']);
                break;
            case -1:
                //超链
                $_array['isblank'] = $data['isblank'];
                break;
            default:
                //自定义模型
                $_array += array('iscontent' => $data['iscontent'], 'kcontent' => $data['kcontent'], 'nlistnumber' => $data['nlistnumber'], 'npagenumber' => $data['npagenumber'], 'klistpath' => $data['klistpath'], 'ktemplatelist1' => $data['ktemplatelist1'], 'ktemplatelist2' => $data['ktemplatelist2'], 'kpathmode' => $data['kpathmode'], 'ktemplatepage1' => $data['ktemplatepage1'], 'ktemplatepage2' => $data['ktemplatepage2'], 'ispublish1' => $data['ispublish1'], 'ispublish2' => $data['ispublish2'], 'nlist' => $data['nlist'], 'npage' => $data['npage']);
        }
        if ($listid) {
            //update
            //			kc_error('<pre>'.print_r($_array,1));
            $king->db->update('%s_list', $_array, 'listid=' . $listid);
            $nlog = 7;
            //更新列表信息
            $king->portal->lastUpdated($listid);
        } else {
            $neworder = $king->db->neworder('%s_list');
            $_array += array('norder' => $neworder, 'norder3' => $neworder, 'norder4' => $neworder, 'norder5' => $neworder);
            $listid = $king->db->insert('%s_list', $_array);
            //			kc_error('<pre>'.print_r($_array,1));
            $nlog = 5;
        }
        //删除缓存
        $king->cache->del('portal/list/' . $listid);
        $king->cache->rd('portal/site');
        if ($data['listid1']) {
            $king->cache->del('portal/list/' . $data['listid1']);
        }
        //单页的时候调用生成列表,列表的时候,加入到增量更新里
        /**/
        if ($modelid == 0) {
            $king->portal->createList($listid);
        }
        /**/
        //写log
        $king->log($nlog, 'ListName:' . $data['klistname']);
        kc_goto($king->lang->get('system/goto/is'), 'manage.php?action=edt', 'manage.php');
    }
    list($left, $right) = king_inc_list();
    $king->skin->output($king->lang->get('portal/title/list' . ($listid ? 'edt' : 'add')), $left, $right, $s);
}