used_mobile && $user_tag->web_show_mobile) {
$id = $itemId = $_REQUEST['id'] ? (int)$_REQUEST['id'] : 0;
$uPArr = explode('/', $_SERVER['REQUEST_URI']);
if (isset($uPArr[2]) && $uPArr[2]) {
$uUrl = substr($uPArr[2], strpos($uPArr[2], '_') + 1);
if (!$id) {
//跳转到手机列表页
$uPArr[2] = 'wap_item/list_' . $uUrl;
} else {
$uPArr[2] = 'wap_item/' . $uUrl;
}
} else {
$uUrl = substr($uPArr[1], strpos($uPArr[1], '_') + 1);
if (!$id) {
//跳转到手机列表页
$uPArr[1] = 'wap_item/list_' . $uUrl;
} else {
$uPArr[1] = 'wap_item/' . $uUrl;
}
}
$lastUrl = implode('/', $uPArr);
$url = 'http://' . $_SERVER['HTTP_HOST'] . $lastUrl;
header('Location: ' . $url);
exit();
}
if ($user_tag->is_tj == 1) {
$smarty->display('tjNew/index.tpl');
exit();
}
require_once(UPPER_ROOT . '/include/page_str.php');
$channel_id = $_REQUEST['channel_id'] ?: 0;
$page = $_REQUEST['page'] ?: 1;
if (!$channel_id) {
echo '';
}
$sql = "select id from ev_user_item_doc
where user_id=" . $user_id . " and channel_id=" . $channel_id . " and is_del=0 && is_hide=0
order by order_sort desc,id desc limit 1 ";
$max_id = $DB_Ev123->get_var($sql);
$id = $itemId = $_REQUEST['id'] ? (int)$_REQUEST['id'] : $max_id;
if (!$id) {
//总数
$sql_cnt = "select count(id) from ev_user_item_doc
where user_id=" . $user_id . " and channel_id=" . $channel_id . " and is_del=0 && is_hide=0
order by order_sort desc,id asc ";
$count_num = $DB_Ev123->get_var($sql_cnt);
$pagerows = 11;
$page_num = ceil($count_num / $pagerows);
//分页显示
if (!$page || 0 == (int)$page) {
$page = 1;
$offset = 0;
} elseif ($page <= 0) {
$page = 1;
$offset = 0;
} elseif ($page > $page_num) {
$page = $page_num;
$offset = ($page - 1) * $pagerows;
} else {
$offset = ($page - 1) * $pagerows;
}
} else {
//取得文章信息
$sql = "select * from ev_user_item_doc where id=" . $id . " and is_del=0";
$doc_info = $DB_Ev123->get_row($sql);
if (!$doc_info) {
echo '';
exit();
}
$doc_info['pulish_date'] = date('Y-m-d', $doc_info['pulish_date']);
$doc_info['zhuanzai_url'] = 'http://' . $doc_info['zhuanzai_url'];
//分页
$tmp_arr = explode('[page]', $doc_info['content']);
if (count($tmp_arr) > 1) {
$doc_info['content'] = $tmp_arr[$page - 1];
$page_str = '';
$page_str = page_str4(count($tmp_arr), 1, $page, '/self_define/item.php?username=' . $user_name . '&channel_id=' . $channel_id . '&id=' . $id . '&page=');
}
if ($page_str) {
$doc_info['content'] .= '
' . $page_str . '
';
}
}
//取得列表信息
$sql = "select * from ev_user_item_doc
where user_id=" . $user_id . " and channel_id=" . $channel_id . " and is_hide=0 and is_del=0
order by order_sort desc,id asc ";
$info_arr = $DB_Ev123->get_results($sql);
$doc_info_arr = array();
if ($info_arr) {
$i = 1;
foreach ($info_arr as $info) {
$doc_info_arr[$info['id']]['title'] = $info['title'];
$doc_info_arr[$info['id']]['i'] = $i;
$doc_info_arr[$info['id']]['short_title'] = cnsubstr($info['title'], 50);
$doc_info_arr[$info['id']]['short_title2'] = cnsubstr($info['title'], 12);
$doc_info_arr[$info['id']]['title_len'] = strlen($info['title']);
$doc_info_arr[$info['id']]['time'] = cnsubstr($info['input_time']);
$doc_info_arr[$info['id']]['pic'] = $info['pic'];
$doc_info_arr[$info['id']]['content'] = $info['content'];
$doc_info_arr[$info['id']]['pic2'] = Job_Pic::format(
[
'type' => 11,
'pic' => $info['pic'],
'width' => 120,
'height' => 90,
'field' => 'showPic'
]
);
$doc_info_arr[$info['id']]['pic3'] = Job_Pic::format(
[
'type' => 11,
'pic' => $info['pic'],
'width' => 150,
'height' => 150,
'field' => 'showPic'
]
);
$doc_info_arr[$info['id']]['url_yemian'] = (int)($info['url_yemian']);
if ($info['url']) {
$doc_info_arr[$info['id']]['link'] = trim($info['url']);
} else {
$doc_info_arr[$info['id']]['link'] = '/' . $user_name . '/item_' . $channel_id . '_' . $info['id'] . '.html';
}
$doc_info_arr[$info['id']]['publish_date'] = $info['publish_date'];
$doc_info_arr[$info['id']]['show_sx'] = $info['show_sx'];
$doc_info_arr[$info['id']]['author'] = $info['author'];
$doc_info_arr[$info['id']]['show_yd'] = $info['show_yd'];
$doc_info_arr[$info['id']]['source'] = $info['source'];
$doc_info_arr[$info['id']]['zhuanzai'] = $info['zhuanzai'];
$doc_info_arr[$info['id']]['zhuanzai_url'] = $info['zhuanzai_url'];
$i++;
}
}
$ser_id = 0;
if ($id) {
$ser_id = $id;
}
//广告
$ad_arr = get_ad_info($user_id, $model_id, $channel_id, $ser_id);
if ($ad_arr) {
foreach ($ad_arr as $key => $val) {
$smarty->assign('ad_' . $key, $val);
}
}
$chan_info = get_chan_name(' where id=' . $channel_id);
$name = $chan_info['name'];
$item_seo_brief = $chan_info['seo_brief'];
$item_key_word = $chan_info['keyword'];
$user_system = Model_Public::getRow('ev_user_system', 'userid=' . USER_ID);
$article_review = $user_system->article_review;
$guest_is_show = $user_system->guest_is_show;
$smarty->assign('chan_info', $chan_info);
$smarty->assign('article_review', $article_review);
$smarty->assign('guest_is_show', $guest_is_show);
$smarty->assign("id", $id);
$smarty->assign("item_seo_brief", $item_seo_brief);
$smarty->assign("info_arr", $info_arr);
$smarty->assign("max_id", $max_id);
$smarty->assign("page_str1", $page_str1);
$smarty->assign("system_arr", $system_arr);
$smarty->assign('channel_info_arr', $channel_info);
$smarty->assign('channel_info_arr2', $channel_info11);
$smarty->assign('bottom_info_arr', $bottom_info_arr);
$smarty->assign('bottom_item_arr', $bottom_item_arr);
$smarty->assign('doc_info_arr', $doc_info_arr);
$smarty->assign('channel_id', $channel_id);
$smarty->assign('doc_info', $doc_info);
$smarty->assign('name', $name);
$smarty->assign('user_name', $user_name);
$smarty->assign('guest_chan_id', $guest_chan_id);
$smarty->assign('line_jobs', $line_jobs);
$smarty->assign('ad_type1', $ad_type1);
$smarty->assign('ad_arr', $ad_arr);
$smarty->display($dec[$model_id] . "item.tpl");