[Customisation Database Commits] r802 - in /trunk/titania: includes/tools/posting.php manage/attention.php

Nathan Guse exreaction at phpbb.com
Sun Mar 21 01:07:20 GMT 2010


Author: exreaction
Date: Sun Mar 21 01:07:20 2010
New Revision: 802

Log:
Update the topic correctly if all posts are approved/unreported

Don't display the message that the post needs approval if the topic needs approval unless the user cannot see any posts in the topic

Modified:
    trunk/titania/includes/tools/posting.php
    trunk/titania/manage/attention.php

Modified: trunk/titania/includes/tools/posting.php
==============================================================================
*** trunk/titania/includes/tools/posting.php (original)
--- trunk/titania/includes/tools/posting.php Sun Mar 21 01:07:20 2010
***************
*** 395,401 ****
  				$message_object->submit($post_object->post_access);
  
  				// Unapproved posts will get a notice
! 				if (!$post_object->topic->topic_approved)
  				{
  					phpbb::$user->add_lang('posting');
  
--- 395,401 ----
  				$message_object->submit($post_object->post_access);
  
  				// Unapproved posts will get a notice
! 				if (!$post_object->topic->get_postcount())
  				{
  					phpbb::$user->add_lang('posting');
  

Modified: trunk/titania/manage/attention.php
==============================================================================
*** trunk/titania/manage/attention.php (original)
--- trunk/titania/manage/attention.php Sun Mar 21 01:07:20 2010
***************
*** 97,107 ****
--- 97,137 ----
  			{
  				$post->post_reported = false;
  				$post->submit();
+ 
+ 				$sql = 'SELECT COUNT(post_id) AS cnt FROM ' . TITANIA_POSTS_TABLE . '
+ 					WHERE topic_id = ' . $post->topic_id . '
+ 						AND post_reported = 1';
+ 				phpbb::$db->sql_query($sql);
+ 				$cnt = phpbb::$db->sql_fetchfield('cnt');
+ 				phpbb::$db->sql_freeresult($result);
+ 
+ 				if (!$cnt)
+ 				{
+ 					$sql = 'UPDATE ' . TITANIA_TOPICS_TABLE . '
+ 						SET topic_reported = 1
+ 						WHERE topic_id = ' . $post->topic_id;
+ 					phpbb::$db->sql_query($sql);
+ 				}
  			}
  			if ($approve)
  			{
  				$post->post_approved = 1;
  				$post->submit();
+ 
+ 				$sql = 'SELECT COUNT(post_id) AS cnt FROM ' . TITANIA_POSTS_TABLE . '
+ 					WHERE topic_id = ' . $post->topic_id . '
+ 						AND post_approved = 0';
+ 				phpbb::$db->sql_query($sql);
+ 				$cnt = phpbb::$db->sql_fetchfield('cnt');
+ 				phpbb::$db->sql_freeresult($result);
+ 
+ 				if (!$cnt)
+ 				{
+ 					$sql = 'UPDATE ' . TITANIA_TOPICS_TABLE . '
+ 						SET topic_approved = 1
+ 						WHERE topic_id = ' . $post->topic_id;
+ 					phpbb::$db->sql_query($sql);
+ 				}
  			}
  
  			users_overlord::load_users(array($post->post_user_id, $post->post_edit_user, $post->post_delete_user));




More information about the customisationdb-commits mailing list