Ejemplo n.º 1
0
 public function index()
 {
     global_run();
     init_app_page();
     $GLOBALS['tmpl']->assign("no_nav", true);
     //无分类下拉
     $id = intval($_REQUEST['id']);
     require_once APP_ROOT_PATH . 'system/model/topic.php';
     $topic = get_topic_item($id);
     if ($id > 0 && !empty($topic)) {
         //
     } else {
         app_redirect(url("index"));
     }
     if ($topic['group_id'] > 0) {
         $GLOBALS['tmpl']->assign('topic_group', get_topic_group($topic['group_id']));
     }
     $title = $topic['forum_title'];
     $content = decode_topic($topic['content']);
     $is_fav = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic where  (fav_id = " . $id . " or (origin_id = " . $id . " and fav_id <> 0))  and user_id = " . intval($GLOBALS['user_info']['id']));
     $GLOBALS['tmpl']->assign("topic", $topic);
     $GLOBALS['tmpl']->assign("title", $title);
     $GLOBALS['tmpl']->assign("content", $content);
     $GLOBALS['tmpl']->assign("is_fav", $is_fav);
     $GLOBALS['tmpl']->assign("page_title", $title);
     $GLOBALS['tmpl']->assign("page_keyword", $title . ",");
     $GLOBALS['tmpl']->assign("page_description", $title . ",");
     $GLOBALS['tmpl']->assign('user_auth', get_user_auth());
     $GLOBALS['tmpl']->display("topic_index.html");
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
 public function index()
 {
     $GLOBALS['tmpl']->caching = true;
     $GLOBALS['tmpl']->cache_lifetime = 600;
     //缓存10分钟
     $cache_id = md5(MODULE_NAME . ACTION_NAME . $GLOBALS['deal_city']['id']);
     if (!$GLOBALS['tmpl']->is_cached('daren_index.html', $cache_id)) {
         $title = $GLOBALS['lang']['DAREN_SHOW'];
         $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => APP_ROOT . "/");
         $site_nav[] = array('name' => $title, 'url' => url("shop", "daren"));
         $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']);
         //输出所有达人推荐
         $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);
         $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] = get_topic_item($vv);
             $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 desc limit 7");
         foreach ($cate_list as $k => $v) {
             //获取分类下的推荐分享
             $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] = get_topic_item($vv);
                 $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']->getAllCached("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;
                 }
             }
         }
         $GLOBALS['tmpl']->assign("cate_list", $cate_list);
         $daren_html = decode_topic($GLOBALS['tmpl']->fetch("inc/daren_show_item.html"));
         $GLOBALS['tmpl']->assign("daren_html", $daren_html);
     }
     $GLOBALS['tmpl']->display("daren_index.html", $cache_id);
 }
Ejemplo n.º 4
0
function load_reply_list()
{
    return decode_topic($GLOBALS['tmpl']->fetch("inc/topic_page_reply_list.html"));
}
Ejemplo n.º 5
0
 public function detail()
 {
     $dp_id = intval($_REQUEST['id']);
     $page = intval($_REQUEST['p']);
     $review_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location_dp where id = " . $dp_id);
     if (!$review_item) {
         app_redirect(url("index", "index"));
     }
     //验证是否为当前商家会员管理的点评
     $s_account_info = es_session::get("account_info");
     if (in_array($review_item['supplier_location_id'], $s_account_info['location_ids']) && $review_item['from_data'] != "") {
         $is_admin = 1;
         $GLOBALS['tmpl']->assign("is_admin", $is_admin);
     }
     $review_item = sys_get_dp_detail($review_item);
     $store_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location where id = " . $review_item['supplier_location_id']);
     //供应商的地址列表
     //定义location_id
     $locations = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "supplier_location where id = " . $review_item['supplier_location_id']);
     $json_location = array();
     $location_ids = array(0);
     foreach ($locations as $litem) {
         $location_ids[] = $litem['id'];
         $arr = array();
         $arr['title'] = $litem['name'];
         $arr['address'] = $litem['address'];
         $arr['tel'] = $litem['tel'];
         $arr['lng'] = $litem['xpoint'];
         $arr['lat'] = $litem['ypoint'];
         $json_location[] = $arr;
     }
     $GLOBALS['tmpl']->assign("json_location", json_encode($json_location));
     $GLOBALS['tmpl']->assign("locations", $locations);
     $GLOBALS['tmpl']->assign("store_info", $store_info);
     //输出回应列表
     $sql_count = "select count(*) from " . DB_PREFIX . "supplier_location_dp_reply  where dp_id = " . $dp_id;
     $count = $GLOBALS['db']->getOne($sql_count);
     $page_size = app_conf("PAGE_SIZE");
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size . "," . $page_size;
     $sql = "select * from " . DB_PREFIX . "supplier_location_dp_reply where dp_id = " . $dp_id . "  order by create_time desc limit " . $limit;
     $reply_list = $GLOBALS['db']->getAll($sql);
     foreach ($reply_list as $k => $v) {
         $reply_list[$k]['user_name'] = $GLOBALS['db']->getOne("select user_name from " . DB_PREFIX . "user where id = " . $v['user_id']);
         $reply_list[$k]['create_time_format'] = pass_date($v['create_time']);
     }
     $page = new Page($count, $page_size);
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->assign('reply_list', $reply_list);
     $GLOBALS['tmpl']->assign('user_auth', get_user_auth());
     $review_list_html = decode_topic($GLOBALS['tmpl']->fetch('inc/review/reply_list.html'));
     $GLOBALS['tmpl']->assign('review_list_html', $review_list_html);
     $GLOBALS['tmpl']->assign('review_item', $review_item);
     $GLOBALS['tmpl']->display('review_detail.html');
 }
Ejemplo n.º 6
0
 public function index()
 {
     $id = intval($_REQUEST['id']);
     $message_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic where id = " . $id . " and is_effect= 1 and is_delete=0");
     if (!$message_item) {
         app_redirect(url("shop"));
         //showErr($GLOBALS['lang']['TOPIC_NULL']);
     }
     if (check_ipop_limit(get_client_ip(), "topic", intval(app_conf("SUBMIT_DELAY")), $id)) {
         $GLOBALS['db']->query("update " . DB_PREFIX . "topic set click_count = click_count + 1 where id = " . $id);
     }
     $message_item = get_topic_item($message_item);
     $group_item = $message_item['topic_group'];
     $GLOBALS['tmpl']->assign("group_info", $group_item);
     if ($group_item) {
         $user_join_group = $GLOBALS['db']->getOne("select group_concat(group_id) from " . DB_PREFIX . "user_topic_group where user_id = " . intval($message_item['user_id']) . " limit 6");
         if (!$user_join_group) {
             $user_join_group = "0";
         }
         $user_joing_group = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "topic_group where is_effect = 1 and (id in (" . $user_join_group . ") or user_id = " . intval($message_item['user_id']) . ") limit 6");
         $GLOBALS['tmpl']->assign("user_joing_group", $user_joing_group);
         //小组其他主题
         $group_topic_rec_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "topic where id <> " . $message_item['id'] . " and group_id = " . $message_item['group_id'] . " and is_best = 1 order by create_time desc limit 5 ");
         $GLOBALS['tmpl']->assign("group_topic_rec_list", $group_topic_rec_list);
         $message_item['group_name'] = $group_item['name'];
     }
     $message_item['content'] = decode_topic($message_item['content']);
     if ($message_item['origin']) {
         $message_item['origin']['content'] = decode_topic($message_item['origin']['content']);
     }
     $title = $message_item['title'] == '' ? $GLOBALS['lang']['TOPIC_SHOW'] : $message_item['title'];
     $muid = intval($message_item['user_id']);
     $muser_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $muid . " and is_effect=  1 and is_delete = 0");
     $uid = intval($GLOBALS['user_info']['id']);
     $focus_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_focus where focus_user_id = " . $uid . " and focused_user_id = " . intval($muser_info['id']));
     if ($focus_data) {
         $muser_info['focused'] = 1;
     }
     $region_list = load_auto_cache("cache_region_conf");
     // 			$province_str = $GLOBALS['db']->getOne("select name from ".DB_PREFIX."region_conf where id = ".intval($muser_info['province_id']));
     $province_str = $region_list[intval($muser_info['province_id'])]['name'];
     //$city_str = $GLOBALS['db']->getOne("select name from ".DB_PREFIX."region_conf where id = ".intval($muser_info['city_id']));
     $city_str = $region_list[intval($muser_info['city_id'])]['name'];
     if ($province_str . $city_str == '') {
         $user_location = $GLOBALS['lang']['LOCATION_NULL'];
     } else {
         $user_location = $province_str . $city_str;
     }
     $muser_info['user_location'] = $user_location;
     $GLOBALS['tmpl']->assign("muser_info", $muser_info);
     $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => APP_ROOT . "/");
     if ($message_item['group_id'] > 0) {
         $site_nav[] = array('name' => $message_item['group_name'], 'url' => url("shop", "group#forum", array("id" => $message_item['group_id'])));
     }
     $site_nav[] = array('name' => $title, 'url' => url("shop", "topic", array("id" => $message_item['id'])));
     $GLOBALS['tmpl']->assign("site_nav", $site_nav);
     $GLOBALS['tmpl']->assign("message_item", $message_item);
     if (trim($message_item['group_name']) != "") {
         $title = $message_item['group_name'] . " - " . $title;
     }
     if (trim($message_item['title']) != "") {
         $title = $message_item['title'] . " - " . $title;
     }
     if (trim($message_item['forum_title']) != "") {
         $title = $message_item['forum_title'] . " - " . $title;
     }
     $GLOBALS['tmpl']->assign("page_title", $title);
     $GLOBALS['tmpl']->assign("page_keyword", $title . ",");
     $GLOBALS['tmpl']->assign("page_description", $title . ",");
     $GLOBALS['tmpl']->assign('user_auth', get_user_auth());
     $GLOBALS['tmpl']->display("topic_index.html");
 }