[Customisation Database Commits] r642 - in /trunk/titania: includes/objects/post.php includes/tools/posting.php language/en/posting.php

Nathan Guse exreaction at phpbb.com
Mon Feb 22 03:54:58 GMT 2010


Author: exreaction
Date: Mon Feb 22 03:54:58 2010
New Revision: 642

Log:
Fixing hard delete, undelete post

Modified:
    trunk/titania/includes/objects/post.php
    trunk/titania/includes/tools/posting.php
    trunk/titania/language/en/posting.php

Modified: trunk/titania/includes/objects/post.php
==============================================================================
*** trunk/titania/includes/objects/post.php (original)
--- trunk/titania/includes/objects/post.php Mon Feb 22 03:54:58 2010
***************
*** 481,497 ****
  		$this->update_topic_postcount(true);
  
  		// Set the visibility appropriately if no posts are visibile to the public/authors
! 		if ($this->topic->get_postcount(TITANIA_ACCESS_PUBLIC) == 0)
  		{
  			$this->topic->topic_access = TITANIA_ACCESS_AUTHORS;
! 			if ($this->topic->get_postcount(TITANIA_ACCESS_AUTHORS) == 0)
  			{
  				$this->topic->topic_access = TITANIA_ACCESS_TEAMS;
- 				if ($this->topic->get_postcount(TITANIA_ACCESS_TEAMS) == 0)
- 				{
- 					// Hard delete the topic
- 					$this->topic->delete();
- 				}
  			}
  		}
  
--- 481,497 ----
  		$this->update_topic_postcount(true);
  
  		// Set the visibility appropriately if no posts are visibile to the public/authors
! 		$flags = titania_count::get_flags(TITANIA_ACCESS_PUBLIC);
! 		if (titania_count::from_db($this->topic->topic_posts, $flags) == 0)
  		{
+ 			// There are no posts visible to the public, change it to authors level access
  			$this->topic->topic_access = TITANIA_ACCESS_AUTHORS;
! 
! 			$flags = titania_count::get_flags(TITANIA_ACCESS_AUTHORS);
! 			if (titania_count::from_db($this->topic->topic_posts, $flags) == 0)
  			{
+ 				// There are no posts visible to authors, change it to teams level access
  				$this->topic->topic_access = TITANIA_ACCESS_TEAMS;
  			}
  		}
  
***************
*** 502,507 ****
--- 502,514 ----
  
  		// Initiate self-destruct mode
  		parent::delete();
+ 
+ 		$flags = titania_count::get_flags(TITANIA_ACCESS_TEAMS, true, true);
+ 		if (titania_count::from_db($this->topic->topic_posts, $flags) == 0)
+ 		{
+ 			// There are no posts left...
+ 			$this->topic->delete();
+ 		}
  	}
  
  	/**

Modified: trunk/titania/includes/tools/posting.php
==============================================================================
*** trunk/titania/includes/tools/posting.php (original)
--- trunk/titania/includes/tools/posting.php Mon Feb 22 03:54:58 2010
***************
*** 335,340 ****
--- 335,341 ----
  	// Common delete/undelete code
  	private function common_delete($post_id, $undelete = false)
  	{
+ 		titania::add_lang('posting');
  		phpbb::$user->add_lang('posting');
  
  		// Load the stuff we need

Modified: trunk/titania/language/en/posting.php
==============================================================================
*** trunk/titania/language/en/posting.php (original)
--- trunk/titania/language/en/posting.php Mon Feb 22 03:54:58 2010
***************
*** 38,43 ****
--- 38,45 ----
  $lang = array_merge($lang, array(
  'UNDELETE_FILE' => 'Cancel Delete',
  'FILE_DELETED' => 'This file will be deleted when you submit',
+ 'UNDELETE_POST' => 'Undelete Post',
+ 'UNDELETE_POST_CONFIRM' => 'Are you sure you want to undelete this post?',
  	'ACCESS'			=> 'Access Level',
  	'ACCESS_AUTHORS'	=> 'Authors Access',
  	'ACCESS_PUBLIC'		=> 'Public Access',




More information about the customisationdb-commits mailing list