public function __construct() { $this->commentid = isset($_GET['commentid']) && trim(urldecode($_GET['commentid'])) ? trim(urldecode($_GET['commentid'])) : $this->_show_msg(L('illegal_parameters')); $this->commentid = safe_replace($this->commentid); $this->format = isset($_GET['format']) ? $_GET['format'] : ''; list($this->applications, $this->contentid) = decode_commentid($this->commentid); }
function __construct() { pc_base::load_app_func('global'); pc_base::load_sys_class('format', '', 0); $this->commentid = isset($_GET['commentid']) && trim(urldecode($_GET['commentid'])) ? trim(urldecode($_GET['commentid'])) : $this->_show_msg(L('illegal_parameters')); $this->commentid = safe_replace($this->commentid); $this->format = isset($_GET['format']) ? $_GET['format'] : ''; list($this->modules, $this->contentid, $this->siteid) = decode_commentid($this->commentid); define('SITEID', $this->siteid); }
/** * * 获取评论数据 * @param array $data PC标签中的配置参数传入 */ public function lists($data) { $commentid = $data['commentid']; if (empty($commentid)) { return false; } $siteid = $data['siteid']; if (empty($siteid)) { pc_base::load_app_func('global', 'comment'); list($module, $contentid, $siteid) = decode_commentid($commentid); } $comment = $this->comment_db->get_one(array('commentid' => $commentid, 'siteid' => $siteid)); if (!$comment) { return false; } //设置存储数据表 $this->comment_data_db->table_name($comment['tableid']); $hot = 'id'; if (isset($data['hot']) && !empty($data['hot'])) { $hot = 'support desc, id'; } //是否按评论方向获取 $direction = isset($data['direction']) && intval($data['direction']) ? intval($data['direction']) : 0; if (!in_array($direction, array(0, 1, 2, 3))) { $direction = 0; } switch ($direction) { case 1: //正方 $sql = array('commentid' => $commentid, 'direction' => 1, 'status' => 1); break; case 2: //反方 $sql = array('commentid' => $commentid, 'direction' => 2, 'status' => 1); break; case 3: //中立方 $sql = array('commentid' => $commentid, 'direction' => 3, 'status' => 1); break; default: //获取所有 $sql = array('commentid' => $commentid, 'status' => 1); } return $this->comment_data_db->select($sql, '*', $data['limit'], $hot . ' desc '); }
/** * 获取评论数据 * * @param array $data YUN标签中的配置参数传入 */ public function lists($data) { $commentid = $data['commentid']; if (empty($commentid)) { return false; } Loader::helper('comment:global'); list($module, $contentid) = decode_commentid($commentid); $comment = $this->comment_db->getby_commentid($commentid); if (!$comment) { return false; } // 设置存储数据表 $this->comment_data_db->table_name($comment['tableid']); $hot = 'id'; if (isset($data['hot']) && !empty($data['hot'])) { $hot = 'support desc, id'; } $sql = array('commentid' => $commentid, 'status' => 1); return $this->comment_data_db->where($sql)->limit($data['limit'])->order($hot . ' desc ')->select(); }
function comment_list() { $WAP = $this->wap; $TYPE = $this->types; $comment = pc_base::load_app_class('comment', 'comment'); pc_base::load_app_func('global', 'comment'); $typeid = intval($_GET['typeid']); $GLOBALS['siteid'] = max($this->siteid, 1); $commentid = isset($_GET['commentid']) && trim(urldecode($_GET['commentid'])) ? trim(urldecode($_GET['commentid'])) : exit('参数错误'); list($modules, $contentid, $siteid) = decode_commentid($commentid); list($module, $catid) = explode('_', $modules); $comment_setting_db = pc_base::load_model('comment_setting_model'); $setting = $comment_setting_db->get_one(array('siteid' => $this->siteid)); //通过API接口调用数据的标题、URL地址 if (!($data = get_comment_api($commentid))) { exit('参数错误'); } else { $title = $data['title']; $url = $data['url']; unset($data); } include template('wap', 'comment_list'); }