function SetSqlStore($sql) { $this->SQL_Store[] = $sql; if (true === DEBUG) { jlog('mysql_query_log', jstripslashes($sql['SQL']), 0); } }
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 Main() { if ($this->MemberHandler->HasPermission($this->Module, $this->Code) == false) { $this->Messager($this->MemberHandler->GetError(), null); } $act_list = array(); if ($this->Config['company_enable']) { $act_list['company'] = '同单位'; } if (!$this->Config['profile_search_close']) { $act_list['search'] = '同城用户'; } if (!$this->Config['profile_maybe_friend_close']) { $act_list['maybe_friend'] = '同兴趣'; } if (!$this->Config['profile_usertag_close']) { $act_list['usertag'] = '同类人'; } if (!$this->Config['profile_role_close']) { $act_list['role'] = '同分组'; } if (false == jconf::get('invite', 'link_display_none')) { $act_list['invite'] = '邀请好友'; } $act = $this->Code; $member = $this->Member; if ($member['medal_id']) { $medal_list = $this->TopicLogic->GetMedal($member['medal_id'], $member['uid']); } $member_nickname = $member['nickname']; if ('invite' == $act) { $sql = "delete from `" . TABLE_PREFIX . "invite` where `fuid`<'1' and `dateline`>'0' and `dateline`<'" . (time() - 86400 * 7) . "'"; $this->DatabaseHandler->Query($sql); $sql = "select count(*) as my_invite_count from `" . TABLE_PREFIX . "invite` where `uid`='{$member['uid']}'"; $query = $this->DatabaseHandler->Query($sql); $row = $query->GetRow(); $my_invite_count = $row['my_invite_count']; $can_invite_count = max(0, $this->Config['invite_count_max'] - $my_invite_count); if ($my_invite_count > 0) { $per_page_num = 5; $query_link = "index.php?mod=" . ($_GET['mod_original'] ? get_safe_code($_GET['mod_original']) : $this->Module) . ($this->Code ? "&code={$this->Code}" : ""); $_config = array('return' => 'array'); $page_arr = page($my_invite_count, $per_page_num, $query_link, $_config); $sql = "select i.*,m.province,m.city,m.topic_count,m.fans_count,m.nickname as fusername from `" . TABLE_PREFIX . "invite` i\r\n\t\t\t\t\t\tleft join `" . TABLE_PREFIX . "members` m on m.uid = i.fuid\r\n\t\t\t\t\t \twhere i.`uid`='{$member['uid']}' order by i.`id` desc {$page_arr['limit']}"; $query = $this->DatabaseHandler->Query($sql); $invite_list = array(); while (false != ($row = $query->GetRow())) { $row['from_area'] = $row['province'] ? $row['province'] . ' ' . $row['city'] : '无'; $row['face'] = face_get($row['fuid']); $invite_list[] = $row; } $invite_list = buddy_follow_html($invite_list, 'fuid'); } $MEMBER_INVITE_CODE = ''; if (!$this->Config['invite_count_max'] || $this->Config['invite_count_max'] > $member['invite_count']) { $MEMBER_INVITE_CODE = $member['invitecode']; } if (!$MEMBER_INVITE_CODE) { $MEMBER_INVITE_CODE = random(16); $sql = "update `" . TABLE_PREFIX . "members` set `invitecode`='{$MEMBER_INVITE_CODE}' where `uid`='" . MEMBER_ID . "'"; $this->DatabaseHandler->Query($sql); } $inviteURL = "index.php?mod=member&code=" . urlencode(MEMBER_ID . "_" . $MEMBER_INVITE_CODE); $inviteURL = get_invite_url($inviteURL, $this->Config['site_url']); $invite = jconf::get('invite'); $invite_msg = empty($invite) ? '' : jstripslashes($invite['invite_msg']); if (!empty($invite_msg)) { $replaces = array('nickname' => $member['nickname'], 'inviteurl' => $inviteURL, 'invite_num' => $this->Config['invite_limit'], 'site_name' => $this->Config['site_name']); foreach ($replaces as $key => $val) { $invite_msg = str_replace("#" . $key . "#", $val, $invite_msg); } } } elseif ('maybe_friend' == $act) { $my_favorite_tags = jlogic('tag_favorite')->my_favorite_tags(MEMBER_ID, 20); if ($my_favorite_tags) { $uids = jlogic('tag_favorite')->favorite_uids($my_favorite_tags, 30); if ($uids) { $p = array('uid' => MEMBER_ID, 'touid' => $uids, 'result_count' => count($uids)); $buddyids = get_buddyids($p); $sql = "select `uid`,`ucuid`,`username`,`face_url`,`face`,`province`,`city`,`fans_count`,`topic_count`,`validate`,`nickname` from `" . TABLE_PREFIX . "members` where `uid` in('" . implode("','", $uids) . "')"; $query = $this->DatabaseHandler->Query($sql); $member_list = array(); while (false != ($row = $query->GetRow())) { $buddy_status = isset($buddyids[$row['uid']]); if (!$buddy_status && MEMBER_ID != $row['uid']) { $row['follow_html'] = follow_html($row['uid'], $buddy_status); $row = jsg_member_make($row); $member_list[$row['uid']] = $row; $tag_favorite_uids[$row['uid']] = $row['uid']; } } } } $user_favorite = array(); if ($tag_favorite_uids) { $user_favorite = jlogic('tag_favorite')->my_favorite($tag_favorite_uids, 100); } } elseif ('usertag' == $act) { $per_page_num = 10; $query_link = 'index.php?mod=profile&code=usertag'; $order = " order by `fans_count` desc "; $sql = "select * from `" . TABLE_PREFIX . "user_tag_fields` where `uid` = '" . MEMBER_ID . "'"; $query = $this->DatabaseHandler->Query($sql); $mytag = array(); $user_tagid = array(); while (false != ($row = $query->GetRow())) { $mytag[] = $row; $user_tagid[$row['tag_id']] = $row['tag_id']; } if ($user_tagid) { $sql = "select * from `" . TABLE_PREFIX . "user_tag_fields` where `uid` != '" . MEMBER_ID . "' and `tag_id` in (" . jimplode($user_tagid) . ") "; $query = $this->DatabaseHandler->Query($sql); $member_uids = array(); while (false != ($row = $query->GetRow())) { $member_uids[$row['uid']] = $row['uid']; } $where = $where_list = " where `uid` in (" . jimplode($member_uids) . ")"; } if ($member_uids) { $member_list = array(); $sql = "select count(*) as `total_record` from `" . TABLE_PREFIX . "members` {$where}"; $total_record = DB::result_first($sql); if ($total_record > 0) { $_config = array('return' => 'array'); $page_arr = page($total_record, $per_page_num, $query_link, $_config); $member_list = $this->TopicLogic->GetMember("{$where} {$order} {$page_arr['limit']}", "`uid`,`ucuid`,`username`,`nickname`,`face_url`,`face`,`fans_count`,`topic_count`,`province`,`city`,`validate`"); $member_list = buddy_follow_html($member_list); } $sql = "select * from `" . TABLE_PREFIX . "user_tag_fields` {$where}"; $query = $this->DatabaseHandler->Query($sql); $member_tag = array(); while (false != ($row = $query->GetRow())) { $member_tag[] = $row; } } $mytag = $this->_MyUserTag(MEMBER_ID); } else { $per_page_num = 10; $query_link = 'index.php?mod=profile&code=' . $act; $where_list = array(); if ('search' == $act) { $province_name = $member['province']; $city_name = $member['city']; $area_name = $member['area']; $street_name = $member['street']; $province = $this->Get['province']; $city = $this->Get['city']; $area = $this->Get['area']; $street = $this->Get['street']; if ($province) { $province_name = DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '{$province}'"); if ($city) { $city_name = DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '{$city}'"); if ($area) { $area_name = DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '{$area}'"); if ($street) { $street_name = DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '{$street}'"); } else { $street_name = ''; } } else { $area_name = ''; $street_name = ''; } } else { $city_name = ''; $area_name = ''; $street_name = ''; } } if (empty($where_list)) { if ($province_name) { $where_list['province'] = "`province`='" . addslashes("{$province_name}") . "'"; $query_link .= "&province=" . $province; if ($city_name) { $where_list['city'] = "`city`='" . addslashes("{$city_name}") . "'"; $query_link .= "&city=" . $city; if ($area_name) { $where_list['area'] = "`area`='" . addslashes("{$area_name}") . "'"; $query_link .= "&area=" . $area; if ($street_name) { $where_list['street'] = "`street`='" . addslashes("{$street_name}") . "'"; $query_link .= "&street=" . $street; } } } } } $query = $this->DatabaseHandler->Query("select * from " . TABLE_PREFIX . "common_district where `upid` = '0' order by list"); while ($rsdb = $query->GetRow()) { $province_arr[$rsdb['id']]['value'] = $rsdb['id']; $province_arr[$rsdb['id']]['name'] = $rsdb['name']; if ($member['province'] == $rsdb['name']) { $province_id = $rsdb['id']; } } $province_id = $province ? $province : $province_id; $province_list = jform()->Select("province", $province_arr, $province_id, "onchange=\"changeProvince();\""); $hid_area = ''; $hid_city = ''; $hid_street = ''; if (!$province && $province_id) { if ($member['city']) { $hid_city = DB::result_first("select id from " . TABLE_PREFIX . "common_district where name = '{$member['city']}' and upid = '{$province_id}'"); } if ($hid_city) { if ($member['area']) { $hid_area = DB::result_first("select id from " . TABLE_PREFIX . "common_district where name = '{$member['area']}' and upid = '{$hid_city}'"); } if ($hid_area) { if ($member['street']) { $hid_street = DB::result_first("select id from " . TABLE_PREFIX . "common_district where name = '{$member['street']}' and upid = '{$hid_area}'"); } } } } $hid_city = $city ? $city : $hid_city; $hid_area = $area ? $area : $hid_area; $hid_street = $street ? $street : $hid_street; } elseif ('company' == $act && $this->Config['company_enable'] && @is_file(ROOT_PATH . 'include/logic/cp.logic.php')) { global $_J; $companyid = jget('companyid', 'int'); $departmentid = jget('departmentid', 'int'); $jobid = jget('jobid', 'int'); if ($companyid < 1 && $departmentid < 1 && $jobid < 1) { $companyid = (int) $_J['member']['companyid']; $departmentid = (int) $_J['member']['departmentid']; $jobid = (int) $_J['member']['jobid']; } $company_list = jlogic('cp')->get_cp_html($companyid); if ($this->Config['department_enable']) { $department_list = jlogic('cp')->get_cp_html($departmentid, 'department', $companyid); } $job_list = jlogic('job')->get_job_select($jobid); if ($companyid > 0) { $where_list['company'] = "`companyid`='" . $companyid . "'"; $query_link .= '&companyid=' . $companyid; } if ($departmentid > 0) { $where_list['department'] = "`departmentid`='" . $departmentid . "'"; $query_link .= '&departmentid=' . $departmentid; } if ($jobid > 0) { $where_list['job'] = "`jobid`='" . $jobid . "'"; $query_link .= '&jobid=' . $jobid; } } else { global $_J; $roleid = $this->Get['roleid'] ? (int) $this->Get['roleid'] : ($_J['role_id'] ? $_J['role_id'] : 0); $roles = jlogic('channel')->get_user_role(); $role_list = jform()->Select("roleid", $roles, $roleid, ""); if ($roleid) { $where_list['role'] = "`role_id`='" . $roleid . "'"; $query_link .= "&roleid=" . $roleid; } } $member_list = array(); if ($where_list) { $where = empty($where_list) ? null : ' WHERE ' . implode(' AND ', $where_list) . ' '; $order = " order by `uid` desc "; $sql = "select count(*) as `total_record` from `" . TABLE_PREFIX . "members` {$where} "; $total_record = DB::result_first($sql); if ($total_record > 0) { $_config = array('return' => 'array'); $page_arr = page($total_record, $per_page_num, $query_link, $_config); $uids = array(); $member_list = $this->TopicLogic->GetMember("{$where} {$order} {$page_arr['limit']}", "`uid`,`ucuid`,`username`,`nickname`,`face_url`,`face`,`fans_count`,`topic_count`,`province`,`city`,`aboutme`"); foreach ($member_list as $_m) { $uids[$_m['uid']] = $_m['uid']; } if ($uids && MEMBER_ID > 0) { $member_list = buddy_follow_html($member_list); $province = isset($_GET['province']) ? $province : $member['province']; $city = isset($_GET['city']) ? $city : $member['city']; $sql = "select * from (select * from `" . TABLE_PREFIX . "topic` where `uid` in (" . jimplode($uids) . ") and `type` != 'reply' order by `dateline` desc) a group by `uid` "; $query = $this->DatabaseHandler->Query($sql); $tids = array(); while (false != ($row = $query->GetRow())) { $tids[$row['tid']] = $row['tid']; } $topic_list = $this->TopicLogic->Get($tids); } } } $gender_radio = jform()->Radio('gender', array(0 => array('name' => '不限', 'value' => 0), 1 => array('name' => '男', 'value' => 1), 2 => array('name' => '女', 'value' => 2)), $gender); } $this->Title = $act_list[$act]; include template('social/profile_main'); }
function _filterKeyword($keyword) { $keyword = str_replace(array('"', "'", '\\', '#', '%', '&', '*', '@', '$'), '', $keyword); $keyword = jstripslashes($keyword); $keyword = strip_tags($keyword); $keyword = trim($keyword); if (2 > strlen($keyword)) { $this->Messager("请输入至少三个字符以上的关键词", -1); } $shield = $this->Code == 'topic' ? 1 : 0; $f_rets = filter($keyword, 0, 0, $shield); if ($f_rets && $f_rets['error']) { $this->Messager("输入的搜索词 " . $f_rets['msg'], null); } if ($f_rets && $f_rets['shield']) { return array('shield' => 1, 'keyword' => $keyword); } $keyword = addslashes($keyword); return $keyword; }
function _content_strip($c) { if (false !== strpos($c, ':/' . '/')) { $st = $GLOBALS['_J']['config']['site_domain']; $bh = substr_count($st, '.') > 1 ? substr($st, strpos($st, '.') + 1) : $st; if (false !== strpos($c, $bh)) { $p = '~<iframe.+?src\\s*\\=\\s*[\\\\]*[\'\\"](https?\\:\\/\\/(?:[\\w]+\\.)*(?:' . preg_quote($bh, '~') . ')[^\'\\"]+?)[\\\\]*[\'\\"].*?>.*?<\\/iframe>~is'; preg_match_all($p, $c, $rs); if ($rs) { $s = $r = array(); foreach ($rs[0] as $k => $v) { $s[$k] = $v; $this->replaces['replace'][] = jstripslashes(preg_replace(array('~ width\\s*\\=\\s*[\\\\]*[\'\\"]\\d+[\\\\]*[\'\\"]~i'), array(' width="460"'), $v)); $r[$k] = '[:[__KEEP_IFRAME_CONTENT_' . mt_rand() . '__]:]'; $this->replaces['search'][] = $r[$k]; } if ($s && $r) { $c = str_replace($s, $r, $c); } } } } $c = trim($c); $c = jhtmlspecialchars($c); $c = str_replace('&', '&', $c); return $c; }
function member_search() { $q = trim($this->Get['q']); $qid = intval(trim($this->Get['qid'])); if (empty($qid)) { $this->Messager('错误的操作'); } $qun_info = $this->QunLogic->get_qun_info($qid); if (empty($qun_info)) { $this->Messager('当前' . $this->Config[changeword][weiqun] . '不存在或者已经被删除了'); } if (empty($q)) { $this->Messager('搜索关键字不能为空'); } $perpage = 60; $gets = array('mod' => 'qun', 'code' => 'member_search', 'qid' => $qid, 'q' => $this->Get['q']); $page_url = 'index.php?' . url_implode($gets); $key = jstripslashes($q); $s_sql = addcslashes($q, '_%'); $where_sql = " m.nickname LIKE('%{$s_sql}%') "; $count = DB::result_first("SELECT COUNT(*)\r\n\t\t\t\t\t\t\t\t FROM " . DB::table('members') . " AS m\r\n\t\t\t\t\t\t\t\t LEFT JOIN " . DB::table('qun_user') . " AS qu\r\n\t\t\t\t\t\t\t\t ON m.uid=qu.uid\r\n\t\t\t\t\t\t\t\t WHERE qu.qid='{$qid}' AND {$where_sql} "); $members = array(); if ($count) { $_config = array('return' => 'array'); $page_arr = page($count, $perpage, $page_url, $_config); $query = DB::query("SELECT m.nickname, m.username, m.uid, m.face\r\n\t\t\t\t\t\t\t\tFROM " . DB::table('members') . " AS m\r\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB::table('qun_user') . " AS qu\r\n\t\t\t\t\t\t\t\tON m.uid=qu.uid\r\n\t\t\t\t\t\t\t\tWHERE qu.qid='{$qid}' AND {$where_sql}\r\n\t\t\t\t\t\t\t\t{$page_arr['limit']} "); while ($value = DB::fetch($query)) { $value['face'] = face_get($value['uid']); $members[] = $value; } } $this->Title = $this->Config[changeword][weiqun] . " - " . $qun_info['name'] . "的成员"; include_once template('qun/members'); }
function DoModify() { $id = (int) get_param('id'); $info = DB::fetch_first("select * from " . DB::table('output') . " where `id`='{$id}'"); if (!$info) { $this->Messager('您要编辑的内容已经不存在了'); } $data = get_param('data'); $data['name'] = trim($data['name']); $data['lock_host'] = trim(strtolower($data['lock_host'])); $data['content_default'] = strip_tags($data['content_default']); $data['type_first'] = $data['type_first'] ? 1 : 0; $data['per_page_num'] = max(0, (int) $data['per_page_num']); $data['width'] = $data['width'] ? $data['width'] : '100%'; $data['height'] = $data['height'] ? $data['height'] : '1000px'; $data['tpl_enable'] = $data['tpl_enable'] ? 1 : 0; if ($data['tpl_enable'] && true === JISHIGOU_FOUNDER) { $data['tpl_file'] = $data['tpl_file'] && false !== strpos($data['tpl_file'], 'output/') ? dir_safe(str_replace(array('.html', '.htm'), '', $data['tpl_file'])) : 'output/output_' . $id; $data['tpl_data'] = trim($data['tpl_data']); if ($data['tpl_enable']) { $tpl_file = ROOT_PATH . 'templates/default/' . $data['tpl_file'] . '.html'; jio()->MakeDir(dirname($tpl_file)); jio()->WriteFile($tpl_file, jstripslashes($data['tpl_data'])); } } else { unset($data['tpl_file']); } unset($data['tpl_data']); DB::update('output', $data, array('id' => $id)); $this->Messager('修改成功'); }
function invite() { $invite = jconf::get('invite'); $invite_msg = empty($invite) ? '' : jstripslashes($invite['invite_msg']); $link_display_none_radio = $this->jishigou_form->YesNoRadio('link_display_none', (int) $invite['link_display_none']); include template('admin/setting_invite'); }
function DoModify() { $ids = max(0, (int) $this->Post['ids']); if (!$ids) { $this->Messager("请指定一个ID", null); } $name = $this->Post['name']; $type = $this->Post['type']; $dateline = time(); $style = $this->Post['share']['style']; $style = serialize($style); $show = $this->Post['share']['show']; $show = serialize($show); $module = $this->Post['share']['condition']; $condition = serialize($module); $nickname = $type == 'topic' ? trim($this->Post['share']['nickname']) : ''; $tag = $type == 'tag' ? trim($this->Post['share']['tag']) : ''; $sql = "update `" . TABLE_PREFIX . "share`\r\n \t\t\tset `name`='{$name}',\r\n \t\t\t\t`type`='{$type}' ,\r\n \t\t\t\t`topic_style`='{$style}' ,\r\n \t\t\t\t`show_style`='{$show}' ,\r\n \t\t\t\t`condition`='{$condition}' ,\r\n \t\t\t\t`nickname`='{$nickname}',\r\n \t\t\t\t`tag`='{$tag}',\r\n \t\t\t\t`dateline`={$dateline}\r\n \t\t\twhere `id` = '{$ids}'"; $this->DatabaseHandler->Query($sql); $set = $this->Post['sharetemp']; $set = jstripslashes($set); $file = ROOT_PATH . 'templates/default/share/sharetemp_' . $ids . '.html'; if (!is_dir(dirname($file))) { jmkdir(dirname($file)); } $len = jio()->WriteFile($file, $set); if (!$len) { die($file . " 文件无法写入,请检查是否有可写权限。"); } $sets['sharetemp'] = $set; jconf::set('sharetemp_' . $ids, $sets); $this->Messager("编辑成功", "admin.php?mod=share&code=modify&ids={$ids}"); }
function index() { $per_page_num = min(500, max(20, (int) (isset($_GET['pn']) ? $_GET['pn'] : $_GET['per_page_num']))); $gets = array('mod' => 'vote', 'pn' => $this->Get['pn'], 'vid' => $this->Get['vid'], 'subject' => $this->Get['subject']); $page_url = 'admin.php?' . url_implode($gets); $where_sql = " 1 "; $vid = $this->Get['vid']; if (!empty($vid)) { if (strpos($vid, ',') !== false) { $vids = explode(',', $vid); foreach ($vids as $key => $val) { $vids[$key] = intval($val); } $where_sql .= " AND v.vid IN(" . jimplode($vids) . ") "; } else { $where_sql .= " AND v.vid=" . intval($vid) . " "; } } $subject = $this->Get['subject']; if (!empty($subject)) { $subject_sql = addcslashes($subject, '_%'); $where_sql .= " AND v.subject like('%{$subject_sql}%') "; $subject = jstripslashes($subject); } if ($this->Code == 'verify') { $action = "admin.php?mod=vote&code=doverify"; $where_sql .= " AND v.verify = 0 "; } elseif ($this->Code == 'index') { $action = "admin.php?mod=vote&code=batch"; $where_sql .= " AND v.verify = 1 "; } $count = DB::result_first("SELECT COUNT(*) FROM " . DB::table("vote") . " v WHERE {$where_sql}"); $list = array(); if ($count) { $page_arr = page($count, $per_page_num, $page_url, array('return' => 'array'), '20 50 100 200,500'); $query = DB::query("SELECT *,m.nickname\r\n\t\t\t\t\t\t\t\tFROM " . DB::table("vote") . " v\r\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB::table("members") . " m ON m.uid = v.uid\r\n\t\t\t\t\t\t\t\tWHERE {$where_sql}\r\n\t\t\t\t\t\t\t\tORDER BY v.dateline DESC\r\n\t\t\t\t\t\t\t\t{$page_arr['limit']}"); while ($value = DB::fetch($query)) { if ($value['recd']) { $value['recd_checked'] = 'checked="checked"'; } $list[] = $value; } } include template('admin/vote'); }
function url_implode($gets) { $arr = array(); foreach ($gets as $key => $value) { if ($value) { $arr[] = $key . '=' . urlencode(jstripslashes($value)); } } return implode('&', $arr); }
function Del_Follow_User_Recommend() { $type = $this->Post['type']; $ids = (array) ($this->Post['ids'] ? $this->Post['ids'] : $this->Get['ids']); $_follow_info = jconf::get('follow_user_recommend'); if ($type == 'recommend') { $recommend_uids = $_follow_info['recommend_uid'] . ','; for ($i = 0; $i < count($ids); $i++) { $recommend_uids = str_replace($ids[$i] . ',', '', $recommend_uids); } } if ($type == 'default') { $default_uids = $_follow_info['default_uid'] . ','; for ($i = 0; $i < count($ids); $i++) { $default_uids = str_replace($ids[$i] . ',', '', $default_uids); } } $follow_uid_recommend = explode(',', $recommend_uids ? $recommend_uids : $_follow_info['recommend_uid']); $follow_uid_recommend = array_filter($follow_uid_recommend); $follow_uid_default = array_unique(explode(',', $default_uids ? $default_uids : $_follow_info['default_uid'])); $follow_uid_default = array_filter($follow_uid_default); $set['recommend_uid'] = implode(',', $follow_uid_recommend); $set['default_uid'] = implode(',', $follow_uid_default); $set = jstripslashes($set); jconf::set('follow_user_recommend', $set); $this->Messager("取消成功"); }
function manage() { $op = trim($this->Get['op']); if ($op == 'edit') { $qid = intval(trim($this->Get['qid'])); if (empty($qid)) { $this->Messager('请指定要编辑的微群'); } $qun_info = $this->QunLogic->get_qun_info($qid); if (empty($qun_info)) { $this->Messager('当前群不存在或者已经被删除了'); } $query = $this->DatabaseHandler->Query("select * from " . TABLE_PREFIX . "common_district where `upid` = '0' order by list"); while ($rsdb = $query->GetRow()) { $province[$rsdb['id']]['value'] = $rsdb['id']; $province[$rsdb['id']]['name'] = $rsdb['name']; if ($qun_info['province'] == $rsdb['name']) { $province_id = $rsdb['id']; } } $province_list = $this->jishigou_form->Select("province", $province, $province_id, "onchange=\"changeProvince();\""); if ($province_id) { if ($qun_info['city']) { $hid_city = DB::result_first("select id from " . TABLE_PREFIX . "common_district where name = '{$qun_info['city']}' and upid = '{$province_id}'"); } } Load::logic("qun"); $qunLogic = new QunLogic(); $themelist = $qunLogic->getQunThemeList(); if (empty($cat_ary['second'][$qun_info['cat_id']])) { $catselect = $this->QunLogic->get_catselect($qun_info['cat_id'], 0); } else { $catselect = $this->QunLogic->get_catselect(0, $qun_info['cat_id']); } $tag = $this->QunLogic->get_qun_strtag($qid); $icon = $this->QunLogic->qun_avatar($qid); $checked = array(); $checked['gview_perm'][$qun_info['gview_perm']] = 'checked="checked"'; $checked['join_type'][$qun_info['join_type']] = 'checked="checked"'; $checked['recd'] = $qun_info['recd'] == 1 ? 'checked="checked"' : ''; $u_tips = $this->QunLogic->upload_tips(); $actions = "admin.php?mod=qun&code=domanage&op=edit"; include template('admin/qun_edit'); } else { $perpage = 20; $gets = array('mod' => 'qun', 'code' => 'manage'); $page_url = 'admin.php?' . url_implode($gets); $level_ary = jconf::get('qun_level'); $where_sql = ' 1 '; $qun_level = $this->Get['qun_level']; if ($qun_level > 0) { $cur_level = $level_ary[$qun_level]; $credits_higher = $cur_level['credits_higher']; $credits_lower = $cur_level['credits_lower']; $where_sql .= " AND q.credits<{$credits_lower} AND q.credits>={$credits_higher} "; } $qun_name = trim($this->Get['qun_name']); if (!empty($qun_name)) { $key_qun_name = jstripslashes($qun_name); $q_sql = addcslashes($qun_name, '_%'); $where_sql .= " AND q.name LIKE('%{$q_sql}%') "; } $nickname = trim($this->Get['nickname']); if (!empty($nickname)) { $key_nickname = jstripslashes($nickname); $n_sql = addcslashes($nickname, '_%'); $where_sql .= " AND m.nickname LIKE('%{$n_sql}%') "; } $timefrom = $this->Get['timefrom']; if ($timefrom) { $str_time_from = strtotime($timefrom); $where_sql .= " and `dateline`>'{$str_time_from}'"; } $timeto = $this->Get['timeto']; if ($timeto) { $str_time_to = strtotime($timeto); $where_sql .= " and `dateline`<'{$str_time_to}'"; } $count = DB::result_first("SELECT COUNT(*)\r\n\t\t\t\t\t\t\t\t\t FROM " . DB::table('qun') . " AS q\r\n\t\t\t\t\t\t\t\t\t LEFT JOIN " . DB::table('members') . " AS m\r\n\t\t\t\t\t\t\t\t\t ON q.founderuid=m.uid\r\n\t\t\t\t\t\t\t\t \t WHERE {$where_sql}"); $qun_list = array(); if ($count) { $_config = array('return' => 'array'); $page_arr = page($count, $perpage, $page_url, $_config); $cat_ary = jconf::get('qun_category'); $query = DB::query("SELECT q.*, m.nickname\r\n\t\t\t\t\t\t\t\t\tFROM " . DB::table('qun') . " AS q\r\n\t\t\t\t\t\t\t\t\tLEFT JOIN " . DB::table('members') . " AS m ON q.founderuid=m.uid\r\n\t\t\t\t\t\t\t\t\tWHERE {$where_sql}\r\n\t\t\t\t\t\t\t\t\tORDER BY dateline DESC\r\n\t\t\t\t\t\t\t\t\t{$page_arr['limit']}"); while ($value = DB::fetch($query)) { $level = $this->QunLogic->qun_level($value['qid'], $value['credits']); $value['level'] = $level['level_name']; if ($parent_id = $cat_ary['second'][$value['cat_id']]['parent_id']) { $value['top_cat'] = $cat_ary['first'][$parent_id]['cat_name']; $value['top_cat_id'] = $parent_id; $value['sub_cat'] = $cat_ary['second'][$value['cat_id']]['cat_name']; } else { $parent_id = $value['cat_id']; $value['top_cat'] = $cat_ary['first'][$parent_id]['cat_name']; $value['top_cat_id'] = $parent_id; } $value['dateline'] = my_date_format($value['dateline'], 'Y-m-d'); if ($value['recd']) { $value['recd_checked'] = 'checked="checked"'; } if ($value['closed']) { $value['closed_checked'] = 'checked="checked"'; } $tag_name_arr = array(); $tag_name = DB::query("select tag_name from " . DB::table('qun_tag_fields') . " where qid = '{$value['qid']}' "); while ($rs = DB::fetch($tag_name)) { $tag_name_arr[] = $rs['tag_name']; } $value['tagname'] = implode(",", $tag_name_arr); $qun_list[] = $value; } } include template('admin/qun_manage'); } }