/** * 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())); } } }
function del() { $model = new Forum(); $model->del(); if ($_GET['parent'] != 0) { $this->redirect('/forum/' . $_GET['parent'] . '/'); } else { $this->redirect('/forum/'); } }
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; } }
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; }
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)); }
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; }
/** * 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(); }
/** * 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); }
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)); }
/** * 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')); } }
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; }
/** * 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'); }
/** * Отобразить карточку форума * * @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)); }
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)); }
/** * 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; } }
function listePosts($idFil, $numPage, &$vueForum) { $forum = new Forum(); $auth = new Auth(); //recuperation des infos pour le fil d'ariane $fil = $forum->getFil($idFil); $section = $forum->getSection($fil->get('idSection')); $ariane = ' <ol class="breadcrumb"> <li><a href="./?mod=forum"> Forum </a></li> <li><a href ="./?mod=forum&page=section&id=' . $section->get('id') . '"> ' . $section->get('nom') . ' </a></li> <li>' . $fil->get('nom') . '</li> </ol>'; $users = $auth->listerUsers(); //liste des différentes section (tableau !!) $listePosts = $forum->listerPosts($idFil); $fil = $forum->getFil($idFil); $vueForum->setBreadCrumb($ariane); $vueForum->listePosts($listePosts, $section, $fil, $users, $numPage); }
public function restoreForum($id) { $forum = Forum::withTrashed()->find($id); if ($forum) { $forum->restore(); Cache::flush(); return Redirect::to('dashboard/storyteller/manage/forums'); } else { return Response::json(['success' => false, 'message' => 'Unable to find forum.']); } }
/** * Default constructor. */ public function __construct() { parent::__construct(); $role = Users::ROLE_GUEST; if ($this->userdata != null) { $role = $this->userdata["role"]; } $content = new Contents(['Settings' => $this->settings]); $f = new Forum(); $menu = new Menu($this->settings); $this->smarty->assign('menulist', $menu->get($role, $this->serverurl)); $this->smarty->assign('usefulcontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEUSEFUL, $role)); $this->smarty->assign('articlecontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEARTICLE, $role)); if ($this->userdata != null) { $this->smarty->assign('recentforumpostslist', $f->getRecentPosts($this->settings->getSetting('showrecentforumposts'))); } $this->smarty->assign('main_menu', $this->smarty->fetch('mainmenu.tpl')); $this->smarty->assign('useful_menu', $this->smarty->fetch('usefullinksmenu.tpl')); $this->smarty->assign('article_menu', $this->smarty->fetch('articlesmenu.tpl')); $category = new Category(['Settings' => $content->pdo]); if ($this->userdata != null) { $parentcatlist = $category->getForMenu($this->userdata["categoryexclusions"]); } else { $parentcatlist = $category->getForMenu(); } $this->smarty->assign('parentcatlist', $parentcatlist); $searchStr = ''; if ($this->page == 'search' && isset($_REQUEST["id"])) { $searchStr = (string) $_REQUEST["id"]; } $this->smarty->assign('header_menu_search', $searchStr); if (isset($_REQUEST["t"])) { $this->smarty->assign('header_menu_cat', $_REQUEST["t"]); } else { $this->smarty->assign('header_menu_cat', ''); } $header_menu = $this->smarty->fetch('headermenu.tpl'); $this->smarty->assign('header_menu', $header_menu); }
/** * Render view. * * @return string */ public function content() { ob_start(); // Title if ($this->area->description) { echo $this->area->description . '<hr>'; } if ($this->area->topic_count) { // Area has topics $last_topic = $this->area->last_topic(); $last_poster = $last_topic->last_post()->author(); ?> <div class="media"> <div class="pull-left"> <?php echo HTML::avatar($last_poster ? $last_poster['avatar'] : null, $last_poster ? $last_poster['username'] : null, false); ?> </div> <div class="media-body"> <small class="ago"><?php echo HTML::time(Date::short_span($last_topic->last_posted, true, true), $last_topic->last_posted); ?> </small> <?php echo $last_poster ? HTML::user($last_poster) : HTML::chars($last_topic->last_poster); ?> <br> <?php echo HTML::anchor(Route::model($last_topic, '?page=last#last'), Forum::topic($last_topic), array('title' => HTML::chars($last_topic->name))); ?> <br /> </div> </div> <small class="stats muted"> <i class="icon-comments"></i> <?php echo Num::format($this->area->topic_count, 0); ?> <i class="icon-comment"></i> <?php echo Num::format($this->area->post_count, 0); ?> </small> <?php } else { // Empty area echo __('No topics yet.'); } return ob_get_clean(); }
protected function RenderContent() { ?> <div class="Panel"> <h3 class="PanelTitle">Forums</h3> <div class="PanelContent"> <div class="ProfilePage"> <div class="ProfileTitle"> <?php $forums = Forum::Get(); $count = count($forums); ?> <span class="ProfileUserName"> <?php echo "There "; if ($count == 1) { echo "is "; } else { echo "are "; } echo $count; if ($count == 1) { echo " forum"; } else { echo " forums"; } echo "."; ?> </span> <span class="ProfileControlBox"> <a href="<?php echo System::ExpandRelativePath("~/community/forums/create.mmo"); ?> " onclick="ForumCreateDialog.Show();">Create Forum</a> </span> </div> <div class="ProfileContent"> <?php $grpForums = new WebButtonGroupControl("grpForums"); foreach ($forums as $item) { $grpForums->Items[] = new WebButtonGroupButton("~/community/forums/" . $item->Name, $item->Title, "~/community/forums/" . $item->Name . "/images/avatar/thumbnail.png", "ForumInformationDialog.ShowDialog(" . $item->ID . ");"); } $grpForums->Render(); ?> </div> </div> </div> </div> <?php }
public static function getCurrentUser() { if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) { header('WWW-Authenticate: Basic realm="nForum API"'); header('HTTP/1.0 401 Unauthorized'); exit; } $id = trim($_SERVER['PHP_AUTH_USER']); $pwd = $_SERVER['PHP_AUTH_PW']; if (strtolower($id) === 'guest' || Forum::checkPwd($id, $pwd, false, true)) { return $id; } return false; }
/** * Run Method. */ public function run() { User::connection()->query('SET FOREIGN_KEY_CHECKS = 0'); $data = []; $genders = ['male', 'female']; $logins = ['admin', 'moder', 'user', 'guest', 'banned']; $faker = Faker\Factory::create('ru_RU'); foreach ($logins as $login) { $gender = $genders[array_rand($genders)]; $data[] = ['login' => $login, 'password' => password_hash($login, PASSWORD_BCRYPT), 'email' => $faker->freeEmail, 'gender' => $gender, 'level' => $login, 'name' => $faker->firstName($gender), 'country' => $faker->country, 'city' => $faker->city, 'info' => $faker->realText(rand(30, 100)), 'phone' => $faker->phoneNumber, 'birthday' => $faker->date('d-m-Y'), 'created_at' => $faker->dateTimeBetween('-3 year')->format('Y-m-d H:i:s')]; } User::connection()->query('TRUNCATE users'); $table = $this->table('users'); $table->insert($data)->save(); Forum::connection()->query('SET FOREIGN_KEY_CHECKS = 1'); }
public function getForums() { global $db, $userManager, $user; if ($userManager->loggedIn()) { $res = $db->query("\n\t\t\t\t\tSELECT *\n\t\t\t\t\tFROM " . TABLE_FORUMS . " AS f\n\t\t\t\t\tLEFT JOIN " . TABLE_FORUMS_TRACK . " AS t\n\t\t\t\t\t\tON t.forum_id = f.id AND t.user_id = :uid\n\t\t\t\t\tWHERE f.category_id = :id\n\t\t\t\t\tORDER BY f.`order` ASC\n\t\t\t\t", array($user->getID(), $this->id)); } else { $res = $db->query("\n\t\t\t\t\tSELECT *\n\t\t\t\t\tFROM " . TABLE_FORUMS . "\n\t\t\t\t\tWHERE category_id = ?\n\t\t\t\t\tORDER BY `order` ASC\n\t\t\t\t", array($this->id)); } $had = array(); $forums = array(); while ($row = $db->fetchObject($res)) { if (!in_array($row->id, $had)) { $forums[] = Forum::fromRow($row, $this); $had[] = $row->id; } } return $forums; }
function testShowLink() { $post = $this->objFromFixture('Post', 'Post1'); Forum::$posts_per_page = 8; // test for show link on first page $this->assertContains($post->Thread()->URLSegment . '/show/' . $post->ThreadID, $post->ShowLink()); // test for link that should be last post on the first page $eighthPost = $this->objFromFixture('Post', 'Post9'); $this->assertContains($eighthPost->Thread()->URLSegment . '/show/' . $eighthPost->ThreadID . '#post' . $eighthPost->ID, $eighthPost->ShowLink()); // test for a show link on a subpage $lastPost = $this->objFromFixture('Post', 'Post10'); $this->assertContains($lastPost->Thread()->URLSegment . '/show/' . $lastPost->ThreadID . '?start=8#post' . $lastPost->ID, $lastPost->ShowLink()); // this is the last post on page 2 $lastPost = $this->objFromFixture('Post', 'Post17'); $this->assertContains($lastPost->Thread()->URLSegment . '/show/' . $lastPost->ThreadID . '?start=8#post' . $lastPost->ID, $lastPost->ShowLink()); // test for a show link on the last subpage $lastPost = $this->objFromFixture('Post', 'Post18'); $this->assertContains($lastPost->Thread()->URLSegment . '/show/' . $lastPost->ThreadID . '?start=16#post' . $lastPost->ID, $lastPost->ShowLink()); }
/** * Creates a new posts. * If creation is successful, the browser will be redirected to the 'show' page. */ public function actionCreate() { if (isset($_POST['Post'])) { $user = User::model()->find('username = :username', array('username' => Yii::app()->user->name)); $session = Yii::app()->session; $topic = Topic::model()->findByPk($session['topic_id']); $forum = Forum::model()->findByPk($session['forum_id']); /*$transaction = Post::model()->dbConnection->beginTransaction(); try { */ $now = date('Y-m-d H:i:s'); $post = new Post(); $post->user_id = $user->id; $post->topic_id = $session['topic_id']; $post->forum_id = $session['forum_id']; $post->body = $_POST['Post']['body']; // TODO: fix me $post->body_html = $post->body; $post->created_at = $now; $post->updated_at = $now; if (!$post->save()) { var_dump('<pre>', $post->getErrors()); } if (!$user->save()) { var_dump('<pre>', $user->getErrors()); } $topic->updated_at = $now; /*$topic->replied_at = $now; $topic->replied_by = $user->id; $topic->last_post_id = $post->id;*/ if (!$topic->save()) { var_dump('<pre>', $topic->getErrors()); } /*$transaction->commit(); } catch(Exception $e) { $transaction->rollBack(); throw new CHttpException(500, 'Failed to save post'); }*/ $url = $this->createUrl('topic/view', array('id' => $session['topic_id'], '#' => "post-{$post->id}")); $this->redirect($url); } }
function __construct() { if ($_GET['act'] == 'del') { Forum::del(); $this->redirect('/' . implode('/', Funcs::$uri) . '/'); } if (Funcs::$uri[2] == '') { $tree = Tree::getTreeByUrl('wide', array('help', 'forum')); Funcs::setMeta($tree); $tree['list'] = Forum::getForum(); View::render('forum/forum', $tree); } elseif (Funcs::$uri[3] == '') { if ($_POST) { $error = Forum::add(); if ($error) { $tree = Forum::getItems(); Funcs::setMeta($tree); View::render('forum/items', $tree); } else { $this->redirect('/' . Funcs::$uri[0] . '/' . Funcs::$uri[1] . '/' . Funcs::$uri[2] . '/'); } } else { $tree = Forum::getItems(); Funcs::setMeta($tree); View::render('forum/items', $tree); } } else { if ($_POST) { $error = Forum::add(); if ($error) { $tree = Forum::getList(); Funcs::setMeta($tree); View::render('forum/list', $tree); } else { $this->redirect('/' . Funcs::$uri[0] . '/' . Funcs::$uri[1] . '/' . Funcs::$uri[2] . '/' . Funcs::$uri[3] . '/'); } } else { $tree = Forum::getList(); Funcs::setMeta($tree); View::render('forum/list', $tree); } } }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Forum::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
if (!$User->check_auth($CAT_FORUM[$topic['idcat']]['auth'], EDIT_CAT_FORUM)) { $Errorh->handler('e_auth', E_USER_REDIRECT); } $id_first = $Sql->query("SELECT MIN(id) FROM " . PREFIX . "forum_msg WHERE idtopic = '" . $msg['idtopic'] . "'", __LINE__, __FILE__); if ($id_first == $id_post_msg) { $Errorh->handler('e_unable_cut_forum', E_USER_REDIRECT); } $level = $Sql->query("SELECT level FROM " . PREFIX . "forum_cats WHERE id = '" . $to . "'", __LINE__, __FILE__); if (!empty($to) && $level > 0) { $title = retrieve(POST, 'title', ''); $subtitle = retrieve(POST, 'desc', ''); $contents = retrieve(POST, 'contents', '', TSTRING_PARSE); $type = retrieve(POST, 'type', 0); if (!empty($to) && !empty($contents) && !empty($title)) { include_once '../forum/forum.class.php'; $Forumfct = new Forum(); $last_topic_id = $Forumfct->Cut_topic($id_post_msg, $msg['idtopic'], $topic['idcat'], $to, $title, $subtitle, $contents, $type, $msg['user_id'], $topic['last_user_id'], $topic['last_msg_id'], $topic['last_timestamp']); $question = retrieve(POST, 'question', ''); if (!empty($question)) { $poll_type = retrieve(POST, 'poll_type', 0); $poll_type = $poll_type == 0 || $poll_type == 1 ? $poll_type : 0; $answers = array(); $nbr_votes = 0; for ($i = 0; $i < 20; $i++) { $answer = str_replace('|', '', retrieve(POST, 'a' . $i, '')); if (!empty($answer)) { $answers[$i] = $answer; $nbr_votes++; } } $Forumfct->Add_poll($last_topic_id, $question, $answers, $nbr_votes, $poll_type);
<?php /* * Made by Samerton * http://worldscapemc.co.uk * * License: MIT */ // Set the page name for the active link in navbar $page = "forum"; // User must be logged in to proceed if (!$user->isLoggedIn()) { Redirect::to('/forum'); die; } $forum = new Forum(); if (!isset($_GET["tid"]) || !is_numeric($_GET["tid"])) { Redirect::to('/forum/error/?error=not_exist'); die; } else { $topic_id = $_GET["tid"]; $forum_id = $queries->getWhere('topics', array('id', '=', $topic_id)); $forum_id = $forum_id[0]->forum_id; } if ($user->canViewMCP($user->data()->id)) { // TODO: Change to permission based if statement if (Input::exists()) { if (Token::check(Input::get('token'))) { $validate = new Validate(); $validation = $validate->check($_POST, array('merge' => array('required' => true))); $posts_to_move = $queries->getWhere('posts', array('topic_id', '=', $topic_id));
$smarty->assign('SESSION_FLASH', Session::flash('home')); } else { $smarty->assign('SESSION_FLASH', ''); } // Generate code for page $jumbotron_content = ' <h1>WorldscapeMC</h1> <p>There are currently 2 players online</p> <p>Join with <strong>play.worldscapemc.com</strong></p> '; $smarty->assign('SITENAME', $sitename); $smarty->assign('JUMBOTRON_CONTENT', $jumbotron_content); $smarty->assign('NEWS', $general_language['news']); $smarty->assign('SOCIAL', $general_language['social']); // Get news content $forum = new Forum(); // Initialise the forum to get the latest news $latest_news = $forum->getLatestNews(5); // Get latest 5 items // HTML Purifier require 'core/includes/htmlpurifier/HTMLPurifier.standalone.php'; $config = HTMLPurifier_Config::createDefault(); $config->set('HTML.Doctype', 'XHTML 1.0 Transitional'); $config->set('URI.DisableExternalResources', false); $config->set('URI.DisableResources', false); $config->set('HTML.Allowed', 'u,p,b,a,i,small,blockquote,span[style],span[class],p,strong,em,li,ul,ol,div[align],br,img'); $config->set('CSS.AllowedProperties', array('text-align', 'float', 'color', 'background-color', 'background', 'font-size', 'font-family', 'text-decoration', 'font-weight', 'font-style', 'font-size')); $config->set('HTML.AllowedAttributes', 'href, src, height, target, width, alt, class, *.style'); $config->set('HTML.SafeIframe', true); $config->set('URI.SafeIframeRegexp', '%^(https?:)?//(www\\.youtube(?:-nocookie)?\\.com/embed/|player\\.vimeo\\.com/video/)%'); $purifier = new HTMLPurifier($config);