-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_mcp_info_on_index.xml
208 lines (184 loc) · 8.08 KB
/
install_mcp_info_on_index.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<?xml-stylesheet type="text/xsl" href="modx.prosilver.en.xsl"?>
<!--For security purposes, please check: http
://www.phpbb.com/mods/ for the latest version of this MOD. Although MODs are checked before being allowed in the MODs Database there is no guarantee that there are no security problems within the MOD. No support will be given for MODs not found within the MODs Database which can be found at http://www.phpbb.com/mods/-->
<mod xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://www.phpbb.com/mods/xml/modx-1.2.6.xsd">
<header>
<license>http://opensource.org/licenses/gpl-license.php GNU General Public License v2</license>
<title lang="en">MCP info on index</title>
<description lang="en">Shows the amount of reported and unapproved posts in a red box on the index page. With this MOD you won't miss any reports and unapproved posts ever again. This box is only visible for users with the proper moderator permissions.</description>
<author-notes lang="en">To install this MOD on a subsilver2 based style. Only apply changes to index.php and language/en/mcp.php and then go to the subsilver2 file which is displayed below at Additional MODX Files</author-notes>
<author-group>
<author>
<username>Derky</username>
<homepage>http://www.phpBB3styles.net/</homepage>
</author>
</author-group>
<mod-version>1.0.4</mod-version>
<installation>
<level>easy</level>
<time>180</time>
<target-version>3.0.12</target-version>
</installation>
<history>
<entry>
<date>2008-09-17</date>
<rev-version>1.0.0</rev-version>
<changelog lang="en">
<change>First release</change>
</changelog>
</entry>
<entry>
<date>2008-09-20</date>
<rev-version>1.0.1</rev-version>
<changelog lang="en">
<change>Use of $db->sql_in_set</change>
<change>Optimized switches and URLs</change>
<change>Added if (!function_exists('get_forum_list')) to avoid problems with other MODs</change>
</changelog>
</entry>
<entry>
<date>2008-10-05</date>
<rev-version>1.0.2</rev-version>
<changelog lang="en">
<change>Better use of $auth->acl_getf_global (optimised)</change>
</changelog>
</entry>
<entry>
<date>2010-05-03</date>
<rev-version>1.0.3</rev-version>
<changelog lang="en">
<change>Added support for PM reports</change>
<change>Seperated the unapproved Topics and Posts counters</change>
</changelog>
</entry>
<entry>
<date>2013-11-10</date>
<rev-version>1.0.4</rev-version>
<changelog lang="en">
<change>Fix installation instructions for phpBB 3.0.12</change>
</changelog>
</entry>
</history>
<link-group>
<link type="template" href="contrib/subsilver2.xml" lang="en">subsilver2</link>
<link type="contrib" href="contrib/update_1.0.3_to_1.0.4.xml" lang="en">update from 1.0.3 to 1.0.4</link>
</link-group>
</header>
<action-group>
<open src="index.php">
<edit>
<find><![CDATA[// Assign index specific vars]]></find>
<action type="before-add"><![CDATA[// Show amount of reported and queue posts for authenticated users
if ($auth->acl_getf_global('m_report') || $auth->acl_getf_global('m_approve'))
{
if (!function_exists('get_forum_list'))
{
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
}
$user->add_lang('mcp');
// Reported Posts
$forum_list = get_forum_list('m_report');
if (!empty($forum_list))
{
$sql = 'SELECT COUNT(r.report_id) AS total_reported
FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p
WHERE r.post_id = p.post_id
AND r.report_closed = 0
AND ' . $db->sql_in_set('p.forum_id', $forum_list);
$result = $db->sql_query($sql);
$total_reported = (int) $db->sql_fetchfield('total_reported');
$db->sql_freeresult($result);
if ($total_reported)
{
$template->assign_vars(array(
'L_REPORTS_TOTAL' => ($total_reported == 1) ? $user->lang['REPORT_TOTAL'] : sprintf($user->lang['REPORTS_TOTAL'], $total_reported),
'U_MCP_REPORTS' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports'))
);
}
}
// Reported PMs
$sql = 'SELECT COUNT(report_id) AS total_pm_reported
FROM ' . REPORTS_TABLE . '
WHERE pm_id <> 0
AND report_closed = 0';
$result = $db->sql_query($sql);
$total_pm_reported = (int) $db->sql_fetchfield('total_pm_reported');
$db->sql_freeresult($result);
if ($total_pm_reported)
{
$template->assign_vars(array(
'L_PM_REPORTS_TOTAL' => ($total_pm_reported == 1) ? $user->lang['PM_REPORT_TOTAL'] : sprintf($user->lang['PM_REPORTS_TOTAL'], $total_pm_reported),
'U_MCP_PM_REPORTS' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=pm_reports'))
);
}
// Posts and Topics in the Queue
$forum_list = get_forum_list('m_approve');
if (!empty($forum_list))
{
// Get the queue topics and posts in 1 query :)
$sql = 'SELECT COUNT(t.topic_id) AS total_queue_topics, (
SELECT COUNT(p.post_id)
FROM ' . POSTS_TABLE . ' p
WHERE p.post_approved = 0
AND ' . $db->sql_in_set('p.forum_id', $forum_list) . ' ) AS total_queue_posts
FROM ' . TOPICS_TABLE . ' t
WHERE t.topic_approved = 0
AND ' . $db->sql_in_set('t.forum_id', $forum_list);
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// Topics contain posts, so let's remove these
$total_queue_posts = $row['total_queue_posts'] - $row['total_queue_topics'];
$total_queue_topics = $row['total_queue_topics'];
if ($total_queue_posts)
{
$template->assign_vars(array(
'L_UNAPPROVED_POSTS_TOTAL' => ($total_queue_posts == 1) ? $user->lang['UNAPPROVED_POST_TOTAL'] : sprintf($user->lang['UNAPPROVED_POSTS_TOTAL'], $total_queue_posts),
'U_MCP_POSTS_QUEUE' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=unapproved_posts'))
);
}
if ($total_queue_topics)
{
$template->assign_vars(array(
'L_UNAPPROVED_TOPICS_TOTAL' => ($total_queue_topics == 1) ? $user->lang['UNAPPROVED_TOPIC_TOTAL'] : sprintf($user->lang['UNAPPROVED_TOPICS_TOTAL'], $total_queue_topics),
'U_MCP_TOPICS_QUEUE' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=unapproved_topics'))
);
}
}
}]]></action>
</edit>
</open>
<open src="language/en/mcp.php">
<edit>
<comment lang="en">If you use a subsilver2 (based) style, stop here and go to /contrib/subsilver2.xml</comment>
<find><![CDATA['UNAPPROVED_POST_TOTAL' => 'In total there is <strong>1</strong> post waiting for approval.',]]></find>
<action type="after-add"><![CDATA[
// MCP info on index
'UNAPPROVED_TOPICS_TOTAL' => 'In total there are <strong>%d</strong> topics waiting for approval.',
'UNAPPROVED_TOPICS_ZERO_TOTAL' => 'There are no topics waiting for approval.',
'UNAPPROVED_TOPIC_TOTAL' => 'In total there is <strong>1</strong> topic waiting for approval.',]]></action>
</edit>
</open>
<open src="styles/prosilver/template/index_body.html">
<edit>
<comment lang="en">If you use a subsilver2 (based) style, stop here and go to /contrib/subsilver2.xml</comment>
<find><![CDATA[<!-- INCLUDE overall_header.html -->]]></find>
<action type="after-add"><![CDATA[<!-- IF U_MCP_REPORTS or U_MCP_PM_REPORTS or U_MCP_POSTS_QUEUE or U_MCP_TOPICS_QUEUE -->
<div id="message" class="rules">
<div class="inner"><span class="corners-top"><span></span></span>
<strong>{L_INFORMATION}:</strong>
<ul>
<!-- IF U_MCP_REPORTS --><li><a href="{U_MCP_REPORTS}">{L_REPORTS_TOTAL}</a></li><!-- ENDIF -->
<!-- IF U_MCP_PM_REPORTS --><li><a href="{U_MCP_PM_REPORTS}">{L_PM_REPORTS_TOTAL}</a></li><!-- ENDIF -->
<!-- IF U_MCP_POSTS_QUEUE --><li><a href="{U_MCP_POSTS_QUEUE}">{L_UNAPPROVED_POSTS_TOTAL}</a></li><!-- ENDIF -->
<!-- IF U_MCP_TOPICS_QUEUE --><li><a href="{U_MCP_TOPICS_QUEUE}">{L_UNAPPROVED_TOPICS_TOTAL}</a></li><!-- ENDIF -->
</ul>
<span class="corners-bottom"><span></span></span></div>
</div>
<!-- ENDIF -->]]></action>
</edit>
</open>
<diy-instructions lang="en">Go to the Administration Control Panel > Styles > Templates and then refresh prosilver.</diy-instructions>
</action-group>
</mod>