function doSave() { $uid = (int) $_POST['uid']; $info = array(); if ($_POST['pwd'] || $_POST['pwd1'] || $_POST['pwd2']) { $pwd = md5(trim($_POST['pwd'])); $pwd1 = md5(trim($_POST['pwd1'])); $pwd2 = md5(trim($_POST['pwd2'])); if (!$_POST['pwd'] || !$_POST['pwd1'] || !$_POST['pwd2']) { javascript::alert("修改密码.原密码,新密码,确认密码不能为空"); } $pwd != $user['password'] && javascript::alert("原密码错误!"); $pwd1 != $pwd2 && javascript::alert("新密码与确认密码不一致!"); iCMS_DB::query("UPDATE `#iCMS@__members` SET `password` = '{$pwd2}' WHERE `uid` ='{$uid}' LIMIT 1"); } // $username=dhtmlspecialchars($_POST['name']); $_POST['email'] && !eregi("^([_\\.0-9a-z-]+)@([0-9a-z][0-9a-z-]+)\\.([a-z]{2,6})\$", $_POST['email']) && javascript::alert("E-mail格式错误!!"); $email = stripslashes($_POST['email']); $gender = intval($_POST['gender']); $info['nickname'] = dhtmlspecialchars(stripslashes($_POST['nickname'])); cstrlen($info['nickname']) > 12 && javascript::alert("昵称长度大于12"); $info['icq'] = intval($_POST['icq']); $info['home'] = dhtmlspecialchars(stripslashes($_POST['home'])); $info['year'] = intval($_POST['year']); $info['month'] = intval($_POST['month']); $info['day'] = intval($_POST['day']); $info['from'] = dhtmlspecialchars(stripslashes($_POST['from'])); $info['signature'] = dhtmlspecialchars(stripslashes($_POST['signature'])); $user['info'] = $info; iCMS_DB::query("UPDATE `#iCMS@__members` SET `info` = '" . addslashes(serialize($user['info'])) . "',`email`='{$email}',`gender`='{$gender}' WHERE `uid` ='{$uid}' LIMIT 1"); javascript::dialog('用户编辑完成!', 'url:' . __SELF__ . '?mo=user&do=manage'); }
function doSave() { $id = (int) $_POST['id']; $name = dhtmlspecialchars($_POST['name']); $table = dhtmlspecialchars($_POST['table']); $description = dhtmlspecialchars($_POST['desc']); $position2 = $_POST['pos']; $position = $_POST['position']; $binding = isset($_POST['binding']) ? 1 : 0; empty($name) && javascript::alert('模块名称不能为空!'); empty($table) && $binding && javascript::alert('模块名不能为空!'); if (!$binding && empty($id)) { if (empty($table)) { include iPATH . 'include/cn.class.php'; $table = CN::pinyin($name); } $table = $table . '_content'; } if ($id) { iCMS_DB::getValue("SELECT `id` FROM `#iCMS@__model` where `table` = '{$table}' and `id`!='{$id}'") && javascript::alert('该模块已经存在!请检查是否重复'); iCMS_DB::query("UPDATE `#iCMS@__model` SET `name` = '{$name}', `table` = '{$table}', `binding` = '{$binding}', `description` = '{$description}', `position` = '{$position}', `position2` = '{$position2}' WHERE `id` = '{$id}';"); } else { iCMS_DB::query("INSERT INTO `#iCMS@__model`(`name`, `table`, `binding`, `description`, `position`,`position2`, `addtime`)VALUES ('{$name}', '{$table}', '{$binding}', '{$description}', '{$position}','{$position2}', '" . time() . "');"); $id = iCMS_DB::$insert_id; } model::cache(); $moreaction = array(array("text" => "下一步添加字段", "url" => __SELF__ . "?mo=models&do=addfield&id=<?php echo {$id};?>"), array("text" => "返回模块列表", "url" => __SELF__ . "?mo=models&do=manage")); javascript::dialog('模块添加完成!<br />10秒后返回模块列表', "url:" . __SELF__ . "?mo=models&do=manage", $moreaction, 10); }
function doStatus() { $id = intval($_GET['id']); $act = intval($_GET['act']); iCMS_DB::query("UPDATE `#iCMS@__advertise` SET `status` = '{$act}' WHERE `id` ='{$id}'"); $this->create($id); javascript::dialog("操作完成!", 'url:1'); }
function doUpdate() { foreach ($_POST as $key => $value) { updateConfig(dhtmlspecialchars($value), $key); } CreateConfigFile(); javascript::dialog('配置已更新!'); }
function doEdit() { $defArray['source'] = explode("\r\n", dhtmlspecialchars($_POST['source'])); $defArray['author'] = explode("\r\n", dhtmlspecialchars($_POST['author'])); $defArray['editor'] = explode("\r\n", dhtmlspecialchars($_POST['editor'])); $this->iCMS->setCache('system/default', $defArray, 0); javascript::dialog('编辑完成!<br />3秒后返回', 'url:' . __SELF__ . '?mo=defaults'); }
function dostatus0() { empty($_POST['id']) && javascript::dialog("请选择要操作的评论!"); foreach ($_POST['id'] as $k => $id) { $indexId = $_POST['indexId'][$id]; iCMS_DB::query("UPDATE `#iCMS@__comment` SET `status` = '0' WHERE `id` ='{$id}'"); iCMS_DB::query("UPDATE `#iCMS@__article` SET `comments` = comments-1 WHERE `id` ='{$indexId}'"); } javascript::dialog("取消审核!", "url:0"); }
function doSave() { strpos($_POST['tplpath'], '..') !== false && javascript::alert("文件路径不能带有.."); preg_match("/\\.([a-zA-Z0-9]{2,4})\$/", $_POST['tplpath'], $exts); $FileExt = strtolower($exts[1]); strstr($FileExt, 'ph') && javascript::alert("文件格式错误!"); in_array($FileExt, array('cer', 'htr', 'cdx', 'asa', 'asp', 'jsp', 'aspx', 'cgi')) && javascript::alert("文件格式错误!"); $FileData = stripslashes($_POST['html']); FS::write(iPATH . 'templates' . $_POST['tplpath'], $FileData); javascript::dialog('保存成功!', 'url:' . __SELF__ . $_POST['REFERER']); }
function doEdit() { $disable = explode("\r\n", dhtmlspecialchars($_POST['disable'])); $filter = explode("\r\n", dhtmlspecialchars($_POST['filter'])); foreach ($filter as $k => $val) { $filterArray[$k] = explode("=", $val); } $this->iCMS->setCache('system/word.filter', $filterArray, 0); $this->iCMS->setCache('system/word.disable', $disable, 0); javascript::dialog('更新完成!<br />3秒后返回', 'url:' . __SELF__ . '?mo=filter'); }
function dodelete() { if (isset($_POST['delete'])) { foreach ($_POST['delete'] as $k => $id) { iCMS_DB::query("DELETE FROM `#iCMS@__plugins_message` WHERE `id` ='{$id}'"); $js[] = '#mid' . $id; } javascript::dialog('全部成功删除!', 'js:parent.$("' . implode(',', $js) . '").remove();parent.iCMS.closeDialog();'); } else { javascript::alert("请选择要删除的留言!"); } }
function doAdd() { $this->init(); $name = dhtmlspecialchars($_POST['name']); $type = dhtmlspecialchars($_POST['type']); $val = intval($_POST['val']); $end = end($this->array); $id = $end['id'] + 1; $this->array[$id] = array('id' => $id, 'name' => $name, 'type' => $type, 'val' => $val); $this->iCMS->setCache('system/contentype', $this->array, 0); javascript::dialog('添加完成!<br />3秒后返回', 'url:' . __SELF__ . '?mo=contentype'); }
function doUpdate() { include_once iPATH . 'include/forum.class.php'; if ($_POST['forum']) { $forum = new forum(); $forum->cache(); } if ($_POST['adm']) { include_once iPATH . 'admin/advertise.mo.php'; $rs = iCMS_DB::getArray("SELECT * FROM `#iCMS@__advertise`", OBJECT); $_count = count($rs); for ($i = 0; $i < $_count; $i++) { adm($rs[$i]); } } $_POST['tpl'] && $this->iCMS->clear_compiled_tpl(); $_POST['iCMS_list'] && FS::rmdir(iPATH . 'cache/list'); $_POST['iCMS_forum'] && FS::rmdir(iPATH . 'cache/forum'); $_POST['iCMS_tag'] && FS::rmdir(iPATH . 'cache/tags'); if ($_POST['iCMS_ALL']) { FS::rmdir(iPATH . 'cache/list'); FS::rmdir(iPATH . 'cache/forum'); FS::rmdir(iPATH . 'cache/tags'); } $_POST['keywords'] && keywords_cache(); $_POST['tags'] && tags_cache(); if ($_POST['model']) { include iPATH . 'include/model.class.php'; model::cache(); } $_POST['field'] && field_cache(); $_POST['config'] && CreateConfigFile(); if ($_POST['Re-Article-Count']) { $rs = iCMS_DB::getArray("SELECT fid FROM `#iCMS@__forum`"); $_count = count($rs); for ($i = 0; $i < $_count; $i++) { $c = iCMS_DB::getValue("SELECT count(*) FROM #iCMS@__article where `fid`='" . $rs[$i]['fid'] . "' LIMIT 1 "); iCMS_DB::query("UPDATE `#iCMS@__forum` SET `count` ='{$c}' WHERE `fid` ='" . $rs[$i]['fid'] . "' LIMIT 1 "); } } if ($_POST['Re-Tag-Count']) { include_once iPATH . 'include/forum.class.php'; $rs = iCMS_DB::getArray("SELECT id FROM `#iCMS@__tags`"); $_count = count($rs); for ($i = 0; $i < $_count; $i++) { $_count = iCMS_DB::getValue("SELECT count(*) FROM `#iCMS@__taglist` WHERE `tid`='" . $rs[$i]['id'] . "'"); iCMS_DB::query("UPDATE `#iCMS@__tags` SET `count` = '{$_count}' WHERE `id` ='" . $rs[$i]['id'] . "'"); tags_cache($rs[$i]['id']); } } javascript::dialog("执行完毕!", 'url:1'); }
function doEdit() { foreach ($_POST['name'] as $id => $value) { iCMS_DB::query("update `#iCMS@__group` set `name`='{$value}',`order`='" . $_POST['order'][$id] . "' where `gid`='{$id}'"); } if ($_POST['addnewname']) { iCMS_DB::query("INSERT INTO `#iCMS@__group`(`gid`,`name`,`order`,`power`,`cpower`,`type`) VALUES (NULL,'" . $_POST['addnewname'] . "','" . $_POST['addneworder'] . "','','','" . $_POST['type'] . "')"); javascript::dialog('添加完成!', 'url:1'); exit; } javascript::dialog('更新完成!', 'url:1'); //_Header(); }
function dosave() { $id = (int) $_POST['id']; $keyword = dhtmlspecialchars($_POST['keyword']); $replace = preg_replace("'<p>(.*?)<\\/p>'si", '\\1', $_POST['replace']); if (empty($id)) { iCMS_DB::query("INSERT IGNORE INTO `#iCMS@__keywords`(`keyword`,`replace`,`addtime`,`status`) values ('{$keyword}','{$replace}','" . time() . "','1')"); } else { iCMS_DB::query("update `#iCMS@__keywords` set `keyword`='{$keyword}',`replace`='{$replace}' where id='{$id}'"); } keywords_cache(); javascript::dialog('操作完成!', 'url:' . __SELF__ . '?mo=keywords'); }
function dosetting() { $gender = intval($_POST['gender']); $nickname = dhtmlspecialchars($_POST['nickname']); $info['icq'] = intval($_POST['icq']); $info['home'] = dhtmlspecialchars(stripslashes($_POST['home'])); $info['year'] = intval($_POST['year']); $info['month'] = intval($_POST['month']); $info['day'] = intval($_POST['day']); $info['from'] = dhtmlspecialchars(stripslashes($_POST['from'])); $info['signature'] = dhtmlspecialchars(stripslashes($_POST['signature'])); iCMS_DB::query("UPDATE `#iCMS@__members` SET `info` = '" . addslashes(serialize($info)) . "',`nickname`='{$nickname}',`gender`='{$gender}' WHERE `uid` ='" . member::$uId . "' LIMIT 1"); javascript::dialog("资料修改完成!"); }
function doSave() { $sortid = (int) $_POST['sortid']; $name = dhtmlspecialchars($_POST['name']); $url = dhtmlspecialchars($_POST['url']); $desc = dhtmlspecialchars($_POST['description']); $logo = dhtmlspecialchars($_POST['logo']); $orderNum = intval($_POST['orderNum']); empty($name) && javascript::alert('网站名称不能为空!'); empty($url) && javascript::alert('网站URL不能为空!'); strpos($url, 'http://') === false && ($url = 'http://' . $url); iCMS_DB::query("INSERT INTO `#iCMS@__links` (`sortid`,`name`,`logo`,`desc`,`url`,`orderNum`) VALUES ('{$sortid}','{$name}','{$logo}','{$desc}','{$url}','{$orderNum}')"); javascript::dialog("添加完成!", 'url:' . __SELF__ . '?mo=link'); }
function dosave() { $id = (int) $_POST['id']; $search = dhtmlspecialchars($_POST['search']); $search = str_replace(array('%', '_'), array('\\%', '\\_'), $search); $times = (int) $_POST['times']; if (empty($id)) { iCMS_DB::query("insert into `#iCMS@__search`(`search`,`times`,`addtime`) values ('{$search}','{$times}','" . time() . "')"); } else { iCMS_DB::query("update `#iCMS@__search` set `search`='{$search}',`times`='{$times}' where id='{$id}'"); } search_cache(); javascript::dialog('操作完成!', 'url:' . __SELF__ . '?mo=search'); }
function doDel() { $mid = (int) $_GET['mid']; $__TABLE__ = 'article'; if ($mid) { $model = $this->iCMS->getCache('system/models.cache', $mid); $__TABLE__ = $model['tbn']; } $id = intval($_GET['id']); $indexId = intval($_GET['indexId']); $id && iCMS_DB::query("DELETE FROM `#iCMS@__comment` WHERE `id` ='{$id}'"); $indexId && iCMS_DB::query("UPDATE `#iCMS@__" . $__TABLE__ . "` SET `comments` = comments-1 WHERE `id` ='{$indexId}'"); javascript::dialog('评论删除成功!', 'js:parent.$("#tr-' . $id . '").remove();parent.iCMS.closeDialog();'); }
function checklogin($a, $p, $Ret = false) { $ip = getip(); if (empty($a) && empty($p)) { $auth = get_cookie('auth'); list($a, $p) = explode('#=iCMS[' . $ip . ']=#', authcode($auth, 'DECODE')); return self::checkadmin($a, $p, $Ret); } else { $crs = self::checkadmin($a, $p, $Ret); set_cookie('auth', authcode($a . '#=iCMS[' . $ip . ']=#' . $p, 'ENCODE')); iCMS_DB::query("UPDATE `#iCMS@__admin` SET `lastip`='" . $ip . "',`lastlogintime`='" . time() . "',`logintimes`=logintimes+1 WHERE `uid`='" . self::$uId . "'"); !$Ret && javascript::dialog("登陆成功!", 'url:' . __SELF__); //UI::redirect('登陆成功, 请稍候......', __SELF__); return $crs; } }
function doSave() { $uid = (int) $_POST['uid']; $info = array(); if ($_POST['pwd1'] && $_POST['pwd2']) { $pwd1 = md5(trim($_POST['pwd1'])); $pwd2 = md5(trim($_POST['pwd2'])); (!$_POST['pwd1'] || !$_POST['pwd2']) && javascript::alert("新密码,确认密码不能为空"); $pwd1 != $pwd2 && javascript::alert("新密码与确认密码不一致!"); iCMS_DB::query("UPDATE `#iCMS@__members` SET `password` = '{$pwd2}' WHERE `uid` ='{$uid}' LIMIT 1"); } //$_POST['username']&&!preg_match("/^([_\.0-9a-z-]+)@([0-9a-z][0-9a-z-]+)\.([a-z]{2,6})$/i",$_POST['username'])&&javascript::alert("E-mail格式错误!!"); $gender = intval($_POST['gender']); $nickname = dhtmlspecialchars($_POST['nickname']); $info['icq'] = intval($_POST['icq']); $info['home'] = dhtmlspecialchars(stripslashes($_POST['home'])); $info['year'] = intval($_POST['year']); $info['month'] = intval($_POST['month']); $info['day'] = intval($_POST['day']); $info['from'] = dhtmlspecialchars(stripslashes($_POST['from'])); $info['signature'] = dhtmlspecialchars(stripslashes($_POST['signature'])); iCMS_DB::query("UPDATE `#iCMS@__members` SET `info` = '" . addslashes(serialize($info)) . "',`nickname`='{$nickname}',`gender`='{$gender}' WHERE `uid` ='{$uid}' LIMIT 1"); javascript::dialog('用户编辑完成!', 'url:' . __SELF__ . '?mo=user&do=manage'); }
function doMove() { javascript::dialog("暂无此功能!", 'url:' . __SELF__ . '?mo=forums'); }
function doreadme() { $data = plugin::readme($_GET['name']); javascript::dialog($data ? array(HTML2JS(htmlspecialchars($data)), '查看说明') : '暂无说明', 'js:', 'msg', '-1'); }
function doextractpic() { Admin::MP("menu_extract_pic"); include iPATH . 'include/forum.class.php'; set_time_limit(0); $speed = 100; //提取速度 $action = $this->PG('action'); $fids = $this->PG('fid'); $startid = (int) $this->PG('startid'); $endid = (int) $this->PG('endid'); $starttime = $this->PG('starttime'); $endtime = $this->PG('endtime'); $totle = isset($_GET['totle']) ? $_GET['totle'] : 0; $loop = isset($_GET['loop']) ? $_GET['loop'] : 1; $i = isset($_GET['i']) ? $_GET['i'] : 0; empty($action) && javascript::alert("请选择操作项"); if ($fids) { empty($fids) && javascript::alert("请选择版块"); is_array($fids) && ($fids = implode(",", $fids)); if (strstr($fids, 'all')) { $forum = new forum(); $fids = substr($forum->fid(), 0, -1); if (empty($fids)) { javascript::dialog("提取完毕", 'url:' . __SELF__ . '?mo=files&do=extract'); } else { _header(__SELF__ . '?mo=files&do=extractpic&fid=' . $fids . '&action=' . $action); } } else { $cArray = explode(',', $fids); $_Ccount = count($cArray); $k = isset($_GET['k']) ? $_GET['k'] : 0; $rs = iCMS_DB::getArray("SELECT id FROM #iCMS@__article WHERE fid in ({$fids}) and `status`='1'"); empty($totle) && ($totle = count($rs)); $tloop = ceil($totle / $speed); if ($loop <= $tloop) { $max = $i + $speed > $totle ? $totle : $i + $speed; for ($j = $i; $j < $max; $j++) { if ($action == "thumb") { if ($this->extractThumb($rs[$j]['id'])) { $msg .= "文章ID:" . $rs[$j]['id'] . "提取…<span style='color:green;'>√</span><br />"; } } elseif ($action == "into") { $intoMsg = $this->into($rs[$j]['id']); if ($intoMsg) { $msg .= $intoMsg . "文章ID:" . $rs[$j]['id'] . "提取…<span style='color:green;'>√</span><br />"; } } } javascript::dialog($msg ? $msg : "暂无提取信息!", 'src:' . __SELF__ . '?mo=files&do=extractpic&fid=' . $fids . '&totle=' . $totle . '&loop=' . ($loop + 1) . '&i=' . $j . '&action=' . $action); } else { javascript::dialog("提取完毕", 'url:' . __SELF__ . '?mo=files&do=extract'); } } } elseif ($startid && $endid) { $startid > $endid && !isset($_GET['g']) && javascript::alert("开始ID不能大于结束ID"); empty($totle) && ($totle = $endid - $startid + 1); empty($i) && ($i = $startid); $tloop = ceil($totle / $speed); if ($loop <= $tloop) { $max = $i + $speed > $endid ? $endid : $i + $speed; for ($j = $i; $j <= $max; $j++) { if ($action == "thumb") { if ($this->extractThumb($j)) { $msg .= "文章ID:" . $j . "提取…<span style='color:green;'>√</span><br />"; } } elseif ($action == "into") { $intoMsg = $this->into($j); if ($intoMsg) { $msg .= $intoMsg . "文章ID:" . $j . "提取…<span style='color:green;'>√</span><br />"; } } } javascript::dialog($msg ? $msg : "暂无提取信息!", 'src:' . __SELF__ . '?mo=files&do=extractpic&startid=' . $startid . '&endid=' . $endid . '&g&loop=' . ($loop + 1) . '&i=' . $j . '&action=' . $action); } else { javascript::dialog("提取完毕", 'url:' . __SELF__ . '?mo=files&do=extract'); } } elseif ($starttime) { $s = strtotime($starttime); $e = empty($endtime) ? time() + 86400 : strtotime($endtime); $rs = iCMS_DB::getArray("SELECT id FROM #iCMS@__article WHERE `pubdate`>='{$s}' and `pubdate`<='{$e}' and `status`='1'"); empty($totle) && ($totle = count($rs)); $tloop = ceil($totle / $speed); if ($loop <= $tloop) { $max = $i + $speed > $totle ? $totle : $i + $speed; for ($j = $i; $j < $max; $j++) { if ($action == "thumb") { if ($this->extractThumb($rs[$j]['id'])) { $msg .= "文章ID:" . $rs[$j]['id'] . "提取…<span style='color:green;'>√</span><br />"; } } elseif ($action == "into") { $intoMsg = $this->into($rs[$j]['id']); if ($intoMsg) { $msg .= $intoMsg . "文章ID:" . $rs[$j]['id'] . "提取…<span style='color:green;'>√</span><br />"; } } } javascript::dialog($msg ? $msg : "暂无提取信息!", 'src:' . __SELF__ . '?mo=files&do=extractpic&starttime=' . $starttime . '&endtime=' . $endtime . '&totle=' . $totle . '&loop=' . ($loop + 1) . '&i=' . $j . '&action=' . $action); } else { javascript::dialog("提取完毕", 'url:' . __SELF__ . '?mo=files&do=extract'); } } else { javascript::alert("请选择方式"); } }
function doEdit() { foreach ((array) $_POST['name'] as $id => $value) { iCMS_DB::query("update `#iCMS@__tags` set `name`='{$value}',`sortid`='" . $_POST['sortid'][$id] . "',`ordernum`=" . _int($_POST['ordernum'][$id]) . ",`updatetime`='" . time() . "' where `id`='{$id}'"); tags_cache($id); } javascript::dialog('TAG更新完成!', 'url:1'); }
function doOrder() { foreach ((array) $_POST['orderNum'] as $id => $orderNum) { iCMS_DB::query("UPDATE `#iCMS@__article` SET `orderNum` = '{$orderNum}' WHERE `id` ='{$id}'"); } javascript::dialog('排序已更新!', "url:1"); }
function doSave() { $uid = (int) $_POST['uid']; $name = dhtmlspecialchars($_POST['name']); $nickname = dhtmlspecialchars($_POST['nickname']); $groupid = $_POST['groupid']; $pwd = md5($_POST['pwd']); $password = md5($_POST['pwd2']); if ($_POST['pwd'] && $_POST['pwd2']) { $pwd != $password && javascript::alert("密码与确认密码不一致!"); } $email && !preg_match("/^([_\\.0-9a-z-]+)@([0-9a-z][0-9a-z-]+)\\.([a-z]{2,6})\$/i", $email) && javascript::alert("E-mail格式错误!!"); if (empty($uid)) { if (!$_POST['pwd'] || !$_POST['pwd2']) { javascript::alert("密码不能为空"); } iCMS_DB::getValue("SELECT `uid` FROM `#iCMS@__members` WHERE `username`='{$name}'") && javascript::alert("该用户名已经存在!"); iCMS_DB::query("INSERT INTO `#iCMS@__members` (`username`,`password`,`groupid`,`nickname`,`gender`,`info`,`power`,`cpower`,`lastip`,`lastlogintime`,`logintimes`,`post`,`type`,`status`)values('{$name}', '{$password}', '{$groupid}', '{$name}', '0', '', '', '', '', '0.0.0.0', '" . time() . "', '0', '0', '1', '1')"); javascript::dialog("添加完成!", "url:" . __SELF__ . '?mo=account&do=manage'); } else { if ($_POST['pwd'] && $_POST['pwd2']) { iCMS_DB::query("UPDATE `#iCMS@__members` SET `password` = '{$password}' WHERE `uid` ='{$uid}' LIMIT 1"); } iCMS_DB::query("UPDATE `#iCMS@__members` SET `nickname`='{$nickname}',`groupid`='{$groupid}' WHERE `uid` ='{$uid}' LIMIT 1"); javascript::dialog("编辑完成!", "url:" . __SELF__ . '?mo=account&do=manage'); } }
function dobakin() { $step = $_GET['step']; $count = $_GET['count']; $pre = $_GET['pre']; if (!$count) { $count = 0; $handle = opendir(iPATH . 'admin/backup'); while ($file = readdir($handle)) { if (eregi("^{$pre}", $file) && eregi("\\.sql\$", $file)) { $count++; } } } !$step && ($step = 1); $this->bakindata(iPATH . 'admin/backup/' . $pre . $step . '.sql'); $i = $step; $step++; if ($count > 1 && $step <= $count) { javascript::dialog("正在导入第{$i}卷备份文件,程序将自动导入余下备份文件...", 'src:' . __SELF__ . "?mo=database&do=bakin&step={$step}&count={$count}&pre={$pre}", 'ok', 3); } else { javascript::dialog("导入成功!"); } }
function doCreateTag() { $speed = 25; //生成速度 $sids = $this->PG('sortid'); $startid = (int) $this->PG('startid'); $endid = (int) $this->PG('endid'); $starttime = $this->PG('starttime'); $endtime = $this->PG('endtime'); $cpageNum = 0; //$_GET['cpn']; $totle = isset($_GET['totle']) ? $_GET['totle'] : 0; $loop = isset($_GET['loop']) ? $_GET['loop'] : 1; $i = isset($_GET['i']) ? $_GET['i'] : 0; $isA = $this->isAll(); if ($sids) { empty($sids) && javascript::alert("请选择分类"); is_array($sids) && ($sids = implode(",", $sids)); if (strstr($sids, 'all')) { $forum = new forum(); $sids = substr($forum->fid(), 0, -1); _header(__SELF__ . '?mo=html&do=CreateTag&time=' . $this->cTime . '&cpn=' . $cpageNum . '&sortid=' . $sids . $isA); } else { $sArray = explode(',', $sids); $sCount = count($sArray); $cpage = isset($_GET['cpage']) ? $_GET['cpage'] : 1; $k = isset($_GET['k']) ? $_GET['k'] : 0; $rs = iCMS_DB::getArray("SELECT `id`,`name` FROM #iCMS@__tags WHERE `sortid` in ({$sids}) and `status`='1' order by id DESC"); empty($totle) && ($totle = count($rs)); $tloop = ceil($totle / $speed); if ($loop <= $tloop) { $max = $i + $speed > $totle ? $totle : $i + $speed; for ($j = $i; $j < $max; $j++) { $c = iHtml::Tag($rs[$j]['name'], $cpage, $loop, $cpageNum); $msg .= "标签: [" . $c['name'] . "] 生成…<span style='color:green;'>√</span><br />"; } javascript::dialog($msg, 'src:' . __SELF__ . '?mo=html&do=CreateTag&sortid=' . $sids . '&totle=' . $totle . '&loop=' . ($loop + 1) . '&i=' . $j . $isA, 'ok', 0); } else { $isA && javascript::dialog("标签更新完毕!<br />开始生成首页", 'url:' . __SELF__ . '?mo=html&do=index&all=true'); javascript::dialog("标签更新完毕"); } } // }elseif($startid && $endid){ // ($startid>$endid &&!isset($_GET['g'])) && javascript::alert("开始ID不能大于结束ID"); // empty($totle)&&$totle=($endid-$startid)+1; // empty($i)&&$i=$startid; // $tloop=ceil($totle/$speed); // if($loop<=$tloop){ // $max=$i+$speed>$endid?$endid:$i+$speed; // for($j=$i;$j<=$max;$j++){ // iHtml::Tag($j); // $msg.="标签ID:{$j}生成…<span style='color:green;'>√</span><br />"; // } // javascript::dialog($msg,'src:'.__SELF__.'?mo=html&do=CreateTag&startid='.$startid.'&endid='.$endid.'&g&loop='.($loop+1).'&i='.$j.$isA,'ok',0); // }else{ // javascript::dialog("标签更新完毕"); // } } elseif ($starttime) { $s = strtotime($starttime); $e = empty($endtime) ? time() + 86400 : strtotime($endtime); $rs = iCMS_DB::getArray("SELECT id,name FROM #iCMS@__tags WHERE `updatetime`>='{$s}' and `updatetime`<='{$e}' and `status`='1' order by id DESC"); empty($totle) && ($totle = count($rs)); $tloop = ceil($totle / $speed); if ($loop <= $tloop) { $max = $i + $speed > $totle ? $totle : $i + $speed; for ($j = $i; $j < $max; $j++) { iHtml::Tag($rs[$j]['name']); $msg .= "标签:[" . $rs[$j]['name'] . "]生成…<span style='color:green;'>√</span><br />"; } javascript::dialog($msg, 'src:' . __SELF__ . '?mo=html&do=CreateTag&starttime=' . $starttime . '&endtime=' . $endtime . '&totle=' . $totle . '&loop=' . ($loop + 1) . '&i=' . $j, 'ok', 0); } else { javascript::dialog("标签更新完毕"); } } else { javascript::alert("请选择方式"); } }
function doDel() { $id = (int) $_GET['id']; !$id && javascript::alert("请选择要删除的文章"); $msg = delArticle($id, member::$uId, 0); javascript::dialog($msg . '<br />成功删除!', 'js:parent.$("#tr-' . $id . '").remove();parent.iCMS.closeDialog();'); }
function dodel() { $id = $_GET['id']; $mid = $_GET['mid']; !$id && javascript::alert("请选择要删除的内容"); $msg = delContent($id, $mid); javascript::dialog($msg . '<br />成功删除!', 'js:parent.$("#aid' . $id . '").remove();parent.iCMS.closeDialog();'); }
function doSave() { $id = (int) $_POST['id']; $name = dhtmlspecialchars($_POST['name']); $table = dhtmlspecialchars($_POST['table']); $description = dhtmlspecialchars($_POST['desc']); $show = (int) $_POST['show']; $position = $_POST['position']; $position2 = $_POST['pos']; $form = dhtmlspecialchars($_POST['form']); $binding = isset($_POST['binding']) ? 1 : 0; empty($name) && javascript::alert('模块名称不能为空!'); empty($table) && $binding && javascript::alert('模块名不能为空!'); if (!$binding && empty($id)) { if (empty($table)) { include iPATH . 'include/cn.class.php'; $table = CN::pinyin($name); } } !preg_match("/[a-zA-Z]/", $table[0]) && javascript::alert('模型表名只能以英文字母开头'); !preg_match("/[a-zA-Z0-9_\\-~]/", $table) && javascript::alert('模型表名只能由英文字母或数字组成'); //model::isSysTable($table) && javascript::alert('您所填写的模块表名是系统表!请重新填写.'); if ($id) { iCMS_DB::getValue("SELECT `id` FROM `#iCMS@__model` where `table` = '{$table}' and `id`!='{$id}'") && javascript::alert('该模块已经存在!请检查是否重复'); iCMS_DB::query("UPDATE `#iCMS@__model` SET `name` = '{$name}', `table` = '{$table}', `binding` = '{$binding}', `description` = '{$description}', `show` = '{$show}', `position` = '{$position}', `position2` = '{$position2}', `form` = '{$form}' WHERE `id` = '{$id}';"); if (!$binding) { $oTable = iCMS_DB::getValue("SELECT `table` FROM `#iCMS@__model` where `id` ='{$id}'"); if ($oTable != $table) { iCMS_DB::query("RENAME TABLE `#iCMS@__" . model::tbn($oTable) . "` TO `#iCMS@__" . model::tbn($table) . "`"); } } } else { iCMS_DB::getValue("SELECT `id` FROM `#iCMS@__model` where `table` = '{$table}'") && javascript::alert('该模块已经存在!请检查是否重复'); $field = $binding ? '' : model::$defaultField; iCMS_DB::query("INSERT INTO `#iCMS@__model`(`name`, `table`, `field`, `binding`, `description`,`show`, `position`,`position2`,`form`, `addtime`)VALUES ('{$name}', '{$table}','{$field}', '{$binding}', '{$description}','{$show}', '{$position}','{$position2}','{$form}', '" . time() . "');"); $id = iCMS_DB::$insert_id; if (!$binding) { //创建模块基础表 $tableSQL = "CREATE TABLE `#iCMS@__" . model::tbn($table) . "` (\n\t\t\t\t\t `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t `fid` int(10) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t `orderNum` smallint(6) NOT NULL DEFAULT '0',\n\t\t\t\t\t `title` varchar(255) NOT NULL DEFAULT '',\n\t\t\t\t\t `clink` varchar(255) NOT NULL DEFAULT '',\n\t\t\t\t\t `editor` varchar(200) NOT NULL DEFAULT '',\n\t\t\t\t\t `userid` int(10) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t `tags` varchar(255) NOT NULL DEFAULT '',\n\t\t\t\t\t `pubdate` int(10) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t `hits` int(10) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t `comments` int(10) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t `good` int(10) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t `bad` int(10) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t `vlink` varchar(255) NOT NULL DEFAULT '',\n\t\t\t\t\t `type` smallint(6) NOT NULL DEFAULT '0',\n\t\t\t\t\t `top` smallint(6) NOT NULL DEFAULT '0',\n\t\t\t\t\t `postype` tinyint(1) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t `status` tinyint(1) unsigned NOT NULL DEFAULT '1',\n\t\t\t\t\t PRIMARY KEY (`id`),\n\t\t\t\t\t KEY `pubdate` (`pubdate`),\n\t\t\t\t\t KEY `comment` (`comments`),\n\t\t\t\t\t KEY `hit` (`hits`),\n\t\t\t\t\t KEY `order` (`orderNum`),\n\t\t\t\t\t KEY `sortid` (`fid`,`id`),\n\t\t\t\t\t KEY `topord` (`top`,`orderNum`),\n\t\t\t\t\t KEY `userid` (`userid`),\n\t\t\t\t\t KEY `postype` (`postype`,`id`),\n\t\t\t\t\t KEY `status` (`status`,`postype`,`id`)\n\t\t\t\t\t ) ENGINE=MyISAM DEFAULT CHARSET=" . DB_CHARSET; iCMS_DB::query($tableSQL); } } model::cache(); $moreaction = array(array("text" => "下一步添加字段", "url" => __SELF__ . "?mo=models&do=addfield&id=" . $id), array("text" => "返回模块列表", "url" => __SELF__ . "?mo=models&do=manage")); javascript::dialog('模块' . ($id ? '编辑' : '添加') . '完成!<br />模块基础建表完成...<br />10秒后返回模块列表', "url:" . __SELF__ . "?mo=models&do=manage", $moreaction, 10); }