public function doMobileDetail() { global $_GPC, $_W; $this->tryLink(); $id = intval($_GPC['id']); $sql = "SELECT * FROM " . tablename('xc_article_article') . " WHERE `id`=:id"; $detail = pdo_fetch($sql, array(':id' => $id)); $detail = istripslashes($detail); if (!empty($detail)) { $this->trackRead($detail); } if (!empty($detail['redirect_url'])) { header('Location: ' . $detail['redirect_url']); exit(0); } if (!empty($_GPC['shareby']) and $_GPC['shareby'] != $_W['fans']['from_user']) { $this->trackAccess($detail); if (!empty($_GPC['linkurl']) && strlen($_GPC['linkurl']) > 0) { header('Location:' . base64_decode($_GPC['linkurl'])); exit; } } else { } $recommendation = unserialize($detail['recommendation']); $recommendation = xc_article_addTplTail($recommendation); $detail['thumb'] = trim(strpos($detail['thumb'], 'http://') === FALSE ? $_W['attachurl'] . $detail['thumb'] : $detail['thumb']); $detail['title'] = $this->parseTemplate($detail, $detail['title']); $detail['source'] = $this->parseTemplate($detail, $detail['source']); $detail['author'] = $this->parseTemplate($detail, $detail['author']); if ($detail['adv_on_off'] == 'off') { $detail['adv_top'] = $detail['adv_status'] = $detail['adv_bottom'] = ''; } else { $detail['adv_top'] = $this->parseTemplate($detail, $detail['adv_top']); $detail['adv_status'] = $this->parseTemplate($detail, $detail['adv_status']); $detail['adv_bottom'] = $this->parseTemplate($detail, $detail['adv_bottom']); } $title = $detail['title']; $_share = array(); $_share['title'] = $title; $_share['imgUrl'] = $_W['attachurl'] . $detail['sharethumb']; $_share['desc'] = $detail['description']; $_share['link'] = $_W['siteroot'] . '/app/' . $this->createMobileUrl('detail', array('id' => $detail['id'])) . '&shareby=' . $_W['fans']['from_user'] . "&track_type=click&tpl={$_GPC['tpl']}&file={$_GPC['file']}" . (!empty($detail['linkurl']) ? '&linkurl=' . base64_encode($detail['linkurl']) : ''); if (!empty($_GPC['tpl']) && !empty($_GPC['file'])) { $_W['account']['template'] = $_GPC['tpl']; include $this->template($_GPC['file']); exit; } if (!empty($detail['template'])) { $_W['account']['template'] = $detail['template']; } if (!empty($detail['templatefile'])) { include $this->template($detail['templatefile']); exit; } include $this->template('detail'); }
function xc_article_site_article($params = array()) { global $_GPC, $_W; extract($params); $pindex = max(1, intval($_GPC['page'])); $psize = 10; $result = array(); $condition = " WHERE weid = '{$_W['weid']}'"; if (!empty($cid)) { $category = pdo_fetch("SELECT parentid FROM " . tablename('xc_article_article_category') . " WHERE id = '{$cid}'"); if (!empty($category['parentid'])) { $condition .= " AND ccate = '{$cid}'"; } else { $condition .= " AND pcate = '{$cid}'"; } } if ($iscommend == 'true') { $condition .= " AND iscommend = '1'"; } if ($ishot == 'true') { $condition .= " AND ishot = '1'"; } $sql = "SELECT * FROM " . tablename('xc_article_article') . $condition . ' ORDER BY displayorder DESC, id DESC'; $result['list'] = pdo_fetchall($sql . " LIMIT " . ($pindex - 1) * $psize . ',' . $psize); $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('xc_article_article') . $condition); $result['pager'] = pagination($total, $pindex, $psize); $result['nextindex'] = $pindex + 1; $result['maxindex'] = intval(($total - 1) / $psize) + 1; if (!empty($result['list'])) { foreach ($result['list'] as &$row) { $row['url'] = murl('entry//detail', array('m' => 'xc_article', 'id' => $row['id'], 'weid' => $_W['weid'], 'shareby' => $_W['fans']['from_user'], 'track_type' => 'click')); $row['thumb'] = strpos($row['thumb'], 'http://') === FALSE ? $_W['attachurl'] . $row['thumb'] : $row['thumb']; } } $result['list'] = xc_article_addTplTail($result['list']); return $result; }