Browse code

Imported Post Unapproval mod

Jeremy D authored on 28/09/2011 19:23:10
Showing 1 changed files
1 1
new file mode 100755
... ...
@@ -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