本文整理汇总了PHP中Forum::addTopic方法的典型用法代码示例。如果您正苦于以下问题:PHP Forum::addTopic方法的具体用法?PHP Forum::addTopic怎么用?PHP Forum::addTopic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Forum
的用法示例。
在下文中一共展示了Forum::addTopic方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateRoute
break;
case validateRoute('PATCH', 'forums/\\d+/topics/\\d+'):
$forum = new Forum($db, $user);
$user->updateLastForumAccess();
httpResponse($forum->updateTopic($params[3], $postdata));
break;
case validateRoute('GET', 'forums/\\d+/topics/\\d+/posts'):
$forum = new Forum($db, $user);
$user->updateLastForumAccess();
list($result, $totalCount) = $forum->getPosts((int) $params[3], (int) $_GET["limit"] ?: 10, (int) $_GET["index"] ?: 0);
httpResponse($result, $totalCount);
break;
case validateRoute('POST', 'forums/\\d+/topics'):
$forum = new Forum($db, $user);
$user->updateLastForumAccess();
$topicId = $forum->addTopic((int) $params[1], $postdata["subject"], $postdata["sub"] ?: '', $postdata["body"]);
httpResponse(array("topicId" => $topicId));
break;
case validateRoute('POST', 'forums/\\d+/topics/\\d+/posts'):
$mailbox = new Mailbox($db, $user);
$forum = new Forum($db, $user, $mailbox);
$user->updateLastForumAccess();
$forum->addPost((int) $params[3], $postdata);
httpResponse($result, $totalCount);
break;
case validateRoute('PATCH', 'forums/\\d+/topics/\\d+/posts/\\d+'):
$forum = new Forum($db, $user);
$forum->updatePost((int) $params[1], (int) $params[3], (int) $params[5], $postdata["postData"]);
httpResponse($result, $totalCount);
break;
case validateRoute('DELETE', 'forums/\\d+/topics/\\d+/posts/\\d+'):
示例2:
$forums->getFile();
break;
case 'closetopic':
$forums->openClose('close');
break;
case 'opentopic':
$forums->openClose('open');
break;
case 'move':
$forums->moveTopic();
break;
case 'deltopic':
$forums->delTopic();
break;
case 'addtopic':
$forums->addTopic();
break;
case 'newtopic':
$forums->newTopic();
break;
case 'newpost':
$forums->newPost();
break;
case 'addpost':
$forums->addPost();
break;
case 'delpost':
$forums->delPost();
break;
case 'addsubscription':
$forums->setAbo('on');
示例3: htmlentities
}
if (isset($_POST["newtopic"])) {
global $forum;
echo ' <div id="newtopicdiv"><form class="signupform" id="newtopicform" method="post" action="" enctype="multipart/form-data">' . '<p class="forumfeed"></p><fieldset><legend><span class="title">Topic deatils</span></legend>' . '<p><label>Topic Subject</label><input id="topic_subject" class="smallinputs" name="firstname" type="text" required /></p>' . '<p><label>Topic Category</label><select id="topic_cat_select" class="smallinput" name="firstname" value="' . $_SESSION["username"] . '" required>' . $forum->getAllCategory() . '</select></p>' . '<p><label> Topic By</label><input id="topic_by" class="smallinputs" name="middlename" userid="' . $_SESSION["user_id"] . '" type="text" value="' . $_SESSION["username"] . '" required /></p>' . '</fieldset></form><p style="text-align:center"><button class="submit" id="newtopicbt" name="cratnewtopic">Create Topic</button ></p></div>';
}
if (isset($_POST["getallforum"])) {
//$reply = $formu->addCategory();
echo 'Forum for will display most recent forms';
}
if (isset($_POST["c_view"])) {
echo $forum->getAllCategoryView();
}
if (isset($_POST["topicspecview"])) {
$topic = htmlentities(htmlspecialchars($_POST["topic"]));
echo $forum->getTopicSpecView($topic);
}
if (isset($_POST["t_view"])) {
echo $forum->getAllTopicView();
}
if (isset($_POST["t_sub"])) {
$t_sub = htmlentities(htmlspecialchars($_POST["t_sub"]));
$t_cat = htmlentities(htmlspecialchars($_POST["t_cat"]));
$t_by = $_SESSION['user_id'];
echo $t_sub . $t_cat . $t_by;
$reply = $forum->addTopic($t_sub, date("Y-m-d H:i:m", time()), $t_cat, $t_by);
if ($reply == true) {
echo 'Topic added succesfully';
} else {
echo 'Unable to add the topic.';
}
}
示例4: Forum
//-->
</script>
</head>
<body>
<div align="center">
<img src="../Images/logoforum.jpg" width="100%" height="92"/>
<br />
<?php
//if session is not set then access will be denied
if (!isset($_SESSION['admin'])) {
echo "<p><font color='#FF0000' size='4'>Access Denied,<br />" . "You are not allowed to access the content until you login" . "<br /></p>\n\t<a href='index.php'>Login Here</a></font>";
} else {
if (isset($_POST['addtopic'])) {
$add = new Forum();
$add->addTopic();
} else {
?>
<h2>ADD A TOPIC</h2> <br />
<form name="frmpost" action="<?php
$_SERVER['PHP_SELF'];
?>
" method="post"
onsubmit="return emptyField()">
<p><strong>Title of the topic: </strong>
<input name="topic_title" type="text" class="style4" size="40" maxlength="100"/>
</p><br />
<p><strong>Description: </strong><br />
<textarea name="post_text" cols='50' rows='8' class="style4"></textarea>
</p>
示例5: bindTopic
/**
* Permet de Charger tout les topics d'un forum
* @param forum Forum dont on doit charger les topics
* @since 1.0.0
*/
public function bindTopic(Forum $forum)
{
$sql = "SELECT topic_id id, topic_titre titre, topic_vu vu, topic_genre genre\n\t\t\t\tFROM topic\n\t\t\t\tWHERE id_forum = :id";
$id_forum = $forum->getId();
$req = $this->bdd->prepare($sql);
$req->bindParam(":id", $id_forum);
$res = $req->execute();
if (!$res) {
return false;
}
$topics = $req->fetchAll(PDO::FETCH_OBJ);
foreach ($topics as $topic) {
$forum->addTopic(new Topic($topic->id, $topic->titre, NULL, $topic->vu, $topic->genre));
}
}