Imported Post Unapproval mod
Jeremy D

Jeremy D commited on 2011-09-28 12:23:10
Showing 4 changed files, with 200 additions and 0 deletions.

... ...
@@ -0,0 +1,24 @@
1
+Copyright (c) 2011, SleePy (smf-mods-license@sleepycode.com)
2
+All rights reserved.
3
+
4
+Redistribution and use in source and binary forms, with or without
5
+modification, are permitted provided that the following conditions are met:
6
+    * Redistributions of source code must retain the above copyright
7
+      notice, this list of conditions and the following disclaimer.
8
+    * Redistributions in binary form must reproduce the above copyright
9
+      notice, this list of conditions and the following disclaimer in the
10
+      documentation and/or other materials provided with the distribution.
11
+    * Neither the name of the <organization> nor the
12
+      names of its contributors may be used to endorse or promote products
13
+      derived from this software without specific prior written permission.
14
+
15
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
19
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0 25
\ No newline at end of file
... ...
@@ -0,0 +1,3 @@
1
+SMF 2.0+ Customization Only
2
+
3
+This Customization allows anyone who has moderation powers to approve topics/posts to unapprove them. Simply click the unapprove button where the approval button would be.
... ...
@@ -0,0 +1,15 @@
1
+<?xml version="1.0"?>
2
+<!DOCTYPE package-info SYSTEM "http://www.simplemachines.org/xml/package-info">
3
+<package-info xmlns="http://www.simplemachines.org/xml/package-info" xmlns:smf="http://www.simplemachines.org/">
4
+	<id>SleePy:post_unapproval</id>
5
+	<name>Post Unapproval</name>
6
+	<version>1.1.4</version>
7
+	<type>modification</type>
8
+	<install for="2.0-2.0.99">
9
+		<readme>README.txt</readme>
10
+		<modification>post_unapproval.xml</modification>
11
+	</install>
12
+	<uninstall for="2.0-2.0.99">
13
+		<modification reverse="true">post_unapproval.xml</modification>
14
+	</uninstall>
15
+</package-info>
0 16
\ No newline at end of file
... ...
@@ -0,0 +1,158 @@
1
+<?xml version="1.0"?>
2
+<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
3
+<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
4
+
5
+	<id>SleePy:post_unapproval</id>
6
+
7
+	<version>1.1.4</version>
8
+
9
+	<file name="$sourcedir/Display.php">
10
+		<operation>
11
+			<search position="replace"><![CDATA[
12
+		'can_remove' => allowedTo('delete_any') || (allowedTo('delete_replies') && $context['user']['started']) || (allowedTo('delete_own') && $message['id_member'] == $user_info['id'] && (empty($modSettings['edit_disable_time']) || $message['poster_time'] + $modSettings['edit_disable_time'] * 60 > time())),
13
+]]></search>
14
+			<add><![CDATA[
15
+		'can_remove' => allowedTo('delete_any') || (allowedTo('delete_replies') && $context['user']['started']) || (allowedTo('delete_own') && $message['id_member'] == $user_info['id'] && (empty($modSettings['edit_disable_time']) || $message['poster_time'] + $modSettings['edit_disable_time'] * 60 > time())),
16
+		'can_unapprove' => $message['approved'] && $context['can_approve'],
17
+]]></add>
18
+		</operation>
19
+	</file>
20
+	<file name="$sourcedir/Post.php">
21
+		<operation>
22
+			<search position="replace"><![CDATA[
23
+	// Generally don't show the approval box... (Assume we want things approved)
24
+	$context['show_approval'] = false;
25
+]]></search>
26
+			<add><![CDATA[
27
+	// Generally don't show the approval box... (Assume we want things approved)
28
+	$context['show_approval'] = allowedTo('approve_posts') && $context['becomes_approved'] ? 2 : (allowedTo('approve_posts') ? 1 : 0);
29
+]]></add>
30
+		</operation>
31
+		<operation>
32
+			<search position="replace"><![CDATA[
33
+	// If the poster is a guest evaluate the legality of name and email.
34
+	if ($posterIsGuest)
35
+]]></search>
36
+			<add><![CDATA[
37
+	// Incase we want to override
38
+	if (allowedTo('approve_posts'))
39
+	{
40
+		$becomesApproved = !isset($_REQUEST['approve']) || !empty($_REQUEST['approve']) ? 1 : 0;
41
+		$approve_has_changed = isset($row['approved']) ? $row['approved'] != $becomesApproved : false;
42
+	}
43
+
44
+	// If the poster is a guest evaluate the legality of name and email.
45
+	if ($posterIsGuest)
46
+]]></add>
47
+		</operation>
48
+	</file>
49
+
50
+	<file name="$themedir/Display.template.php">
51
+
52
+		<operation>
53
+
54
+			<search position="replace"><![CDATA[
55
+		// Maybe we can approve it, maybe we should?
56
+		if ($message['can_approve'])
57
+			echo '
58
+									<li class="approve_button"><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve'], '</a></li>';
59
+]]></search>
60
+
61
+			<add><![CDATA[
62
+		// Maybe we can approve it, maybe we should?
63
+		if ($message['can_approve'] || $message['can_unapprove'])
64
+			echo '
65
+									<li class="', $message['can_unapprove'] ? 'un' : '', 'approve_button"><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt[$message['can_unapprove'] ? 'unapprove' : 'approve'], '</a></li>';
66
+]]></add>
67
+
68
+		</operation>
69
+
70
+	</file>
71
+
72
+	<file name="$themedir/css/index.css">
73
+
74
+		<operation>
75
+
76
+			<search position="replace"><![CDATA[
77
+ul.quickbuttons li.approve_button
78
+{
79
+	background: url(../images/theme/quickbuttons.png) no-repeat 0 -90px;
80
+}
81
+]]></search>
82
+
83
+			<add><![CDATA[
84
+ul.quickbuttons li.approve_button
85
+{
86
+	background: url(../images/theme/quickbuttons.png) no-repeat 0 -90px;
87
+}
88
+ul.quickbuttons li.unapprove_button
89
+{
90
+	background: url(../images/icons/quick_remove.gif) no-repeat;
91
+}
92
+]]></add>
93
+
94
+		</operation>
95
+
96
+	</file>
97
+
98
+	<file name="$languagedir/Modifications.english.php">
99
+		<operation>
100
+			<search position="end" />
101
+			<add><![CDATA[$txt['unapprove'] = 'Unapprove';
102
+]]></add>
103
+		</operation>
104
+	</file>
105
+	<file name="$languagedir/Modifications.english_utf8.php" error="skip">
106
+		<operation>
107
+			<search position="end" />
108
+			<add><![CDATA[$txt['unapprove'] = 'Unapprove';
109
+]]></add>
110
+		</operation>
111
+	</file>
112
+	<file name="$languagedir/Modifications.turkish.php" error="skip">
113
+		<operation>
114
+			<search position="end" />
115
+			<add><![CDATA[$txt['unapprove'] = 'Mesajı onaylama';
116
+]]></add>
117
+		</operation>
118
+	</file>
119
+	<file name="$languagedir/Modifications.turkish_utf8.php" error="skip">
120
+		<operation>
121
+			<search position="end" />
122
+			<add><![CDATA[$txt['unapprove'] = 'Mesaj&#305; onaylama';
123
+]]></add>
124
+		</operation>
125
+	</file>
126
+
127
+	<file name="$themedir/../core/Display.template.php" error="skip">
128
+
129
+		<operation>
130
+
131
+			<search position="replace"><![CDATA[
132
+	$restore_message_button = create_button('restore_topic.gif', 'restore_message', 'restore_message', 'align="middle"');
133
+]]></search>
134
+
135
+			<add><![CDATA[	// UNAPPROVE MOD
136
+	$restore_message_button = create_button('restore_topic.gif', 'restore_message', 'restore_message', 'align="middle"');
137
+	$unapprove_button = create_button('../icons/quick_remove.gif', 'unapprove', 'unapprove', 'align="middle"');
138
+]]></add>
139
+
140
+		</operation>
141
+
142
+		<operation>
143
+
144
+			<search position="replace"><![CDATA[
145
+		// Can they reply? Have they turned on quick reply?]]></search>
146
+
147
+			<add><![CDATA[
148
+		// Maybe we can approve it, maybe we should?
149
+		if ($message['can_unapprove'])
150
+			echo '
151
+							<li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';sesc=', $context['session_id'], '">', $unapprove_button, '</a></li>';
152
+
153
+		// Can they reply? Have they turned on quick reply?]]></add>
154
+
155
+		</operation>
156
+
157
+	</file>
158
+</modification>
0 159
\ No newline at end of file
1 160