Ejemplo n.º 1
0
                        }
                    }
                }
                if (HasPermission('mod.stickthreads', $forum['id'])) {
                    if ($_POST['stick']) {
                        $mod .= ", sticky = 1";
                    } else {
                        if ($_POST['unstick']) {
                            $mod .= ", sticky = 0";
                        }
                    }
                }
                $now = time();
                $rUsers = Query("update {users} set posts=posts+1, lastposttime={0} where id={1} limit 1", time(), $loguserid);
                $rPosts = Query("insert into {posts} (thread, user, date, ip, num, options, mood) values ({0},{1},{2},{3},{4}, {5}, {6})", $tid, $loguserid, $now, $_SERVER['REMOTE_ADDR'], $loguser['posts'] + 1, $options, (int) $_POST['mood']);
                $pid = InsertId();
                $rPostsText = Query("insert into {posts_text} (pid,text,revision,user,date) values ({0}, {1}, {2}, {3}, {4})", $pid, $post, 0, $loguserid, time());
                $rFora = Query("update {forums} set numposts=numposts+1, lastpostdate={0}, lastpostuser={1}, lastpostid={2} where id={3} limit 1", $now, $loguserid, $pid, $fid);
                $rThreads = Query("update {threads} set lastposter={0}, lastpostdate={1}, replies=replies+1, lastpostid={2}" . $mod . " where id={3} limit 1", $loguserid, $now, $pid, $tid);
                $attachs = HandlePostAttachments($pid, true);
                Query("UPDATE {posts} SET has_attachments={0} WHERE id={1}", !empty($attachs) ? 1 : 0, $pid);
                Report("New reply by [b]" . $loguser['name'] . "[/] in [b]" . $thread['title'] . "[/] (" . $forum['title'] . ") -> [g]#HERE#?pid=" . $pid, $isHidden);
                $bucket = "newreply";
                include BOARD_ROOT . "lib/pluginloader.php";
                die(header("Location: " . actionLink("post", $pid)));
            } else {
                $attachs = HandlePostAttachments(0, false);
            }
        }
    }
}
Ejemplo n.º 2
0
if (!$thread) {
    Kill(__('Unknown thread.'));
}
$fid = $thread['forum'];
if (!HasPermission('forum.viewforum', $fid)) {
    Kill(__('You may not access this forum.'));
}
$tags = ParseThreadTags($thread['title']);
$isHidden = !HasPermission('forum.viewforum', $fid, true);
if ($_POST['report']) {
    if ($_POST['key'] !== $loguser['token']) {
        Kill(__('No.'));
    }
    // TODO make this use actual notifications or anything better
    Query("INSERT INTO {pmsgs_text} (title,text) VALUES ({0},{1})", "Post report (post #{$pid})", '');
    $pmid = InsertId();
    Query("INSERT INTO {pmsgs} (id,userto,userfrom,date,ip,msgread,deleted,drafting)\n\t\tVALUES ({0},{1},{2},{3},{4},0,0,0)", $pmid, -1, $loguserid, time(), $_SERVER['REMOTE_ADDR']);
    $report = "<strong>Post report</strong>\n\n<strong>Post:</strong> " . actionLinkTag($tags[0], 'post', $pid) . " (post #{$pid})\n\n<strong>Message:</strong>\n{$_POST['message']}\n\n" . actionLinkTag('Mark issue as resolved', 'showprivate', $pmid, 'markread=1');
    Query("UPDATE {pmsgs_text} SET text={0} WHERE pid={1}", $report, $pmid);
    SendNotification('pm', $pmid, -1);
    die(header('Location: ' . actionLink('post', $pid)));
}
MakeCrumbs(forumCrumbs($forum) + array(actionLink("thread", $tid, '', $isHidden ? '' : $tags[0]) => $tags[0], '' => __("Report post")));
$user = Fetch(Query("SELECT * FROM {users} WHERE id={0}", $post['user']));
foreach ($user as $key => $value) {
    $post['u_' . $key] = $value;
}
MakePost($post, POST_SAMPLE);
$fields = array('message' => '<textarea id="text" name="message" rows=10></textarea>', 'btnSubmit' => '<input type="submit" name="report" value="' . __('Submit report') . '">');
echo '
	<form action="" method="POST">';
Ejemplo n.º 3
0
     SetPerms($id);
     dieAjax('Ok|' . $id);
     break;
 case 'addcategory':
     //Get new cat data
     $name = $_POST['name'];
     if ($name == "") {
         dieAjax(__("Name can't be empty."));
     }
     $corder = (int) $_POST['corder'];
     $board = (int) $_POST['board'];
     if (!isset($forumBoards[$board])) {
         $board = '';
     }
     Query("INSERT INTO {categories} (`name`, `corder`, `board`) VALUES ({0}, {1}, {2})", $name, $corder, $board);
     dieAjax('Ok|' . InsertId());
     break;
 case 'deleteforum':
     //Get Forum ID
     $id = (int) $_POST['id'];
     //Check that forum exists
     $rForum = Query("SELECT id FROM {forums} WHERE id={0}", $id);
     if (!NumRows($rForum)) {
         dieAjax("No such forum.");
     }
     //Check that forum has threads.
     if (FetchResult("SELECT COUNT(*) FROM {threads} WHERE forum={0}", $id) > 0) {
         dieAjax(__('Cannot delete a forum that contains threads.'));
     }
     //
     // L/R tree shiz
Ejemplo n.º 4
0
function SendSystemPM($to, $message, $title)
{
    global $systemUser;
    //Don't send system PMs if no System user was set
    if ($systemUser == 0) {
        return;
    }
    $rPM = Query("insert into {pmsgs} (userto, userfrom, date, ip, msgread) values ({0}, {1}, {2}, '127.0.0.1', 0)", $to, $systemUser, time());
    $pid = InsertId();
    $rPM = Query("insert into {pmsgs_text} (pid, text, title) values ({0}, {1}, {2})", $pid, $message, $title);
    //print "PM sent.";
}