[Customisation Database Commits] r768 - in /trunk/titania: common.php includes/objects/post.php includes/objects/topic.php includes/overlords/topics.php includes/tools/posting.php install.php manage/attention.php manage/index.php styles/default/template/common/post_list.html

Nathan Guse exreaction at phpbb.com
Tue Mar 16 01:52:50 GMT 2010


Author: exreaction
Date: Tue Mar 16 01:52:50 2010
New Revision: 768

Log:
Now we can require users to have posts approved before they are accepted

Modified:
    trunk/titania/common.php
    trunk/titania/includes/objects/post.php
    trunk/titania/includes/objects/topic.php
    trunk/titania/includes/overlords/topics.php
    trunk/titania/includes/tools/posting.php
    trunk/titania/install.php
    trunk/titania/manage/attention.php
    trunk/titania/manage/index.php
    trunk/titania/styles/default/template/common/post_list.html

Modified: trunk/titania/common.php
==============================================================================
*** trunk/titania/common.php (original)
--- trunk/titania/common.php Tue Mar 16 01:52:50 2010
***************
*** 17,23 ****
  }
  
  // Version number (only used for the installer)
! define('TITANIA_VERSION', '0.1.49');
  
  define('PHPBB_USE_BOARD_URL_PATH', true);
  if (!defined('IN_TITANIA_INSTALL'))
--- 17,23 ----
  }
  
  // Version number (only used for the installer)
! define('TITANIA_VERSION', '0.1.50');
  
  define('PHPBB_USE_BOARD_URL_PATH', true);
  if (!defined('IN_TITANIA_INSTALL'))

Modified: trunk/titania/includes/objects/post.php
==============================================================================
*** trunk/titania/includes/objects/post.php (original)
--- trunk/titania/includes/objects/post.php Tue Mar 16 01:52:50 2010
***************
*** 388,393 ****
--- 388,395 ----
  				'attention_type'		=> TITANIA_ATTENTION_UNAPPROVED,
  				'attention_object_type'	=> TITANIA_POST,
  				'attention_object_id'	=> $this->post_id,
+ 				'attention_poster_id'	=> $this->post_user_id,
+ 				'attention_post_time'	=> $this->post_time,
  				'attention_url'			=> $this->get_url(),
  				'attention_title'		=> $this->post_subject,
  			));
***************
*** 785,791 ****
  			'U_DELETE'						=> $this->acl_get('delete') ? $this->get_url('delete') : '',
  			'U_REPORT'						=> (phpbb::$user->data['is_registered']) ? $this->get_url('report') : '',
  			'U_WARN'						=> false,//$this->get_url('warn'),
! 			'U_INFO'						=> titania_url::build_url('manage/attention', array('type' => TITANIA_POST, 'id' => $this->post_id)),
  			'U_QUOTE'						=> $this->acl_get('post') ? $this->get_url('quote') : '',
  
  			'S_UNREAD_POST'					=> ($this->unread) ? true : false, // remember that you must set this up extra...
--- 787,793 ----
  			'U_DELETE'						=> $this->acl_get('delete') ? $this->get_url('delete') : '',
  			'U_REPORT'						=> (phpbb::$user->data['is_registered']) ? $this->get_url('report') : '',
  			'U_WARN'						=> false,//$this->get_url('warn'),
! 			'U_INFO'						=> (phpbb::$auth->acl_gets('u_titania_mod_author_mod', 'u_titania_mod_contrib_mod', 'u_titania_mod_faq_mod', 'u_titania_mod_post_mod') || sizeof(titania_types::find_authed('moderate'))) ? titania_url::build_url('manage/attention', array('type' => TITANIA_POST, 'id' => $this->post_id)) : '',
  			'U_QUOTE'						=> $this->acl_get('post') ? $this->get_url('quote') : '',
  
  			'S_UNREAD_POST'					=> ($this->unread) ? true : false, // remember that you must set this up extra...

Modified: trunk/titania/includes/objects/topic.php
==============================================================================
*** trunk/titania/includes/objects/topic.php (original)
--- trunk/titania/includes/objects/topic.php Tue Mar 16 01:52:50 2010
***************
*** 169,177 ****
  			$append['action'] = $action;
  		}
  
! 		$url = titania_url::build_url($base, $append);
  
! 		return $url;
  	}
  
  	/**
--- 169,186 ----
  			$append['action'] = $action;
  		}
  
! 		return titania_url::build_url($base, $append);
! 	}
  
! 	/**
! 	 * Get the parent URL for this topic
! 	 */
! 	public function get_parent_url()
! 	{
! 		$base = $append = false;
! 		titania_url::split_base_params($base, $append, $this->topic_url);
! 
! 		return titania_url::build_url($base, $append);
  	}
  
  	/**

Modified: trunk/titania/includes/overlords/topics.php
==============================================================================
*** trunk/titania/includes/overlords/topics.php (original)
--- trunk/titania/includes/overlords/topics.php Tue Mar 16 01:52:50 2010
***************
*** 46,52 ****
  		$sql = ($no_where) ? '' : (($where) ? ' WHERE' : ' AND');
  		$sql .= " ({$prefix}topic_access >= " . titania::$access_level . " OR {$prefix}topic_first_post_user_id = " . phpbb::$user->data['user_id'] . ')';
  
! 		if (phpbb::$auth->acl_get('u_titania_mod_post_mod'))
  		{
  			$sql .= " AND {$prefix}topic_approved = 1";
  		}
--- 46,52 ----
  		$sql = ($no_where) ? '' : (($where) ? ' WHERE' : ' AND');
  		$sql .= " ({$prefix}topic_access >= " . titania::$access_level . " OR {$prefix}topic_first_post_user_id = " . phpbb::$user->data['user_id'] . ')';
  
! 		if (!phpbb::$auth->acl_get('u_titania_mod_post_mod'))
  		{
  			$sql .= " AND {$prefix}topic_approved = 1";
  		}

Modified: trunk/titania/includes/tools/posting.php
==============================================================================
*** trunk/titania/includes/tools/posting.php (original)
--- trunk/titania/includes/tools/posting.php Tue Mar 16 01:52:50 2010
***************
*** 384,394 ****
--- 384,414 ----
  				{
  					$post_object->topic->topic_sticky = true;
  				}
+ 				else
+ 				{
+ 					if (!phpbb::$auth->acl_get('u_titania_post_approved'))
+ 					{
+ 						$post_object->post_approved = false;
+ 					}
+ 				}
  
  				$post_object->submit();
  
  				$message_object->submit($post_object->post_access);
  
+ 				// Unapproved posts will get a notice
+ 				if (!$post_object->topic->topic_approved)
+ 				{
+ 					phpbb::$user->add_lang('posting');
+ 
+ 					trigger_error(phpbb::$user->lang['POST_STORED_MOD'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_INDEX'], '<a href="' . $post_object->topic->get_parent_url() . '">', '</a>'));
+ 				}
+ 				else if (!$post_object->post_approved)
+ 				{
+ 					phpbb::$user->add_lang('posting');
+ 					trigger_error(phpbb::$user->lang['POST_STORED_MOD'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_TOPIC'], '<a href="' . $post_object->topic->get_url() . '">', '</a>'));
+ 				}
+ 
  				redirect($post_object->get_url());
  			}
  		}

Modified: trunk/titania/install.php
==============================================================================
*** trunk/titania/install.php (original)
--- trunk/titania/install.php Tue Mar 16 01:52:50 2010
***************
*** 800,805 ****
--- 800,811 ----
  		'custom' => 'titania_custom',
  	),
  
+ 	'0.1.50' => array(
+ 		'permission_add' => array(
+ 			'u_titania_post_approved',
+ 		),
+ 	),
+ 
  	// IF YOU ADD A NEW VERSION DO NOT FORGET TO INCREMENT THE VERSION NUMBER IN common.php!
  );
  

Modified: trunk/titania/manage/attention.php
==============================================================================
*** trunk/titania/manage/attention.php (original)
--- trunk/titania/manage/attention.php Tue Mar 16 01:52:50 2010
***************
*** 64,70 ****
  		$sql = 'UPDATE ' . TITANIA_ATTENTION_TABLE . ' SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . '
  			WHERE attention_object_id = ' . (int) $object_id . '
  				AND attention_object_type = ' . (int) $object_type . '
! 				AND attention_type = ' . (($close || $delete) ? TITANIA_ATTENTION_REPORTED : TITANIA_ATTENTION_UNAPPROVED);
  		phpbb::$db->sql_query($sql);
  	}
  	add_form_key('attention');
--- 64,70 ----
  		$sql = 'UPDATE ' . TITANIA_ATTENTION_TABLE . ' SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . '
  			WHERE attention_object_id = ' . (int) $object_id . '
  				AND attention_object_type = ' . (int) $object_type . '
! 				AND attention_type = ' . (($close) ? TITANIA_ATTENTION_REPORTED : TITANIA_ATTENTION_UNAPPROVED);
  		phpbb::$db->sql_query($sql);
  	}
  	add_form_key('attention');

Modified: trunk/titania/manage/index.php
==============================================================================
*** trunk/titania/manage/index.php (original)
--- trunk/titania/manage/index.php Tue Mar 16 01:52:50 2010
***************
*** 50,56 ****
  );
  
  
! $page = (isset($nav_ary[$page])) ? $page : 'queue';
  
  // Display nav menu
  titania::generate_nav($nav_ary, $page);
--- 50,56 ----
  );
  
  
! $page = (isset($nav_ary[$page])) ? $page : 'attention';
  
  // Display nav menu
  titania::generate_nav($nav_ary, $page);

Modified: trunk/titania/styles/default/template/common/post_list.html
==============================================================================
*** trunk/titania/styles/default/template/common/post_list.html (original)
--- trunk/titania/styles/default/template/common/post_list.html Tue Mar 16 01:52:50 2010
***************
*** 43,51 ****
  			<h3 <!-- IF posts.S_FIRST_ROW -->class="first"<!-- ENDIF -->><!-- IF posts.POST_ICON_IMG --><img src="{T_ICONS_PATH}{posts.POST_ICON_IMG}" width="{posts.POST_ICON_IMG_WIDTH}" height="{posts.POST_ICON_IMG_HEIGHT}" alt="" /> <!-- ENDIF --><a href="{posts.U_VIEW}">{posts.POST_SUBJECT}</a> <!-- IF posts.S_ACCESS_TEAMS or posts.S_ACCESS_AUTHORS --><img src="{T_TITANIA_THEME_PATH}/{S_USER_LANG}/icon_access_<!-- IF posts.S_ACCESS_TEAMS -->teams<!-- ELSE -->author<!-- ENDIF -->.png" alt="" /><!-- ENDIF --></h3>
  			<p class="author"><!-- IF S_IS_BOT -->{posts.MINI_POST_IMG}<!-- ELSE --><a href="{posts.U_MINI_POST}">{posts.MINI_POST_IMG}</a><!-- ENDIF -->{L_POST_BY_AUTHOR} <strong>{posts.USER_FULL}</strong> &raquo; {posts.POST_TIME} </p>
  
! 			<!-- IF posts.S_POST_UNAPPROVED or posts.S_POST_REPORTED -->
  				<p class="rules">
! 					<!-- IF posts.S_POST_UNAPPROVED -->{UNAPPROVED_IMG} <a href="{posts.U_INFO}"><strong>{L_POST_UNAPPROVED}</strong></a><br /><!-- ENDIF -->
  					<!-- IF posts.S_POST_REPORTED -->{REPORTED_IMG} <a href="{posts.U_INFO}"><strong>{L_POST_REPORTED}</strong></a><!-- ENDIF -->
  				</p>
  			<!-- ENDIF -->
--- 43,51 ----
  			<h3 <!-- IF posts.S_FIRST_ROW -->class="first"<!-- ENDIF -->><!-- IF posts.POST_ICON_IMG --><img src="{T_ICONS_PATH}{posts.POST_ICON_IMG}" width="{posts.POST_ICON_IMG_WIDTH}" height="{posts.POST_ICON_IMG_HEIGHT}" alt="" /> <!-- ENDIF --><a href="{posts.U_VIEW}">{posts.POST_SUBJECT}</a> <!-- IF posts.S_ACCESS_TEAMS or posts.S_ACCESS_AUTHORS --><img src="{T_TITANIA_THEME_PATH}/{S_USER_LANG}/icon_access_<!-- IF posts.S_ACCESS_TEAMS -->teams<!-- ELSE -->author<!-- ENDIF -->.png" alt="" /><!-- ENDIF --></h3>
  			<p class="author"><!-- IF S_IS_BOT -->{posts.MINI_POST_IMG}<!-- ELSE --><a href="{posts.U_MINI_POST}">{posts.MINI_POST_IMG}</a><!-- ENDIF -->{L_POST_BY_AUTHOR} <strong>{posts.USER_FULL}</strong> &raquo; {posts.POST_TIME} </p>
  
! 			<!-- IF not posts.S_POST_APPROVED or posts.S_POST_REPORTED -->
  				<p class="rules">
! 					<!-- IF not posts.S_POST_APPROVED -->{UNAPPROVED_IMG} <a href="{posts.U_INFO}"><strong>{L_POST_UNAPPROVED}</strong></a><br /><!-- ENDIF -->
  					<!-- IF posts.S_POST_REPORTED -->{REPORTED_IMG} <a href="{posts.U_INFO}"><strong>{L_POST_REPORTED}</strong></a><!-- ENDIF -->
  				</p>
  			<!-- ENDIF -->




More information about the customisationdb-commits mailing list