[Customisation Database Commits] r215 - in /trunk/titania: ./ includes/ includes/core/ includes/objects/ modules/authors/ modules/mods/

Nathan Guse exreaction at phpbb.com
Sat Jun 13 20:40:10 UTC 2009


Author: exreaction
Date: Sat Jun 13 20:40:08 2009
New Revision: 215

Log:
Renaming constants to have TITANIA_ prefix

Modified:
    trunk/titania/includes/constants.php
    trunk/titania/includes/core/titania.php
    trunk/titania/includes/objects/author.php
    trunk/titania/includes/objects/contribution.php
    trunk/titania/includes/objects/faq.php
    trunk/titania/includes/objects/modification.php
    trunk/titania/includes/objects/rating.php
    trunk/titania/includes/objects/style.php
    trunk/titania/modules/authors/authors_main.php
    trunk/titania/modules/mods/mods_details.php
    trunk/titania/modules/mods/mods_faq.php
    trunk/titania/modules/mods/mods_main.php
    trunk/titania/styles.php

Modified: trunk/titania/includes/constants.php
==============================================================================
*** trunk/titania/includes/constants.php (original)
--- trunk/titania/includes/constants.php Sat Jun 13 20:40:08 2009
***************
*** 39,47 ****
  define('TITANIA_RATINGS_TABLE',				$table_prefix . 'ratings');
  
  // Customisation/Queue (contrib) status
! define('STATUS_NEW', 0);
! define('STATUS_APPROVED', 1);
! define('STATUS_DENIED', 2);
  define('TITANIA_STATUS_TESTING', 3);
  define('TITANIA_STATUS_ATTENTION', 4);
  define('TITANIA_STATUS_APPROVE', 5); // Awaiting approve
--- 39,47 ----
  define('TITANIA_RATINGS_TABLE',				$table_prefix . 'ratings');
  
  // Customisation/Queue (contrib) status
! define('TITANIA_STATUS_NEW', 0);
! define('TITANIA_STATUS_APPROVED', 1);
! define('TITANIA_STATUS_DENIED', 2);
  define('TITANIA_STATUS_TESTING', 3);
  define('TITANIA_STATUS_ATTENTION', 4);
  define('TITANIA_STATUS_APPROVE', 5); // Awaiting approve
***************
*** 53,60 ****
  define('TAG_TYPE_COMPLEXITY', 3);
  
  // Errorbox types
! define('ERROR_ERROR', 1);
! define('ERROR_SUCCESS', 2);
  
  // Header status codes
  define('HEADER_OK',						200);
--- 53,60 ----
  define('TAG_TYPE_COMPLEXITY', 3);
  
  // Errorbox types
! define('TITANIA_ERROR', 1);
! define('TITANIA_SUCCESS', 2);
  
  // Header status codes
  define('HEADER_OK',						200);
***************
*** 81,98 ****
  define('HEADER_SERVICE_UNAVAILABLE',	503);
  
  // Customisation (contrib) type
! define('CONTRIB_TYPE_MOD', 1);
! define('CONTRIB_TYPE_STYLE', 2);
! define('CONTRIB_TYPE_SNIPPET', 3);
! define('CONTRIB_TYPE_LANG_PACK', 4);
  
  // Author constants
! define('AUTHOR_HIDDEN', 0);
! define('AUTHOR_VISIBLE', 1);
  
  // Rating Type Constants
! define('RATING_AUTHOR', 1);
! define('RATING_CONTRIB', 2);
  
  // Download types
  define('TITANIA_DOWNLOAD_CONTRIB', 1);
--- 81,98 ----
  define('HEADER_SERVICE_UNAVAILABLE',	503);
  
  // Customisation (contrib) type
! define('TITANIA_TYPE_MOD', 1);
! define('TITANIA_TYPE_STYLE', 2);
! define('TITANIA_TYPE_SNIPPET', 3);
! define('TITANIA_TYPE_LANG_PACK', 4);
  
  // Author constants
! define('TITANIA_AUTHOR_HIDDEN', 0);
! define('TITANIA_AUTHOR_VISIBLE', 1);
  
  // Rating Type Constants
! define('TITANIA_RATING_AUTHOR', 1);
! define('TITANIA_RATING_CONTRIB', 2);
  
  // Download types
  define('TITANIA_DOWNLOAD_CONTRIB', 1);

Modified: trunk/titania/includes/core/titania.php
==============================================================================
*** trunk/titania/includes/core/titania.php (original)
--- trunk/titania/includes/core/titania.php Sat Jun 13 20:40:08 2009
***************
*** 388,404 ****
  	 *
  	 * @param string $l_title message title - custom or user->lang defined
  	 * @param mixed $l_message message string or array of strings
! 	 * @param int $error_type ERROR_SUCCESS or ERROR_ERROR constant
  	 * @param int $status_code an HTTP status code
  	 */
! 	public static function error_box($l_title, $l_message, $error_type = ERROR_SUCCESS, $status_code = NULL)
  	{
  		if ($status_code)
  		{
  			self::set_header_status($status_code);
  		}
  
! 		$block = ($error_type == ERROR_ERROR) ? 'errorbox' : 'successbox';
  
  		if ($l_title)
  		{
--- 388,404 ----
  	 *
  	 * @param string $l_title message title - custom or user->lang defined
  	 * @param mixed $l_message message string or array of strings
! 	 * @param int $error_type TITANIA_SUCCESS or TITANIA_ERROR constant
  	 * @param int $status_code an HTTP status code
  	 */
! 	public static function error_box($l_title, $l_message, $error_type = TITANIA_SUCCESS, $status_code = NULL)
  	{
  		if ($status_code)
  		{
  			self::set_header_status($status_code);
  		}
  
! 		$block = ($error_type == TITANIA_ERROR) ? 'errorbox' : 'successbox';
  
  		if ($l_title)
  		{

Modified: trunk/titania/includes/objects/author.php
==============================================================================
*** trunk/titania/includes/objects/author.php (original)
--- trunk/titania/includes/objects/author.php Sat Jun 13 20:40:08 2009
***************
*** 62,68 ****
  			'author_snippets'		=> array('default' => 0),
  			'author_mods'			=> array('default' => 0),
  			'author_styles'			=> array('default' => 0),
! 			'author_visible'		=> array('default' => AUTHOR_VISIBLE),
  		));
  
  		if ($user_id !== false)
--- 62,68 ----
  			'author_snippets'		=> array('default' => 0),
  			'author_mods'			=> array('default' => 0),
  			'author_styles'			=> array('default' => 0),
! 			'author_visible'		=> array('default' => TITANIA_AUTHOR_VISIBLE),
  		));
  
  		if ($user_id !== false)

Modified: trunk/titania/includes/objects/contribution.php
==============================================================================
*** trunk/titania/includes/objects/contribution.php (original)
--- trunk/titania/includes/objects/contribution.php Sat Jun 13 20:40:08 2009
***************
*** 81,87 ****
  			'contrib_desc_uid'				=> array('default' => '',	'readonly' => true),
  			'contrib_desc_options'			=> array('default' => 7,	'readonly' => true),
  
! 			'contrib_status'				=> array('default' => STATUS_NEW),
  			'contrib_version'				=> array('default' => '',	'max' => 15),
  
  			'contrib_revision'				=> array('default' => 0),
--- 81,87 ----
  			'contrib_desc_uid'				=> array('default' => '',	'readonly' => true),
  			'contrib_desc_options'			=> array('default' => 7,	'readonly' => true),
  
! 			'contrib_status'				=> array('default' => TITANIA_STATUS_NEW),
  			'contrib_version'				=> array('default' => '',	'max' => 15),
  
  			'contrib_revision'				=> array('default' => 0),
***************
*** 326,332 ****
  
  		if (!phpbb::$config['email_enable'])
  		{
! 			titania::error_box('ERROR', 'EMAIL_DISABLED', ERROR_ERROR, HEADER_SERVICE_UNAVAILABLE);
  
  			return false;
  		}
--- 326,332 ----
  
  		if (!phpbb::$config['email_enable'])
  		{
! 			titania::error_box('ERROR', 'EMAIL_DISABLED', TITANIA_ERROR, HEADER_SERVICE_UNAVAILABLE);
  
  			return false;
  		}
***************
*** 338,344 ****
  				login_box(titania::$page, phpbb::$user->lang['ERROR_CONTRIB_EMAIL_FRIEND']);
  			}
  
! 			titania::error_box('ERROR', 'ERROR_CONTRIB_EMAIL_FRIEND', ERROR_ERROR, HEADER_FORBIDDEN);
  
  			return false;
  		}
--- 338,344 ----
  				login_box(titania::$page, phpbb::$user->lang['ERROR_CONTRIB_EMAIL_FRIEND']);
  			}
  
! 			titania::error_box('ERROR', 'ERROR_CONTRIB_EMAIL_FRIEND', TITANIA_ERROR, HEADER_FORBIDDEN);
  
  			return false;
  		}
***************
*** 384,390 ****
  
  			if (!empty($error))
  			{
! 				titania::error_box('ERROR', $error, ERROR_ERROR);
  
  				return false;
  			}
--- 384,390 ----
  
  			if (!empty($error))
  			{
! 				titania::error_box('ERROR', $error, TITANIA_ERROR);
  
  				return false;
  			}
***************
*** 447,453 ****
  
  			phpbb::$user->set_custom_lang_path($lang_path);
  
! 			titania::error_box('SUCCESS', 'EMAIL_SENT', ERROR_SUCCESS);
  
  			return true;
  		}
--- 447,453 ----
  
  			phpbb::$user->set_custom_lang_path($lang_path);
  
! 			titania::error_box('SUCCESS', 'EMAIL_SENT', TITANIA_SUCCESS);
  
  			return true;
  		}

Modified: trunk/titania/includes/objects/faq.php
==============================================================================
*** trunk/titania/includes/objects/faq.php (original)
--- trunk/titania/includes/objects/faq.php Sat Jun 13 20:40:08 2009
***************
*** 55,69 ****
  	 */
  	private $contrib_identifier;
  
- 	/*
- 	 * Contrib identifiers
- 	 */
- 	private $contrib_identifiers = array(
- 		CONTRIB_TYPE_MOD 	=> 'mod',
- 		CONTRIB_TYPE_STYLE 	=> 'style',
- 		CONTRIB_TYPE_SNIPPET 	=> 'snippet'
- 	);
- 
  	/**
  	 * Constructor class for titania faq
  	 *
--- 55,60 ----

Modified: trunk/titania/includes/objects/modification.php
==============================================================================
*** trunk/titania/includes/objects/modification.php (original)
--- trunk/titania/includes/objects/modification.php Sat Jun 13 20:40:08 2009
***************
*** 37,43 ****
  		parent::__construct($contrib_id);
  
  		$this->object_config = array_merge($this->object_config, array(
! 			'contrib_type' => array('default' => CONTRIB_TYPE_MOD),
  		));
  	}
  }
\ No newline at end of file
--- 37,43 ----
  		parent::__construct($contrib_id);
  
  		$this->object_config = array_merge($this->object_config, array(
! 			'contrib_type' => array('default' => TITANIA_TYPE_MOD),
  		));
  	}
  }
\ No newline at end of file

Modified: trunk/titania/includes/objects/rating.php
==============================================================================
*** trunk/titania/includes/objects/rating.php (original)
--- trunk/titania/includes/objects/rating.php Sat Jun 13 20:40:08 2009
***************
*** 125,131 ****
  		switch($type)
  		{
  			case 'author' :
! 				$this->rating_type_id = RATING_AUTHOR;
  				$this->cache_table = TITANIA_AUTHORS_TABLE;
  				$this->cache_rating = 'author_rating';
  				$this->cache_rating_count = 'author_rating_count';
--- 125,131 ----
  		switch($type)
  		{
  			case 'author' :
! 				$this->rating_type_id = TITANIA_RATING_AUTHOR;
  				$this->cache_table = TITANIA_AUTHORS_TABLE;
  				$this->cache_rating = 'author_rating';
  				$this->cache_rating_count = 'author_rating_count';
***************
*** 133,139 ****
  			break;
  
  			case 'contrib' :
! 				$this->rating_type_id = RATING_CONTRIB;
  				$this->cache_table = TITANIA_CONTRIBS_TABLE;
  				$this->cache_rating = 'contrib_rating';
  				$this->cache_rating_count = 'contrib_rating_count';
--- 133,139 ----
  			break;
  
  			case 'contrib' :
! 				$this->rating_type_id = TITANIA_RATING_CONTRIB;
  				$this->cache_table = TITANIA_CONTRIBS_TABLE;
  				$this->cache_rating = 'contrib_rating';
  				$this->cache_rating_count = 'contrib_rating_count';

Modified: trunk/titania/includes/objects/style.php
==============================================================================
*** trunk/titania/includes/objects/style.php (original)
--- trunk/titania/includes/objects/style.php Sat Jun 13 20:40:08 2009
***************
*** 37,43 ****
  		parent::__construct($contrib_id);
  
  		$this->object_config = array_merge($this->object_config, array(
! 			'contrib_type' => array('default' => CONTRIB_TYPE_STYLE),
  		));
  	}
  }
\ No newline at end of file
--- 37,43 ----
  		parent::__construct($contrib_id);
  
  		$this->object_config = array_merge($this->object_config, array(
! 			'contrib_type' => array('default' => TITANIA_TYPE_STYLE),
  		));
  	}
  }
\ No newline at end of file

Modified: trunk/titania/modules/authors/authors_main.php
==============================================================================
*** trunk/titania/modules/authors/authors_main.php (original)
--- trunk/titania/modules/authors/authors_main.php Sat Jun 13 20:40:08 2009
***************
*** 69,75 ****
  
  				if (!$found)
  				{
! 					titania::error_box('ERROR', phpbb::$user->lang['AUTHOR_NOT_FOUND'], ERROR_ERROR);
  
  					$this->main($id, 'list');
  					return;
--- 69,75 ----
  
  				if (!$found)
  				{
! 					titania::error_box('ERROR', phpbb::$user->lang['AUTHOR_NOT_FOUND'], TITANIA_ERROR);
  
  					$this->main($id, 'list');
  					return;
***************
*** 128,134 ****
  					'ON'	=> 'a.user_id = u.user_id'
  				),
  			),
! 			'WHERE'		=> 'a.author_visible <> ' . AUTHOR_HIDDEN,
  			'ORDER_BY'	=> $sort->get_order_by(),
  		);
  
--- 128,134 ----
  					'ON'	=> 'a.user_id = u.user_id'
  				),
  			),
! 			'WHERE'		=> 'a.author_visible <> ' . TITANIA_AUTHOR_HIDDEN,
  			'ORDER_BY'	=> $sort->get_order_by(),
  		);
  

Modified: trunk/titania/modules/mods/mods_details.php
==============================================================================
*** trunk/titania/modules/mods/mods_details.php (original)
--- trunk/titania/modules/mods/mods_details.php Sat Jun 13 20:40:08 2009
***************
*** 103,109 ****
  				),
  			),
  			'WHERE'		=> 'c.contrib_id = ' . (int) $mod_id . '
! 							AND c.contrib_status = ' .  STATUS_APPROVED,
  		);
  		$sql = phpbb::$db->sql_build_query('SELECT', $sql_ary);
  		$result = phpbb::$db->sql_query($sql);
--- 103,109 ----
  				),
  			),
  			'WHERE'		=> 'c.contrib_id = ' . (int) $mod_id . '
! 							AND c.contrib_status = ' .  TITANIA_STATUS_APPROVED,
  		);
  		$sql = phpbb::$db->sql_build_query('SELECT', $sql_ary);
  		$result = phpbb::$db->sql_query($sql);
***************
*** 139,145 ****
  
  		if (!phpbb::$config['email_enable'])
  		{
! 			titania::error_box('ERROR', phpbb::$user->lang['EMAIL_DISABLED'], ERROR_ERROR, HEADER_SERVICE_UNAVAILABLE);
  			$this->main('details', 'details');
  			return;
  		}
--- 139,145 ----
  
  		if (!phpbb::$config['email_enable'])
  		{
! 			titania::error_box('ERROR', phpbb::$user->lang['EMAIL_DISABLED'], TITANIA_ERROR, HEADER_SERVICE_UNAVAILABLE);
  			$this->main('details', 'details');
  			return;
  		}
***************
*** 151,157 ****
  				login_box(TITANIA_ROOT . $this->page . '&amp;mod=' . $mod_id, 'NO_EMAIL_MOD');
  			}
  
! 			titania::error_box('ERROR', phpbb::$user->lang['NO_EMAIL_MOD'], ERROR_ERROR, HEADER_FORBIDDEN);
  			$this->main('details', 'details');
  			return;
  		}
--- 151,157 ----
  				login_box(TITANIA_ROOT . $this->page . '&amp;mod=' . $mod_id, 'NO_EMAIL_MOD');
  			}
  
! 			titania::error_box('ERROR', phpbb::$user->lang['NO_EMAIL_MOD'], TITANIA_ERROR, HEADER_FORBIDDEN);
  			$this->main('details', 'details');
  			return;
  		}
***************
*** 165,171 ****
  		$sql = 'SELECT c.contrib_id, c.contrib_name
  			FROM ' . TITANIA_CONTRIBS_TABLE . ' c
  			WHERE c.contrib_id = ' . (int) $mod_id . '
! 				AND c.contrib_status = ' .  STATUS_APPROVED;
  		$result = phpbb::$db->sql_query($sql);
  		$mod = phpbb::$db->sql_fetchrow($result);
  		phpbb::$db->sql_freeresult($result);
--- 165,171 ----
  		$sql = 'SELECT c.contrib_id, c.contrib_name
  			FROM ' . TITANIA_CONTRIBS_TABLE . ' c
  			WHERE c.contrib_id = ' . (int) $mod_id . '
! 				AND c.contrib_status = ' .  TITANIA_STATUS_APPROVED;
  		$result = phpbb::$db->sql_query($sql);
  		$mod = phpbb::$db->sql_fetchrow($result);
  		phpbb::$db->sql_freeresult($result);
***************
*** 261,267 ****
  					$messenger->send(NOTIFY_EMAIL);
  				}
  
! 				titania::error_box('SUCCESS', 'EMAIL_SENT', ERROR_SUCCESS);
  				$this->main('details', 'details');
  				return;
  			}
--- 261,267 ----
  					$messenger->send(NOTIFY_EMAIL);
  				}
  
! 				titania::error_box('SUCCESS', 'EMAIL_SENT', TITANIA_SUCCESS);
  				$this->main('details', 'details');
  				return;
  			}

Modified: trunk/titania/modules/mods/mods_faq.php
==============================================================================
*** trunk/titania/modules/mods/mods_faq.php (original)
--- trunk/titania/modules/mods/mods_faq.php Sat Jun 13 20:40:08 2009
***************
*** 64,70 ****
  			trigger_error('INVALID_FORM');
  		}
  
! 		$faq = new titania_faq($faq_id, CONTRIB_TYPE_MOD);
  
  		$this->tpl_name = 'faq/faq_manage';
  
--- 64,70 ----
  			trigger_error('INVALID_FORM');
  		}
  
! 		$faq = new titania_faq($faq_id);
  
  		$this->tpl_name = 'faq/faq_manage';
  

Modified: trunk/titania/modules/mods/mods_main.php
==============================================================================
*** trunk/titania/modules/mods/mods_main.php (original)
--- trunk/titania/modules/mods/mods_main.php Sat Jun 13 20:40:08 2009
***************
*** 66,72 ****
  
  				if (!$found)
  				{
! 					titania::error_box('ERROR', $user->lang['MOD_NOT_FOUND'], ERROR_ERROR);
  
  					$mode = ($category) ? 'list' : 'categories';
  					$this->main($id, $mode);
--- 66,72 ----
  
  				if (!$found)
  				{
! 					titania::error_box('ERROR', $user->lang['MOD_NOT_FOUND'], TITANIA_ERROR);
  
  					$mode = ($category) ? 'list' : 'categories';
  					$this->main($id, $mode);
***************
*** 85,91 ****
  				if (!$found)
  				{
  					$categories = titania::$cache->get_categories(TAG_TYPE_MOD_CATEGORY);
! 					titania::error_box('ERROR', sprintf($user->lang['NO_MODS'], $categories[$category]['name']), ERROR_ERROR);
  					$this->main($id, 'categories');
  					return;
  				}
--- 85,91 ----
  				if (!$found)
  				{
  					$categories = titania::$cache->get_categories(TAG_TYPE_MOD_CATEGORY);
! 					titania::error_box('ERROR', sprintf($user->lang['NO_MODS'], $categories[$category]['name']), TITANIA_ERROR);
  					$this->main($id, 'categories');
  					return;
  				}
***************
*** 171,177 ****
  				),
  			),
  			'WHERE'		=> 't.tag_id = ' . $category . '
! 							AND c.contrib_status = ' .  STATUS_APPROVED,
  			'ORDER_BY'	=> $sort->get_order_by(),
  		);
  		$sql = $db->sql_build_query('SELECT', $sql_ary);
--- 171,177 ----
  				),
  			),
  			'WHERE'		=> 't.tag_id = ' . $category . '
! 							AND c.contrib_status = ' .  TITANIA_STATUS_APPROVED,
  			'ORDER_BY'	=> $sort->get_order_by(),
  		);
  		$sql = $db->sql_build_query('SELECT', $sql_ary);

Modified: trunk/titania/styles.php
==============================================================================
*** trunk/titania/styles.php (original)
--- trunk/titania/styles.php Sat Jun 13 20:40:08 2009
***************
*** 32,38 ****
  	case 'support':
  		$style = new titania_style($contrib_id);
  
! 		if (!$style->load() || $style->contrib_type != CONTRIB_TYPE_STYLE)
  		{
  			titania::trigger_error('ERROR_CONTRIB_NOT_FOUND', E_USER_NOTICE, HEADER_NOT_FOUND);
  		}
--- 32,38 ----
  	case 'support':
  		$style = new titania_style($contrib_id);
  
! 		if (!$style->load() || $style->contrib_type != TITANIA_TYPE_STYLE)
  		{
  			titania::trigger_error('ERROR_CONTRIB_NOT_FOUND', E_USER_NOTICE, HEADER_NOT_FOUND);
  		}




More information about the customisationdb-commits mailing list