/**
 	属性转换为数组
 	@param string $s    属性 listid="1" type="list"
 	@param array  $ass  assign数组
 */
 private function attrib2array($s, $ass = null)
 {
     if ($ass) {
         //替换内部标签
         $this->tempArray = $ass;
         $s = preg_replace_callback('%\\(((\\w+):(\\w+))([^)]*)/\\)%s', array(&$this, 'attribBack'), $s);
         $this->tempArray = array();
     }
     preg_match_all('/([\\w\\-!]+)=(["\'])(.*?)\\2/s', $s, $array, PREG_SET_ORDER);
     $newArray = array();
     if ($array) {
         foreach ($array as $val) {
             $key = strtolower($val[1]);
             if ($key == 'replace') {
                 //支持多个replace功能
                 list($k, $v) = kc_explode('|', $val[3], 2);
                 $newArray['replace'][$k] = $v;
             } else {
                 $newArray[$key] = $val[3];
             }
         }
     }
     return $newArray;
 }
Exemple #2
0
function king_ajax_logout()
{
    global $king;
    $king->access(0);
    $king->cache->del('system/admin/' . $king->admin['adminname']);
    //写注销log
    list($_name, $_pass) = isset($_COOKIE['KingCMS_Admin']) ? kc_explode("\t", $_COOKIE['KingCMS_Admin'], 2) : array(NULL, NULL);
    $king->log(3, $_name);
    header('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTR STP IND DEM"');
    setcookie('KingCMS_Admin', $_name, -864000, '/');
    kc_ajax('', '', 0, 'parent.location=\'../system/login.php\'');
}
Exemple #3
0
 /**
 	返回htm标签
 	@param string $_label       Label标签中的内容
 	@param string $_htmlcode    表单的主体内容
 	@param array  $_arraycheck  表单验证,详见kc_check()
 	@param string $_tag         表单对应的KingCMS标签
 	@param string $_help        帮助
 	@return string
 */
 public function htmForm($_label = null, $_htmlcode = null, $_arraycheck = null, $_tag = null, $_help = null)
 {
     if ($this->config('htmlframe' . $this->isMng) == 1 && !in_array($GLOBALS['action'], array('ajax', 'iframe'))) {
         //1代表的是table结构
         $s = '<tbody><tr>';
         if (!empty($_label)) {
             $s .= '<th>';
             preg_match_all("/^([^\\(]+)((\\(.*\\))?)\$/", $_label, $_label_array, PREG_PATTERN_ORDER);
             //拆分标题和提示内容
             $s .= $_label_array[1][0];
             $s .= '</th>';
         } else {
             $s .= "<th>&nbsp;</th>";
         }
         $s .= '<td>';
         $s_tag = '';
         if ($this->isMng) {
             if ($this->admin['adminmode'] == 2) {
                 if (isset($_tag[0])) {
                     $array = explode(',', $_tag);
                     $s_tag .= ' <var>';
                     foreach ($array as $val) {
                         list($prefix, $name) = substr($val, 0, 7) == 'config.' ? explode('.', $val, 2) : array($val, '');
                         /*
                         						if(substr($val,0,7)=='config.'){
                         							$kctag='{config:'.$name.'/}';
                         						}else{
                         							$kctag='{king:'.$val.'/}';
                         						}
                         */
                         $kctag = $prefix == 'config' ? '{config:' . $name . '/}' : '{king:' . $val . '/}';
                         $s_tag .= '<i title="' . $this->lang->get('system/common/tag') . ':{king:' . $val . '/}" onClick="window.clipboardData.setData(\'Text\',\'' . $kctag . '\');">' . $kctag . '</i>';
                     }
                     $s_tag .= '</var>';
                 }
             }
         }
         $s .= '<table class="k_side" cellspacing="0"><tr><td>';
         $s .= $_htmlcode;
         if ($_arraycheck) {
             $s .= kc_check($_arraycheck);
         }
         $s .= '</td>';
         $s .= isset($_help[0]) ? "<td>{$_help}</td>" : '';
         $s .= isset($s_tag[0]) ? "<td>{$s_tag}</td>" : '';
         $s .= '</tr></table>';
         $s .= '</td></tr></tbody>';
     } else {
         $s = isset($_label[0]) ? '<div class="k_htm">' : '<div class="k_htm_in">';
         if ($_label) {
             $s .= '<label>' . $_label;
         }
         if ($this->isMng && isset($_tag[0])) {
             if ($this->admin['adminmode'] == 2) {
                 $array = explode(',', $_tag);
                 $s .= ' <var>';
                 foreach ($array as $val) {
                     list($prefix, $name) = kc_explode('.', $val, 2);
                     /*
                     					strtolower($prefix)=='config'
                     						? $kctag='{const:'.$name.'/}'
                     						: $kctag='{king:'.$val.'/}';
                     */
                     $kctag = $prefix == 'config' ? '{config:' . $name . '/}' : '{king:' . $val . '/}';
                     $s .= '<i title="' . $this->lang->get('system/common/tag') . ':{king:' . $val . '/}" onClick="window.clipboardData.setData(\'Text\',\'' . $kctag . '\');">' . $kctag . '</i>';
                 }
                 $s .= '</var>';
             }
         }
         if ($_label) {
             $s .= '</label>';
         }
         $s .= '<p>';
         if (isset($_help[0])) {
             //			$s.='<table class="k_side" cellspacing="0"><tr><td>';
             $s .= $_htmlcode;
             //			$s.='</td><td>';
             $s .= "<tt>{$_help}</tt>";
             if ($_arraycheck) {
                 $s .= kc_check($_arraycheck);
             }
             //			$s.='</td></tr></table>';
         } else {
             $s .= $_htmlcode;
             if ($_arraycheck) {
                 $s .= kc_check($_arraycheck);
             }
         }
         $s .= '</p></div>';
     }
     return $s;
 }
Exemple #4
0
 /**
 	tab转换为数组类型,用在标签解析
 	@param string $s    文本
 	@param string $type 类型
 		images
 		files
 	@return
 */
 private function tab2array($s, $type)
 {
     if (empty($s)) {
         return false;
     }
     global $king;
     $_array = explode("\t\t", $s);
     $title = '';
     $value = '';
     $array = array();
     foreach ($_array as $key => $val) {
         list($value, $title) = kc_explode("\t", $val, 2);
         switch ($type) {
             case 'images':
                 $array[] = array('title' => $title, 'image' => $value);
                 break;
             case 'files':
                 $array[] = array('title' => $title, 'file' => kc_validate($value, 6) ? $value : $king->config('inst') . $value);
                 break;
         }
     }
     return $array;
 }