[Mtdmods-checkins] SF.net SVN: mtdmods: [9] ApproveMOD
Brought to you by:
markthedaemon
|
From: <mar...@us...> - 2006-06-17 19:36:20
|
Revision: 9 Author: markthedaemon Date: 2006-06-17 12:36:06 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/mtdmods/?rev=9&view=rev Log Message: ----------- I told you it would come :P, new MODX format install now included in the package! BETA release shortly :D Added Paths: ----------- ApproveMOD/LICENSE.txt ApproveMOD/contrib/install.mod ApproveMOD/install.xml ApproveMOD/modx.subsilver.en.xsl Removed Paths: ------------- ApproveMOD/contrib/install.txt Added: ApproveMOD/LICENSE.txt =================================================================== --- ApproveMOD/LICENSE.txt (rev 0) +++ ApproveMOD/LICENSE.txt 2006-06-17 19:36:06 UTC (rev 9) @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. Added: ApproveMOD/contrib/install.mod =================================================================== --- ApproveMOD/contrib/install.mod (rev 0) +++ ApproveMOD/contrib/install.mod 2006-06-17 19:36:06 UTC (rev 9) @@ -0,0 +1,2379 @@ +############################################################## +## MOD Title: Approve Post MOD +## MOD Author: MarkTheDaemon < mar...@us... > (Mark Barnes) http://mtdmods.sourceforge.net +## MOD Author: AceMan < php...@sy... > (Mike Dawidowicz) http://www.synace.com +## MOD Description: Designate a forum for moderation by admins & chosen moderators. +## Option to setup Topic, Topic Edit, Post, Post Edit, User-Specific moderation. +## Auto-Approve users or replies to chosen topics. +## Notify users on post approval, selected moderators on new posts, via private messaging or email. +## MOD Version: 0.0.1 +## +## Installation Level: Intermediate +## Installation Time: 20 minutes +## Files To Edit: index.php +## posting.php +## viewforum.php +## viewtopic.php +## includes/topic_review.php +## admin/admin_forums.php +## search.php +## templates/subSilver/admin/forum_edit_body.tpl +## includes/constants.php +## language/lang_english/lang_main.php +## language/lang_english/lang_admin.php +## Included Files: admin/admin_approve.php +## templates/subSilver/admin/approve_index.tpl +## templates/subSilver/admin/approve_header.tpl +## templates/subSilver/admin/approve_forums.tpl +## templates/subSilver/admin/approve_users.tpl +## templates/subSilver/admin/approve_topics.tpl +## templates/subSilver/admin/approve_posts.tpl +## templates/subSilver/admin/approve_detail.tpl +## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2 +## Generator: MOD Studio [ ModTemplateTools 1.0.2288.38406 ] +############################################################## +## 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/ +############################################################## +## Author Notes: I (MarkTheDaemon) have taken over development of this MOD, with permission from AceMan +############################################################## +## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD +############################################################## + +# +#-----[ SQL ]------------------------------------------ +# +CREATE TABLE phpbb_approve_forums ( + forum_id smallint(5) unsigned NOT NULL default '0', + enabled tinyint(1) NOT NULL default '0', + approve_posts tinyint(1) NOT NULL default '0', + approve_topics tinyint(1) NOT NULL default '0', + approve_users tinyint(1) NOT NULL default '0', + approve_poste tinyint(1) NOT NULL default '0', + approve_topice tinyint(1) NOT NULL default '0', + approve_notify tinyint(1) NOT NULL default '0', + approve_notify_approval tinyint(1) NOT NULL default '0', + approve_notify_type tinyint(1) NOT NULL default '0', + approve_notify_message tinyint(1) NOT NULL default '0', + approve_notify_message_len smallint(5) NOT NULL default '500', + approve_moderators varchar(255) NOT NULL default '0', + approve_notify_posts tinyint(1) NOT NULL default '0', + approve_notify_poste tinyint(1) NOT NULL default '0', + approve_notify_topics tinyint(1) NOT NULL default '0', + approve_notify_topice tinyint(1) NOT NULL default '0', + forum_hide_unapproved_topics tinyint(1) NOT NULL default '0', + forum_hide_unapproved_posts tinyint(1) NOT NULL default '0', + PRIMARY KEY (forum_id) +); + +CREATE TABLE phpbb_approve_posts ( + approval_id mediumint(8) unsigned NOT NULL auto_increment, + topic_id mediumint(8) unsigned NOT NULL default '0', + post_id mediumint(8) unsigned NOT NULL default '0', + is_topic tinyint(1) NOT NULL default '0', + is_post tinyint(1) NOT NULL default '0', + poster_id mediumint(8) NOT NULL default '0', + PRIMARY KEY (approval_id), + KEY post_id (post_id), + KEY topic_id (topic_id) +); + +CREATE TABLE phpbb_approve_topics ( + topic_id mediumint(8) unsigned NOT NULL default '0', + approve_moderate tinyint(1) NOT NULL default '0', + PRIMARY KEY (topic_id) +); + +CREATE TABLE phpbb_approve_users ( + user_id mediumint(8) NOT NULL default '0', + approve_moderate tinyint(1) NOT NULL default '0', + PRIMARY KEY (user_id) +); + +INSERT INTO phpbb_approve_users ( user_id, approve_moderate ) VALUES (-1, 1); + +# +#-----[ COPY ]------------------------------------------ +# +copy admin/admin_approve.php to admin/admin_approve.php +copy templates/subSilver/admin/approve_index.tpl to templates/subSilver/admin/approve_index.tpl +copy templates/subSilver/admin/approve_header.tpl to templates/subSilver/admin/approve_header.tpl +copy templates/subSilver/admin/approve_forums.tpl to templates/subSilver/admin/approve_forums.tpl +copy templates/subSilver/admin/approve_users.tpl to templates/subSilver/admin/approve_users.tpl +copy templates/subSilver/admin/approve_topics.tpl to templates/subSilver/admin/approve_topics.tpl +copy templates/subSilver/admin/approve_posts.tpl to templates/subSilver/admin/approve_posts.tpl +copy templates/subSilver/admin/approve_detail.tpl to templates/subSilver/admin/approve_detail.tpl + +# +#-----[ OPEN ]------------------------------------------ +# +index.php +# +#-----[ FIND ]------------------------------------------ +# +$template->assign_block_vars('catrow.forumrow', array( + 'ROW_COLOR' => '#' . $row_color, +# +#-----[ BEFORE, ADD ]------------------------------------------ +# +// +// Begin Approve_Mod Block : 1 +// + $approve_mod = array(); + $approve_sql = "SELECT enabled, approve_moderators, forum_hide_unapproved_posts, forum_hide_unapproved_topics + FROM " . APPROVE_FORUMS_TABLE . " + WHERE forum_id = " . intval($forum_data[$j]['forum_id']) . " LIMIT 0,1"; + if ( !($approve_result = $db->sql_query($approve_sql)) ) + { + message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); + } + if ( $approve_row = $db->sql_fetchrow($approve_result) ) + { + if ( intval($approve_row['enabled']) == 1 ) + { + $approve_mod = $approve_row; + $approve_mod['enabled'] = true; + } + } + if ( $approve_mod['enabled'] ) + { + + if ( $forum_data[$j]['user_id'] == ANONYMOUS || $approve_mod['forum_hide_unapproved_posts'] || $approve_mod['forum_hide_unapproved_topics'] ) + { + $approve_mod['moderators'] = array(); + $approve_mod['moderators'] = explode('|', $approve_mod['approve_moderators']); + + if ( !in_array($userdata['user_id'], $approve_mod['moderators']) && !$is_auth_ary[$forum_id]['auth_mod'] && $last_post != $lang['No_Posts'] ) + { + $approve_sql = "SELECT * + FROM " . APPROVE_POSTS_TABLE . " + WHERE post_id = " . intval($forum_data[$j]['forum_last_post_id']) . " + LIMIT 0,1"; + if ( !$approve_result = $db->sql_query($approve_sql) ) + { + message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); + } + $approve_row = $db->sql_fetchrow($approve_result); + if ( intval($approve_row['post_id']) == intval($forum_data[$j]['forum_last_post_id']) ) + { + if ( $approve_mod['forum_hide_unapproved_posts'] || $approve_mod['forum_hide_unapproved_topics'] ) + { + $approve_sql = "SELECT p.post_id, p.poster_id, p.post_time, p.post_username, u.username, u.user_id + FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u + WHERE p.forum_id = " . intval($forum_data[$j]['forum_id']) . " + AND u.user_id = p.poster_id + ORDER BY p.post_time DESC"; + if ( !($approve_result = $db->sql_query($approve_sql)) ) + { + message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); + } + while( $approve_row = $db->sql_fetchrow($approve_result) ) + { + $approve_sql = "SELECT * FROM " . APPROVE_POSTS_TABLE . " + WHERE post_id = " . intval($approve_row['post_id']) . " + LIMIT 0,1"; + if ( !($approve_result2 = $db->sql_query($approve_sql)) ) + { + message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); + } + $approve_row2 = $db->sql_fetchrow($approve_result2); + if ( !$approve_row2['post_id'] ) + { + $last_post_time = create_date($board_config['default_dateformat'], $approve_row['post_time'], $board_config['board_timezone']); + $last_post = $last_post_time . '<br />'; + + $last_post .= ( $approve_row['user_id'] == ANONYMOUS ) ? ( ($approve_row['post_username'] != '' ) ? $approve_row['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $approve_row['poster_id']) . '">' . $approve_row['username'] . '</a> '; + + $last_post .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $approve_row['post_id']) . '#' . $approve_row['post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>'; + break; + } + } + } + else + { + $last_post = $last_post_time . '<br />'; + $last_post .= $lang['Guest'] . ' ' . '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . '=' . $forum_data[$j]['forum_id']) . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>'; + } + } + } + } + } +// +// End Approve_Mod Block : 1 +// +# +#-----[ OPEN ]------------------------------------------ +# +posting.php +# +#-----[ FIND ]------------------------------------------ +# +// -------------------- +// What shall we do? +// +if ( ( $delete || $poll_delete || $mode == 'delete' ) && !$confirm ) +# +#-----[ BEFORE, ADD ]------------------------------------------ +# +// +// Begin Approve_mod Block : 2 +// +if ( $mode == 'newtopic' || $mode == 'reply' || $mode == 'editpost' || $mode == 'quote' ) +{ + $approve_mod = array(); + $approve_mod['notify'] = false; + $approve_sql = "SELECT * + FROM " . APPROVE_FORUMS_TABLE . " + WHERE forum_id = " . intval($forum_id); + if ( !($approve_result = $db->sql_query($approve_sql)) ) + { + message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); + } + if ( $approve_row = $db->sql_fetchrow($approve_result) ) + { + if ( intval($approve_row['enabled']) == 1 ) + { + $approve_mod = $approve_row; + $approve_mod['enabled'] = true; + } + } + $approve_mod['moderators'] = array(); + $approve_mod['moderators'] = explode('|', $approve_mod['approve_moderators']); + if ( in_array($userdata['user_id'], $approve_mod['moderators']) || $is_auth['auth_mod'] ) + { + //moderator, don't screen their post + $approve_mod['enabled'] = false; + } + + if ( $approve_mod['enabled'] ) + { + if ( $approve_mod['forum_hide_unapproved_posts'] ) + { + $lang['Stored'] = $lang['approve_admin_Stored_replacement']; + } + // + // Check if quoted post is approved + // + if ( $mode == 'quote' ) + { + // patch purpose proposed by Markus Rietzler < mar...@rz... > + // check if the quoted post has been approved, if so, empty the quote text + $approve_sql = "SELECT * + FROM " . APPROVE_POSTS_TABLE . " + WHERE post_id = " . intval($post_id) . " + AND is_post = 1"; + if ( !($approve_result = $db->sql_query($approve_sql)) ) + { + message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); + } + if ( $approve_row = $db->sql_fetchrow($approve_result) ) + { + //quoted post is not approved + $approve_mod['quoted_post_not_approved'] = true; + } + } + + // + // Check user and topic moderation + // + if ( $approve_mod['approve_users'] ) + { + //all users & topics, let's check them to see if we should disable moderation + if ( $approve_mod['approve_posts'] && $mode != 'newtopic' ) + { + $approve_sql = "SELECT approve_moderate + FROM " . APPROVE_TOPICS_TABLE . " + WHERE topic_id = " . intval($topic_id) . " + AND approve_moderate = -1 + LIMIT 0,1"; + if ( !($approve_result = $db->sql_query($approve_sql)) ) + { + message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); + } + if ( $approve_row = $db->sql_fetchrow($approve_result) ) + { + if ( intval($approve_row['approve_moderate']) == -1 ) + { + //topic auto-approved + $approve_mod['enabled'] = false; + } + } + } + if ( $approve_mod['enabled'] ) + { + $approve_sql = "SELECT approve_moderate + FROM " . APPROVE_USERS_TABLE . " + WHERE user_id = " . intval($userdata['user_id']) . " + AND approve_moderate = -1 + LIMIT 0,1"; + if ( !($approve_result = $db->sql_query($approve_sql)) ) + { + message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); + } + if ( $approve_row = $db->sql_fetchrow($approve_result) ) + { + if ( intval($approve_row['approve_moderate']) == -1 ) + { + //user auto-approved + $approve_mod['enabled'] = false; + } + } + } + } + else + { + //only selected topics, let's check them to see if we should turn on moderation + $approve_mod['enabled'] = false; + $approve_sql = "SELECT * + FROM " . APPROVE_TOPICS_TABLE . " + WHERE topic_id = " . intval($topic_id) . " + LIMIT 0,1"; + if ( !($approve_result = $db->sql_query($approve_sql)) ) + { + message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); + } + if ( $approve_row = $db->sql_fetchrow($approve_result) ) + { + if ( intval($approve_row['approve_moderate']) == 1 ) + { + //topic is moderated + $approve_mod['enabled'] = true; + } + } + } + //check the user to see if we should still moderate them, regardless of topic settings + if ( !$approve_mod['enabled'] ) + { + $approve_sql = "SELECT * + FROM " . APPROVE_USERS_TABLE . " + WHERE user_id = " . intval($userdata['user_id']) . " + LIMIT 0,1"; + if ( !($approve_result = $db->sql_query($approve_sql)) ) + { + message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); + } + if ( $approve_row = $db->sql_fetchrow($approve_result) ) + { + if ( intval($approve_row['approve_moderate']) == 1 ) + { + //user is moderated + $approve_mod['enabled'] = true; + } + } + } + if ( $approve_mod['enabled'] ) + { + //check admin settings for what to allow & what to moderate + switch ($mode) + { + case 'newtopic': + if ( intval($approve_mod['approve_topics']) != 1 ) + { + //new topics are not moderated + $approve_mod['enabled'] = false; + } + break; + + case 'reply': + case 'quote': + if ( intval($approve_mod['approve_posts']) != 1 ) + { + //new replies are not moderated + $approve_mod['enabled'] = false; + } + break; + + case 'editpost': + if ( intval($approve_mod['approve_poste']) != 1 ) + { + //post edits are not moderated + $approve_mod['enabled'] = false; + } + $approve_mod_post_id = ($HTTP_GET_VARS[POST_POST_URL]) ? $HTTP_GET_VARS[POST_POST_URL] : $HTTP_POST_VARS[POST_POST_URL]; + if ( !$approve_mod['enabled'] && ( intval($approve_mod['approve_topice']) == 1 ) && !empty($approve_mod_post_id) ) + { + //let's see if it's a topic and if so, turn moderation back on + $approve_sql = "SELECT t.topic_first_post_id + FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p + WHERE p.post_id = " . intval($approve_mod_post_id) . " + AND t.topic_id = p.topic_id + LIMIT 0,1"; + if ( !($approve_result = $db->sql_query($approve_sql)) ) + { + message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); + } + if ( $approve_row = $db->sql_fetchrow($approve_result) ) + { + if ( intval($approve_row['topic_first_post_id']) == intval($approve_mod_post_id) ) + { + //topic edits are moderated + $approve_mod['enabled'] = true; + } + } + } + break; + } + } + } +} +// +// End Approve_mod Block : 2 +// +# +#-----[ FIND ]------------------------------------------ +# +submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, str_replace("\'", "''", $username), str_replace("\'", "''", $subject), str_replace("\'", "''", $message), str_replace("\'", "''", $poll_title), $poll_options, $poll_length); +# +#-----[ AFTER, ADD ]------------------------------------------ +# +// +// Begin Approve_Mod Block : 3 +// + if ( $approve_mod['enabled'] ) + { + if ( $mode == 'newtopic' && $approve_mod['approve_topics'] ) + { + $approve_sql = "INSERT INTO " . APPROVE_POSTS_TABLE . " (post_id, topic_id, is_topic, is_post, poster_id) + VALUES (" . intval($post_id) . ", " . intval($topic_id) . ", 1, 1, " . intval($userdata['user_id']) . ")"; + if ( !($approve_result = $db->sql_query($approve_sql)) ) + { + message_die(GENERAL_ERROR, $lang['approve_posts_error_insert'], '', __LINE__, __FILE__, $approve_sql); + } + if ( $approve_mod['approve_notify_topics'] ) + { + $approve_mod['notify'] = true; + } + } + elseif ( $mode == 'reply' && $approve_mod['approve_posts'] ) + { + $approve_sql = "INSERT INTO " . APPROVE_POSTS_TABLE . " (post_id, topic_id, is_post, poster_id) + VALUES (" . intval($post_id) . ", " . intval($topic_id) . ", 1, " . intval($userdata['user_id']) . ")"; + if ( !($approve_result = $db->sql_query($approve_sql)) ) + { + message_die(GENERAL_ERROR, $lang['approve_posts_error_insert'], '', __LINE__, __FILE__, $approve_sql); + } + if ( $approve_mod['approve_notify_posts'] ) + { + $approve_mod['notify'] = true; + } + } + elseif ( $mode == 'editpost' ) + { + $approve_mod['topic_or_post'] = 'is_post'; + $approve_sql = "SELECT t.topic_first_post_id FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p + WHERE p.post_id = " . intval($post_id) . " + AND t.topic_id = p.topic_id + LIMIT 0,1"; + if ( !($approve_result = $db->sql_query($approve_sql)) ) + { + message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); + } + if ( $approve_row = $db->sql_fetchrow($approve_result) ) + { + if ( intval($approve_row['topic_first_post_id']) == intval($post_id) ) + { + $approve_mod['topic_or_post'] = 'is_topic'; + } + } + if ( (($approve_mod['topic_or_post'] == 'is_topic') && $approve_mod['approve_topice']) || (($approve_mod['topic_or_post'] == 'is_post') && $approve_mod['approve_poste']) ) + { + $approve_sql = "DELETE FROM " . APPROVE_POSTS_TABLE . " + WHERE topic_id = " . intval($topic_id) . " + AND post_id = " . intval($post_id); + if ( !($approve_result = $db->sql_query($approve_sql)) ) + { + message_die(GENERAL_ERROR, $lang['approve_posts_error_delete'], '', __LINE__, __FILE__, $approve_sql); + } + $approve_sql = "INSERT INTO " . APPROVE_POSTS_TABLE . " (post_id, topic_id, " . $approve_mod['topic_or_post'] . ", poster_id) + VALUES (" . intval($post_id) . ", " . intval($topic_id) . ", 1, " . intval($userdata['user_id']) . ")"; + if ( !($approve_result = $db->sql_query($approve_sql)) ) + { + message_die(GENERAL_ERROR, $lang['approve_posts_error_insert'], '', __LINE__, __FILE__, $approve_sql); + } + if ( $approve_mod['approve_notify_topice'] && ($approve_mod['topic_or_post'] == 'is_topic')) + { + $approve_mod['notify'] = true; + } + if ( $approve_mod['approve_notify_poste'] && ($approve_mod['topic_or_post'] == 'is_post')) + { + $approve_mod['notify'] = true; + } + } + } + } +// +// End Approve_Mod Block : 3 +// +# +#-----[ FIND ]------------------------------------------ +# +delete_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id); +# +#-----[ AFTER, ADD ]------------------------------------------ +# +// +// Begin Approve_Mod Block : 4 +// + $sql = "DELETE FROM " . APPROVE_POSTS_TABLE . " + WHERE post_id = " . intval($post_id); + if ( !($result = $db->sql_query($sql)) ) + { + message_die(GENERAL_ERROR, $lang['approve_posts_error_delete'], '', __LINE__, __FILE__, $sql); + } +// +// End Approve_Mod Block : 4 +// +# +#-----[ FIND ]------------------------------------------ +# +if ($error_msg == '' && $mode != 'poll_delete') + { + user_notification($mode, $post_data, $post_info['topic_title'], $forum_id, $topic_id, $post_id, $notify_user); + } +# +#-----[ AFTER, ADD ]------------------------------------------ +# +// +// Begin Aprove_Mod Block : 5 +// + if ( $approve_mod['notify'] && $approve_mod['approve_notify'] ) + { + $approve_sql = "SELECT * FROM " . APPROVE_POSTS_TABLE . " + WHERE post_id = " . intval($post_id) . " + LIMIT 0,1"; + if ( !($approve_result = $db->sql_query($approve_sql)) ) + { + message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); + } + if ( $approve_row = $db->sql_fetchrow($approve_result) ) + { + for($i = 0; !empty($approve_mod['moderators'][$i]); $i++) + { + $approve_sql = "SELECT user_email, user_notify_pm, user_active FROM " . USERS_TABLE . " + WHERE user_id = " . intval($approve_mod['moderators'][$i]) . " + LIMIT 0,1"; + if ( !($approve_result = $db->sql_query($approve_sql)) ) + { + message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); + } + if ( $to_userdata = $db->sql_fetchrow($approve_result) ) + { + if ( intval($approve_mod['approve_notify_type']) == -1) + { + $email_headers = 'From: ' . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\n"; + $script_name = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($board_config['script_path'])); + $script_name = ( $script_name != '' ) ? $script_name . '/viewtopic.'.$phpEx : 'viewtopic.'.$phpEx; + $server_name = trim($board_config['server_name']); + $server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://'; + $server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/'; + if ( !class_exists('emailer') ) + { + @include_once($phpbb_root_path . 'includes/emailer.'.$phpEx); + } + $emailer = new emailer($board_config['smtp_delivery']); + $emailer->extra_headers($email_headers); + $emailer->email_address($to_userdata['user_email']); + $emailer->set_subject($board_config['sitename'] . " : " . $lang['approve_notify_subject'] . " " . $post_id); + $emailer->msg = $board_config['sitename'] . "\n" . $lang['approve_notify_link'] . "\n" . $server_protocol . $server_name . $server_port . $script_name . '?'. POST_POST_URL . '=' . $post_id . '#' . $post_id; + $emailer->msg .= "\n\n" . $lang['approve_notify_approve_link'] . "\n" . $server_protocol . $server_name . $server_port . $script_name . '?'. POST_POST_URL . '=' . $post_id . '&app_p=' . $post_id . '#' . $post_id; + if ( intval($approve_mod['approve_notify_message']) == 1 ) + { + $emailer->msg .= (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "\n\n" . $board_config['board_email_sig']) : ''; + $emailer->msg .= "\n\n". $lang['approve_notify_message'] ."\n----------------------------\n"; + $emailer->msg .= ( intval($approve_mod['approve_notify_message_len']) != 0 && (strlen($message) > intval($approve_mod['approve_notify_message_len']) ) ) ? substr($message, 0, intval($approve_mod['approve_notify_message_len']) ) . $lang['approve_notify_message_exceeded'] : $message; + $emailer->msg = stripslashes($emailer->msg); + } + $emailer->from($board_config['board_email']); + $emailer->replyto($board_config['board_email']); + $emailer->assign_vars(array()); + $emailer->send(); + $emailer->reset(); + } + if ( intval($approve_mod['approve_notify_type']) == 1 ) + { + $script_name = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($board_config['script_path'])); + $script_name = ( $script_name != '' ) ? $script_name . '/viewtopic.'.$phpEx : 'viewtopic.'.$phpEx; + $server_name = trim($board_config['server_name']); + $server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://'; + $server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/'; + $privmsg_subject = $lang['approve_notify_subject'] . " " . $post_id; + $privmsg_message = $lang['approve_notify_link'] . "\n" . $server_protocol . $server_name . $server_port . $script_name . '?'. POST_POST_URL . '=' . $post_id . '#' . $post_id; + if ( $approve_mod['approve_notify_message'] ) + { + $privmsg_message .= "\n" . $lang['approve_notify_approve_link'] . "\n" . $server_protocol . $server_name . $server_port . $script_name . '?'. POST_POST_URL . '=' . $post_id . '&app_p=' . $post_id . '#' . $post_id; + $approve_post_max_length = ( $approve_mod['approve_notify_message_len'] > 10 ) ? $approve_mod['approve_notify_message_len'] : 10; + $privmsg_message .= "\n\n". $lang['approve_notify_message'] ."\n----------------------------\n"; + $privmsg_message .= ( intval($approve_mod['approve_notify_message_len']) != 0 && (strlen($message) > intval($approve_mod['approve_notify_message_len']) ) ) ? substr($message, 0, intval($approve_mod['approve_notify_message_len']) ) . $lang['approve_notify_message_exceeded'] : $message; + + } + $bbcode_uid = make_bbcode_uid(); + $privmsg_message = prepare_message($privmsg_message, 1, 1, 1, $bbcode_uid); + $msg_time = time(); + // + // See if recipient is at their inbox limit + // + $sql = "SELECT COUNT(privmsgs_id) AS inbox_items, MIN(privmsgs_date) AS oldest_post_time + FROM " . PRIVMSGS_TABLE . " + WHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . " + OR privmsgs_type = " . PRIVMSGS_READ_MAIL . " + OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " ) + AND privmsgs_to_userid = " . intval($approve_mod['moderators'][$i]); + if ( !($result = $db->sql_query($sql)) ) + { + message_die(GENERAL_MESSAGE, $lang['No_such_user']); + } + $sql_priority = ( SQL_LAYER == 'mysql' ) ? 'LOW_PRIORITY' : ''; + if ( $inbox_info = $db->sql_fetchrow($result) ) + { + if ( intval($inbox_info['inbox_items']) >= intval($board_config['max_inbox_privmsgs']) && !empty($inbox_info['oldest_post_time']) ) + { + $sql = "SELECT privmsgs_id FROM " . PRIVMSGS_TABLE . " + WHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . " + OR privmsgs_type = " . PRIVMSGS_READ_MAIL . " + OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " ) + AND privmsgs_date = " . $inbox_info['oldest_post_time'] . " + AND privmsgs_to_userid = " . intval($approve_mod['moderators'][$i]); + if ( !$result = $db->sql_query($sql) ) + { + message_die(GENERAL_ERROR, 'Could not find oldest privmsgs (inbox)', '', __LINE__, __FILE__, $sql); + } + $old_privmsgs_id = $db->sql_fetchrow($result); + $old_privmsgs_id = $old_privmsgs_id['privmsgs_id']; + $sql = "DELETE $sql_priority FROM " . PRIVMSGS_TABLE . " + WHERE privmsgs_id = $old_privmsgs_id"; + if ( !$db->sql_query($sql) ) + { + message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs (inbox)'.$sql, '', __LINE__, __FILE__, $sql); + } + $sql = "DELETE $sql_priority FROM " . PRIVMSGS_TEXT_TABLE . " + WHERE privmsgs_text_id = $old_privmsgs_id"; + if ( !$db->sql_query($sql) ) + { + message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs text (inbox)', '', __LINE__, __FILE__, $sql); + } + } + } + // + // Send the pm notification + // + $sql_info = "INSERT INTO " . PRIVMSGS_TABLE . " (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_enable_html, privmsgs_enable_bbcode, privmsgs_enable_smilies, privmsgs_attach_sig) + VALUES (" . PRIVMSGS_NEW_MAIL . ", '" . str_replace("\'", "''", $privmsg_subject) . "', " . intval($approve_mod['moderators'][$i]) . ", " . intval($approve_mod['moderators'][$i]) . ", $msg_time, '0.0.0.0', 1, 1, 1, 0)"; + if ( !($result = $db->sql_query($sql_info, BEGIN_TRANSACTION)) ) + { + message_die(GENERAL_ERROR, "Could not insert/update private message sent info.", "", __LINE__, __FILE__, $sql_info); + } + $privmsg_sent_id = $db->sql_nextid(); + $sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text) + VALUES ($privmsg_sent_id, '" . $bbcode_uid . "', '" . str_replace("\'", "''", $privmsg_message) . "')"; + if ( !$db->sql_query($sql, END_TRANSACTION) ) + { + message_die(GENERAL_ERROR, "Could not insert/update private message sent text.", "", __LINE__, __FILE__, $sql_info); + } + // + // Add to the users new pm counter + // + $sql = "UPDATE " . USERS_TABLE . " + SET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = " . time() . " + WHERE user_id = " . intval($approve_mod['moderators'][$i]); + if ( !$status = $db->sql_query($sql) ) + { + message_die(GENERAL_ERROR, 'Could not update private message new/read status for user', '', __LINE__, __FILE__, $sql); + } + if ( $to_userdata['user_notify_pm'] && !empty($to_userdata['user_email']) && $to_userdata['user_active'] ) + { + $email_headers = 'From: ' . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\n"; + + $script_name = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($board_config['script_path'])); + $script_name = ( $script_name != '' ) ? $script_name . '/privmsg.'.$phpEx : 'privmsg.'.$phpEx; + $server_name = trim($board_config['server_name']); + $server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://'; + $server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/'; + + if ( !class_exists('emailer') ) + { + include_once($phpbb_root_path . 'includes/emailer.'.$phpEx); + } + $emailer = new emailer($board_config['smtp_delivery']); + $emailer->from($board_config['board_email']); + $emailer->replyto($board_config['board_email']); + $emailer->use_template('privmsg_notify', $to_userdata['user_lang']); + $emailer->extra_headers($email_headers); + $emailer->email_address($to_userdata['user_email']); + $emailer->set_subject($lang['Notification_subject']); + + $emailer->assign_vars(array( + 'USERNAME' => $to_username, + 'SITENAME' => $board_config['sitename'], + 'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', + + 'U_INBOX' => $server_protocol . $server_name . $server_port . $script_name . '?folder=inbox') + ); + + $emailer->send(); + $emailer->reset(); + } + } + } + }//moderator notification + } + } +// +// End Approve_Mod Block : 5 +// +# +#-----[ FIND ]------------------------------------------ +# +$mode = 'reply'; +# +#-----[ AFTER, ADD ]------------------------------------------ +# +// +// Begin Approve_Mod Block : 6 +// + if ( $approve_mod['enabled'] || $approve_mod['quoted_post_not_approved'] ) + { + $approve_sql = "SELECT * FROM " . APPROVE_POSTS_TABLE . " + WHERE post_id = " . intval($post_id) . " + AND is_post = 1"; + if ( !($approve_result = $db->sql_query($approve_sql)) ) + { + message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); + } + if ( $approve_row = $db->sql_fetchrow($approve_result) ) + { + // post_id belongs to a post, that has to be approved, so + // we delete quoted message and subject. + $subject = ''; + $message = ''; + } + } +// +// End Approve_Mod Block : 6 +// +# +#-----[ FIND ]------------------------------------------ +# +// Generate smilies listing for page output +generate_smilies('inline', PAGE_POSTING); +# +#-----[ AFTER, ADD ]------------------------------------------ +# +// +// Begin Aprove_Mod Block : 7 +// +if ( $approve_mod['enabled'] ) +{ + if ( $mode != 'newtopic' && !($mode == 'editpost' && $post_data['first_post']) ) + { + $template->assign_block_vars('switch_type_toggle', array()); + } + $topic_type_toggle = $topic_type_toggle . "<br /><span class='copyright'><b>" . $lang['approve_notify_poster'] . "</b></span>"; +} +// +// End Approve_Mod Block : 7 +// +# +#-----[ OPEN ]------------------------------------------ +# +viewforum.php +# +#-----[ FIND ]------------------------------------------ +# +// +// Okay, lets dump out the page ... +// +if( $total_topics ) +{ +# +#-----[ BEFORE, ADD ]------------------------------------------ +# +// +// Begin Approve_Mod Block : 8 +// + $approve_mod = array(); + $approve_sql = "SELECT * FROM " . APPROVE_FORUMS_TABLE . " + WHERE forum_id = " . intval($forum_id); + if ( !($approve_result = $db->sql_query($approve_sql)) ) + { + message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); + } + if ( $approve_row = $db->sql_fetchrow($approve_result) ) + { + if ( intval($approve_row['enabled']) == 1 ) + { + $approve_mod = $approve_row; + $approve_mod['enabled'] = true; + } + } + $approve_mod['moderators'] = array(); + $approve_mod['moderators'] = explode('|', $approve_mod['approve_moderators']); +// +// End Approve_Mod Block : 8 +// +# +#-----[ FIND ]------------------------------------------ +# +$template->assign_block_vars('topicrow', array( + 'ROW_COLOR' => $row_color, +# +#-----[ BEFORE, ADD ]------------------------------------------ +# +// +// Begin Approve_Mod Block : 9 +// + if ( $approve_mod['enabled'] ) + { + $approve_mod['topics_awaiting'] = false; + $approve_sql = "SELECT * FROM " . APPROVE_POSTS_TABLE . " + WHERE topic_id = " . intval($topic_id) . " + AND is_topic = 1 + LIMIT 0,1"; + if ( !($approve_result = $db->sql_query($approve_sql)) ) + { + message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); + } + if ( $approve_row = $db->sql_fetchrow($approve_result) ) + { + if ( intval($approve_row['is_topic']) == 1 ) + { + $approve_mod['topics_awaiting'] = true; + } + } + + if ( in_array($userdata['user_id'], $approve_mod['moderators']) || $is_auth['auth_mod'] ) + { + if ( $approve_mod['topics_awaiting'] ) + { + $topic_title .= "</a><br /><a href=\"" . append_sid("viewtopic." . $phpEx . "?t=" . $topic_id ) . "\" class='copyright'>[ " . $lang['approve_topic_is_awaiting'] . " ]"; + } + else + { + $approve_sql = "SELECT * FROM " . APPROVE_POSTS_TABLE . " + WHERE topic_id = " . intval($topic_id) . " + AND is_post = 1 + ORDER BY post_id + LIMIT 0,2"; + if ( !($approve_result = $db->sql_query($approve_sql)) ) + { + message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); + } + if ( $approve_row = $db->sql_fetchrow($approve_result) ) + { + if ( $db->sql_numrows($approve_result) >= 1 ) + { + $topic_title .= "</a><br /><a href=\"" . append_sid("viewtopic." . $phpEx . "?p=" . $approve_row['post_id'] ) . "#" . $approve_row['post_id'] . "\" class='copyright'>[ " . $lang['approve_topic_has_awaiting'] . " ]"; + } + } + } + } + else + { + if ( $approve_mod['topics_awaiting'] ) + { + if ( $approve_mod['forum_hide_unapproved_topics'] ) + { + continue; + } + $topic_title = "</a><span class='copyright'>[ " . $lang['approve_topic_is_awaiting'] . " ]</span>"; + $view_topic_url = append_sid("viewforum.php?f=" . $forum_id ); + $last_post_url = $last_post_url = '<img src="' . $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" border="0" />'; + $goto_page = ''; + $last_post_author = ( intval($topic_rowset[$i]['id2']) == intval(ANONYMOUS) ) ? $lang['Guest'] : $last_post_author; + $topic_author = ( intval($topic_rowset[$i]['user_id']) == intval(ANONYMOUS) ) ? $lang['Guest'] : $topic_author; + } + else + { + $approve_sql = "SELECT * FROM " . APPROVE_POSTS_TABLE . " + WHERE post_id = " . intval($topic_rowset[$i]['topic_last_post_id']) . " + AND is_post = 1 + LIMIT 0,1"; + if ( !($approve_result = $db->sql_query($approve_sql)) ) + { + message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); + } + $approve_row = $db->sql_fetchrow($approve_result); + if ( intval($approve_row['post_id']) == intval($topic_rowset[$i]['topic_last_post_id']) ) + { + if ( $approve_mod['forum_hide_unapproved_posts'] ) + { + $approve_sql = "SELECT p.post_id, p.poster_id, p.post_time, p.post_username, u.username + FROM " . POSTS_TABLE . " p, " . APPROVE_POSTS_TABLE . " a, " . USERS_TABLE . " u + WHERE a.post_id = " . intval($topic_rowset[$i]['topic_last_post_id']) . " + AND p.topic_id = a.topic_id + AND u.user_id = p.poster_id + ORDER BY p.post_time DESC"; + if ( !($approve_result = $db->sql_query($approve_sql)) ) + { + message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); + } + while( $approve_row = $db->sql_fetchrow($approve_result) ) + { + $approve_sql = "SELECT * FROM " . APPROVE_POSTS_TABLE . " + WHERE post_id = " . intval($approve_row['post_id']) . " + LIMIT 0,1"; + if ( !($approve_result2 = $db->sql_query($approve_sql)) ) + { + message_die(GENERAL_ERROR, $lang['approve_posts_error_obtain'], '', __LINE__, __FILE__, $approve_sql); + } + $approve_row2 = $db->sql_fetchrow($approve_result2); + if ( !$approve_row2['post_id'] ) + { + $last_post_time = create_date($board_config['default_dateformat'], $approve_row['post_time'], $board_config['board_timezone']); + + $last_post_author = ( $approve_row['poster_id'] == ANONYMOUS ) ? ( ($approve_row['post_username'] != '' ) ? $approve_row['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $approve_row['poster_id']) . '">' . $approve_row['username'] . '</a>'; + + $last_post_url = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $approve_row['post_id']) . '#' . $approve_row['post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" border="0" /></a>'; + break; + } + } + } + else + { + $last_post_author = ( intval($topic_rowset[$i]['id2']) == intval(ANONYMOUS) ) ? $lang['Guest'] : $last_post_author; + } + } + } + } + } +// +// End Approve_Mod Block : 9 +// +# +#-----[ OPEN ]------------------------------------------ +# +viewtopic.php +# +#-----[ FIND ]----... [truncated message content] |