本文整理汇总了PHP中content::get_published_content_byid方法的典型用法代码示例。如果您正苦于以下问题:PHP content::get_published_content_byid方法的具体用法?PHP content::get_published_content_byid怎么用?PHP content::get_published_content_byid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类content
的用法示例。
在下文中一共展示了content::get_published_content_byid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
function create()
{
$avatar = $this->attachlib->get_avatar($this->user['user_id']);
$content = $this->input['thread'];
$topic_id = $this->input['tid'];
$pcd = intval($this->input['pcd']);
$aid = urldecode($this->input['aid']);
if ($aid) {
$aid_array = array_filter(explode(',', $aid));
$aid = $this->attachlib->tmp2att($aid_array);
}
if ($pcd) {
$c = new content();
$article = $c->get_published_content_byid($pcd);
if ($article) {
$extend_arc = array('title' => $article['title'], 'brief' => $article['brief'], 'href' => $article['content_url'], 'bundle_id' => $article['bundle_id'], 'module_id' => $article['module_id']);
$article = is_array($article['indexpic']) ? array('host' => $article['indexpic']['host'], 'dir' => $article['indexpic']['dir'], 'filepath' => $article['indexpic']['filepath'], 'filename' => $article['indexpic']['filename']) : array();
$aid .= ',' . $this->attachlib->attach($article, 'publish', 'attach', $extend_arc);
}
}
if (!$topic_id) {
$this->errorOutput("请选择一个话题");
}
$short_link = $this->attachlib->outlink(urldecode($this->input['outlink']));
if ($short_link) {
$aid .= ',' . $short_link;
}
$location = array('lat' => $this->input['lat'], 'lon' => $this->input['lon'], 'address' => urldecode($this->input['address']), 'gpsx' => $this->input['gpsx'], 'gpsy' => $this->input['gpsy']);
if ($location['lat'] && $location['lon']) {
$loc = FromBaiduToGpsXY($location['lon'], $location['lat']);
$location['gpsx'] = $loc['x'];
$location['gpsy'] = $loc['y'];
} elseif ($location['gpsx'] && $location['gpsy']) {
$loc = FromGpsToBaiduXY($location['gpsx'], $location['gpsy']);
$location['lon'] = $loc['x'];
$location['lat'] = $loc['y'];
}
if ($map = $this->attachlib->map($location)) {
$aid .= ',' . $map;
}
if (!$content && !$aid) {
$this->errorOutput("内容不能为空");
}
$aid = $aid ? trim($aid, ',') : '';
$data = array('tid' => $topic_id, 'content' => $content, 'aid' => $aid, 'client' => $this->input['client'] ? $this->input['client'] : $this->user['user_name'], 'status' => 0, 'create_time' => TIMENOW, 'user_id' => $this->user['user_id'], 'avatar' => $avatar ? addslashes(serialize($avatar)) : '', 'user_name' => $this->user['user_name'], 'pcd' => $pcd, 'ip' => hg_getip());
$sql = 'INSERT INTO ' . DB_PREFIX . 'thread SET ';
foreach ($data as $key => $val) {
$sql .= "`{$key}` = \"{$val}\",";
}
$sql = trim($sql, ',');
$this->db->query($sql);
$data['id'] = $this->db->insert_id();
$data['format_create_time'] = hg_tran_time($data['create_time']);
$data['materail'] = $this->attachlib->get_attach_by_aid($aid);
$this->attachlib->delete_attach(urldecode($this->input['aid']));
$this->addItem($data);
$this->output();
}