本文整理汇总了PHP中Forum类的典型用法代码示例。如果您正苦于以下问题:PHP Forum类的具体用法?PHP Forum怎么用?PHP Forum使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Forum类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: moveModal
/**
* Move thread (TODO: Should this be in Forums?)
*/
public function moveModal()
{
$id = $this->getVal('id');
$wm = WallMessage::newFromId($id);
if (empty($wm)) {
return true;
}
/** @var $mainWall WallMessage */
$mainWall = $wm->getWall();
if (!$this->wg->User->isAllowed('wallmessagemove')) {
$this->displayRestrictionError();
return false;
// skip rendering
}
$forum = new Forum();
$list = $forum->getListTitles(DB_SLAVE, NS_WIKIA_FORUM_BOARD);
$this->destinationBoards = array(array('value' => '', 'content' => wfMsg('forum-board-destination-empty')));
/** @var $title Title */
foreach ($list as $title) {
$value = $title->getArticleID();
if ($mainWall->getId() != $value) {
$wall = Wall::newFromTitle($title);
$this->destinationBoards[$value] = array('value' => $value, 'content' => htmlspecialchars($wall->getTitle()->getText()));
}
}
}
示例2: del
function del()
{
$model = new Forum();
$model->del();
if ($_GET['parent'] != 0) {
$this->redirect('/forum/' . $_GET['parent'] . '/');
} else {
$this->redirect('/forum/');
}
}
示例3: inserir
public function inserir(Forum $forum)
{
//Objetivo deste metodo é inserir um objeto no banco, fazendo-o ter persistencia.
//utilizaremos a abstracao do SQL da classe TsqlInstruction
//1. Foreach dos atributos . PRa cada existencia de atributo é um valor a ser adicionado.
$instrucao = new TSqlInsert();
$instrucao->setEntity("forum");
if ($forum->getId() != null) {
$instrucao->setRowData("id", $forum->getId());
}
if ($forum->getTitulo() != null) {
$instrucao->setRowData("titulo", $forum->getTitulo());
}
if ($forum->getCorpo() != null) {
$instrucao->setRowData("corpo", $forum->getCorpo());
}
if ($forum->getUsuario() != null) {
$instrucao->setRowData("usuario", $forum->getUsuario());
}
echo $instrucao->getInstruction();
if ($this->Conexao->query($instrucao->getInstruction())) {
return true;
} else {
return false;
}
}
示例4: Execute
public function Execute(Template $template, Session $session, $request)
{
$template = CreateAncestors($template, $template['L_ADMINPANEL']);
if ($session['user'] instanceof Member && $session['user']['perms'] & ADMIN) {
$forum = new Forum();
if ($forum->setForumpermissions(intval($request['forum_id']), $request)) {
header("Location: admin.php?act=permissions");
}
}
return TRUE;
}
示例5: delete
public function delete($id)
{
$db = new DB();
$this->delCartForUser($id);
$this->delUserCategoryExclusions($id);
$releases = new Releases();
$releases->deleteCommentsForUser($id);
$forum = new Forum();
$forum->deleteUser($id);
$db->query(sprintf("delete from users where ID = %d", $id));
}
示例6: action
public function action()
{
$page = 1;
if (isset($_GET['page'])) {
$page = intval($_GET['page']);
}
$forum = new Forum();
$pages = ceil(Thread::getCount() / $forum->getItemsPerPage());
$this->threads = $forum->getThreadList($page);
$this->pageNumber = $pages;
$this->page = $page;
}
示例7: content
/**
* Render view.
*
* @return string
*/
public function content()
{
if (!$this->topics) {
return '';
}
ob_start();
?>
<ul class="list-unstyled">
<?php
foreach ($this->topics as $topic) {
?>
<li>
<?php
echo HTML::anchor(Route::model($topic, '?page=last#last'), Forum::topic($topic), array('title' => HTML::chars($topic->name)));
?>
</li>
<?php
}
?>
</ul>
<?php
return ob_get_clean();
}
示例8: sys_checkpwd
/**
* check id pwd
* @param String $id
* @param String $pwd
* @param String $md5
* @param String $ip
* @return {v:true|false,pwd:}
*/
public function sys_checkpwd()
{
@($id = trim($this->params['url']['id']));
@($pwd = rawurldecode($this->params['url']['pwd']));
@($md5 = intval(trim($this->params['url']['md5'])));
@($ip = trim($this->params['url']['ip']));
$md5 = $md5 == 1 ? true : false;
$this->ByrSession->from = $ip == "" ? "0.0.0.0" : $ip;
if ($md5) {
if (Configure::read("cookie.encryption")) {
$pwd = $this->ByrSession->decrypt($pwd);
}
$pwd = base64_decode($pwd);
}
$ret = array();
if (Forum::checkPwd($id, $pwd, $md5, true)) {
$ret['v'] = true;
$pwd = base64_encode(User::getInstance($id)->md5passwd);
if (Configure::read("cookie.encryption")) {
$pwd = $this->ByrSession->encrypt($pwd);
}
$ret['pwd'] = rawurlencode($pwd);
} else {
$ret['v'] = false;
}
echo BYRJSON::encode($ret);
}
示例9: actionCreate
public function actionCreate($id)
{
$forum = Forum::model()->findByPk($id);
if (null == $forum) {
throw new CHttpException(404, 'Forum not found.');
}
if ($forum->is_locked && (Yii::app()->user->isGuest || !Yii::app()->user->isForumAdmin())) {
throw new CHttpException(403, 'Forum is locked.');
}
$model = new PostForm();
$model->setScenario('create');
// This makes subject required
if (isset($_POST['PostForm'])) {
if (!isset($_POST['YII_CSRF_TOKEN']) || $_POST['YII_CSRF_TOKEN'] != Yii::app()->getRequest()->getCsrfToken()) {
throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
}
$model->attributes = $_POST['PostForm'];
if ($model->validate()) {
$thread = new Thread();
$thread->forum_id = $forum->id;
$thread->subject = $model->subject;
$thread->author_id = Yii::app()->user->id;
$thread->lastPost_user_id = Yii::app()->user->id;
$thread->lastPost_time = time();
$thread->save(false);
$post = new Post();
$post->author_id = Yii::app()->user->id;
$post->thread_id = $thread->id;
$post->content = $model->content;
$post->save(false);
$this->redirect($thread->url);
}
}
$this->render('newThread', array('forum' => $forum, 'model' => $model));
}
示例10: before
/**
* Construct controller
*/
public function before()
{
parent::before();
$this->page_title = __('Forum');
// Generic page actions
$this->page_actions['new-posts'] = array('link' => Route::url('forum'), 'text' => '<i class="icon-comment icon-white"></i> ' . __('New posts'));
// Forum areas dropdown
$groups = Model_Forum_Group::factory()->find_all();
$areas = array();
foreach ($groups as $group) {
$divider = false;
foreach ($group->areas() as $area) {
if (Permission::has($area, Model_Forum_Area::PERMISSION_READ, self::$user)) {
$divider = true;
$areas[] = array('link' => Route::model($area), 'text' => HTML::entities($area->name));
}
}
if ($divider) {
$areas[] = array('divider' => true);
}
}
array_pop($areas);
$this->page_actions['areas'] = array('link' => Route::url('forum_group'), 'text' => '<i class="icon-folder-open icon-white"></i> ' . __('Areas'));
$this->page_actions['area'] = array('link' => Route::url('forum_group'), 'text' => '', 'dropdown' => $areas);
if (self::$user) {
$this->page_actions['private-messages'] = array('link' => Forum::private_messages_url(), 'text' => '<i class="icon-envelope icon-white"></i> ' . __('Private messages'));
}
}
示例11: forums
public function forums()
{
//Everyone has access to unrestricted forums.
$collection = Forum::with('category')->whereNotNull('category_id')->orderBy('position')->get();
$character = $this->activeCharacter();
$sect = $character ? $character->sect()->first() : null;
$clan = $character ? $character->clan()->first() : null;
if (!$this->isStoryteller()) {
foreach ($collection as $k => $c) {
$allowed = true;
if ($c->sect_id != 0) {
if ($sect) {
$sect_id = $sect->hidden_id ? $sect->hidden_id : $sect->sect_id;
if ($sect_id != $c->sect_id) {
$allowed = false;
}
} else {
$allowed = false;
}
}
if ($c->clan_id != null) {
if ($clan) {
$clan_id = $clan->hidden_id ? $clan->hidden_id : $clan->clan_id;
if ($clan_id != $c->clan_id) {
$allowed = false;
}
} else {
$allowed = false;
}
}
if ($c->background_id != null) {
if ($character == null) {
$allowed = false;
} else {
if ($character->backgrounds()->where('background_id', $c->background_id)->count() == 0) {
$allowed = false;
}
}
}
if ($c->read_permission != null) {
if (!$this->hasPermissionById($c->read_permission)) {
$allowed = false;
}
}
if ($c->is_private) {
if ($character == null) {
$allowed = false;
} else {
if (!ForumCharacterPermission::where(['forum_id' => $c->id, 'character_id' => $character->id])->exists()) {
$allowed = false;
}
}
}
if (!$allowed) {
$collection->forget($k);
}
}
}
return $collection;
}
示例12: run
/**
* Run Method.
*/
public function run()
{
Forum::connection()->query('SET FOREIGN_KEY_CHECKS = 0');
$faker = Faker\Factory::create('ru_RU');
// Заполнение разделов
$data = [];
for ($i = 0; $i < 15; $i++) {
$data[] = ['sort' => $i, 'parent_id' => $i < 4 ? 0 : rand(1, 4), 'title' => $faker->realText(rand(20, 30)), 'description' => $faker->realText(rand(30, 50)), 'closed' => $i % 5 ? 0 : 1, 'created_at' => $faker->dateTimeBetween('-1 month')->format('Y-m-d H:i:s')];
}
Forum::connection()->query('TRUNCATE forums');
$table = $this->table('forums');
$table->insert($data)->save();
// Заполнение тем
$data = [];
for ($i = 0; $i < 100; $i++) {
$data[] = ['forum_id' => rand(1, 15), 'user_id' => rand(1, 5), 'title' => $faker->realText(rand(25, 50)), 'note' => $i % 3 ? $faker->realText(rand(30, 100)) : '', 'closed' => $i % 5 ? 0 : 1, 'locked' => $i % 6 ? 0 : 1, 'created_at' => $faker->dateTimeBetween('-1 month')->format('Y-m-d H:i:s')];
}
Topic::connection()->query('TRUNCATE topics');
$table = $this->table('topics');
$table->insert($data)->save();
// Заполнение сообщений
$data = [];
for ($i = 0; $i < 1000; $i++) {
$data[] = ['forum_id' => rand(1, 15), 'topic_id' => rand(1, 50), 'user_id' => rand(1, 5), 'text' => $faker->realText(rand(50, 500)), 'ip' => $faker->ipv4, 'brow' => App::getUserAgent($faker->userAgent), 'created_at' => $faker->dateTimeBetween('-1 month')->format('Y-m-d H:i:s')];
}
Post::connection()->query('TRUNCATE posts');
$table = $this->table('posts');
$table->insert($data)->save();
Forum::connection()->query('SET FOREIGN_KEY_CHECKS = 1');
}
示例13: actionShow
/**
* Отобразить карточку форума
*
* @param string $alias - url форума
* @throws CHttpException
*
* @return void
*/
public function actionShow($alias = null)
{
$forum = Forum::model()->open()->findByAttributes(array('alias' => $alias));
if ($forum === null) {
throw new CHttpException(404, Yii::t('ForumModule.forum', 'Page was not found!'));
}
$this->render('show', array('forum' => $forum));
}
示例14: delete
public function delete($id)
{
$db = new DB();
$this->delCartForUser($id);
$this->delUserCategoryExclusions($id);
$this->delDownloadRequests($id);
$this->delApiRequests($id);
$rc = new ReleaseComments();
$rc->deleteCommentsForUser($id);
$um = new UserMovies();
$um->delMovieForUser($id);
$us = new UserSeries();
$us->delShowForUser($id);
$forum = new Forum();
$forum->deleteUser($id);
$db->exec(sprintf("DELETE from users where ID = %d", $id));
}
示例15: load
/**
* Load your component.
*
* @param \Cx\Core\ContentManager\Model\Entity\Page $page The resolved page
*/
public function load(\Cx\Core\ContentManager\Model\Entity\Page $page)
{
global $_CORELANG, $objTemplate, $subMenuTitle;
switch ($this->cx->getMode()) {
case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND:
$objForum = new Forum(\Env::get('cx')->getPage()->getContent());
\Env::get('cx')->getPage()->setContent($objForum->getPage());
// $moduleStyleFile = $this->getDirectory() . '/css/frontend_style.css';
break;
case \Cx\Core\Core\Controller\Cx::MODE_BACKEND:
$this->cx->getTemplate()->addBlockfile('CONTENT_OUTPUT', 'content_master', 'LegacyContentMaster.html');
$objTemplate = $this->cx->getTemplate();
\Permission::checkAccess(106, 'static');
$subMenuTitle = $_CORELANG['TXT_FORUM'];
$objForum = new ForumAdmin();
$objForum->getPage();
break;
}
}