831 |
florian |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
////////////////////////////////////////////////////////////////////////////////
|
|
|
4 |
// //
|
|
|
5 |
// Copyright (C) 2006 Phorum Development Team //
|
|
|
6 |
// http://www.phorum.org //
|
|
|
7 |
// //
|
|
|
8 |
// This program is free software. You can redistribute it and/or modify //
|
|
|
9 |
// it under the terms of either the current Phorum License (viewable at //
|
|
|
10 |
// phorum.org) or the Phorum License that was distributed with this file //
|
|
|
11 |
// //
|
|
|
12 |
// This program is distributed in the hope that it will be useful, //
|
|
|
13 |
// but WITHOUT ANY WARRANTY, without even the implied warranty of //
|
|
|
14 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. //
|
|
|
15 |
// //
|
|
|
16 |
// You should have received a copy of the Phorum License //
|
|
|
17 |
// along with this program. //
|
|
|
18 |
////////////////////////////////////////////////////////////////////////////////
|
|
|
19 |
|
|
|
20 |
if(!defined("PHORUM_CONTROL_CENTER")) return;
|
|
|
21 |
|
|
|
22 |
if (!$PHORUM["DATA"]["MESSAGE_MODERATOR"]) {
|
|
|
23 |
phorum_redirect_by_url(phorum_get_url(PHORUM_CONTROLCENTER_URL));
|
|
|
24 |
exit();
|
|
|
25 |
}
|
|
|
26 |
|
|
|
27 |
// the number of days to show
|
|
|
28 |
if (isset($_POST['moddays']) && is_numeric($_POST['moddays'])) {
|
|
|
29 |
$moddays = (int)$_POST['moddays'];
|
|
|
30 |
} elseif(isset($PHORUM['args']['moddays']) && !empty($PHORUM["args"]['moddays']) && is_numeric($PHORUM["args"]['moddays'])) {
|
|
|
31 |
$moddays = (int)$PHORUM['args']['moddays'];
|
|
|
32 |
} else {
|
|
|
33 |
$moddays = 2;
|
|
|
34 |
}
|
|
|
35 |
|
|
|
36 |
|
|
|
37 |
if (isset($_POST['onlyunapproved']) && is_numeric($_POST['onlyunapproved'])) {
|
|
|
38 |
$showwaiting = (int)$_POST['onlyunapproved'];
|
|
|
39 |
} elseif(isset($PHORUM['args']['onlyunapproved']) && !empty($PHORUM["args"]['onlyunapproved']) && is_numeric($PHORUM["args"]['onlyunapproved'])) {
|
|
|
40 |
$showwaiting = (int)$PHORUM['args']['onlyunapproved'];
|
|
|
41 |
} else {
|
|
|
42 |
$showwaiting = 0;
|
|
|
43 |
}
|
|
|
44 |
$PHORUM['DATA']['SELECTED'] = $moddays;
|
|
|
45 |
$PHORUM['DATA']['SELECTED_2'] = $showwaiting?true:false;
|
|
|
46 |
|
|
|
47 |
// some needed vars
|
|
|
48 |
$numunapproved = 0;
|
|
|
49 |
$oldforum = $PHORUM['forum_id'];
|
|
|
50 |
|
|
|
51 |
$mod_forums = phorum_user_access_list(PHORUM_USER_ALLOW_MODERATE_MESSAGES);
|
|
|
52 |
$gotforums = (count($mod_forums) > 0);
|
|
|
53 |
|
|
|
54 |
$PHORUM['DATA']['PREPOST'] = array();
|
|
|
55 |
|
|
|
56 |
if ($gotforums)
|
|
|
57 |
$foruminfo = phorum_db_get_forums($mod_forums,-1,$PHORUM['vroot']);
|
|
|
58 |
else
|
|
|
59 |
$foruminfo = array();
|
|
|
60 |
|
|
|
61 |
// Make sure we have a forum name for unapproved announcements.
|
|
|
62 |
$foruminfo[0] = array (
|
|
|
63 |
'name' => $PHORUM["DATA"]["LANG"]["Announcement"]
|
|
|
64 |
);
|
|
|
65 |
|
|
|
66 |
foreach($mod_forums as $forum => $rest) {
|
|
|
67 |
$checkvar = 1;
|
|
|
68 |
// Get the threads
|
|
|
69 |
$rows = array();
|
|
|
70 |
// get the thread set started
|
|
|
71 |
$rows = phorum_db_get_unapproved_list($forum,$showwaiting,$moddays);
|
|
|
72 |
// loop through and read all the data in.
|
|
|
73 |
foreach($rows as $key => $row) {
|
|
|
74 |
$numunapproved++;
|
|
|
75 |
$rows[$key]['forumname'] = $foruminfo[$forum]['name'];
|
|
|
76 |
$rows[$key]['checkvar'] = $checkvar;
|
|
|
77 |
if ($checkvar)
|
|
|
78 |
$checkvar = 0;
|
|
|
79 |
$rows[$key]['forum_id'] = $forum;
|
|
|
80 |
$rows[$key]["url"] = phorum_get_url(PHORUM_FOREIGN_READ_URL, $forum, $row["thread"], $row['message_id']);
|
|
|
81 |
// we need to fake the forum_id here
|
|
|
82 |
$PHORUM["forum_id"] = $forum;
|
|
|
83 |
$rows[$key]["approve_url"] = phorum_get_url(PHORUM_MODERATION_URL, PHORUM_APPROVE_MESSAGE, $row["message_id"], "prepost=1", "old_forum=" . $oldforum);
|
|
|
84 |
$rows[$key]["approve_tree_url"] = phorum_get_url(PHORUM_MODERATION_URL, PHORUM_APPROVE_MESSAGE_TREE, $row["message_id"], "prepost=1", "old_forum=" . $oldforum);
|
|
|
85 |
$rows[$key]["delete_url"] = phorum_get_url(PHORUM_MODERATION_URL, PHORUM_DELETE_TREE, $row["message_id"], "prepost=1", "old_forum=" . $oldforum);
|
|
|
86 |
$PHORUM["forum_id"] = $oldforum;
|
|
|
87 |
$rows[$key]["short_datestamp"] = phorum_date($PHORUM["short_date"], $row["datestamp"]);
|
|
|
88 |
|
|
|
89 |
if ($row["user_id"]) {
|
|
|
90 |
$url = phorum_get_url(PHORUM_PROFILE_URL, $row["user_id"]);
|
|
|
91 |
$rows[$key]["profile_url"] = $url;
|
|
|
92 |
$rows[$key]["linked_author"] = "<a href=\"$url\">$row[author]</a>";
|
|
|
93 |
} else {
|
|
|
94 |
$rows[$key]["profile_url"] = "";
|
|
|
95 |
$rows[$key]["linked_author"] = $row["author"];
|
|
|
96 |
}
|
|
|
97 |
}
|
|
|
98 |
// $PHORUM['DATA']['FORUMS'][$forum]['forum_id']=$forum;
|
|
|
99 |
$PHORUM['DATA']['PREPOST'] = array_merge($PHORUM['DATA']['PREPOST'], $rows);
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
|
|
|
103 |
if (!$numunapproved) {
|
|
|
104 |
$PHORUM["DATA"]["UNAPPROVEDMESSAGE"] = $PHORUM["DATA"]["LANG"]["NoUnapprovedMessages"];
|
|
|
105 |
}
|
|
|
106 |
|
|
|
107 |
$template = "cc_prepost";
|
|
|
108 |
?>
|