[Customisation Database Commits] r174 - in /trunk: ./ titania/common.php titania/includes/authors/authors_main.php titania/includes/class_pagination.php titania/includes/class_titania.php titania/includes/titania_config.php titania/template/authors/author_profile.html

David Lewis highwayoflife at phpbb.com
Thu Nov 13 07:37:02 CET 2008


Author: HighwayofLife
Date: Thu Nov 13 07:37:00 2008
New Revision: 174

Log:
merging from highwayoflife branch up to r173

Added:
    trunk/titania/includes/titania_config.php
      - copied unchanged from r173, branches/highwayoflife/titania/includes/titania_config.php
Modified:
    trunk/   (props changed)
    trunk/titania/common.php
    trunk/titania/includes/authors/authors_main.php
    trunk/titania/includes/class_pagination.php
    trunk/titania/includes/class_titania.php
    trunk/titania/template/authors/author_profile.html

Propchange: trunk/
------------------------------------------------------------------------------
*** svn:ignore (original)
--- svn:ignore Thu Nov 13 07:37:00 2008
***************
*** 1,4 ****
  .cache
  .settings
! *.project
  develop
--- 1,4 ----
  .cache
  .settings
! .project
  develop

Modified: trunk/titania/common.php
==============================================================================
*** trunk/titania/common.php (original)
--- trunk/titania/common.php Thu Nov 13 07:37:00 2008
***************
*** 23,28 ****
--- 23,31 ----
  	die('<p>The Titania config.' . PHP_EXT . ' file could not be found.</p>
  	<p><a href="' . TITANIA_ROOT . 'install/index.' . PHP_EXT . '">Click here to install Titania</a></p>');
  }
+ 
+ // config.php contains a titania_config array, set here in case it does not.
+ $config_ary = array();
  require(TITANIA_ROOT . 'config.' . PHP_EXT);
  
  // We need those variables to let phpBB 3.0.x scripts work properly.
***************
*** 43,56 ****
  
  // Include titania constants
  require(TITANIA_ROOT . 'includes/constants.' . PHP_EXT);
  
  // Include titania main class
  require(TITANIA_ROOT . 'includes/class_titania.' . PHP_EXT);
  
! $titania = new titania();
  
  // Include policy file (and interface)
  require(TITANIA_ROOT . 'includes/interface_policy.' . PHP_EXT);
  require(TITANIA_ROOT . 'policy.' . PHP_EXT);
- include(TITANIA_ROOT . 'includes/class_base_object.' . PHP_EXT);
- 
--- 46,62 ----
  
  // Include titania constants
  require(TITANIA_ROOT . 'includes/constants.' . PHP_EXT);
+ require(TITANIA_ROOT . 'includes/class_base_object.' . PHP_EXT);
  
  // Include titania main class
  require(TITANIA_ROOT . 'includes/class_titania.' . PHP_EXT);
  
! // Include titania configurations
! require(TITANIA_ROOT . 'includes/titania_config.' . PHP_EXT);
! 
! $titania_config = new titania_config($config_ary);
! $titania = new titania($titania_config);
  
  // Include policy file (and interface)
  require(TITANIA_ROOT . 'includes/interface_policy.' . PHP_EXT);
  require(TITANIA_ROOT . 'policy.' . PHP_EXT);

Modified: trunk/titania/includes/authors/authors_main.php
==============================================================================
*** trunk/titania/includes/authors/authors_main.php (original)
--- trunk/titania/includes/authors/authors_main.php Thu Nov 13 07:37:00 2008
***************
*** 105,111 ****
  		$sort->sort_request(false);
  
  		$pagination = new pagination();
! 		$pagination->set_result_lang('AUTHOR');
  		$start = $pagination->set_start();
  		$limit = $pagination->set_limit();
  
--- 105,111 ----
  		$sort->sort_request(false);
  
  		$pagination = new pagination();
! 		$pagination->result_lang = 'AUTHOR';
  		$start = $pagination->set_start();
  		$limit = $pagination->set_limit();
  
***************
*** 177,187 ****
  		$pagination->sql_total_count($sql_ary, 'a.author_id');
  
  		$pagination->set_params(array(
! 			'sk'	=> $sort->get_sort_key(),
! 			'sd'	=> $sort->get_sort_dir(),
  		));
  
! 		$pagination->build_pagination($this->page);
  
  		$template->assign_vars(array(
  			'S_MODE_SELECT'		=> $sort->get_sort_key_list(),
--- 177,187 ----
  		$pagination->sql_total_count($sql_ary, 'a.author_id');
  
  		$pagination->set_params(array(
! 			'sk'	=> $sort->get_sort_key(false),
! 			'sd'	=> $sort->get_sort_dir(false),
  		));
  
! 		$pagination->build_pagination($this->u_action);
  
  		$template->assign_vars(array(
  			'S_MODE_SELECT'		=> $sort->get_sort_key_list(),
***************
*** 230,242 ****
  			'REAL_NAME'			=> htmlspecialchars($author['author_realname']),
  			'WEBSITE'			=> $author['author_website'],
  			'RATING'			=> $this->generate_rating($author['author_rating']),
! 			'S_RATING_PERCENT'	=> $author['author_rating'] / 5,
  			'CONTRIB_COUNT'		=> $this->generate_contrib_string('contrib', 'link', $author['author_contribs'], $author_id),
  			'SNIPPET_COUNT'		=> $this->generate_contrib_string('snippet', 'link', $author['author_snippets'], $author_id),
  			'MOD_COUNT'			=> $this->generate_contrib_string('mod', 'link', $author['author_mods'], $author_id),
  			'STYLE_COUNT'		=> $this->generate_contrib_string('style', 'link', $author['author_styles'], $author_id),
  
! 			'U_PHPBB_PROFILE'	=> ($author['phpbb_user_id']) ? U_PHPBBCOM_VIEWPROFILE . '&amp;u=' . $author['phpbb_user_id'] : '',
  		));
  
  		return true;
--- 230,242 ----
  			'REAL_NAME'			=> htmlspecialchars($author['author_realname']),
  			'WEBSITE'			=> $author['author_website'],
  			'RATING'			=> $this->generate_rating($author['author_rating']),
! 			'RATING_COUNT'		=> $author['author_rating_count'],
  			'CONTRIB_COUNT'		=> $this->generate_contrib_string('contrib', 'link', $author['author_contribs'], $author_id),
  			'SNIPPET_COUNT'		=> $this->generate_contrib_string('snippet', 'link', $author['author_snippets'], $author_id),
  			'MOD_COUNT'			=> $this->generate_contrib_string('mod', 'link', $author['author_mods'], $author_id),
  			'STYLE_COUNT'		=> $this->generate_contrib_string('style', 'link', $author['author_styles'], $author_id),
  
! 			'U_PHPBB_PROFILE'	=> ($author['phpbb_user_id'] && titania::$config->phpbbcom_profile) ? U_PHPBBCOM_VIEWPROFILE . '&amp;u=' . $author['phpbb_user_id'] : '',
  		));
  
  		return true;

Modified: trunk/titania/includes/class_pagination.php
==============================================================================
*** trunk/titania/includes/class_pagination.php (original)
--- trunk/titania/includes/class_pagination.php Thu Nov 13 07:37:00 2008
***************
*** 21,109 ****
   *
   * @package Titania
   */
! class pagination
  {
  	/**
! 	 * start
! 	 *
! 	 * @var int
! 	 */
! 	protected $start = 0;
! 
! 	/**
! 	 * limit number of results to display on page
! 	 *
! 	 * @var int
! 	 */
! 	protected $limit = DEFAULT_OFFSET_LIMIT;
! 
! 	/**
! 	 * total results/rows/count
! 	 *
! 	 * @var int
! 	 */
! 	protected $total_results = 0;
! 
! 	/**
! 	 * Displaying results/rows
! 	 *
! 	 * @var int
! 	 */
! 	protected $results = 0;
! 
! 	/**
! 	 * pagination url
! 	 *
! 	 * @var string
! 	 */
! 	protected $url = '';
! 
! 	/**
! 	 * result language var, e.g.: TOTAL_ROW, plural language var appended automatically
! 	 *
! 	 * @var string
! 	 */
! 	protected $result_lang = 'RETURNED_RESULT';
! 
! 	/**
! 	 * Template vars, set automatically but may be changed if necessary.
! 	 *
! 	 * @var array
! 	 */
! 	protected $template_vars = array();
! 
! 	/**
! 	 * default results/rows to display
! 	 *
! 	 * @var int
! 	 */
! 	protected $default_limit = DEFAULT_OFFSET_LIMIT;
! 
! 	/**
! 	 * Maximimum definable limit allowed
! 	 *
! 	 * @var int
! 	 */
! 	protected $max_limit = MAX_OFFSET_LIMIT;
! 
! 	/**
! 	 * params array
  	 *
  	 * @var array
  	 */
! 	protected $params = array();
  
  	/**
  	 * Set some default variables, set template_vars default values
  	 */
  	public function __construct()
  	{
! 		$this->template_vars = array(
! 			'TOTAL_ROWS'	=> 'TOTAL_ROWS',
! 			'PAGINATION'	=> 'PAGINATION',
! 			'PAGE_NUMBER'	=> 'PAGE_NUMBER',
! 			'S_MODE_ACTION'	=> 'S_MODE_ACTION',
! 		);
  	}
  
  	/**
--- 21,59 ----
   *
   * @package Titania
   */
! class pagination extends titania_object
  {
  	/**
! 	 * URL Params
  	 *
  	 * @var array
  	 */
! 	private $params = array();
  
  	/**
  	 * Set some default variables, set template_vars default values
  	 */
  	public function __construct()
  	{
! 		// Configure object properties
! 		$this->object_config = array_merge($this->object_config, array(
! 			'start'			=> array('default' => 0),
! 			'limit'			=> array('default' => DEFAULT_OFFSET_LIMIT),
! 			'default_limit'	=> array('default' => DEFAULT_OFFSET_LIMIT),
! 			'max_limit'		=> array('default' => MAX_OFFSET_LIMIT),
! 			'results'		=> array('default' => 0),
! 			'total_results'	=> array('default' => 0),
! 			'url'			=> array('default' => ''),
! 			'result_lang'	=> array('default' => 'RETURNED_RESULT'),
! 			'template_vars'	=> array(
! 				'default' => array(
! 					'TOTAL_ROWS'	=> 'TOTAL_ROWS',
! 					'PAGINATION'	=> 'PAGINATION',
! 					'PAGE_NUMBER'	=> 'PAGE_NUMBER',
! 					'S_MODE_ACTION'	=> 'S_MODE_ACTION',
! 				),
! 			),
! 		));
  	}
  
  	/**
***************
*** 145,189 ****
  		{
  			if ($value)
  			{
! 				$this->params[$key] = $key . '=' . $value;
  			}
  		}
  	}
  
  	/**
! 	 * Set total_results, generally from config or SQL COUNT() Query
! 	 *
! 	 * @param int $total_results
! 	 */
! 	public function set_total_results($total_results)
! 	{
! 		$this->total_results = $total_results;
! 
! 		return true;
! 	}
! 
! 	/**
! 	 * Set the results, usually from a manual count of while loop
! 	 *
! 	 * @param int $results
! 	 */
! 	public function set_results($results)
! 	{
! 		$this->results = $results;
! 
! 		return true;
! 	}
! 
! 	/**
! 	 * set result language var, e.g.: TOTAL_ROW, plural language var appended automatically
  	 *
! 	 * @param string $lang_var
  	 */
! 	public function set_result_lang($lang_var)
  	{
! 		$this->result_lang = $lang_var;
! 
! 		return true;
  	}
  
  	/**
--- 95,116 ----
  		{
  			if ($value)
  			{
! 				$key = (string) $key;
! 				$this->params[$key] = $key . '=' . (string) $value;
  			}
  		}
  	}
  
  	/**
! 	 * Set single URL parameter
  	 *
! 	 * @param string $key
! 	 * @param string $value
  	 */
! 	public function set_param($key, $value)
  	{
! 		$key = (string) $key;
! 		$this->params[$key] = $key . '=' . (string) $value;
  	}
  
  	/**
***************
*** 205,212 ****
  		{
  			$this->template_vars[$key] = $lang;
  		}
  
! 		return true;
  	}
  
  	/**
--- 132,148 ----
  		{
  			$this->template_vars[$key] = $lang;
  		}
+ 	}
  
! 	/**
! 	 * Set single template variable
! 	 *
! 	 * @param string $key
! 	 * @param string $value
! 	 */
! 	public function set_template_var($key, $value)
! 	{
! 		$this->template_vars[$key] = $value;
  	}
  
  	/**

Modified: trunk/titania/includes/class_titania.php
==============================================================================
*** trunk/titania/includes/class_titania.php (original)
--- trunk/titania/includes/class_titania.php Thu Nov 13 07:37:00 2008
***************
*** 29,37 ****
  	public $page;
  
  	/**
  	 * construct class
  	 */
! 	public function __construct()
  	{
  		global $user, $auth, $template;
  
--- 29,44 ----
  	public $page;
  
  	/**
+ 	 * Titania configuration
+ 	 *
+ 	 * @var unknown_type
+ 	 */
+ 	public static $config;
+ 
+ 	/**
  	 * construct class
  	 */
! 	public function __construct($titania_config)
  	{
  		global $user, $auth, $template;
  
***************
*** 47,52 ****
--- 54,66 ----
  		$user->set_custom_lang_path(TITANIA_ROOT . 'language');
  
  		$user->add_lang('titania_common');
+ 
+ 		if (!class_exists('titania_config'))
+ 		{
+ 			include(TITANIA_ROOT . 'includes/titania_config.' . PHP_EXT);
+ 		}
+ 
+ 		self::$config = $titania_config->get_config_data();
  	}
  
  	/**

Modified: trunk/titania/template/authors/author_profile.html
==============================================================================
*** trunk/titania/template/authors/author_profile.html (original)
--- trunk/titania/template/authors/author_profile.html Thu Nov 13 07:37:00 2008
***************
*** 5,15 ****
  <tr><td>{USER_FULL}</td></tr>
  <tr><td>{REAL_NAME}</td></tr>
  <tr><td>{WEBSITE}</td></tr>
! <tr><td>{RATING}</td></tr>
  <tr><td>{CONTRIB_COUNT}</td></tr>
  <tr><td>{SNIPPET_COUNT}</td></tr>
  <tr><td>{MOD_COUNT}</td></tr>
  <tr><td>{STYLE_COUNT}</td></tr>
! <td width="10%"><!-- IF authors.U_PHPBB_PROFILE --><a href="{authors.U_PHPBB_PROFILE}">{L_PHPBB_PROFILE}</a><!-- ELSE -->&nbsp;<!-- ENDIF --></td>
  </table>
  <!-- INCLUDE overall_footer.html -->
\ No newline at end of file
--- 5,17 ----
  <tr><td>{USER_FULL}</td></tr>
  <tr><td>{REAL_NAME}</td></tr>
  <tr><td>{WEBSITE}</td></tr>
! <tr><td>{RATING} ({RATING_COUNT})</td></tr>
  <tr><td>{CONTRIB_COUNT}</td></tr>
  <tr><td>{SNIPPET_COUNT}</td></tr>
  <tr><td>{MOD_COUNT}</td></tr>
  <tr><td>{STYLE_COUNT}</td></tr>
! <!-- IF U_PHPBB_PROFILE -->
! 	<tr><td width="10%"><a href="{U_PHPBB_PROFILE}">{L_PHPBB_PROFILE}</a></td></tr>
! <!-- ENDIF -->
  </table>
  <!-- INCLUDE overall_footer.html -->
\ No newline at end of file




More information about the customisationdb-commits mailing list