当前位置: 首页>>代码示例>>PHP>>正文


PHP content::get_published_content_byid方法代码示例

本文整理汇总了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();
 }
开发者ID:h3len,项目名称:Project,代码行数:58,代码来源:thread_update.php


注:本文中的content::get_published_content_byid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。