Exemplo n.º 1
0
require AT_INCLUDE_PATH . '../mods/_standard/forums/lib/forums.inc.php';
if (isset($_POST['cancel'])) {
    $msg->addFeedback('CANCELLED');
    header('Location: ' . AT_BASE_HREF . 'mods/_standard/forums/index.php');
    exit;
} else {
    if (isset($_POST['edit_forum'])) {
        $_POST['fid'] = intval($_POST['fid']);
        if ($_POST['title'] == '') {
            $msg->addError(array('EMPTY_FIELDS', _AT('title')));
        } else {
            $_POST['title'] = validate_length($_POST['title'], 60);
        }
        if (!$msg->containsErrors()) {
            if (!is_shared_forum($_POST['fid'])) {
                edit_forum($_POST);
                $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
            } else {
                $msg->addError('FORUM_NO_EDIT_SHARE');
            }
            header('Location: ' . AT_BASE_HREF . 'mods/_standard/forums/index.php');
            exit;
        }
    }
}
$onload = 'document.form.title.focus();';
require AT_INCLUDE_PATH . 'header.inc.php';
$fid = intval($_REQUEST['fid']);
if (!isset($_POST['submit'])) {
    $row = get_forum($fid, $_SESSION['course_id']);
    if (!is_array($row)) {
Exemplo n.º 2
0
 if (mysql_num_rows($getforum) == 0) {
     print "No forum exists with this ID.<br>";
     print "<a href='index.php?m=admin&act=forums&do=list'>Return to editing forums</a>";
 } else {
     $forum = dbrow($getforum);
     print "Editing the forum {$forum['name']}:";
     print " (<a href='index.php?m=admin&act=forums&do=list'>Return to editing forums</a>)";
     $getcategories = dbquery("SELECT * FROM categories");
     $categories = array('0' => 'Uncategorised');
     while ($row = dbrow($getcategories)) {
         $categories[$row[id]] = $row[name];
     }
     // if it returns a non-blank string, it's an error
     // if it returns true (check with ===) the forum has been edited successfully
     // if it returns nothing, just show the form
     $result = edit_forum();
     if ($result === true) {
         header("Location: index.php?m=admin&act=forums&do=list");
     } else {
         if ($result != '') {
             print '<b>The following errors occurred while editing the forum:<br>' . $result . '</b><br>The data has been saved.<hr>';
         }
         if (!isset($_POST['makeit'])) {
             $_POST[name] = $forum[name];
             $_POST[desc] = $forum[desc];
             $_POST[category] = $forum[category];
             $_POST[order] = $forum[order];
             $_POST[view_power] = $forum[view_power];
             $_POST[reply_power] = $forum[reply_power];
             $_POST[thread_power] = $forum[thread_power];
             $_POST[mod_power] = $forum[mod_power];