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


PHP content::getById方法代码示例

本文整理汇总了PHP中content::getById方法的典型用法代码示例。如果您正苦于以下问题:PHP content::getById方法的具体用法?PHP content::getById怎么用?PHP content::getById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在content的用法示例。


在下文中一共展示了content::getById方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: transmit


//.........这里部分代码省略.........
     $q = $this->db->query("SELECT Log.id,Content.contentid,User.ncUid FROM Log,Content,User WHERE action='publishStory' AND status='pending' AND User.userid=Log.userid1 AND Log.itemid=Content.siteContentId  AND User.ncUid>0 AND Content.contentid>0 AND Content.isBlocked=0 AND User.isBlocked=0 ORDER BY id DESC LIMIT {$limit};");
     $pubStory = array();
     $x = 0;
     while ($data = $this->db->readQ($q)) {
         $pubStory[$x][contentid] = $data->contentid;
         $pubStory[$x][logid] = $data->id;
         $pubStory[$x][uid] = $data->ncUid;
         $x += 1;
     }
     $log['pubStory'] = $pubStory;
     /*** Transmit posted raw stories - req ncUid ***/
     $q = $this->db->queryC("SELECT Log.id,Log.itemid,User.ncUid FROM Log,User WHERE action='publishWire' AND status='pending' AND User.userid=Log.userid1 AND User.ncUid>0 AND User.isBlocked=0 ORDER BY id DESC LIMIT {$limit};");
     $pubWire = array();
     $x = 0;
     while ($data = $this->db->readQ($q)) {
         $wireQuery = $this->db->queryC("SELECT * FROM Newswire WHERE id={$data->itemid};");
         if ($wireQuery !== false) {
             $wi = $this->db->readQ($wireQuery);
             $pubWire[$x][logid] = $data->id;
             $pubWire[$x][uid] = $data->ncUid;
             // fetch wire story url
             $pubWire[$x][url] = $wi->url;
             $pubWire[$x][siteContentId] = $data->itemid2;
             $pubWire[$x][wireid] = $wi->wireid;
             switch ($wi->feedType) {
                 default:
                     // wire
                     $pubWire[$x][feedType] = 'wire';
                     break;
                 case 'blog':
                     $pubWire[$x][feedType] = 'blog';
                     $pubWire[$x][title] = $wi->title;
                     $pubWire[$x][date] = $wi->date;
                     $pubWire[$x][caption] = $utilObj->shorten($wi->caption, 500);
                     break;
             }
             $x += 1;
         } else {
             // story deleted from newswire
             $this->db->update("Log", "status='error'", "id={$data->id}");
         }
     }
     $log['pubWire'] = $pubWire;
     /*** Transmit posted stories, a new user posted story - req ncUid ***/
     $q = $this->db->queryC("SELECT Log.id,Log.itemid,User.ncUid FROM Log,User WHERE action='postStory' AND status='pending' AND User.userid=Log.userid1 AND User.ncUid>0 AND User.isBlocked=0 ORDER BY id DESC LIMIT {$limit};");
     if ($q !== false) {
         //$this->db->log('inside poststory');
         require_once PATH_CORE . '/classes/content.class.php';
         $cObj = new content($this->db);
         $postStory = array();
         $x = 0;
         while ($data = $this->db->readQ($q)) {
             $this->db->log($data->id);
             // fetch contentid from siteContentid
             $si = $cObj->getById($data->itemid);
             if ($si !== false) {
                 $postStory[$x][logid] = $data->id;
                 $postStory[$x][siteContentId] = $data->itemid;
                 $postStory[$x][uid] = $data->ncUid;
                 $postStory[$x][title] = $si->title;
                 $postStory[$x][url] = $si->url;
                 $postStory[$x][date] = $si->date;
                 $postStory[$x][caption] = htmlentities($utilObj->shorten(strip_tags($si->caption), 500), ENT_QUOTES);
                 $imageProps = $cObj->getImage($data->itemid);
                 if ($imageProps !== false) {
                     $postStory[$x][imageurl] = $imageProps->url;
                 }
                 $x += 1;
             }
         }
         $log['postStory'] = $postStory;
     }
     $this->narrate('Posting stories to NewsCloud');
     $this->narrate($postStory);
     /*** Transmit comments - req. ncUid and contentid ***/
     $comments = array();
     $q = $this->db->query("SELECT Log.id,Comments.comments,Comments.siteCommentId,Content.contentid,User.ncUid FROM Log,Comments,Content,User WHERE Log.itemid=Comments.siteCommentId AND Comments.siteContentId=Log.itemid2 AND Content.siteContentId=Log.itemid2 AND  Content.contentid>0 AND Log.userid1=User.userid AND User.ncUid>0   AND action='comment' AND status='pending' AND Content.isBlocked=0 AND User.isBlocked=0 AND Comments.videoid=0 ORDER BY id DESC LIMIT {$limit};");
     $x = 0;
     while ($data = $this->db->readQ($q)) {
         $comments[$x][uid] = $data->ncUid;
         $comments[$x][contentid] = $data->contentid;
         $comments[$x][logid] = $data->id;
         $comments[$x][comments] = htmlentities($data->comments, ENT_QUOTES);
         $comments[$x][siteCommentId] = $data->siteCommentId;
         $x += 1;
         // fetch contentid from siteContentid
         //$contentid=$this->lookupContentId($data->itemid);
         //if ($contentid!==false AND $contentid<>0) {
         // fetch newscloud id from userid1
         //$ncUid=$this->lookupUid($data->userid1);
         //if ($ncUid<>0) {
         //}
         //}
     }
     $log['comments'] = $comments;
     $this->narrate('Transmitting comments');
     $this->narrate($comments);
     // send serialized array out
     return serialize($log);
 }
开发者ID:smbale,项目名称:open-social-media-toolkit,代码行数:101,代码来源:log.class.php

示例2: content

    $action = 'unknown';
}
if (isset($_GET['userid'])) {
    $userid = $_GET['userid'];
} else {
    $userid = 0;
}
if (isset($_GET['itemid'])) {
    $itemid = $_GET['itemid'];
} else {
    $id = 0;
}
switch ($action) {
    case 'jumpToStory':
        // to do: log story read
        require_once PATH_CORE . "classes/content.class.php";
        $cObj = new content($db);
        $story = $cObj->getById($itemid);
        header("Location: " . $story->url);
        break;
    case 'readWire':
        require_once PATH_CORE . "/classes/log.class.php";
        $logObj = new log($db);
        $info = $logObj->serialize(0, $db->ui->userid, 'readWire', $itemid);
        $logObj->update($info);
        require_once PATH_CORE . "classes/newswire.class.php";
        $nwObj = new newswire($db);
        $url = $nwObj->getWebpage($itemid);
        header("Location: " . $url);
        break;
}
开发者ID:smbale,项目名称:open-social-media-toolkit,代码行数:31,代码来源:process.php


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