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 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 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 DoModify() { $field = 'theme'; $image_id = MEMBER_ID; $theme_bg_image = str_replace($this->Config['site_url'] . '/', '', $this->Post['theme_bg_image']); $image_path = RELATIVE_ROOT_PATH . 'images/' . $field . '/' . face_path($image_id); $image_name = $image_id . "_o.jpg"; $image_file = $image_path . $image_name; if ($_FILES && $_FILES[$field]['name']) { if (!is_dir($image_path)) { jio()->MakeDir($image_path); } jupload()->init($image_path, $field, true); jupload()->setNewName($image_name); $result = jupload()->doUpload(); if ($result) { $result = is_image($image_file); } if (!$result) { jio()->DeleteFile($image_file); $this->Messager("[图片上载失败]" . implode(" ", (array) jupload()->getError()), null); } else { $theme_bg_image = $image_file; } } else { if ($theme_bg_image != $image_file) { } } $theme_id = $this->Post['theme_id']; $theme_bg_color = $this->Post['theme_bg_color']; $theme_text_color = $this->Post['theme_text_color']; $theme_link_color = $this->Post['theme_link_color']; $theme_bg_image_type = $this->Post['theme_bg_image_type']; $theme_bg_repeat = $this->Post['theme_bg_repeat'] ? 1 : 0; $theme_bg_fixed = $this->Post['theme_bg_fixed'] ? 1 : 0; $sql = "update " . TABLE_PREFIX . "members set\r\n\t\t\t`theme_bg_image`='{$theme_bg_image}', `theme_bg_color`='{$theme_bg_color}', `theme_text_color`='{$theme_text_color}',\r\n\t\t\t`theme_link_color`='{$theme_link_color}' , theme_id='{$theme_id}' , theme_bg_image_type='{$theme_bg_image_type}' ,\r\n\t\t\t`theme_bg_repeat`='{$theme_bg_repeat}' , `theme_bg_fixed`='{$theme_bg_fixed}'\r\n\t\t\twhere `uid`='" . MEMBER_ID . "'"; $this->DatabaseHandler->Query($sql); if ('admin' == MEMBER_ROLE_TYPE && $this->Post['set_default']) { $config = array(); $config['theme_id'] = $theme_id; $config['theme_bg_image'] = $theme_bg_image; $config['theme_bg_color'] = $theme_bg_color; $config['theme_text_color'] = $theme_text_color; $config['theme_link_color'] = $theme_link_color; $config['theme_bg_image_type'] = $theme_bg_image_type; $config['theme_bg_repeat'] = $theme_bg_repeat; $config['theme_bg_fixed'] = $theme_bg_fixed; jconf::update($config); } $query = $this->DatabaseHandler->Query("select * from " . TABLE_PREFIX . "members where `uid`='" . MEMBER_ID . "'"); $this->_initTheme($query->GetRow()); $this->Messager("设置成功", 'index.php?mod=topic&code=myhome'); }
function dosetting() { $config = array(); $config['vote_open'] = $this->Post['config']['vote_open']; $config['vote_verify'] = $this->Post['config']['vote_verify']; $config['vote_vip'] = $this->Post['config']['vote_vip']; 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 doploy() { $config = array(); $config['qun_setting']['qun_ploy']['avatar'] = $this->Post['config']['qun_ploy']['avatar']; $config['qun_setting']['qun_ploy']['vip'] = $this->Post['config']['qun_ploy']['vip']; jconf::update($config); $new_ploy_ary = array(); if (!empty($this->Post['new_qun_ploy'])) { $new_fans_nums = $this->Post['new_qun_ploy']['fans_num_min']; foreach ($new_fans_nums as $key => $value) { $qun_num = $this->Post['new_qun_ploy']['qun_num'][$key]; $topics_lower = $this->Post['new_qun_ploy']['topics_lower'][$key]; if ($qun_num && $value) { $new_ploy_ary[] = array('fans_num_min' => intval($value), 'topics_lower' => $topics_lower, 'qun_num' => intval($qun_num)); } } } $qun_ploy = $this->Post['qun_ploy']; $new_ploy_keys = array(); if (!empty($qun_ploy)) { $new_ploy_keys = array_keys($qun_ploy); $max_ployid = max($new_ploy_keys); } foreach ($new_ploy_ary as $k => $v) { $qun_ploy[$k + $max_ployid + 1] = $v; } $del_ids =& $this->Post['del_ids']; $order_ary = array(); $order_ary_2 = array(); if (is_array($qun_ploy)) { foreach ($qun_ploy as $id => $val) { if (is_array($del_ids) && in_array($id, $del_ids) || $id == 0 && (!$val['fans_num_min'] || !$val['topics_lower'] || !$val['qun_num'])) { unset($qun_ploy[$id]); } else { $order_ary[$val['fans_num_min']] = $id; $order_ary_2[$val['topics_lower']] = $id; } } } ksort($order_ary); ksort($order_ary_2); $range_ary = array(); $range_ary_2 = array(); $min_limit = array_keys($order_ary); $min_limit_2 = array_keys($order_ary_2); for ($i = 0; $i < count($min_limit); $i++) { $range_ary[$order_ary[$min_limit[$i]]] = array('fans_num_max' => isset($min_limit[$i + 1]) ? $min_limit[$i + 1] : 999999999, 'fans_num_min' => $min_limit[$i]); } for ($i = 0; $i < count($min_limit_2); $i++) { $range_ary_2[$order_ary_2[$min_limit_2[$i]]] = array('topics_higher' => isset($min_limit_2[$i + 1]) ? $min_limit_2[$i + 1] : 999999999, 'topics_lower' => $min_limit_2[$i]); } foreach ($qun_ploy as $id => $ploy) { $fans_num_max_new = $range_ary[$id]['fans_num_max']; $fans_num_min_new = $range_ary[$id]['fans_num_min']; $topics_higher_new = $range_ary_2[$id]['topics_higher']; $topics_lower_new = $range_ary_2[$id]['topics_lower']; if ($fans_num_max_new == $fans_num_min_new) { $this->Messager('策略粉丝限制重复'); } if (in_array($id, $new_ploy_keys)) { $data = array('id' => $id, 'qun_num' => abs($ploy['qun_num']), 'fans_num_min' => $fans_num_min_new, 'fans_num_max' => $fans_num_max_new, 'topics_lower' => $topics_lower_new, 'topics_higher' => $topics_higher_new); $this->QunLogic->update_ploy($data); } else { $data = array('qun_num' => abs($ploy['qun_num']), 'fans_num_min' => $fans_num_min_new, 'fans_num_max' => $fans_num_max_new, 'topics_lower' => $topics_lower_new, 'topics_higher' => $topics_higher_new); $this->QunLogic->add_ploy($data); } } if (!empty($del_ids)) { $count = $this->QunLogic->ploy_nums(); if ($count == count($del_ids)) { $this->QunLogic->update_ploy_cache(); $this->Messager('操作成功,但不允许删除全部策略'); } $this->QunLogic->delete_ploy($del_ids); } $this->QunLogic->update_ploy_cache(); $this->Messager('操作成功了'); }
public function onOff() { $onOff = (int) $this->Get["reward_on_off"]; jconf::update("reward_open", $onOff); $this->Messager('操作成功', 'admin.php?mod=reward'); }
function DoModifyFtp() { $ftp_key = jget('ftp_key', 'int'); $do = jget('do'); $mod_new_ftp = $ftp_config = jconf::get('ftp'); if ($ftp_key >= 0 && $do == 'edit') { $ftp = $this->Post['ftp']; $ftp['on'] = $ftp['on'] && $ftp['host'] ? 1 : 0; $ftp['ssl'] = $ftp['ssl'] ? 1 : 0; $ftp['port'] = $ftp['port'] ? $ftp['port'] : ($ftp['type'] == 'FTP' ? 21 : 80); $ftp['attachurl'] = $ftp['attachurl'] ? $ftp['attachurl'] : ($ftp['type'] == 'Aliyun' && $ftp['attachdir'] ? 'http:/' . '/' . $ftp['attachdir'] . '.oss.aliyuncs.com' : ''); $ftp['pasv'] = $ftp['pasv'] ? 1 : 0; $ftp['timeout'] = max(0, (int) $ftp['timeout']); $ftp['priority'] = max(1, (int) $ftp['priority']); if ('请输入FTP密码' == $ftp['password']) { $ftp['password'] = $ftp_config[$ftp_key]['password']; } $mod_new_ftp[$ftp_key] = $ftp; $ftp_on_error = false; jconf::set('ftp', $mod_new_ftp); if ($ftp['on']) { if (!($ftp['host'] && $ftp['port'] && $ftp['username'] && $ftp['password'] && $ftp['attachdir'] && $ftp['attachurl'])) { $mod_new_ftp[$ftp_key]['on'] = $ftp['on'] = 0; jconf::set('ftp', $mod_new_ftp); $this->Messager('<font color=red>数据填写不完整</font>'); } $ftp_result = ftpcmd('upload', 'images/noavatar.gif', '', $ftp_key); if ($ftp_result < 1) { $ftp_error = $ftp_result; $mod_new_ftp[$ftp_key]['on'] = $ftp['on'] = 0; $ftp_on_error = true; jconf::set('ftp', $mod_new_ftp); } } $ftp_sys_on = 0; foreach ($mod_new_ftp as $val) { if ($val['on'] == 1) { $ftp_sys_on = 1; break; } } if ($ftp_sys_on != $this->Config['ftp_on']) { $config = array(); $config['ftp_on'] = $ftp_sys_on; jconf::update($config); } $errors = array('-100' => '服务器禁止了FTP功能', '-101' => '配置中没有开启FTP(请在配置中启用FTP功能)', '-102' => '连接到FTP服务器错误(请检查FTP地址或者端口号是否正确)', '-103' => '登录FTP服务器错误(请检查FTP用户名和密码是否正确)', '-104' => '更改FTP目录错误(请检查FTP用户的权限)', '-105' => '创建FTP目录错误(请检查FTP用户的权限)', '-106' => '文件本地读取错误', '-107' => '文件上传到FTP服务器错误(请检查FTP的权限)<br>如果您是第一次开启,出现该提示,则说明您的FTP无写入权限<br>如果您以前已经正常开启使用过,则说明您的FTP无修改与删除权限<br>'); if ($ftp_error && isset($errors[$ftp_error])) { $this->Messager($errors[$ftp_error], null); } elseif ($ftp_on_error) { $this->Messager('<font color=red>服务开启失败,请检查数据填写是否正确</font>'); } } else { $newftp = jget('newftp'); $newftp_arr = array(); if ($newftp['host']) { foreach ($newftp['host'] as $k => $v) { if ($v && $newftp['port'][$k]) { $newftp_arr[$k]['host'] = $v; $newftp_arr[$k]['port'] = $newftp['port'][$k]; $newftp_arr[$k]['username'] = $newftp['username'][$k]; $newftp_arr[$k]['password'] = $newftp['password'][$k]; $newftp_arr[$k]['type'] = $newftp['type'][$k]; $newftp_arr[$k]['on'] = 0; $newftp_arr[$k]['ssl'] = 0; $newftp_arr[$k]['pasv'] = 0; $newftp_arr[$k]['timeout'] = 0; $newftp_arr[$k]['priority'] = 1; $newftp_arr[$k]['attachdir'] = $newftp['type'][$k] == 'FTP' ? '.' : ''; } } } $ids = jget('ids'); if ($ids) { foreach ($ids as $k => $v) { unset($ftp_config[$v]); } } $new_ftp_config = array_merge($ftp_config, $newftp_arr); jconf::set('ftp', $new_ftp_config); } $this->Messager("设置成功"); }
function DoSetting() { if (!is_file(ROOT_PATH . './api/uc_client/client.php')) { $this->Messager('Ucenter的客户端文件 <b>' . ROOT_PATH . './api/uc_client/client.php' . "</b> 不存在,请检查"); } if (!is_file(ROOT_PATH . 'api/uc.php')) { $this->Messager('Ucenter的api文件 <b>' . ROOT_PATH . 'api/uc.php' . "</b> 不存在,请检查"); } if (trim($_POST['uc_config_string'])) { $_uc_config = $this->_get_uc_config($_POST['uc_config_string']); if (!$_uc_config) { $this->Messager("通过字符串更新UC配置失败,请手工填写具体的配置信息", null); } $_POST['ucenter'] = array_merge($_POST['ucenter'], $_uc_config); } $_POST['ucenter']['uc_charset'] = $_POST['ucenter']['uc_db_charset'] = $this->Config['charset']; if (!$_POST['ucenter']['uc_key']) { $this->Messager("请填写Ucenter通信密钥,建议查看" . "帮助文" . "档</b>" . "</a>"); } if (!$_POST['ucenter']['uc_api']) { $this->Messager("请填写Ucenter地址,建议查看" . "帮助文" . "档</b>" . "</a>"); } if (!$_POST['ucenter']['uc_app_id']) { $this->Messager("请填写当前应用ID,建议查看" . "帮助文" . "档</b>" . "</a>"); } if ('请输入Ucenter的数据库密码' == $_POST['ucenter']['uc_db_password']) { $_POST['ucenter']['uc_db_password'] = jconf::get('ucenter', 'uc_db_password'); } if ('mysql' == $_POST['ucenter']['uc_connect']) { $_POST['ucenter']['uc_db_name'] = "`" . trim($_POST['ucenter']['uc_db_name'], '`') . "`"; $_POST['ucenter']['uc_db_table_prefix'] = $_POST['ucenter']['uc_db_name'] . '.' . (false !== ($_tmp_pos = strpos($_POST['ucenter']['uc_db_table_prefix'], '.')) ? substr($_POST['ucenter']['uc_db_table_prefix'], $_tmp_pos + 1) : $_POST['ucenter']['uc_db_table_prefix']); if (@($dl = mysql_connect($_POST['ucenter']['uc_db_host'], $_POST['ucenter']['uc_db_user'], $_POST['ucenter']['uc_db_password'])) && mysql_query("SHOW COLUMNS FROM {$_POST['ucenter']['uc_db_table_prefix']}members", $dl)) { } else { $this->Messager("无法连接Ucenter数据库,请检查您填写的Ucenter数据库配置信息"); } } $ucenter = $_POST['ucenter']; jconf::set('ucenter', $ucenter); if ($ucenter['enable']) { if ('mysql' == $ucenter['uc_connect']) { include_once ROOT_PATH . './api/uc_api_db.php'; $uc_db = new JSG_UC_API_DB(); @$uc_db->connect($ucenter['uc_db_host'], $ucenter['uc_db_user'], $ucenter['uc_db_password'], $ucenter['uc_db_name'], $ucenter['uc_db_charset'], 0, $ucenter['uc_db_table_prefix']); if (!$uc_db->link || !$uc_db->query("SHOW COLUMNS FROM {$ucenter['uc_db_table_prefix']}members", 'SILENT')) { $ucenter['enable'] = 0; jconf::set('ucenter', $ucenter); jconf::update('ucenter_enable', $ucenter['enable'] ? 1 : 0); $this->Messager("无法连接Ucenter数据库,请检查您填写的Ucenter数据库配置信息是否正确."); } else { jconf::update('ucenter_enable', $ucenter['enable'] ? 1 : 0); if ($ucenter['enable']) { $this->Messager("Ucenter配置保存成功,如果您已经对数据库进行过备份了,<a href='admin.php?mod=ucenter&code=merge&confirm=1'><b>请点此进行用户数据整合</b></a>", null); } } } } jconf::update('ucenter_enable', $ucenter['enable'] ? 1 : 0); $this->Messager("配置成功", 'admin.php?mod=ucenter&code=ucenter'); }
function DoValidate() { $data = array('is_card_pic' => (int) $this->Post['is_card_pic']); $new_config = array(); $new_config['card_pic_enable'] = $data; jconf::update($new_config); $this->Messager("设置成功", 'admin.php?mod=vipintro&code=validate_setting', -1); }
function SetVest() { $config = array(); $config['vest_enable'] = $this->Post['config']['vest_enable'] ? 1 : 0; $config['vest_role'] = $this->Post['config']['vest_role'] ? implode(',', $this->Post['config']['vest_role']) : ''; jconf::update($config); $this->Messager('设置成功', 'admin.php?mod=member&code=config'); }
function _upgradeLock($lock = true) { if ($lock) { @touch(ROOT_PATH . './data/cache/upgrade.lock'); jconf::update('upgrade_lock_time', time()); } else { jconf::update('upgrade_lock_time', 0); @unlink(ROOT_PATH . './data/cache/upgrade.lock'); @unlink(ROOT_PATH . 'upgrade.php'); } }
function archive($tid = 0) { $num = 1000000; $keep = 200000; $tid = jfilter($tid, 'int'); if ($tid > 0 && $tid - $GLOBALS['_J']['config']['last_archive_topic_tid'] > $num + $keep) { $max_tid = $num + max(0, (int) $GLOBALS['_J']['config']['last_archive_topic_tid']); if (!jtable('topic_table_id')->table_id($max_tid)) { $table_id = jtable('topic_table_id')->add($max_tid); if ($table_id) { $p = array('<=@tid' => $max_tid); jtable('topic')->copy($this->_table . '_' . $table_id, 3, $p); jtable('topic_more')->copy('topic_more_' . $table_id, 3, $p); jconf::update('last_archive_topic_tid', $max_tid); } } } }
function archive($tid = 0) { $num = 500000; $tid = jfilter($tid, 'int'); if ($tid > 0 && $tid - $GLOBALS['_J']['config']['last_archive_topic_relation_tid'] > $num) { $max_tid = $num + max(0, (int) $GLOBALS['_J']['config']['last_archive_topic_relation_tid']); if (!jtable('topic_relation_table_id')->table_id($max_tid)) { $table_id = jtable('topic_relation_table_id')->add($max_tid); if ($table_id) { $table_name = $this->_table . '_' . $table_id; jtable($this->_table)->copy($table_name, 3, array('<=@totid' => $max_tid)); jconf::update('last_archive_topic_relation_tid', $max_tid); } } } }
function doSetting() { $config = array(); $config['event_open'] = $this->Post['open'] ? $this->Post['open'] : 0; $config['event_verify'] = $this->Post['verify'] ? $this->Post['verify'] : 0; $config['event_vip'] = $this->Post['vip'] ? $this->Post['vip'] : 0; jconf::update($config); $this->Messager('操作成功了'); }
function Main() { $sql = "SELECT * FROM " . TABLE_PREFIX . 'task'; $query = $this->DatabaseHandler->Query($sql); $task_list = array(); $available_count = 0; while ($row = $query->GetRow()) { $disabled = $row['weekday'] == -1 && $row['day'] == -1 && $row['hour'] == -1 && $row['minute'] == '' ? 'disabled' : ''; $row['disabled'] = $disabled; $row['type_name'] = $row['type'] == 'system' ? "内置" : "自定义"; if ($row['available'] == 1) { $available_count++; } foreach (array('weekday', 'day', 'hour', 'minute') as $key) { if (in_array($row[$key], array(-1, ''))) { $row[$key] = '<b>*</b>'; } elseif ($key == 'weekday') { $row[$key] = $lang['rows_week_day_' . $row[$key]]; } elseif ($key == 'minute') { foreach ($row[$key] = explode("\t", $row[$key]) as $k => $v) { $row[$key][$k] = sprintf('%02d', $v); } $row[$key] = implode(',', $row[$key]); } } $row['lastrun'] = $row['lastrun'] ? my_date_format($row['lastrun'], "Y-m-d<\\b\\r>H:i:s") : '<b>N/A</b>'; $row['nextrun'] = $row['nextrun'] ? my_date_format($row['nextrun'], "Y-m-d<\\b\\r>H:i:s") : '<b>N/A</b>'; $task_list[] = $row; } if ($available_count > 0) { $task_disable = 1; } else { $task_disable = 0; } if ($task_disable != $this->Config['task_disable']) { $config = array(); $config['task_disable'] = $task_disable; jconf::update($config); } include template('admin/task_list'); }
function Setting() { $config = jget('config'); jconf::update($config); $this->Messager('设置成功', -1); }
function doModify() { $delete_list = (array) $this->Post['delete']; @($robot_config = jconf::get('robot')); $robot_config['turnon'] = (bool) $this->Post['config']['turnon']; if (sizeof($delete_list)) { include_once ROOT_PATH . 'include/logic/robot.logic.php'; $RobotRogic = new RobotLogic(); include_once ROOT_PATH . 'include/logic/robot_log.logic.php'; $RobotLogLogic = new RobotLogLogic(""); foreach ($delete_list as $name) { unset($robot_config['list'][$name]); $sql = "DELETE from " . $RobotRogic->tableName . " where name='" . $name . "'"; $query = $this->DatabaseHandler->Query($sql); $sql = "DELETE from " . $RobotLogLogic->tableName . " where name='" . $name . "'"; $query = $this->DatabaseHandler->Query($sql, "SKIP_ERROR"); } } jconf::set('robot', $robot_config); jconf::update('robot_enable', $robot_config['turnon'] ? 1 : 0); $this->Messager("修改成功"); }
function doset() { $channel = $this->Post['channel']; $config = array(); $config['channel_enable'] = $channel['enable'] ? 1 : 0; $config['channel_must'] = $channel['must'] ? 1 : 0; $config['channel_recommend'] = $channel['recommend'] ? $channel['recommend'] : 0; $config['channel_rtitle'] = $channel['rtitle'] ? $channel['rtitle'] : '新闻公告'; jconf::update($config); $this->Messager("修改成功"); }
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 DoModifyHZSWB() { jfunc('hzswb'); $hzswb_default = jconf::get('hzswb'); $hzswb = $this->Post['hzswb']; $hzswb['enable'] = $hzswb['enable'] ? 1 : 0; $hzswb = hzswb_config($hzswb); if ($hzswb['enable'] != $this->Config['hzswb_enable']) { jconf::update('hzswb_enable', $hzswb['enable']); } if ($hzswb != $hzswb_default) { jconf::set('hzswb', $hzswb); } $this->Messager("配置修改成功"); }
public function do_setting() { $wechat = $this->Post['wechat']; $diy_key = $this->Post['diy_key']; $diy_reply = $this->Post['diy_reply']; $delete = $this->Post['delete']; $wechat_conf = jconf::get("wechat"); if ($_FILES['qrcode']['name']) { $image_name = "my_wechat_qrcode.jpg"; $image_path = RELATIVE_ROOT_PATH . 'images/'; $image_file = $image_path . $image_name; jupload()->init($image_path, 'qrcode', true); jupload()->setMaxSize(512); jupload()->setNewName($image_name); $result = jupload()->doUpload(); if ($result) { $result = is_image($image_file); } if (!$result) { unlink($image_file); } image_thumb($image_file, $image_file, 150, 150); if ($this->Config['ftp_on']) { $ftp_key = randgetftp(); $get_ftps = jconf::get('ftp'); $site_url = $get_ftps[$ftp_key]['attachurl']; $ftp_result = ftpcmd('upload', $image_file, '', $ftp_key); if ($ftp_result > 0) { jio()->DeleteFile($image_file); $image_file = $site_url . '/' . str_replace('./', '', $image_file); } } $wechat['my_qrcode'] = $image_file; } else { $wechat['my_qrcode'] = $wechat_conf['my_qrcode']; } $wechat['help_key'] = explode('|', $wechat['help_key']); $wechat['bind_key'] = explode('|', $wechat['bind_key']); $wechat['3g_key'] = explode('|', $wechat['3g_key']); $wechat['wap_key'] = explode('|', $wechat['wap_key']); if ($diy_key && $diy_reply) { $wechat['diy_reply']['diy_key'][] = $diy_key; $temp_key = array_search($diy_key, $wechat['diy_reply']['diy_key']); $wechat['diy_reply']['diy_reply'][$temp_key] = $diy_reply; } if (is_array($delete)) { foreach ($delete as $diy_key_del) { if ($wechat['diy_reply']['diy_key'][$diy_key_del]) { unset($wechat['diy_reply']['diy_key'][$diy_key_del]); } if ($wechat['diy_reply']['diy_reply'][$diy_key_del]) { unset($wechat['diy_reply']['diy_reply'][$diy_key_del]); } } } if ($wechat['on'] && !$wechat['token']) { $this->Messager("开启微信必须设置Token"); } else { $r = jconf::update("wechat_enable", $wechat['on']); $r = jconf::update("wechat_qrcode", $wechat['my_qrcode']); $r = jconf::update("my_wechat", $wechat['mywechat']); $r = jconf::set("wechat", $wechat); $this->Messager("设置成功!"); } }
function DoModify() { $enable = $this->Post['enable'] ? 1 : 0; if ($enable != $this->Config['ad_enable']) { jconf::update('ad_enable', $enable); } $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 archive($uid = 0) { $num = 200000; $uid = jfilter($uid, 'int'); if ($uid > 0 && $uid - $GLOBALS['_J']['config']['last_archive_member_uid'] > $num) { $max_uid = $num + max(0, (int) $GLOBALS['_J']['config']['last_archive_member_uid']); if (!jtable('member_table_id')->table_id($max_uid)) { $table_id = jtable('member_table_id')->add($max_uid); if ($table_id) { jtable($this->_table)->copy($this->_table . '_' . $table_id, 3, array('<=@uid' => $max_uid)); jtable('member_relation')->copy('member_relation_' . $table_id, 3, array('<=@touid' => $max_uid)); jconf::update('last_archive_member_uid', $max_uid); } } } }
function DoSave() { if (!is_file(ROOT_PATH . './api/pw_client/uc_client.php')) { $this->Messager('Phpwind的客户端文件 <b>' . ROOT_PATH . './api/pw_client/uc_client.php' . "</b> 不存在,请检查"); } if (!is_file(ROOT_PATH . 'pw_api.php')) { $this->Messager('Phpwind的api文件 <b>' . ROOT_PATH . 'pw_api.php' . "</b> 不存在,请检查"); } $phpwind = $this->Post['phpwind']; $phpwind_config_default = $phpwind_config = jconf::get('phpwind'); $phpwind_config['enable'] = $phpwind['enable'] ? 1 : 0; $phpwind_config['face'] = $phpwind['face'] ? 1 : 0; $phpwind_config['bbs'] = $phpwind['bbs'] ? 1 : 0; $phpwind_config['pw_db_host'] = $phpwind['pw_db_host']; $phpwind_config['pw_db_name'] = $phpwind['pw_db_name']; $phpwind_config['pw_db_user'] = $phpwind['pw_db_user']; $phpwind_config['pw_db_password'] = $phpwind['pw_db_password']; $phpwind_config['pw_ip'] = $phpwind['pw_ip']; $phpwind_config['pw_db_table_prefix'] = $phpwind['pw_db_table_prefix']; $phpwind_config['pw_db_charset'] = $phpwind['pw_db_charset']; $phpwind_config['pw_charset'] = $phpwind['pw_charset']; $phpwind_config['pw_pptkey'] = $phpwind['pw_pptkey']; $phpwind_config['pw_key'] = $phpwind['pw_key'] ? $phpwind['pw_key'] : ''; $phpwind_config['pw_api'] = $phpwind['pw_api']; $phpwind_config['pw_app_id'] = $phpwind['pw_app_id'] ? $phpwind['pw_app_id'] : 0; if ($phpwind_config['enable']) { include_once ROOT_PATH . './api/uc_api_db.php'; $pw_db = new JSG_UC_API_DB(); @$pw_db->connect($phpwind['pw_db_host'], $phpwind['pw_db_user'], $phpwind['pw_db_password'], $phpwind['pw_db_name'], $phpwind['pw_db_charset'], 1, $phpwind['pw_db_table_prefix']); if (!$pw_db->link || !$pw_db->query("SHOW COLUMNS FROM {$phpwind['pw_db_table_prefix']}members", 'SILENT')) { $this->Messager("无法连接PhpWind数据库,请检查您填写的PhpWind数据库配置信息是否正确."); exit; } } if ($phpwind_config_default != $phpwind_config) { jconf::set('phpwind', $phpwind_config); } if ($phpwind_config['enable'] != $this->Config['phpwind_enable'] || $phpwind_config['bbs'] != $this->Config['pwbbs_enable']) { $config = array(); $config['phpwind_enable'] = $phpwind_config['enable']; $config['pwbbs_enable'] = $phpwind_config['bbs']; if ($phpwind_config['enable'] == 1) { $config['ucenter_enable'] = 0; $config['dzbbs_enable'] = 0; } jconf::update($config); } $this->Messager("配置成功"); }