Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Imported Post Unapproval mod

  • Loading branch information...
commit e680fef4c2e3c624083b95b649b3c1a833800401 0 parents
Jeremy D authored
Showing with 200 additions and 0 deletions.
  1. +24 −0 LICENSE.txt
  2. +3 −0  README.txt
  3. +15 −0 package-info.xml
  4. +158 −0 post_unapproval.xml
24 LICENSE.txt
@@ -0,0 +1,24 @@
+Copyright (c) 2011, SleePy (smf-mods-license@sleepycode.com)
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the <organization> nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3  README.txt
@@ -0,0 +1,3 @@
+SMF 2.0+ Customization Only
+
+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.
15 package-info.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<!DOCTYPE package-info SYSTEM "http://www.simplemachines.org/xml/package-info">
+<package-info xmlns="http://www.simplemachines.org/xml/package-info" xmlns:smf="http://www.simplemachines.org/">
+ <id>SleePy:post_unapproval</id>
+ <name>Post Unapproval</name>
+ <version>1.1.4</version>
+ <type>modification</type>
+ <install for="2.0-2.0.99">
+ <readme>README.txt</readme>
+ <modification>post_unapproval.xml</modification>
+ </install>
+ <uninstall for="2.0-2.0.99">
+ <modification reverse="true">post_unapproval.xml</modification>
+ </uninstall>
+</package-info>
158 post_unapproval.xml
@@ -0,0 +1,158 @@
+<?xml version="1.0"?>
+<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
+<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
+
+ <id>SleePy:post_unapproval</id>
+
+ <version>1.1.4</version>
+
+ <file name="$sourcedir/Display.php">
+ <operation>
+ <search position="replace"><![CDATA[
+ '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())),
+]]></search>
+ <add><![CDATA[
+ '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())),
+ 'can_unapprove' => $message['approved'] && $context['can_approve'],
+]]></add>
+ </operation>
+ </file>
+ <file name="$sourcedir/Post.php">
+ <operation>
+ <search position="replace"><![CDATA[
+ // Generally don't show the approval box... (Assume we want things approved)
+ $context['show_approval'] = false;
+]]></search>
+ <add><![CDATA[
+ // Generally don't show the approval box... (Assume we want things approved)
+ $context['show_approval'] = allowedTo('approve_posts') && $context['becomes_approved'] ? 2 : (allowedTo('approve_posts') ? 1 : 0);
+]]></add>
+ </operation>
+ <operation>
+ <search position="replace"><![CDATA[
+ // If the poster is a guest evaluate the legality of name and email.
+ if ($posterIsGuest)
+]]></search>
+ <add><![CDATA[
+ // Incase we want to override
+ if (allowedTo('approve_posts'))
+ {
+ $becomesApproved = !isset($_REQUEST['approve']) || !empty($_REQUEST['approve']) ? 1 : 0;
+ $approve_has_changed = isset($row['approved']) ? $row['approved'] != $becomesApproved : false;
+ }
+
+ // If the poster is a guest evaluate the legality of name and email.
+ if ($posterIsGuest)
+]]></add>
+ </operation>
+ </file>
+
+ <file name="$themedir/Display.template.php">
+
+ <operation>
+
+ <search position="replace"><![CDATA[
+ // Maybe we can approve it, maybe we should?
+ if ($message['can_approve'])
+ echo '
+ <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>';
+]]></search>
+
+ <add><![CDATA[
+ // Maybe we can approve it, maybe we should?
+ if ($message['can_approve'] || $message['can_unapprove'])
+ echo '
+ <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>';
+]]></add>
+
+ </operation>
+
+ </file>
+
+ <file name="$themedir/css/index.css">
+
+ <operation>
+
+ <search position="replace"><![CDATA[
+ul.quickbuttons li.approve_button
+{
+ background: url(../images/theme/quickbuttons.png) no-repeat 0 -90px;
+}
+]]></search>
+
+ <add><![CDATA[
+ul.quickbuttons li.approve_button
+{
+ background: url(../images/theme/quickbuttons.png) no-repeat 0 -90px;
+}
+ul.quickbuttons li.unapprove_button
+{
+ background: url(../images/icons/quick_remove.gif) no-repeat;
+}
+]]></add>
+
+ </operation>
+
+ </file>
+
+ <file name="$languagedir/Modifications.english.php">
+ <operation>
+ <search position="end" />
+ <add><![CDATA[$txt['unapprove'] = 'Unapprove';
+]]></add>
+ </operation>
+ </file>
+ <file name="$languagedir/Modifications.english_utf8.php" error="skip">
+ <operation>
+ <search position="end" />
+ <add><![CDATA[$txt['unapprove'] = 'Unapprove';
+]]></add>
+ </operation>
+ </file>
+ <file name="$languagedir/Modifications.turkish.php" error="skip">
+ <operation>
+ <search position="end" />
+ <add><![CDATA[$txt['unapprove'] = 'Mesajı onaylama';
+]]></add>
+ </operation>
+ </file>
+ <file name="$languagedir/Modifications.turkish_utf8.php" error="skip">
+ <operation>
+ <search position="end" />
+ <add><![CDATA[$txt['unapprove'] = 'Mesaj&#305; onaylama';
+]]></add>
+ </operation>
+ </file>
+
+ <file name="$themedir/../core/Display.template.php" error="skip">
+
+ <operation>
+
+ <search position="replace"><![CDATA[
+ $restore_message_button = create_button('restore_topic.gif', 'restore_message', 'restore_message', 'align="middle"');
+]]></search>
+
+ <add><![CDATA[ // UNAPPROVE MOD
+ $restore_message_button = create_button('restore_topic.gif', 'restore_message', 'restore_message', 'align="middle"');
+ $unapprove_button = create_button('../icons/quick_remove.gif', 'unapprove', 'unapprove', 'align="middle"');
+]]></add>
+
+ </operation>
+
+ <operation>
+
+ <search position="replace"><![CDATA[
+ // Can they reply? Have they turned on quick reply?]]></search>
+
+ <add><![CDATA[
+ // Maybe we can approve it, maybe we should?
+ if ($message['can_unapprove'])
+ echo '
+ <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>';
+
+ // Can they reply? Have they turned on quick reply?]]></add>
+
+ </operation>
+
+ </file>
+</modification>
Please sign in to comment.
Something went wrong with that request. Please try again.