本文整理汇总了PHP中NewsStory::store方法的典型用法代码示例。如果您正苦于以下问题:PHP NewsStory::store方法的具体用法?PHP NewsStory::store怎么用?PHP NewsStory::store使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NewsStory
的用法示例。
在下文中一共展示了NewsStory::store方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editPost
function editPost()
{
if (!$this->_checkUser($this->params[1], $this->params[2])) {
$this->response->add(new XoopsXmlRpcFault(104));
} else {
if (!($fields =& $this->_getPostFields($this->params[0]))) {
} else {
$missing = array();
foreach ($fields as $tag => $detail) {
if (!isset($this->params[3][$tag])) {
$data = $this->_getTagCdata($this->params[3]['xoops_text'], $tag, true);
if (trim($data) == '') {
if ($detail['required']) {
$missing[] = $tag;
}
} else {
$post[$tag] = $data;
}
} else {
$post[$tag] = $this->params[3][$tag];
}
}
if (count($missing) > 0) {
$msg = '';
foreach ($missing as $m) {
$msg .= '<' . $m . '> ';
}
$this->response->add(new XoopsXmlRpcFault(109, $msg));
} else {
// will be removed... don't worry if this looks bad
include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
$story = new NewsStory($this->params[0]);
$storyid = $story->storyid();
if (empty($storyid)) {
$this->response->add(new XoopsXmlRpcFault(106));
} elseif (!$this->_checkAdmin()) {
$this->response->add(new XoopsXmlRpcFault(111));
} else {
$story->setTitle(addslashes(trim($post['title'])));
if (isset($post['moretext'])) {
$story->setBodytext(addslashes(trim($post['moretext'])));
}
if (!isset($post['hometext'])) {
$story->setHometext(addslashes(trim($this->params[3]['xoops_text'])));
} else {
$story->setHometext(addslashes(trim($post['hometext'])));
}
if ($this->params[4]) {
$story->setApproved(true);
$story->setPublished(time());
}
$story->setTopicalign('R');
if (!$story->store()) {
$this->response->add(new XoopsXmlRpcFault(106));
} else {
$this->response->add(new XoopsXmlRpcBoolean(true));
}
}
}
}
}
}
示例2: empty
$story->setExpired($expdate);
}
}
$story->setApproved($_POST['approve']);
$story->setTopicId($_POST['topicid']);
$story->setTitle($_POST['title']);
$story->setHometext($_POST['hometext']);
$story->setBodytext($_POST['bodytext']);
$nohtml = empty($_POST['nohtml']) ? 0 : 1;
$nosmiley = empty($_POST['nosmiley']) ? 0 : 1;
$story->setNohtml($nohtml);
$story->setNosmiley($nosmiley);
$story->setIhome($_POST['ihome']);
$story->setTopicalign($_POST['topicalign']);
$story->setTopicdisplay($_POST['topicdisplay']);
$story->store();
$notification_handler =& xoops_gethandler('notification');
$tags = array();
$tags['STORY_NAME'] = $story->title();
$tags['STORY_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/article.php?storyid=' . $story->storyid();
if (!empty($isnew)) {
$notification_handler->triggerEvent('story', $story->storyid(), 'approve', $tags);
}
$notification_handler->triggerEvent('global', 0, 'new_story', $tags);
/*
$poster = new XoopsUser($story->uid());
$subject = _AM_ARTPUBLISHED;
$message = sprintf(_AM_HELLO,$poster->uname());
$message .= "\n\n"._AM_YOURARTPUB."\n\n";
$message .= _AM_TITLEC.$story->title()."\n"._AM_URLC.XOOPS_URL."/modules/".$xoopsModule->dirname()."/article.php?storyid=".$story->storyid()."\n"._AM_PUBLISHEDC.formatTimestamp($story->published(),"m",0)."\n\n";
$message .= $xoopsConfig['sitename']."\n".XOOPS_URL."";
示例3: isset
$story->setTopicId($topic_id);
$story->setHostname(xoops_getenv('REMOTE_ADDR'));
$story->setNohtml($nohtml_db);
$nosmiley = isset($nosmiley) ? intval($nosmiley) : 0;
$notifypub = isset($notifypub) ? intval($notifypub) : 0;
$story->setNosmiley($nosmiley);
$story->setNotifyPub($notifypub);
$story->setType('user');
if ($xoopsModuleConfig['autoapprove'] == 1) {
$approve = 1;
$story->setApproved($approve);
$story->setPublished(time());
$story->setExpired(0);
$story->setTopicalign('R');
}
$result = $story->store();
if ($result) {
// Notification
$notification_handler =& xoops_gethandler('notification');
$tags = array();
$tags['STORY_NAME'] = $subject;
$tags['STORY_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/article.php?storyid=' . $story->storyid();
if ($xoopsModuleConfig['autoapprove'] == 1) {
$notification_handler->triggerEvent('global', 0, 'new_story', $tags);
} else {
$tags['WAITINGSTORIES_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/index.php?op=newarticle';
$notification_handler->triggerEvent('global', 0, 'story_submit', $tags);
}
// If notify checkbox is set, add subscription for approve
if ($notifypub) {
include_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
示例4: while
$news->setBodytext($text_lastversion['bodytext'] . $links . $forum);
$news->Setkeywords('');
$news->Setdescription('');
$news->counter = $article['counter'];
$news->setTopicId($news_topicid);
$news->setIhome($article['ihome']);
$news->setNotifyPub($article['notifypub']);
$news->story_type = $article['story_type'];
$news->setTopicdisplay($article['topicdisplay']);
$news->setTopicalign($article['topicalign']);
$news->setComments($article['comments']);
$news->rating = $article['rating'];
$news->votes = $votes['cpt'];
$approved = $article['published'] > 0 ? true : false;
$news->approved = $approved;
$news->store($approved);
echo '<br> This story was imported : ' . $news->title();
$news_newsid = $news->storyid();
// ********************
// The files
$result4 = $db->query('SELECT * FROM ' . $ams_files . ' WHERE storyid=' . $ams_newsid);
while ($file = $db->fetchArray($result4)) {
$sfile = new sFiles();
$sfile->setFileRealName($file['filerealname']);
$sfile->setStoryid($news_newsid);
$sfile->date = $file['date'];
$sfile->setMimetype($file['mimetype']);
$sfile->setDownloadname($file['downloadname']);
$sfile->counter = $file['counter'];
$sfile->store();
echo '<br> This file was imported : ' . $sfile->getDownloadname();