function DoSave() { $dedecms = $this->Post['dedecms']; $dedecms_config_default = $dedecms_config = jconf::get('dedecms'); $dedecms_config['enable'] = $dedecms['enable'] ? 1 : 0; $dedecms_config['db_host'] = $dedecms['db_host']; $dedecms_config['db_name'] = $dedecms['db_name']; $dedecms_config['db_user'] = $dedecms['db_user']; $dedecms_config['db_pass'] = $dedecms['db_pass']; $dedecms_config['db_port'] = $dedecms['db_port']; $dedecms_config['db_pre'] = $dedecms['db_pre']; $dedecms_config['charset'] = $dedecms['charset']; $dedecms_config['db_url'] = $dedecms['db_url']; if ($dedecms_config['enable']) { include_once ROOT_PATH . './api/uc_api_db.php'; $dede_db = new JSG_UC_API_DB(); @$dede_db->connect($dedecms['db_host'], $dedecms['db_user'], $dedecms['db_pass'], $dedecms['db_name'], $dedecms['charset'], 1, $dedecms['db_pre']); if (!$dede_db->link || !$dede_db->query("SHOW COLUMNS FROM {$dedecms['db_pre']}member", 'SILENT')) { $this->Messager("无法连接DedeCMS数据库,请检查您填写的DedeCMS数据库配置信息是否正确."); exit; } } if ($dedecms_config_default != $dedecms_config) { jconf::set('dedecms', $dedecms_config); } if ($dedecms_config['enable'] != $this->Config['dedecms_enable']) { $config = array(); $config['dedecms_enable'] = $dedecms_config['enable']; jconf::update($config); } $this->Messager("修改成功"); }
function ForceIP() { $ip = trim($this->Post['ip']); if (!$ip) { json_error("无效IP。"); } if ('admin' != MEMBER_ROLE_TYPE) { json_error("您没有封IP权限"); } if ($ip == $GLOBALS['_J']['client_ip']) { json_error("无法禁止当前的IP。"); } if (preg_match("/^(\\d{1,3}\\.){1,3}\\d{1,3}\\.?\$/", $ip)) { $ip = str_replace(".", "\\.", $ip); } $access = jconf::get('access'); $ip_arr = explode('|', $access['ipbanned']); if ($ip_arr && in_array($ip, $ip_arr)) { json_error("已禁止此IP"); } if ($access['ipbanned']) { $access['ipbanned'] .= '|' . $ip; } else { $access['ipbanned'] = $ip; } jconf::set('access', $access); $config = array(); $config['ipbanned_enable'] = $access['ipbanned'] ? 1 : 0; jconf::update($config); json_result('禁止IP:' . $ip . '成功'); }
function DoClean() { $type = get_param('type'); if (!$type) { $this->Messager("请先选择要清理的缓存对象"); } $this->_removeTopicAttach(); $this->_removeTopicLongtext(); $this->_removeVoteImage(); if (in_array('data', $type)) { cache_db('clear'); jtable('failedlogins')->truncate(); DB::query("update " . TABLE_PREFIX . "members set `username`=`uid` WHERE `username`!=`uid` AND `username` REGEXP '^[0-9]*\$'"); } if (in_array('tpl', $type)) { cache_clear(); jconf::set('validate_category', array()); jlogic('credits')->rule_conf(true); } if (in_array('channel', $type)) { jlogic('channel')->update_data(); } if (in_array('album', $type)) { jlogic('image')->update_data(); } $this->Messager("已清空所有缓存"); }
function writeNextRunTime() { $query = $this->DatabaseHandler->Query("SELECT nextrun FROM " . TABLE_PREFIX . 'task' . " WHERE available>'0' ORDER BY nextrun LIMIT 1"); $row = $query->GetRow(); $nextruntime = $row['nextrun'] ? $row['nextrun'] : time() + 1800; jconf::set('task', 'nextrun', $nextruntime); }
function update_feature_cache() { $features = array(); $query = DB::query("SELECT * FROM " . DB::table('feature')); while ($value = DB::fetch($query)) { $features[$value['featureid']] = $value['featurename']; } jconf::set('feature', $features); }
function weibo_show() { $conf = jconf::get('weibo_show'); $link_display_none_radio = $this->jishigou_form->YesNoRadio('link_display_none', (int) $conf['link_display_none']); if (jpost('settingsubmit')) { $conf['link_display_none'] = jpost('link_display_none') ? 1 : 0; jconf::set('weibo_show', $conf); $this->Messager('设置成功了'); } include template(); }
function DoModify() { $set['about'] = $this->Post['about']; $set['contact'] = $this->Post['contact']; $set['joins'] = $this->Post['joins']; $set['float'] = $this->Post['float']; $set['float_align'] = $this->Post['float_align']; $set['float_style'] = $this->Post['float_style']; $set = jstripslashes($set); jconf::set('web_info', $set); $this->Messager("修改成功", 'admin.php?mod=web_info'); }
function doconfig() { $config = $this->Post['config']; $live_config['user'] = trim($config['user']); $live_config['des'] = trim($config['des']); $live_config['ads'] = trim($config['ads']); $uid = DB::result_first("SELECT uid FROM " . DB::table("members") . " WHERE nickname = '{$live_config['user']}'"); if ($uid) { $live_config['uid'] = $uid; jconf::set('live', $live_config); $this->Messager("配置成功"); } else { $this->Messager("用户 <b>" . $live_config['user'] . "</b> 不存在!"); } }
function update_qun_num($cat_id, $num = null) { $ret = false; $cat_id = (int) $cat_id; if ($cat_id > 0) { if (isset($num)) { $num = (int) $num; $ret = $this->db->update_count($cat_id, 'qun_num', $num); } else { } } if ($ret) { jconf::set('qun_category', array()); } return $ret; }
function setting() { if (jget('settingsubmit')) { $url = jget('url'); $url['status_default'] = (int) $url['status_default']; foreach ($url['status_set'] as $k => $v) { $url['status_set'][$k] = (int) $v; } jconf::set('url', $url); $this->Messager('设置成功'); } $url = jconf::get('url'); $options = array(1 => array('value' => 1, 'name' => '加入白名单(允许访问)队列<br />'), 0 => array('value' => 0, 'name' => '加入常规(默认)队列<br />'), -1 => array('value' => -1, 'name' => '加入黑名单(禁止访问)队列<br />')); $status_default_radio = $this->jishigou_form->Radio('url[status_default]', $options, (int) $url['status_default']); $options = array(0 => array('value' => 0, 'name' => '直接跳转到相应的链接地址(推荐用于白名单(允许访问)队列)<br />'), 1 => array('value' => 1, 'name' => '给出可以点击的链接地址,需要点击后才能跳转(推荐用于常规(默认)队列)<br />'), 2 => array('value' => 2, 'name' => '给出链接地址,需要自行复制链接地址到浏览器地址栏中进行访问(推荐用于常规(默认)队列)<br />'), 3 => array('value' => 3, 'name' => '禁止访问(推荐用于黑名单(禁止访问)队列)<br />')); $status_set_allow_radio = $this->jishigou_form->Radio('url[status_set][1]', $options, (int) $url['status_set'][1]); $status_set_normal_radio = $this->jishigou_form->Radio('url[status_set][0]', $options, (int) $url['status_set'][0]); $status_set_disallow_radio = $this->jishigou_form->Radio('url[status_set][-1]', $options, (int) $url['status_set'][-1]); include template(); }
function DoSave() { $dzbbs = $this->Post['dzbbs']; $dzbbs_config_default = $dzbbs_config = jconf::get('dzbbs'); $dzbbs_config['enable'] = $dzbbs['enable'] ? 1 : 0; $dzbbs_config['db_host'] = $dzbbs['db_host']; $dzbbs_config['db_name'] = $dzbbs['db_name']; $dzbbs_config['db_user'] = $dzbbs['db_user']; $dzbbs_config['db_pass'] = $dzbbs['db_pass']; $dzbbs_config['db_port'] = $dzbbs['db_port']; $dzbbs_config['db_pre'] = $dzbbs['db_pre']; $dzbbs_config['charset'] = $dzbbs['charset']; $dzbbs_config['db_url'] = $dzbbs['db_url']; $dzbbs_config['dz_ver'] = $dzbbs['dz_ver']; if ($dzbbs_config['enable']) { $table_m = $dzbbs['dz_ver'] == 'dzx' ? $dzbbs['db_pre'] . 'common_member' : $dzbbs['db_pre'] . 'members'; include_once ROOT_PATH . './api/uc_api_db.php'; $dz_db = new JSG_UC_API_DB(); @$dz_db->connect($dzbbs['db_host'], $dzbbs['db_user'], $dzbbs['db_pass'], $dzbbs['db_name'], $dzbbs['charset'], 1, $dzbbs['db_pre']); if (!$dz_db->link || !$dz_db->query("SHOW COLUMNS FROM {$table_m}", 'SILENT')) { $this->Messager("无法连接Discuz数据库,请检查您填写的Discuz数据库配置信息是否正确."); exit; } } if ($dzbbs_config_default != $dzbbs_config) { jconf::set('dzbbs', $dzbbs_config); } if ($dzbbs_config['enable'] != $this->Config['dzbbs_enable']) { $config = array(); $config['dzbbs_enable'] = $dzbbs_config['enable']; if ($dzbbs_config['enable'] == 1) { $config['ucenter_enable'] = 1; $config['pwbbs_enable'] = 0; $config['phpwind_enable'] = 0; } jconf::update($config); } $this->Messager("修改成功"); }
function DoModifySetting() { $attach = $this->Post['attach']; $attach_config_default = $attach_config = jconf::get('attach'); $attach_config['enable'] = $attach['enable'] ? 1 : 0; $attach_config['qun_enable'] = $attach['qun_enable'] ? 1 : 0; $attach_config['request_file_type'] = jlogic('attach')->type_filter($attach['request_file_type']); $attach_config['request_size_limit'] = min(max(1, (int) $attach['request_size_limit']), 51200); $attach_config['request_files_limit'] = min(max(1, (int) $attach['request_files_limit']), 50); $attach_config['score_min'] = max(1, (int) $attach['score_min']); $attach_config['score_max'] = max(1, (int) $attach['score_max']); if ($attach_config['score_max'] < $attach_config['score_min']) { $attach_config['score_max'] = $attach_config['score_min']; } $attach_config['no_score_user'] = is_array($this->Post['no_score_user']) ? implode(',', $this->Post['no_score_user']) : ''; $config = array(); if ($attach_config_default != $attach_config) { jconf::set('attach', $attach_config); } if ($attach_config['enable'] != $this->Config['attach_enable']) { $config['attach_enable'] = $attach_config['enable']; } if ($attach_config['qun_enable'] != $this->Config['qun_attach_enable']) { $config['qun_attach_enable'] = $attach_config['qun_enable']; } if ($attach_config['request_file_type'] != $this->Config['attach_file_type']) { $config['attach_file_type'] = $attach_config['request_file_type']; } if ($attach_config['request_size_limit'] != $this->Config['attach_size_limit']) { $config['attach_size_limit'] = $attach_config['request_size_limit']; } if ($attach_config['request_files_limit'] != $this->Config['attach_files_limit']) { $config['attach_files_limit'] = $attach_config['request_files_limit']; } if ($config) { jconf::update($config); } $this->Messager("修改成功"); }
function modify() { if (jget('settingsubmit')) { $limit = jget('limit', 'int'); if ($limit < 1) { $limit = 15; } $time = jget('time', 'int'); if ($time < 1) { $time = 15; } $white_list = jget('white_list'); if ($white_list) { $white_list = explode("\n", $white_list); foreach ($white_list as $k => $v) { $white_list[$k] = trim($v); } $white_list = array_remove_empty(array_unique($white_list)); } $failedlogins = array('limit' => $limit, 'time' => $time, 'white_list' => $white_list); jconf::set('failedlogins', $failedlogins); } $this->Messager('设置成功', 'admin.php?mod=failedlogins&code=index'); }
function hot_tag_recommend() { $rets = array(); if ($GLOBALS['_J']['config']['hot_tag_recommend_enable']) { $rets = jconf::get('hot_tag_recommend'); if ($rets['list'] && TIMESTAMP - $rets['time'] >= 1800) { $for_count = $rets['num']; foreach ($rets['list'] as $key => $val) { if ($for_count < 1) { break; } $for_count--; if ($val['tag_id']) { $rets['list'][$key]['topic_count'] = DB::result_first(" select `topic_count` from `" . TABLE_PREFIX . "tag` where id='{$val[tag_id]}' "); } else { $rets['list'][$key]['topic_count'] = 0; } } $rets['time'] = TIMESTAMP; jconf::set('hot_tag_recommend', $rets); } } return $rets; }
function DoDelADV() { $ids = jget('ids'); if ($ids && is_array($ids)) { $ad = jconf::get('ad'); $ids_where = implode(',', $ids); DB::query(" delete from `" . TABLE_PREFIX . "ad` where `adid` in ({$ids_where}) "); foreach ($ad['ad_list'] as $k => $page) { foreach ($page as $k_local => $local) { foreach ($local as $ad_id => $ad_one) { $ad_info = DB::fetch_first(" select * from `" . TABLE_PREFIX . "ad` where `adid` = '{$ad_id}' "); if (!$ad_info) { if (isset($ad['ad_list'][$k][$k_local][$ad_id]) && is_array($ad['ad_list'][$k][$k_local][$ad_id])) { unset($ad['ad_list'][$k][$k_local][$ad_id]); } } if (in_array($ad_id, $ids)) { if (isset($ad['ad_list'][$k][$k_local][$ad_id]) && is_array($ad['ad_list'][$k][$k_local][$ad_id])) { unset($ad['ad_list'][$k][$k_local][$ad_id]); } } } $ad['ad_list'][$k][$k_local] = array_filter($ad['ad_list'][$k][$k_local]); } $ad['ad_list'][$k] = array_filter($ad['ad_list'][$k]); } $ad['ad_list'] = array_filter($ad['ad_list']); jconf::set('ad', $ad); } $this->Messager('删除成功', 'admin.php?mod=income&code=ad_list'); }
function update_category_cache() { $cat_ary = array(); $query = DB::query("SELECT * FROM " . DB::table('talk_category') . " ORDER BY display_order ASC"); while ($value = DB::fetch($query)) { if ($value['parent_id'] == 0) { $cat_ary['first'][$value['cat_id']] = $value; } else { $cat_ary['second'][$value['cat_id']] = $value; } } if (!empty($cat_ary['first'])) { foreach ($cat_ary['first'] as $key => $v) { $tmp_cat_id = $v['cat_id']; $count = DB::result_first("SELECT COUNT(*) FROM " . DB::table('talk_category') . " WHERE parent_id='{$tmp_cat_id}'"); if ($count < 1) { unset($cat_ary['first'][$key]); } } jconf::set('talk_category', $cat_ary); return $cat_ary; } return array(); }
function Disallow() { $name = trim($this->Get['name']); $disallow = 'disallow1' == $this->Code ? 1 : 0; $sql = "update `" . TABLE_PREFIX . "robot` set `disallow`='{$disallow}' where `name`='{$name}'"; $this->DatabaseHandler->Query($sql); $sql = "select `name`,`disallow` from `" . TABLE_PREFIX . "robot` where `disallow`=1"; $query = $this->DatabaseHandler->Query($sql); $robot_config = jconf::get('robot'); $robot_config['list'] = array(); while (false != ($row = $query->GetRow())) { $robot_config['list'][$row['name']]['disallow'] = $row['disallow']; } jconf::set('robot', $robot_config); $disallow_string = "User-agent: {$name}\r\nDisallow: /\r\n\r\n"; $robots_path = ROOT_PATH . 'robots.txt'; $robots_string_new = $robots_string = jio()->ReadFile($robots_path); $disallow_string_strpos = strpos($robots_string, $disallow_string); if ($disallow && false === $disallow_string_strpos) { $robots_string_new = $disallow_string . $robots_string_new; } elseif (!$disallow && false !== $disallow_string_strpos) { $robots_string_new = str_replace($disallow_string, "", $robots_string_new); } if ($robots_string_new != $robots_string) { $return = jio()->WriteFile($robots_path, $robots_string_new); if (!$return) { $this->Messager("写入 <b>{$robots_path}</b> 文件失败,请检查是否有可读写的权限", null); } } $this->Messager("修改成功"); }
function DoModify() { $link = $this->Post['link']; if ($link['new']['name'] != "" && $link['new']['url'] != "") { $new_link = $link['new']; $link[] = $new_link; } unset($link['new']); if ($this->Post['delete']) { foreach ($this->Post['delete'] as $link_id) { unset($link[$link_id]); } } $n = 100; $i = 0; $link_list = array(); foreach (@$link as $l) { if (!empty($l['logo'])) { $key = $i++; } else { $key = $n++; } $l['url'] = addslashes($l['url']); $l['order'] = (int) ($l['order'] ? $l['order'] : $key); $link_list[$key] = $l; } if ($link_list) { foreach ($link_list as $k => $n) { $order[$k] = $n['order']; } @array_multisort($order, SORT_ASC, $link_list); } jconf::set('link', $link_list); $this->Messager("修改成功"); }
function DoRecommend() { $act = $this->Post['act'] ? $this->Post['act'] : $this->Get['act']; $timestamp = time(); $uid = MEMBER_ID; $username = MEMBER_NAME; $hot_tag_recommend_config = jconf::get('hot_tag_recommend'); $messager = ""; if ('delete' == $act) { $hot_tag_recommend = $hot_tag_recommend_config; $id = max(0, (int) get_param('id')); $info = DB::fetch_first("select * from " . TABLE_PREFIX . "tag_recommend where `id`='{$id}'"); if (!$info) { $this->Messager("你要删除的内容已经不存在了"); } $name = $info['name']; DB::query("delete from " . TABLE_PREFIX . "tag_recommend where `id`='{$id}'"); DB::query("update " . TABLE_PREFIX . "tag set `status`=0 where `name`='{$name}'"); $messager = "删除成功"; } else { $_arr = $this->Post['hot_tag_recommend']; if ($_arr) { $name = $_arr['name'] ? $_arr['name'] : "热门话题推荐"; $num = min(20, max(1, (int) $_arr['num'])); $hot_tag_recommend = array('enable' => $_arr['enable'] ? 1 : 0, 'name' => $name, 'num' => $num, 'time' => time()); if ($_arr['list']) { $_list = $this->Post['_list']; foreach ($_arr['list'] as $k => $v) { if ($v != $_list[$k]) { $v['enable'] = $v['enable'] ? 1 : 0; $_sets = array(); foreach ($v as $_k => $_v) { if ($_v != $_list[$k][$_k]) { $_sets[$_k] = "`{$_k}`='{$_v}'"; } } if ($_sets) { $_sets['last_update'] = "`last_update`='{$timestamp}'"; DB::query("update " . TABLE_PREFIX . "tag_recommend set " . implode(" , ", $_sets) . " where `id`='{$k}'"); if ($v['enable'] != $_list[$k]['enable']) { DB::query("update " . TABLE_PREFIX . "tag set `status`='{$v['enable']}' where `name`='{$v['name']}'"); } } } } } } else { $hot_tag_recommend = $hot_tag_recommend_config; } $_new_arr = $this->Post['hot_tag_recommend_new']; foreach ($_new_arr as $k => $v) { if ($name = get_safe_code($v['name'])) { if (DB::fetch_first("select * from " . TABLE_PREFIX . "tag_recommend where `name`='{$name}'")) { continue; } if (false == DB::fetch_first("select * from " . TABLE_PREFIX . "tag where `name`='{$name}'")) { jtable('tag')->insert(array('name' => $name, 'user_id' => MEMBER_ID, 'username' => MEMBER_NAME, 'dateline' => TIMESTAMP, 'last_post' => TIMESTAMP)); } $_enable = $v['enable'] ? 1 : 0; $desc = $v['desc']; $order = (int) $v['order']; DB::query("insert into " . TABLE_PREFIX . "tag_recommend (`enable`,`name`,`desc`,`order`,`dateline`,`uid`,`username`) values ('{$_enable}','{$name}','{$desc}','{$order}','{$timestamp}','{$uid}','{$username}')"); DB::query("update " . TABLE_PREFIX . "tag set `status`='{$_enable}' where `name`='{$name}'"); } } $messager = "设置成功"; } if (false == jpost('is_ajax')) { if ($hot_tag_recommend) { $__list = array(); if ($hot_tag_recommend['num'] > 0) { $sql = "select tr.*,t.id as tag_id,t.topic_count from " . TABLE_PREFIX . "tag_recommend tr left join " . TABLE_PREFIX . "tag t on t.name=tr.name where tr.enable=1 order by `order` desc , `id` desc limit {$hot_tag_recommend['num']}"; $query = $this->DatabaseHandler->Query($sql); while (false != ($row = $query->GetRow())) { $__list[$row['id']] = $row; } } $hot_tag_recommend['list'] = $__list; if ($hot_tag_recommend_config != $hot_tag_recommend) { jconf::set('hot_tag_recommend', $hot_tag_recommend); if ($hot_tag_recommend['enable'] != $this->Config['hot_tag_recommend_enable']) { $config = array(); $config['hot_tag_recommend_enable'] = $hot_tag_recommend['enable']; jconf::update($config); } } } $this->Messager($messager); } else { json_result($messager); } }
function DoSetMailMsg() { $mail_msg = jget('msg'); $mail_msg['msg'] = stripcslashes($mail_msg['msg']); jconf::set('mail_msg', $mail_msg); $this->Messager("设置成功", -1); }
function _experience() { $sql = "\r\n\t\t\tSELECT\r\n\t\t\t\t*\r\n\t\t\tFROM\r\n\t\t\t\t" . TABLE_PREFIX . 'role' . "\r\n\t\t\tORDER BY\r\n\t\t\t\t`creditshigher` ASC, `creditslower` ASC, `rank` ASC, `id` ASC"; $query = $this->DatabaseHandler->Query($sql); $experience_list = array(); $rank = 0; while (false != ($row = $query->GetRow())) { if ('normal' == $row['type'] && ($row['creditshigher'] > 0 || $row['creditslower'] > 0)) { if ($rank != $row['rank']) { $this->DatabaseHandler->Query("update " . TABLE_PREFIX . "role set `rank`='{$rank}' where `id`='{$row['id']}'"); $row['rank'] = $rank; } $rank += 1; if ($row['rank'] > 0) { $experience_list[$row['rank']] = array('level' => $row['rank'], 'start_credits' => $row['creditshigher'], 'order' => $row['rank'], 'enable' => 1); } } else { if ($row['rank']) { $this->DatabaseHandler->Query("update " . TABLE_PREFIX . "role set `rank`='0' where `id`='{$row['id']}'"); $row['rank'] = 0; } } } if ($experience_list) { $experience = jconf::get('experience'); if ($experience_list != $experience['list']) { $experience['list'] = $experience_list; jconf::set('experience', $experience); } } }
function doUserFree($uid) { $force_out_list = jconf::get('login_enable'); unset($force_out_list[4][$uid]); unset($force_out_list[118][$uid]); DB::query("delete from " . TABLE_PREFIX . "force_out where uid = '{$uid}'"); jconf::set('login_enable', $force_out_list); }
function Delete() { $ids = $this->Post['ids'] ? $this->Post['ids'] : $this->Get['ids']; if (!$ids) { $this->Messager("请指定要删除的对象"); } $ids = (array) $ids; foreach ($ids as $id) { $id = is_numeric($id) ? $id : 0; if ($id > 0) { $sql = "delete from `" . TABLE_PREFIX . "share` where `id` = '{$id}'"; $this->DatabaseHandler->Query($sql); $file = ROOT_PATH . 'templates/default/share/sharetemp_' . $id . '.html'; jio()->DeleteFile($file); jconf::set('sharetemp_' . $id, array()); jio()->DeleteFile('./setting/sharetemp_' . $id . '.php'); } } $this->Messager("删除成功", "admin.php?mod=share"); }
function doleader() { $config = array(); $config['feed_type'] = array(); $feed_type = $this->Post['feed_type']; if ($feed_type) { $config['feed_type'] = $feed_type; } $config['feed_user'] = array(); $feed_nicknames = $this->Post['feed_nicknames']; if ($feed_nicknames) { $feed_nicknames = explode("\r\n", $feed_nicknames); foreach ($feed_nicknames as $key => $one) { $uid = jtable('members')->val(array('nickname' => trim($one)), 'uid'); if ($uid) { $config['feed_user'][$uid] = $one; } else { unset($feed_nicknames[$key]); } } } $cat_ary = array('type' => $feed_type, 'user' => implode("\r\n", $feed_nicknames)); jconf::set('feed', $cat_ary); jconf::update($config); $this->Messager("修改成功", 'admin.php?mod=feed&code=leader'); }
function MenuClick() { $search_admin_menu_index = jconf::get('search_admin_menu_index'); $search_admin_menu_click = jconf::get('search_admin_menu_click'); $id = (int) $this->Get['id']; if (!isset($search_admin_menu_index[$id])) { $this->Messager('请指定一个正确的地址', null); } $search_admin_menu_click[$id] += 1; arsort($search_admin_menu_click); jconf::set('search_admin_menu_click', $search_admin_menu_click); $url = current($search_admin_menu_index[$id]['index']); $this->Messager(null, $url); }
public function do_left_navigation() { $slide_config = jconf::get('left_navigation'); $slide = $this->Post['slide']; $chk = $this->Post['chk']; $temp['order'] = $this->Post['slide_new_order']; $temp['name'] = $this->Post['slide_new_name']; $temp['code'] = $this->Post['slide_new_code']; $temp['url'] = $this->Post['slide_new_url']; $temp['avaliable'] = $this->Post['slide_new_avaliable']; $temp_for_slide = array("mine" => array(), "myapp" => array(), "app" => array()); if ($slide) { foreach ($temp_for_slide as $k_type => $value) { if (!empty($temp['code'][$k_type])) { foreach ($temp['code'][$k_type] as $k_new_one => $code_one) { if (!$code_one || !$temp['name'][$k_type][$k_new_one]) { continue; } $slide[$k_type][$code_one]['code'] = $code_one; $slide[$k_type][$code_one]['name'] = $temp['name'][$k_type][$k_new_one]; $slide[$k_type][$code_one]['order'] = $temp['order'][$k_type][$k_new_one]; $slide[$k_type][$code_one]['url'] = $temp['url'][$k_type][$k_new_one]; $slide[$k_type][$code_one]['avaliable'] = $temp['avaliable'][$k_type][$k_new_one]; } } foreach ($slide[$k_type] as $k => $v) { if ($chk && in_array($k, $chk)) { unset($slide[$k_type][$k]); continue; } $slide[$k_type][$k]['avaliable'] = $v['avaliable'] ? 1 : 0; if (!$v['name'] || !$v['code']) { unset($slide[$k_type][$k]); continue; } $changeWords = array('mygroup'); if (in_array($v['code'], $changeWords)) { $slide[$k_type][$k]['name'] = str_replace('微群', $this->Config['changeword']['weiqun'], $v['name']); } $changeWords = array('newdigout', 'mydigout'); if (in_array($v['code'], $changeWords)) { $slide[$k_type][$k]['name'] = str_replace('赞', $this->Config['changeword']['dig'], $v['name']); } } } } if ($slide['mine']) { usort($slide['mine'], create_function('$a,$b', 'if($a[order]==$b[order])return 0;return $a[order]<$b[order]?1:-1;')); } else { $slide['mine'] = array(); } if ($slide['myapp']) { usort($slide['myapp'], create_function('$a,$b', 'if($a[order]==$b[order])return 0;return $a[order]<$b[order]?1:-1;')); } else { $slide['myapp'] = array(); } if ($slide['app']) { usort($slide['app'], create_function('$a,$b', 'if($a[order]==$b[order])return 0;return $a[order]<$b[order]?1:-1;')); } else { $slide['app'] = array(); } $slide = $slide ? $slide : $slide_config; jconf::set('left_navigation', $slide); $this->Messager('设置成功'); }
function rule_conf($update = false) { if ($update || false == ($credits_rule = jconf::get('credits_rule'))) { if (!$update && $credits_rule) { return $credits_rule; } $credits = jconf::get('credits'); $_extcredits = array(); foreach ($credits['ext'] as $_k => $_v) { if ($_v['enable'] && $_v['name']) { $_extcredits[$_k] = $_v; } } $credits_rule = array(); $query = DB::query("select * from " . TABLE_PREFIX . "credits_rule order by rid"); while (false != ($row = DB::fetch($query))) { $v = false; foreach ($_extcredits as $_k => $_v) { if ($row[$_k]) { $v = true; break; } } if ($v) { foreach ($row as $k => $v) { if (!$v) { unset($row[$k]); } } if (strpos($row['action'], '_C') !== false || strpos($row['action'], '_D') !== false) { $row['related'] = jlogic('channel')->id2subject($row['related']); } $credits_rule[$row['action']] = $row; } } if ($credits_rule) { $r = jconf::set('credits_rule', $credits_rule); } } return $credits_rule; }
function DoModify() { if (isset($this->Post['show'])) { jconf::set('show', $this->Post['show']); } if (isset($this->Post['cache'])) { jconf::set('cache', $this->Post['cache']); } cache_clear(); $config = array(); if ($this->Post['template_path'] != "" && $this->Post['template_path'] != $this->Config['template_path']) { $this->Post['template_path'] = dir_safe($this->Post['template_path']); $config['template_path'] = $this->Post['template_path']; } if (isset($this->Post['templatedeveloper']) && $this->Post['templatedeveloper'] != $this->Config['templatedeveloper']) { $config['templatedeveloper'] = $this->Post['templatedeveloper'] ? 1 : 0; } if (isset($this->Post['style_three_tol']) && $this->Post['style_three_tol'] != $this->Config['style_three_tol']) { $config['style_three_tol'] = $this->Post['style_three_tol'] ? 1 : 0; } if ($config) { jconf::update($config); } $this->Messager("设置成功"); }
function update_ploy_cache() { $cat_ary = array(); $query = DB::query("SELECT * FROM " . DB::table('qun_ploy') . " ORDER BY qun_num ASC"); while ($value = DB::fetch($query)) { $cat_ary[$value['id']] = $value; } jconf::set('qun_ploy', $cat_ary); return $cat_ary; }
function doProfile() { $profile = jlogic('member_profile')->getProfile(); #排序 $displayorder = jget('displayorder'); jlogic('member_profile')->setProfileOrder($displayorder); #自定义的title $title = jget('title'); jlogic('member_profile')->setProfileTitle($title); $eventinfo = jget('eventinfo'); if ($eventinfo) { foreach ($eventinfo as $key => $val) { $eventinfo[$key] = $profile[$key]; } } jconf::set('profileeventinfo', $eventinfo); $this->Messager('设置成功'); }