public function load($param) { $param = array(); $key = $this->build_key(__CLASS__, $param); $GLOBALS['cache']->set_dir(APP_ROOT_PATH . "public/runtime/data/" . __CLASS__ . "/"); $result = $GLOBALS['cache']->get($key); if ($result === false) { $result['image'] = get_topic_list(4, array("cid" => 0, "tag" => ""), "", "group_id <> 0 and is_recommend = 1 and has_image = 1 "); $result['image'] = $result['image']['list']; //$result['image'] = $GLOBALS['db']->getAll("select * from ".DB_PREFIX."topic where group_id <> 0 and is_effect = 1 and is_delete = 0 and is_recommend = 1 and has_image = 1 order by create_time desc limit 4"); $ids = array(0); foreach ($result['image'] as $k => $v) { $result['image'][$k] = format_topic_item($v); $result['image'][$k]['group_info'] = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic_group where id = " . $v['group_id']); $ids[] = $v['id']; } $result['list'] = get_topic_list(8, array("cid" => 0, "tag" => ""), "", "group_id <> 0 and is_recommend = 1 and id not in(" . implode(",", $ids) . ")"); $result['list'] = $result['list']['list']; //$result['list'] = $GLOBALS['db']->getAll("select * from ".DB_PREFIX."topic where group_id <> 0 and is_effect = 1 and is_delete = 0 and is_recommend = 1 and id not in(".implode(",",$ids).") order by create_time desc limit 8"); foreach ($result['list'] as $k => $v) { $result['list'][$k] = format_topic_item($v); $result['list'][$k]['group_info'] = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic_group where id = " . $v['group_id']); } $GLOBALS['cache']->set_dir(APP_ROOT_PATH . "public/runtime/data/" . __CLASS__ . "/"); $GLOBALS['cache']->set($key, $result); } return $result; }
$_GET['id'] = intval($_GET['id']); $sql .= "topic_id = '{$_GET['id']}'"; } else { exit; } $db->query($sql); clear_cache_files(); if (!empty($_REQUEST['is_ajax'])) { $url = 'topic.php?act=query&' . str_replace('act=delete', '', $_SERVER['QUERY_STRING']); ecs_header("Location: {$url}\n"); exit; } $links[] = array('href' => 'topic.php', 'text' => $_LANG['back_list']); sys_msg($_LANG['succed'], 0, $links); } elseif ($_REQUEST['act'] == 'query') { $topic_list = get_topic_list(); $smarty->assign('topic_list', $topic_list['item']); $smarty->assign('filter', $topic_list['filter']); $smarty->assign('record_count', $topic_list['record_count']); $smarty->assign('page_count', $topic_list['page_count']); $smarty->assign('use_storage', empty($_CFG['use_storage']) ? 0 : 1); /* 排序标记 */ $sort_flag = sort_flag($topic_list['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); $tpl = 'topic_list.htm'; make_json_result($smarty->fetch($tpl), '', array('filter' => $topic_list['filter'], 'page_count' => $topic_list['page_count'])); } /** * 获取专题列表. */ function get_topic_list()
public function forum() { global_run(); init_app_page(); $GLOBALS['tmpl']->assign("no_nav", true); //无分类下拉 $group_id = intval($_REQUEST['id']); $group_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic_group where is_effect = 1 and id = " . $group_id); if (!$group_item) { showErr("不存在的小组"); } $GLOBALS['tmpl']->assign("group_info", $group_item); $title = $group_item['name']; $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index", "index")); $site_nav[] = array('name' => $GLOBALS['lang']['GROUP_FORUM'], 'url' => url("index", "group")); $site_nav[] = array('name' => $title, 'url' => url("index", "group#forum", array("id" => $group_id))); $GLOBALS['tmpl']->assign("site_nav", $site_nav); $GLOBALS['tmpl']->assign("page_title", $title); $GLOBALS['tmpl']->assign("page_keyword", $title . ","); $GLOBALS['tmpl']->assign("page_description", $title . ","); //输出是否加入组 $user_id = intval($GLOBALS['user_info']['id']); if ($user_id == 0) { $is_join = 0; } else { $is_admin = 0; if ($group_item['user_id'] == $user_id) { $is_admin = 1; } if ($is_admin == 0) { $join_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_topic_group where user_id = " . $user_id . " and group_id = " . $group_item['id']); if ($join_data) { $is_join = 1; $is_admin = $join_data['type']; } else { $is_join = 0; } } else { $is_join = 1; } } $GLOBALS['tmpl']->assign('is_join', $is_join); $GLOBALS['tmpl']->assign('is_admin', $is_admin); //输出列表 $page_size = app_conf("PAGE_SIZE"); $page = intval($_REQUEST['p']); if ($page <= 0) { $page = 1; } $limit = ($page - 1) * $page_size . "," . $page_size; $condition = " group_id = " . $group_item['id']; $sortby = "is_top desc,create_time desc"; $sortkey = "ordery_sort"; $filter = intval($_REQUEST['filter']); //0全部 1推荐 $sort = intval($_REQUEST['sort']); //0创建时间 1回复时间 $url_param = array("filter" => $filter, "sort" => $sort, "p" => $page, "id" => $group_id); if ($filter == 1) { $condition .= " and is_best = 1 "; } if ($sort == 1) { $sortby = " is_top desc,last_time desc "; $sortkey = "last_time_sort"; } $tmp_url_param = $url_param; $tmp_url_param['filter'] = 0; $urls['all'] = url("index", "group#forum", $tmp_url_param); $tmp_url_param = $url_param; $tmp_url_param['filter'] = 1; $urls['is_best'] = url("index", "group#forum", $tmp_url_param); $tmp_url_param = $url_param; $tmp_url_param['sort'] = 0; $urls['create_time'] = url("index", "group#forum", $tmp_url_param); $tmp_url_param = $url_param; $tmp_url_param['sort'] = 1; $urls['last_time'] = url("index", "group#forum", $tmp_url_param); $GLOBALS['tmpl']->assign("urls", $urls); // $sql = "select * from ".DB_PREFIX."topic use index($sortkey) where is_effect = 1 and is_delete = 0 $condition order by $sortby limit ".$limit; // $sql_count = "select count(*) from ".DB_PREFIX."topic use index($sortkey) where is_effect = 1 and is_delete = 0 $condition "; // $list = $GLOBALS['db']->getAll($sql); // $count = $GLOBALS['db']->getOne($sql_count); $list = get_topic_list($limit, array("cid" => 0, "tag" => ""), "", $condition, $sortby); $list = $list['list']; $count = count($list); $GLOBALS['tmpl']->assign("list", $list); $page = new Page($count, $page_size); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $join_url = url("index", "group#joingroup", array("id" => $group_id)); $exit_url = url("index", "group#exitgroup", array("id" => $group_id)); $edit_url = url("index", "group#edit", array("id" => $group_id)); $GLOBALS['tmpl']->assign("join_url", $join_url); $GLOBALS['tmpl']->assign("exit_url", $exit_url); $GLOBALS['tmpl']->assign("edit_url", $edit_url); //输出组员 $user_list = $GLOBALS['db']->getAll("select user_id as id,type from " . DB_PREFIX . "user_topic_group where group_id = " . $group_item['id'] . " order by type desc limit 10 "); $GLOBALS['tmpl']->assign('user_list', $user_list); $GLOBALS['tmpl']->assign('user_auth', get_user_auth()); $GLOBALS['tmpl']->display("group_forum.html"); }
public function focustopic() { $this->init_user(); $user_info = $this->user_data; $ajax = intval($_REQUEST['ajax']); if ($ajax == 0) { $this->init_main(); } $user_id = intval($GLOBALS['user_info']['id']); //输出发言列表 $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE"); //开始输出相关的用户日志 $uids = $GLOBALS['db']->getOne("select group_concat(focused_user_id) from " . DB_PREFIX . "user_focus where focus_user_id = " . $user_info['id'] . " "); if ($uids) { $uids = trim($uids, ","); $result = get_topic_list($limit, " user_id in (" . $uids . ") "); } $GLOBALS['tmpl']->assign("topic_list", $result['list']); $page = new Page($result['total'], app_conf("PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign('user_data', $user_info); if ($ajax == 0) { $list_html = $GLOBALS['tmpl']->fetch("inc/topic_col_list.html"); $GLOBALS['tmpl']->assign("list_html", $list_html); $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['UC_CENTER_MYFAV']); $GLOBALS['tmpl']->assign("post_title", $GLOBALS['lang']['UC_CENTER_MYFAV']); $GLOBALS['tmpl']->assign("inc_file", "inc/uc/uc_center_index.html"); $GLOBALS['tmpl']->display("page/uc.html"); } else { header("Content-Type:text/html; charset=utf-8"); echo $GLOBALS['tmpl']->fetch("inc/topic_col_list.html"); } }
public function focustopic() { $GLOBALS['tmpl']->caching = true; $GLOBALS['tmpl']->cache_lifetime = 600; $cache_id = md5(MODULE_NAME . ACTION_NAME . trim($_REQUEST['id']) . intval($_REQUEST['p'])); if (!$GLOBALS['tmpl']->is_cached('page/space_index.html', $cache_id)) { $this->init(); $title = sprintf($GLOBALS['lang']['WHOS_SPACE'], $this->space_user['user_name']); $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => APP_ROOT . "/"); $site_nav[] = array('name' => $title, 'url' => url("index", "space#focustopic", array("id" => $this->space_user['id']))); $site_nav[] = array('name' => $GLOBALS['lang']['SPACE_FOCUSTOPIC'], 'url' => url("index", "space#focustopic", array("id" => $this->space_user['id']))); $GLOBALS['tmpl']->assign("site_nav", $site_nav); $GLOBALS['tmpl']->assign("page_title", $title); $GLOBALS['tmpl']->assign("page_keyword", $title . ","); $GLOBALS['tmpl']->assign("page_description", $title . ","); //输出发言列表 $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE"); //开始输出相关的用户日志 $uids = $GLOBALS['db']->getOne("select group_concat(focused_user_id) from " . DB_PREFIX . "user_focus where focus_user_id = " . $this->space_user['id'] . " "); if ($uids) { $uids = trim($uids, ","); $result = get_topic_list($limit, " user_id in (" . $uids . ") "); } $GLOBALS['tmpl']->assign("topic_list", $result['list']); $page = new Page($result['total'], app_conf("PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $list_html = $GLOBALS['tmpl']->fetch("inc/topic_col_list.html"); $GLOBALS['tmpl']->assign("list_html", $list_html); } $GLOBALS['tmpl']->display("page/space_index.html", $cache_id); }
public function index() { global_run(); init_app_page(); $GLOBALS['tmpl']->assign("no_nav", true); //无分类下拉 $GLOBALS['tmpl']->caching = true; $GLOBALS['tmpl']->cache_lifetime = 600; //缓存10分钟 $cache_id = md5(MODULE_NAME . ACTION_NAME); if (!$GLOBALS['tmpl']->is_cached('daren_index.html', $cache_id)) { require_once APP_ROOT_PATH . 'system/model/topic.php'; $title = $GLOBALS['lang']['DAREN_SHOW']; $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index", "index")); $site_nav[] = array('name' => $title, 'url' => url("index", "daren")); $GLOBALS['tmpl']->assign("site_nav", $site_nav); $user_id = intval($GLOBALS['user_info']['id']); //输出所有达人推荐 $rnd_daren_list = get_rand_user(42, 1); $GLOBALS['tmpl']->assign("rnd_daren_list", $rnd_daren_list); $daren_list = get_rand_user(8, 1); foreach ($daren_list as $kk => $vv) { $focus_uid = intval($vv['id']); $focus_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_focus where focus_user_id = " . $user_id . " and focused_user_id = " . $focus_uid); if ($focus_data) { $daren_list[$kk]['focused'] = 1; } } $GLOBALS['tmpl']->assign("daren_list", $daren_list); //获取推荐的 达人分享6条 $topic_list = get_topic_list(6, array("cid" => 0, "tag" => ""), "", "is_recommend = 1"); $topic_list = $topic_list['list']; //$topic_list = $GLOBALS['db']->getAll("select t.* from ".DB_PREFIX."topic as t where t.is_effect = 1 and t.is_delete = 0 and t.is_recommend = 1 order by t.create_time desc limit 6"); foreach ($topic_list as $kk => $vv) { $vv['content'] = msubstr($vv['content'], 0, 30); $topic_list[$kk] = format_topic_item($vv); $topic_list[$kk]['content'] = decode_topic($topic_list[$kk]['content']); $topic_user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $vv['user_id'] . " and is_effect =1 and is_delete = 0"); $focus_uid = intval($topic_user_info['id']); $focus_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_focus where focus_user_id = " . $user_id . " and focused_user_id = " . $focus_uid); if ($focus_data) { $topic_user_info['focused'] = 1; } $topic_list[$kk]['user_info'] = $topic_user_info; } $GLOBALS['tmpl']->assign("topic_list", $topic_list); $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "topic_tag_cate where showin_web = 1 order by sort asc limit 7"); foreach ($cate_list as $k => $v) { //获取分类下的推荐分享 $cate_list[$k]['topic_list'] = get_topic_list(4, array("cid" => 0, "tag" => ""), " left join " . DB_PREFIX . "topic_cate_link as l on l.topic_id = t.id ", "l.cate_id = " . $v['id'] . " and t.is_recommend = 1"); $cate_list[$k]['topic_list'] = $cate_list[$k]['topic_list']['list']; //$cate_list[$k]['topic_list'] = $GLOBALS['db']->getAll("select t.* from ".DB_PREFIX."topic as t left join ".DB_PREFIX."topic_cate_link as l on l.topic_id = t.id where l.cate_id = ".$v['id']." and t.is_effect = 1 and t.is_delete = 0 and t.is_recommend = 1 order by t.create_time desc limit 4"); foreach ($cate_list[$k]['topic_list'] as $kk => $vv) { $vv['content'] = msubstr($vv['content'], 0, 30); $cate_list[$k]['topic_list'][$kk] = format_topic_item($vv); $cate_list[$k]['topic_list'][$kk]['content'] = decode_topic($cate_list[$k]['topic_list'][$kk]['content']); $topic_user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $vv['user_id'] . " and is_effect =1 and is_delete = 0"); $focus_uid = intval($topic_user_info['id']); $focus_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_focus where focus_user_id = " . $user_id . " and focused_user_id = " . $focus_uid); if ($focus_data) { $topic_user_info['focused'] = 1; } $cate_list[$k]['topic_list'][$kk]['user_info'] = $topic_user_info; } $cate_list[$k]['daren_list'] = $GLOBALS['db']->getAll("select u.* from " . DB_PREFIX . "user as u left join " . DB_PREFIX . "user_cate_link as l on l.user_id = u.id where l.cate_id = " . $v['id'] . " and u.is_effect = 1 and u.is_delete = 0 and u.is_daren = 1 order by rand() limit 8"); foreach ($cate_list[$k]['daren_list'] as $kk => $vv) { $focus_uid = intval($vv['id']); $focus_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_focus where focus_user_id = " . $user_id . " and focused_user_id = " . $focus_uid); if ($focus_data) { $cate_list[$k]['daren_list'][$kk]['focused'] = 1; } } //print_r($cate_list);exit; } $GLOBALS['tmpl']->assign("cate_list", $cate_list); $GLOBALS['tmpl']->assign("page_title", $title); $GLOBALS['tmpl']->assign("page_keyword", $title . ","); $GLOBALS['tmpl']->assign("page_description", $title . ","); } $GLOBALS['tmpl']->display("daren_index.html", $cache_id); }
public function atme() { $ajax = intval($_REQUEST['ajax']); if ($ajax == 0) { $this->init_main(); $is_merchant = intval($GLOBALS['user_info']['is_merchant']); $GLOBALS['tmpl']->assign('is_merchant', $is_merchant); } $user_id = intval($GLOBALS['user_info']['id']); //输出发言列表 $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE"); $user_name = $GLOBALS['user_info']['user_name']; $user_name_unicode = str_to_unicode_string($user_name); $condition = " match(user_name_match) against('" . $user_name_unicode . "' IN BOOLEAN MODE) "; $result = get_topic_list($limit, $condition); $result['list'] = div_to_col($result['list']); $GLOBALS['tmpl']->assign("topic_list", $result['list']); $page = new Page($result['total'], app_conf("PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); if ($ajax == 0) { $list_html = decode_topic_without_img($GLOBALS['tmpl']->fetch("inc/topic_col_list.html")); $GLOBALS['tmpl']->assign("list_html", $list_html); $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['UC_CENTER_ATME']); $GLOBALS['tmpl']->assign("post_title", $GLOBALS['lang']['UC_CENTER_ATME']); $GLOBALS['tmpl']->assign("inc_file", "inc/uc/uc_center_index.html"); $GLOBALS['tmpl']->display("uc.html"); } else { header("Content-Type:text/html; charset=utf-8"); echo decode_topic_without_img($GLOBALS['tmpl']->fetch("inc/topic_col_list.html")); } }
public function fav() { $this->init(); $title = sprintf($GLOBALS['lang']['WHOS_SPACE'], $this->space_user['user_name']); $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => APP_ROOT . "/"); $site_nav[] = array('name' => $title, 'url' => url("shop", "space", array("id" => $this->space_user['id']))); $site_nav[] = array('name' => $GLOBALS['lang']['SPACE_FAV'], 'url' => url("shop", "space#fav", array("id" => $this->space_user['id']))); $GLOBALS['tmpl']->assign("site_nav", $site_nav); $GLOBALS['tmpl']->assign("page_title", $title); $GLOBALS['tmpl']->assign("page_keyword", $title . ","); $GLOBALS['tmpl']->assign("page_description", $title . ","); $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE"); $result = get_topic_list($limit, "user_id = " . $this->space_user['id'] . " and fav_id <> 0"); //$result['list'] = div_to_col($result['list']); $GLOBALS['tmpl']->assign("topic_list", $result['list']); $page = new Page($result['total'], app_conf("PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign("inc_file", "inc/space/space_index.html"); $GLOBALS['tmpl']->display("space.html"); }
public function uc_home_fav() { require_once APP_ROOT_PATH . 'app/Lib/page.php'; require_once APP_ROOT_PATH . "system/model/topic.php"; global_run(); $is_why = 0; //1 自己,2其它登录用户看,3未登录用户看 $id = intval($_REQUEST['id']); if ($id) { if ($id == $GLOBALS['user_info']['id']) { $is_why = 1; $home_user_info = $GLOBALS['user_info']; } else { $is_why = 3; $home_user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id=" . $id); $GLOBALS['tmpl']->assign("id", $id); if ($GLOBALS['user_info']) { $is_why = 2; $my_info = $GLOBALS['user_info']; } } } else { if (check_save_login() == LOGIN_STATUS_NOLOGIN) { app_redirect(); showErr("请先登录", url("index", "user#login")); } else { $is_why = 1; $home_user_info = $GLOBALS['user_info']; } } $GLOBALS['tmpl']->assign('user_auth', get_user_auth()); $page = intval($_REQUEST['page']); if ($page == 0) { $page = 1; } $step = intval($_REQUEST['step']); $step_size = intval($_REQUEST['step_size']); $limit = ($page - 1) * PIN_PAGE_SIZE + ($step - 1) * PIN_SECTOR . "," . PIN_SECTOR; if ($step == 0 || $step > $step_size) { //超出 $result['doms'] = array(); $result['step'] = 0; $result['status'] = 0; $result['info'] = 'end'; ajax_return($result); } //我关注的用户 $focus_user_list = load_auto_cache("cache_focus_user", array("uid" => $home_user_info['id'])); $t_ids[] = $home_user_info['id']; foreach ($focus_user_list as $k => $v) { $t_ids[] = $v['id']; } $excondition = " user_id in (" . implode(",", $t_ids) . ") and is_effect = 1 and is_delete = 0 and fav_id <> 0 and relay_id = 0 and type in ('share','dealcomment','youhuicomment','eventcomment','slocationcomment','eventsubmit','sharedeal','shareyouhui','shareevent') "; $result_list = get_topic_list($limit, null, "", $excondition); $result_list = $result_list['list']; if ($result_list) { $result['doms'] = array(); foreach ($result_list as $k => $v) { $GLOBALS['tmpl']->assign("message_item", $v); $result['doms'][] = decode_topic_without_img($GLOBALS['tmpl']->fetch("inc/pin_box.html")); } if ($step == 0 || $step >= $step_size) { //超出 $result['step'] = 0; $result['status'] = 0; $result['info'] = 'end'; ajax_return($result); } else { $result['status'] = 1; $result['step'] = $step + 1; $result['info'] = 'next'; ajax_return($result); } } else { $result['doms'] = array(); $result['step'] = 0; $result['status'] = 0; $result['info'] = 'end'; // $result['sql'] = $sql; ajax_return($result); } }