コード例 #1
0
    exit;
}
if (isset($_POST['submit_no'])) {
    $msg->addFeedback('CANCELLED');
    if ($_POST['nest']) {
        header('Location: view.php?fid=' . $_POST['fid'] . SEP . 'pid=' . ($_POST['ppid'] ? $_POST['ppid'] : $_POST['pid']));
        exit;
    } else {
        header('Location: index.php?fid=' . $_POST['fid']);
        exit;
    }
    exit;
} else {
    if (isset($_POST['submit_yes'])) {
        // check if they have access
        if (!valid_forum_user($fid)) {
            $msg->addError('FORUM_NOT_FOUND');
            header('Location: list.php');
            exit;
        }
        if ($ppid == 0) {
            /* If deleting an entire post */
            /* First get number of comments from specific post */
            $sql = "SELECT * FROM %sforums_threads WHERE post_id=%d AND forum_id=%d";
            $row_posts = queryDB($sql, array(TABLE_PREFIX, $pid, $fid), TRUE);
            if (count($row_posts) == 0) {
                $msg->addError('FORUM_NOT_FOUND');
                header('Location: list.php');
                exit;
            }
            // else:
コード例 #2
0
ファイル: new_thread.php プロジェクト: zort77/ATutor
/* This program is free software. You can redistribute it and/or*/
/* modify it under the terms of the GNU General Public License  */
/* as published by the Free Software Foundation.				*/
/****************************************************************/
// $Id$
define('AT_INCLUDE_PATH', '../../../../include/');
require AT_INCLUDE_PATH . 'vitals.inc.php';
require AT_INCLUDE_PATH . '../mods/_standard/forums/lib/forums.inc.php';
$fid = intval($_REQUEST['fid']);
$_POST['parent_id'] = intval($_REQUEST['parent_id']);
$_pages['mods/_standard/forums/forum/index.php?fid=' . $fid]['title'] = get_forum_name($fid);
$_pages['mods/_standard/forums/forum/index.php?fid=' . $fid]['parent'] = 'mods/_standard/forums/forum/list.php';
$_pages['mods/_standard/forums/forum/index.php?fid=' . $fid]['children'] = array('mods/_standard/forums/forum/new_thread.php');
$_pages['mods/_standard/forums/forum/new_thread.php']['title_var'] = 'new_thread';
$_pages['mods/_standard/forums/forum/new_thread.php']['parent'] = 'mods/_standard/forums/forum/index.php?fid=' . $fid;
if (!valid_forum_user($fid) || !$_SESSION['enroll']) {
    $msg->addError('FORUM_DENIED');
    require AT_INCLUDE_PATH . 'header.inc.php';
    require AT_INCLUDE_PATH . 'footer.inc.php';
    exit;
}
if (isset($_POST['cancel'])) {
    $msg->addFeedback('CANCELLED');
    header('Location: ' . url_rewrite('mods/_standard/forums/forum/index.php?fid=' . $fid, AT_PRETTY_URL_IS_HEADER));
    exit;
} else {
    if (isset($_POST['submit'])) {
        $missing_fields = array();
        $_POST['subject'] = htmlentities(addslashes($_POST['subject']), ENT_QUOTES, 'UTF-8');
        $_POST['body'] = htmlspecialchars(strip_tags($_POST['body']), ENT_QUOTES, 'UTF-8');
        $_POST['replytext'] = htmlspecialchars(strip_tags($_POST['replytext']), ENT_QUOTES, 'UTF-8');
コード例 #3
0
ファイル: edit_post.php プロジェクト: genaromendezl/ATutor
/*																			*/
/* This program is free software. You can redistribute it and/or			*/
/* modify it under the terms of the GNU General Public License				*/
/* as published by the Free Software Foundation.							*/
/****************************************************************************/
// $Id$
define('AT_INCLUDE_PATH', '../../../include/');
require AT_INCLUDE_PATH . 'vitals.inc.php';
require_once AT_INCLUDE_PATH . '../mods/_standard/forums/lib/forums.inc.php';
$fid = intval($_REQUEST['fid']);
if (isset($_GET['pid'])) {
    $pid = intval($_GET['pid']);
} else {
    $pid = intval($_POST['pid']);
}
if (!$pid || !$fid || !valid_forum_user($fid)) {
    $msg->addError('ITEM_NOT_FOUND');
    header('Location: ../../../forum/list.php');
    exit;
}
$sql = "SELECT *, UNIX_TIMESTAMP(date) AS udate FROM %sforums_threads WHERE post_id=%d";
$post_row = queryDB($sql, array(TABLE_PREFIX, $pid), TRUE);
if (count($post_row) == 0) {
    $msg->addError('ITEM_NOT_FOUND');
    header('Location: ' . url_rewrite('/mods/_standard/forums/forum/list.php', AT_PRETTY_URL_IS_HEADER));
    exit;
}
$forum_info = get_forum($fid, $_SESSION['course_id']);
$expiry = $post_row['udate'] + $forum_info['mins_to_edit'] * 60;
// check if we're either a) an assistant or, b) own this post and within the time allowed:
if (!(authenticate(AT_PRIV_FORUMS, AT_PRIV_RETURN) || $post_row['member_id'] == $_SESSION['member_id'] && ($expiry > time() || isset($_POST['edit_post'])))) {
コード例 #4
0
ファイル: move_thread.php プロジェクト: vicentborja/ATutor
$_REQUEST['pid'] = intval($_REQUEST['pid']);
$_REQUEST['ppid'] = intval($_REQUEST['ppid']);
$_REQUEST['fid'] = intval($_REQUEST['fid']);
if (!valid_forum_user($_REQUEST['fid'])) {
    $msg->addError('FORUM_NOT_FOUND');
    header('Location: list.php');
    exit;
}
if (isset($_POST['cancel'])) {
    $msg->addFeedback('CANCELLED');
    header('Location: index.php?fid=' . $_REQUEST['fid']);
    exit;
} else {
    if (isset($_POST['submit'])) {
        // check if they have access
        if (!valid_forum_user($_REQUEST['fid']) || !valid_forum_user($_REQUEST['new_fid'])) {
            $msg->addError('FORUM_NOT_FOUND');
            header('Location: list.php');
            exit;
        }
        if ($_REQUEST['fid'] == $_REQUEST['new_fid']) {
            $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
            header('Location: index.php?fid=' . $_REQUEST['fid']);
            exit;
        }
        $sql = "SELECT * FROM " . TABLE_PREFIX . "forums_threads WHERE post_id={$_REQUEST['pid']} AND forum_id={$_REQUEST['fid']}";
        $result = mysql_query($sql, $db);
        if (!($row = mysql_fetch_assoc($result))) {
            $msg->addError('FORUM_NOT_FOUND');
            header('Location: list.php');
            exit;
コード例 #5
0
ファイル: delete_forum.php プロジェクト: genaromendezl/ATutor
/****************************************************************************/
// $Id$
define('AT_INCLUDE_PATH', '../../../include/');
require AT_INCLUDE_PATH . 'vitals.inc.php';
authenticate(AT_PRIV_FORUMS);
require_once AT_INCLUDE_PATH . '../mods/_standard/forums/lib/forums.inc.php';
if (isset($_POST['submit_no'])) {
    $msg->addFeedback('CANCELLED');
    header('Location: ' . AT_BASE_HREF . 'mods/_standard/forums/index.php');
    exit;
} else {
    if (isset($_POST['submit_yes'])) {
        $_POST['fid'] = intval($_POST['fid']);
        // check if this forum is shared:
        // (if this forum is shared, then we do not want to delete it.)
        if (!is_shared_forum($_POST['fid']) && valid_forum_user($_POST['fid'])) {
            delete_forum($_POST['fid']);
            $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
        } else {
            $msg->addError('FORUM_NO_DEL_SHARE');
        }
        header('Location: ' . AT_BASE_HREF . 'mods/_standard/forums/index.php');
        exit;
    }
}
$_section[0][0] = _AT('discussions');
$_section[0][1] = 'discussions/';
$_section[1][0] = _AT('forums');
$_section[1][1] = 'forum/list.php';
$_section[2][0] = _AT('delete_forum');
require AT_INCLUDE_PATH . 'header.inc.php';