本文整理汇总了PHP中Publication::getForumId方法的典型用法代码示例。如果您正苦于以下问题:PHP Publication::getForumId方法的具体用法?PHP Publication::getForumId怎么用?PHP Publication::getForumId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Publication
的用法示例。
在下文中一共展示了Publication::getForumId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: takeAction
/**
* Performs the action; returns true on success, false on error.
*
* @param $p_context - the current context object
* @return bool
*/
public function takeAction(CampContext &$p_context)
{
$p_context->default_url->reset_parameter('f_'.$this->m_name);
$p_context->url->reset_parameter('f_'.$this->m_name);
if (!is_null($this->m_error)) {
return false;
}
// Check that the article exists.
$articleMetaObj = $p_context->default_article;
if (!$articleMetaObj->defined) {
$this->m_error = new PEAR_Error('The article was not selected. You must view an article in order to post comments.',
ACTION_PREVIEW_COMMENT_ERR_NO_ARTICLE);
return false;
}
if (!$articleMetaObj->comments_enabled || $articleMetaObj->comments_locked) {
$this->m_error = new PEAR_Error('Comments are not enabled for this publication/article.',
ACTION_PREVIEW_COMMENT_ERR_NOT_ENABLED);
return false;
}
// Get the publication.
$publicationObj = new Publication($articleMetaObj->publication->identifier);
$forum = new Phorum_forum($publicationObj->getForumId());
if (!$forum->exists()) {
$forum->create();
$forum->setName($publicationObj->getName());
$publicationObj->setForumId($forum->getForumId());
}
$forumId = $forum->getForumId();
$user = $p_context->user;
if ($user->defined) {
$this->m_properties['reader_email'] = $user->email;
} else {
if ($forum->getPublicPermissions() & (PHORUM_USER_ALLOW_NEW_TOPIC | PHORUM_USER_ALLOW_REPLY)) {
if (!isset($this->m_properties['reader_email'])) {
$this->m_error = new PEAR_Error('EMail field is empty. You must fill in your EMail address.',
ACTION_PREVIEW_COMMENT_ERR_NO_EMAIL);
return false;
}
} else {
$this->m_error = new PEAR_Error('You must be a registered user in order to submit a comment. Please subscribe or log in if you already have a subscription.',
ACTION_PREVIEW_COMMENT_ERR_NO_PUBLIC);
return false;
}
}
// Check if the reader was banned from posting comments.
if (Phorum_user::IsBanned($userRealName, $userEmail)) {
$this->m_error = new PEAR_Error('You are banned from submitting comments.',
ACTION_PREVIEW_COMMENT_ERR_BANNED);
return false;
}
$this->m_error = ACTION_OK;
return true;
}
示例2: camp_html_content_top
}
$articlesRemaining = Article::GetNumUniqueArticles($Pub);
if ($articlesRemaining > 0) {
$errorMsgs[] = getGS('There are $1 article(s) left.', $articlesRemaining);
$doDelete = false;
}
$subscriptionsRemaining = Subscription::GetNumSubscriptions($Pub);
if ($subscriptionsRemaining > 0) {
$errorMsgs[] = getGS('There are $1 subscription(s) left.', $subscriptionsRemaining);
$doDelete = false;
}
if ($doDelete) {
$forum = new Phorum_forum($publicationObj->getForumId());
$forum->delete();
$publicationObj->delete();
camp_html_goto_page("/$ADMIN/pub");
} else {
$errorMsgs[] = getGS('The publication $1 could not be deleted.',
'<B>'.htmlspecialchars($publicationObj->getName()).'</B>');
}
echo camp_html_content_top(getGS("Deleting publication"), array("Pub" => $publicationObj));
?>
<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box">
<TR>
<TD COLSPAN="2">
示例3: takeAction
/**
* Performs the action; returns true on success, false on error.
*
* @param $p_context - the current context object
* @return bool
*/
public function takeAction(CampContext &$p_context)
{
$p_context->default_url->reset_parameter('f_'.$this->m_name);
$p_context->url->reset_parameter('f_'.$this->m_name);
if (!is_null($this->m_error)) {
return false;
}
// Check that the article exists.
$articleMetaObj = $p_context->default_article;
if (!$articleMetaObj->defined) {
$this->m_error = new PEAR_Error('The article was not selected. You must view an article in order to post comments.',
ACTION_SUBMIT_COMMENT_ERR_NO_ARTICLE);
return false;
}
if (!$articleMetaObj->comments_enabled || $articleMetaObj->comments_locked) {
$this->m_error = new PEAR_Error('Comments are not enabled for this publication/article.',
ACTION_SUBMIT_COMMENT_ERR_NOT_ENABLED);
return false;
}
// Get the publication.
$publicationObj = new Publication($articleMetaObj->publication->identifier);
$forum = new Phorum_forum($publicationObj->getForumId());
if (!$forum->exists()) {
$forum->create();
$forum->setName($publicationObj->getName());
$publicationObj->setForumId($forum->getForumId());
}
$forumId = $forum->getForumId();
$user = $p_context->user;
if ($user->defined) {
$phorumUser = Phorum_user::GetByUserName($user->uname);
if (is_null($phorumUser)) {
$phorumUser = new Phorum_user();
}
$userId = $user->identifier;
$userEmail = $user->email;
$userRealName = $user->name;
$userPasswd = $user->password_encrypted;
// Check if the phorum user existed or was created successfuly.
// If not, set the error code to 'internal error' and exit.
if (!Phorum_user::CampUserExists($userId)
&& !$phorumUser->create($user->uname, $userPasswd, $userEmail, $userId)) {
$this->m_error = new PEAR_Error('There was an internal error when submitting the comment (code 1).',
ACTION_SUBMIT_COMMENT_ERR_INTERNAL);
return false;
}
} else {
if ($forum->getPublicPermissions() & (PHORUM_USER_ALLOW_NEW_TOPIC | PHORUM_USER_ALLOW_REPLY)) {
if (!isset($this->m_properties['reader_email'])) {
$this->m_error = new PEAR_Error('EMail field is empty. You must fill in your EMail address.',
ACTION_SUBMIT_COMMENT_ERR_NO_EMAIL);
return false;
}
$userId = null;
$userEmail = $this->m_properties['reader_email'];
$userRealName = $userEmail;
} else {
$this->m_error = new PEAR_Error('You must be a registered user in order to submit a comment. Please subscribe or log in if you already have a subscription.',
ACTION_SUBMIT_COMMENT_ERR_NO_PUBLIC);
return false;
}
}
// Validate the CAPTCHA code if it was enabled for the current publication.
if ($publicationObj->isCaptchaEnabled()) {
if ($this->_processCaptcha() === FALSE) {
return FALSE;
}
}
// Check if the reader was banned from posting comments.
if (Phorum_user::IsBanned($userRealName, $userEmail)) {
$this->m_error = new PEAR_Error('You are banned from submitting comments.',
ACTION_SUBMIT_COMMENT_ERR_BANNED);
return false;
}
// Create the first post message (if needed)
$articleObj = new Article($articleMetaObj->language->number, $articleMetaObj->number);
$firstPost = $this->CreateFirstComment($articleObj, $forumId);
if (is_null($firstPost)) {
$this->m_error = new PEAR_Error('There was an internal error when submitting the comment (code 2).',
ACTION_SUBMIT_COMMENT_ERR_INTERNAL);
return false;
}
// Set the parent to the currently viewed comment if a certain existing
// comment was selected. Otherwise, set the parent identifier to the root message.
$parentMessage = new Phorum_message($p_context->comment->identifier);
if (!$parentMessage->exists()) {
//.........这里部分代码省略.........
示例4: Publication
camp_html_goto_page(camp_html_article_url($articleObj, $f_language_selected, "edit.php"));
}
}
// Add the user if it doesnt exist in the Phorum user table
$phorumUser = new Phorum_user($g_user->getUserId());
if (!$phorumUser->CampUserExists($g_user->getUserId())) {
$success = $phorumUser->create($g_user->getUserName(),
$g_user->getPassword(),
$g_user->getEmail(),
$g_user->getUserId());
}
// Get the forum ID.
$publicationObj = new Publication($articleObj->getPublicationId());
$forumId = $publicationObj->getForumId();
// Exit if the forum hasnt been created (this should never happen).
if (!$forumId) {
camp_html_goto_page(camp_html_article_url($articleObj, $f_language_selected, "edit.php")."#add_comment");
}
// Create/get first post.
$firstPost = camp_comment_first_post($articleObj, $forumId);
$firstPost->fetch(); // fix 1st comment
// Exit if the forum hasnt been created (this should never happen).
if (!$firstPost->exists()) {
camp_html_goto_page(camp_html_article_url($articleObj, $f_language_selected, "edit.php")."#add_comment");
}
$threadId = $firstPost->getThreadId();