/** 右侧列表 */ 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"> Image</th>' : ''; $s .= "<th class=\"l line\"> FileName</th><th class=\"line r\">Size </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); }
function king_def() { global $king; $sel_array = array('mysql' => 'MySQL', 'sqlite' => 'SQLite'); $phpself = $_SERVER['PHP_SELF']; $inst = substr($phpself, 0, strlen($phpself) - 11); //安装目录 $select_type = kc_htm_radio('dbtype', $sel_array, 'sqlite'); //数据库类型 $array_dirs = array('config.php', 'system/js'); $array_func = array('mysql_connect', 'file_get_contents', 'file_put_contents', 'simplexml_load_file'); //,'fsockopen' $s = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r\n<title>" . $king->lang->get('system/install/title') . "</title>\r\n<link href=\"system/skins/default/style.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n<style type=\"text/css\">\r\n.k_table_form{font-size:12px;}\r\n.k_table_form th{width:200px;color:#000;font-weight:normal;text-indent:5px;padding:5px;}\r\n.k_table_form td{text-indent:5px;}\r\n</style>\r\n<meta name=\"generator\" content=\"KingCMS\"/>\r\n<script type=\"text/javascript\" src=\"system/js/jquery.js\"></script>\r\n<script type=\"text/javascript\" src=\"system/js/jquery.kc.js\"></script>\r\n<script type=\"text/javascript\" src=\"system/skins/default/fun.js\"></script>\r\n<script type=\"text/javascript\">\r\njQuery(function(\$){\r\n\r\n\t\$(\"#k_dbtype_mysql , #k_dbtype_sqlite\").click(function(){\$.ck_radio(this)});\r\n\r\n\t\$.ck_radio=function(obj){\r\n\t\tif(\$(obj).attr('id')=='k_dbtype_mysql'){\r\n\t\t\t\$('.mysql').show();\r\n\t\t\t\$('.sqlite').hide();\r\n\r\n\t\t}else{\r\n\t\t\t\$('.sqlite').show();\r\n\t\t\t\$('.mysql').hide();\r\n\t\t\r\n\t\t}\r\n\t}\r\n\r\n});\r\n\r\n</script>\r\n</head>\r\n<body>\r\n<div id=\"k_ajax\"></div>\r\n<div id=\"top\">\r\n\t<a id=\"logo\" href=\"http://www.kingcms.com\" target=\"_blank\"><img alt=\"KingCMS\" src=\"system/skins/default/logo.gif\"/></a>\r\n\t<ul class=\"k_menu\">\r\n\t\t<li><a href=\"INSTALL.php\">" . $king->lang->get('system/common/install') . "</a></li>\r\n\t\t<li><a href=\"javascript:;\">" . $king->lang->get('system/common/language') . "</a>\r\n\r\n\t\t\t\t<ul>"; //language $array = kc_f_getdir('system/language', 'xml'); $array = array_map('kc_f_name', $array); $_language = kc_cookie('language'); foreach ($array as $val) { $s .= '<li><a href="javascript:;" class="k_ajax" rel="{CMD:\'language\',lang:\'' . $val . '\'}">'; if ($_language == $val) { $s .= '• '; } $s .= kc_getlang($val) . '</a></li>'; } $s .= "</ul>\r\n\t\t</li>\r\n\t</ul>\r\n</div>\r\n<div id=\"main\">\r\n\r\n\r\n<table class=\"w0\"><tr><td style=\"vertical-align:top;\" class=\"w10\">\r\n\t<form name=\"form_install\" id=\"form_install\">\r\n\t<h3 class=\"caption\">" . $king->lang->get('system/install/db') . "</h3>\r\n\t<table class=\"k_table_form\" cellspacing=\"0\">\r\n\t\t<tbody><tr><th>" . $king->lang->get('system/install/dbtype') . "</th><td>{$select_type}</td></tr></tbody>\r\n\t\t<tr><th>" . $king->lang->get('system/install/pre') . "</th><td><input id=\"pre\" name=\"pre\" class=\"k_in w200\" value=\"king\"/></td></tr>\r\n\t\t<tr><th>" . $king->lang->get('system/install/preadmin') . "</th><td><input id=\"preadmin\" name=\"preadmin\" class=\"k_in w200\" value=\"kc\"/></td></tr>\r\n\r\n\t\t<tr class=\"mysql none\"><th>" . $king->lang->get('system/install/dbhost') . "</th><td><input id=\"host\" name=\"host\" class=\"k_in w200\" value=\"localhost\"/></td></tr>\r\n\t\t<tr class=\"mysql none\"><th>" . $king->lang->get('system/install/dbdata') . "</th><td><input id=\"data\" name=\"data\" class=\"k_in w200\" value=\"test\"/></td></tr>\r\n\t\t<tr class=\"mysql none\"><th>" . $king->lang->get('system/install/dbuser') . "</th><td><input id=\"user\" name=\"user\" class=\"k_in w200\" value=\"root\"/></td></tr>\r\n\t\t<tr class=\"mysql none\"><th>" . $king->lang->get('system/install/dbpass') . "</th><td><input id=\"pass\" name=\"pass\" class=\"k_in w200\" value=\"\"/></td></tr>\r\n\r\n\t\t<tr class=\"sqlite\"><th>" . $king->lang->get('system/install/dbfile') . "</th><td><input id=\"sqlitedata\" name=\"sqlitedata\" class=\"k_in w200\" value=\"" . kc_random(12) . ".db3\"/></td></tr>\r\n\t</table>\r\n\r\n\t<h3 class=\"caption\">" . $king->lang->get('system/install/admin') . "</h3>\r\n\t<table class=\"k_table_form\" cellspacing=\"0\">\r\n\t\t<tbody><tr><th>" . $king->lang->get('system/install/adminname') . "</th><td><input id=\"adminname\" name=\"adminname\" class=\"k_in w200\" value=\"admin\"/></td></tr></tbody>\r\n\t\t<tr><th>" . $king->lang->get('system/install/adminpass') . "</th><td><input id=\"adminpass\" name=\"adminpass\" class=\"k_in w200\" value=\"admin888\"/></td></tr>\r\n\t</table>\r\n\r\n\t<h3 class=\"caption\">" . $king->lang->get('system/level/config') . "</h3>\r\n\t<table class=\"k_table_form\" cellspacing=\"0\">\r\n\t\t<tbody><tr><th>" . $king->lang->get('system/install/cache') . "</th><td><input id=\"cache\" name=\"cache\" class=\"k_in w200\" value=\"_cache\"/></td></tr></tbody>\r\n\r\n\t\t<tr><th>" . $king->lang->get('system/const/inst') . "</th><td><input id=\"inst\" name=\"inst\" class=\"k_in w100\" value=\"{$inst}\"/></td></tr>\r\n\t\t<tr><th>" . $king->lang->get('system/install/timediff') . "</th><td><input id=\"timediff\" name=\"timediff\" class=\"k_in w100\"/></td></tr>\r\n\t\t<tr><th>" . $king->lang->get('system/install/debug') . "</th><td><input id=\"debug\" value=\"1\" name=\"debug\" type=\"checkbox\" checked=\"checked\"/><label for=\"debug\">" . $king->lang->get('system/install/opendebug') . "</label></td></tr>\r\n\t</table>\r\n\r\n\t<script type=\"text/javascript\">\r\n\tvar dateObj = new Date();\r\n\tvar timediff=" . date('G', 0) . ";\r\n\t\$('#timediff').val(timediff);\r\n\t</script>\r\n\r\n\t<p>\r\n\t\t<input value=\"1\" id=\"license\" name=\"license\" type=\"checkbox\"/><label for=\"license\">" . $king->lang->get('system/install/readlicense') . "</label>\r\n\t\t[<a href=\"http://www.kingcms.com/license/\" target=\"_blank\">" . $king->lang->get('system/install/license') . "</a>]\r\n\t</p>\r\n\t\t<input value=\"1\" id=\"isdelete\" name=\"isdelete\" type=\"checkbox\" checked=\"checked\"/><label for=\"isdelete\">" . $king->lang->get('system/install/isdelete') . "</label>\r\n\t<p>\r\n\r\n\t</p>\r\n\r\n\t<p class=\"k_submit\">\r\n\r\n\t\t<input value=\"" . $king->lang->get('system/common/install') . "[S]\" class=\"k_ajax big\" rel=\"{CMD:'config',FORM:'form_install'}\" type=\"button\" accesskey=\"s\"/>\r\n\r\n\t</p>\r\n\t</form>\r\n</td><td class=\"w1\" style=\"vertical-align:top;\"></td><td>\r\n\r\n\t<h3 class=\"caption\">" . $king->lang->get('system/skin/sys') . "</h3>\r\n\t<table class=\"k_table_list\" cellspacing=\"0\">\r\n\t<tr><th class=\"w10\">" . $king->lang->get('system/skin/obj') . "</th><th class=\"w5\">" . $king->lang->get('system/skin/required') . "</th><th class=\"w5\">" . $king->lang->get('system/skin/this') . "</th></tr>"; $s .= '<tr><td>' . $king->lang->get('system/skin/os') . '</td><td>ALL</td><td>' . PHP_OS . '</td></tr>'; $s .= '<tr><td>' . $king->lang->get('system/skin/phpver') . '</td><td>5.1.0+</td><td>' . PHP_VERSION . '</td></tr>'; if (function_exists('disk_free_space')) { $s .= '<tr><td>' . $king->lang->get('system/skin/diskspace') . '</td><td>>2 Mb</td><td>' . kc_f_size(disk_free_space('./')) . '</td></tr>'; } $s .= "</table>\r\n\t<h3 class=\"caption\">" . $king->lang->get('system/skin/writeinfo') . "</h3>\r\n\t<table class=\"k_table_list\" cellspacing=\"0\">\r\n\t<tr><th class=\"w10\">" . $king->lang->get('system/skin/filedir') . "</th><th class=\"w5\">" . $king->lang->get('system/skin/required') . "</th><th class=\"w5wgfv -k07-87;[yu'pbv9io/h9;'99999\">" . $king->lang->get('system/skin/this') . "</td></tr>"; foreach ($array_dirs as $val) { $s .= '<tr><td>' . $val . '</td><td>' . $king->lang->get('system/skin/write/w1') . '</td><td>' . $king->lang->get('system/skin/write/w' . (is_writable(ROOT . $val) ? 1 : 0)) . '</td></tr>'; } $s .= "</table>\r\n\t<h3 class=\"caption\">" . $king->lang->get('system/skin/func') . "</h3>\r\n\t<table class=\"k_table_list\" cellspacing=\"0\">\r\n\t<tr><th class=\"w10\">" . $king->lang->get('system/skin/funs') . "</th><th class=\"w5\">" . $king->lang->get('system/skin/required') . "</th><th class=\"w5\">" . $king->lang->get('system/skin/this') . "</th></tr>"; foreach ($array_func as $val) { $s .= '<tr><td>' . $val . '()</td><td>' . $king->lang->get('system/skin/fun/f1') . '</td><td>' . $king->lang->get('system/skin/fun/f' . (function_exists($val) ? 1 : 0)) . '</td></tr>'; } $s .= "</table>\r\n\t<h3 class=\"caption\">" . $king->lang->get('system/skin/other') . "</h3>\r\n\t<table class=\"k_table_list\" cellspacing=\"0\">\r\n\t"; $s .= "<tr><th class=\"w10 red\">" . $king->lang->get('system/skin/obj') . "</th><th class=\"w5 red\">" . $king->lang->get('system/skin/advice') . "</th><th class=\"w5 red\">" . $king->lang->get('system/skin/this') . "</th></tr>\r\n\t<tr><td>" . $king->lang->get('system/skin/browser') . "</td><td>IE 7.0</td><td>" . kc_browser() . "</td></tr>\r\n\t<tr><td>" . $king->lang->get('system/skin/safemode') . "</td><td>--</td><td>" . $king->lang->get('system/skin/open/o' . (ini_get('safe_mode') ? 1 : 0)) . "</td></tr>\r\n\t<tr><td>" . $king->lang->get('system/skin/maxetime') . "</td><td>--</td><td>" . ini_get('max_execution_time') . "s</td></tr>\r\n\t</table>\r\n\r\n\t<p><img class=\"f6 os\" src=\"system/images/white.gif\"/><a href=\"http://www.kingcms.com/\" class=\"k_ajax\" rel=\"{CMD:'repass',METHOD:'GET'}\">" . $king->lang->get('system/install/resetpass') . "</a></p>\r\n\t<p><img class=\"j2 os\" src=\"system/images/white.gif\"/><a href=\"http://www.kingcms.com/\" class=\"k_ajax\" rel=\"{CMD:'delete'}\">" . $king->lang->get('system/install/delfile') . "</a></p>\r\n\t<p><img class=\"n1 os\" src=\"system/images/white.gif\"/><a href=\"system/login.php\">" . $king->lang->get('system/install/login') . "</a></p>\r\n\r\n</td></tr></table>\r\n\r\n</div>\r\n</body>\r\n</html>"; exit($s); }
/** 重命名文件或文件夹 */ function king_ajax_rename() { global $king; $king->access('webftp_rename'); $isdir = kc_post('isdir', 2, 1); $path = kc_post('path'); $file = kc_post('file', 0, 1); $id = kc_post('id'); $new = kc_post($id); if (!kc_validate($new, '/^[A-Za-z0-9\\.\\_]+$/')) { kc_ajax('', kc_icon('a1'), '', "alert('" . $king->lang->get('webftp/error/newname') . "')"); } kc_f_rename($path . $file, $path . $new); $s = "<a rel=\"{CMD:'right',path:'{$path}{$new}/',ID:'ftp_root',leftopen:1,IS:2}\" class=\"k_ajax\" href=\"javascript:;\">{$new}</a>"; $js = ''; $oldID = 'k_brow_right_' . _path2id($path . $file); $newID = 'k_brow_right_' . _path2id($path . $new); if ($isdir) { //目录 //在原有的项目下面添加一个新的,并在下面中删除掉老的 $js .= "\$('#{$oldID}').after(iii('b1','{$path}','{$new}','--','" . kc_formatdate(kc_f_mtime($path . $new)) . "'));"; } else { $js .= "\$('#{$oldID}').after(iii('" . kc_f_ico($new) . "','{$path}','{$new}','" . kc_f_size(kc_f_filesize($path . $new)) . "','" . kc_formatdate(kc_f_mtime($path . $new)) . "'));"; } $js .= "\$.kc_ready('#{$newID}');"; $js .= "\$('#{$oldID}').remove();"; $cachepath = "system/filemanage/{$path}index"; $king->cache->del($cachepath); //清理缓存 $js .= "\$.kc_close();"; kc_ajax('', '', '', $js); }