本文整理汇总了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);
}
示例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;
}