public function respond() { checkauth(); $sql = "SELECT * FROM " . tablename('basic_reply') . " WHERE `rid` IN ({$this->rule}) ORDER BY RAND() LIMIT 1"; $reply = pdo_fetch($sql); $reply['content'] = htmlspecialchars_decode($reply['content']); $reply['content'] = str_replace(array('<br>', ' '), array("\n", ' '), $reply['content']); $reply['content'] = strip_tags($reply['content'], '<a>'); //替换要替换的内容 $reply['content'] = formot_content($reply['content']); return $this->respText($reply['content']); }
public function respond() { global $_W; $rid = $this->rule; $sql = "SELECT * FROM " . tablename('news_reply') . " WHERE rid = :id ORDER BY displayorder DESC, id ASC LIMIT 8"; $commends = pdo_fetchall($sql, array(':id' => $rid)); $news = array(); foreach ($commends as $c) { $row = array(); $row['title'] = formot_content($c['title']); $row['description'] = formot_content($c['description']); !empty($c['thumb']) && ($row['picurl'] = tomedia($c['thumb'])); $row['url'] = empty($c['url']) ? $this->createMobileUrl('detail', array('id' => $c['id'])) : $c['url']; $news[] = $row; } return $this->respNews($news); }
public function doMobileDetail() { global $_W, $_GPC; $id = intval($_GPC['id']); $sql = "SELECT * FROM " . tablename('news_reply') . " WHERE `id`=:id"; $row = pdo_fetch($sql, array(':id' => $id)); if (!empty($row['url'])) { header("Location: " . $row['url']); } $row = istripslashes($row); $row['content'] = formot_content($row['content']); $row['title'] = formot_content($row['title']); $row['description'] = formot_content($row['description']); if ($_W['os'] == 'android' && $_W['container'] == 'wechat' && $_W['account']['account']) { $subscribeurl = "weixin://profile/{$_W['account']['account']}"; } else { $sql = 'SELECT `subscribeurl` FROM ' . tablename('account_wechats') . " WHERE `acid` = :acid"; $subscribeurl = pdo_fetchcolumn($sql, array(':acid' => intval($_W['acid']))); } include $this->template('detail'); }