<?php /** * Legg til ny forumtråd * * Inndata: * - sid * - forum_id * - title * - text * - type [optional, forum mod] * - locked [optional, forum mod] */ require "../../../app/ajax.php"; ajax::validate_sid(); // kontroller lås ajax::validate_lock(true); global $_base, $_game; // kontroller forumkategori og tilgang $forum = new \Kofradia\Forum\CategoryAjax(postval("forum_id")); $forum->require_access(); // forsøk å legg til forumtråden $type = isset($_POST['type']) && $forum->fmod ? $_POST['type'] : NULL; $locked = isset($_POST['locked']) && $forum->fmod ? $_POST['locked'] : NULL; $forum->add_topic(postval("title"), postval("text"), $type, $locked);
/** * Markere/fjerne markering av meldingstråd * @param inbox_thread_ajax $thread */ public static function thread_mark(inbox_thread_ajax $thread) { // kontroller SID ajax::validate_sid(); // kan vi ikke markere denne tråden? if (!$thread->data_rel) { ajax::text("NO-RELATION", ajax::TYPE_INVALID); } // skal vi fjerne eller legge til markering? if (!isset($_POST['mark'])) { ajax::text("MISSING-MARK", ajax::TYPE_INVALID); } $mark = $_POST['mark'] != 0; // forsøk å markere tråden $thread->mark($mark); }