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

Nathan Guse exreaction at phpbb.com
Wed Jun 10 22:36:52 UTC 2009


Author: exreaction
Date: Wed Jun 10 22:36:52 2009
New Revision: 206

Log:
CDB_ -> TITANIA_

Modified:
    trunk/titania/config.example.php
    trunk/titania/includes/constants.php
    trunk/titania/includes/core/cache.php
    trunk/titania/includes/objects/author.php
    trunk/titania/includes/objects/contribution.php
    trunk/titania/includes/objects/download.php
    trunk/titania/includes/objects/faq.php
    trunk/titania/includes/objects/rating.php
    trunk/titania/includes/tools/diff.php
    trunk/titania/install/index.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

Modified: trunk/titania/config.example.php
==============================================================================
*** trunk/titania/config.example.php (original)
--- trunk/titania/config.example.php Wed Jun 10 22:36:52 2009
***************
*** 21,27 ****
  	/**
  	* Prefix of the sql tables.
  	*
! 	* @param	string	$cdb_table_prefix	Table prefix
  	*/
  	'table_prefix' => 'customisation_',
  );
--- 21,27 ----
  	/**
  	* Prefix of the sql tables.
  	*
! 	* @param	string	$titania_table_prefix	Table prefix
  	*/
  	'table_prefix' => 'customisation_',
  );

Modified: trunk/titania/includes/constants.php
==============================================================================
*** trunk/titania/includes/constants.php (original)
--- trunk/titania/includes/constants.php Wed Jun 10 22:36:52 2009
***************
*** 24,51 ****
  
  // Table names
  $table_prefix = titania::$config->table_prefix;
! define('CDB_AUTHORS_TABLE',				$table_prefix . 'authors');
! define('CDB_CONTRIBS_TABLE',			$table_prefix . 'contribs');
! define('CDB_CONTRIB_TAGS_TABLE',		$table_prefix . 'contrib_tags');
! define('CDB_CONTRIB_COAUTHORS_TABLE',	$table_prefix . 'contrib_coauthors');
! define('CDB_DOWNLOADS_TABLE',			$table_prefix . 'downloads');
! define('CDB_QUEUE_TABLE',				$table_prefix . 'queue');
! define('CDB_QUEUE_HISTORY_TABLE',		$table_prefix . 'queue_history');
! define('CDB_REVISIONS_TABLE',			$table_prefix . 'revisions');
! define('CDB_TAG_FIELDS_TABLE',			$table_prefix . 'tag_fields');
! define('CDB_TAG_TYPES_TABLE',			$table_prefix . 'tag_types');
! define('CDB_WATCH_TABLE',				$table_prefix . 'watch');
! define('CDB_CONTRIB_FAQ_TABLE',			$table_prefix . 'contrib_faq');
! define('CDB_RATINGS_TABLE',				$table_prefix . 'ratings');
  
  // Customisation/Queue (contrib) status
  define('STATUS_NEW', 0);
  define('STATUS_APPROVED', 1);
  define('STATUS_DENIED', 2);
! define('CDB_STATUS_TESTING', 3);
! define('CDB_STATUS_ATTENTION', 4);
! define('CDB_STATUS_APPROVE', 5); // Awaiting approve
! define('CDB_STATUS_DENY', 6); // Awating deny
  
  // Tag types
  define('TAG_TYPE_MOD_CATEGORY', 1);
--- 24,51 ----
  
  // Table names
  $table_prefix = titania::$config->table_prefix;
! define('TITANIA_AUTHORS_TABLE',				$table_prefix . 'authors');
! define('TITANIA_CONTRIBS_TABLE',			$table_prefix . 'contribs');
! define('TITANIA_CONTRIB_TAGS_TABLE',		$table_prefix . 'contrib_tags');
! define('TITANIA_CONTRIB_COAUTHORS_TABLE',	$table_prefix . 'contrib_coauthors');
! define('TITANIA_DOWNLOADS_TABLE',			$table_prefix . 'downloads');
! define('TITANIA_QUEUE_TABLE',				$table_prefix . 'queue');
! define('TITANIA_QUEUE_HISTORY_TABLE',		$table_prefix . 'queue_history');
! define('TITANIA_REVISIONS_TABLE',			$table_prefix . 'revisions');
! define('TITANIA_TAG_FIELDS_TABLE',			$table_prefix . 'tag_fields');
! define('TITANIA_TAG_TYPES_TABLE',			$table_prefix . 'tag_types');
! define('TITANIA_WATCH_TABLE',				$table_prefix . 'watch');
! define('TITANIA_CONTRIB_FAQ_TABLE',			$table_prefix . 'contrib_faq');
! 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
! define('TITANIA_STATUS_DENY', 6); // Awating deny
  
  // Tag types
  define('TAG_TYPE_MOD_CATEGORY', 1);
***************
*** 95,99 ****
  define('RATING_CONTRIB', 2);
  
  // Download types
! define('CDB_DOWNLOAD_CONTRIB', 1);
! define('CDB_DOWNLOAD_POST', 2);
\ No newline at end of file
--- 95,99 ----
  define('RATING_CONTRIB', 2);
  
  // Download types
! define('TITANIA_DOWNLOAD_CONTRIB', 1);
! define('TITANIA_DOWNLOAD_POST', 2);
\ No newline at end of file

Modified: trunk/titania/includes/core/cache.php
==============================================================================
*** trunk/titania/includes/core/cache.php (original)
--- trunk/titania/includes/core/cache.php Wed Jun 10 22:36:52 2009
***************
*** 35,47 ****
  	 */
  	public function get_categories($tag_type = TAG_TYPE_MOD_CATEGORY)
  	{
! 		$categories = $this->get('_cdb_categories');
  
  		if (!$categories)
  		{
  			$categories = array();
  			$sql = 'SELECT tag_id, tag_field_name, tag_field_desc
! 						FROM ' . CDB_TAG_FIELDS_TABLE . '
  						WHERE tag_type_id = ' . (int) $tag_type;
  			$result = phpbb::$db->sql_query($sql);
  
--- 35,47 ----
  	 */
  	public function get_categories($tag_type = TAG_TYPE_MOD_CATEGORY)
  	{
! 		$categories = $this->get('_titania_categories');
  
  		if (!$categories)
  		{
  			$categories = array();
  			$sql = 'SELECT tag_id, tag_field_name, tag_field_desc
! 						FROM ' . TITANIA_TAG_FIELDS_TABLE . '
  						WHERE tag_type_id = ' . (int) $tag_type;
  			$result = phpbb::$db->sql_query($sql);
  
***************
*** 56,62 ****
  			}
  			phpbb::$db->sql_freeresult($result);
  
! 			$this->put('_cdb_categories', $categories);
  		}
  
  		return $categories;
--- 56,62 ----
  			}
  			phpbb::$db->sql_freeresult($result);
  
! 			$this->put('_titania_categories', $categories);
  		}
  
  		return $categories;

Modified: trunk/titania/includes/objects/author.php
==============================================================================
*** trunk/titania/includes/objects/author.php (original)
--- trunk/titania/includes/objects/author.php Wed Jun 10 22:36:52 2009
***************
*** 32,38 ****
  	 *
  	 * @var string
  	 */
! 	protected $sql_table		= CDB_AUTHORS_TABLE;
  
  	/**
  	 * SQL identifier field
--- 32,38 ----
  	 *
  	 * @var string
  	 */
! 	protected $sql_table		= TITANIA_AUTHORS_TABLE;
  
  	/**
  	 * SQL identifier field

Modified: trunk/titania/includes/objects/contribution.php
==============================================================================
*** trunk/titania/includes/objects/contribution.php (original)
--- trunk/titania/includes/objects/contribution.php Wed Jun 10 22:36:52 2009
***************
*** 32,38 ****
  	 *
  	 * @var string
  	 */
! 	protected $sql_table		= CDB_CONTRIBS_TABLE;
  
  	/**
  	 * Primary sql identifier for the contribution object
--- 32,38 ----
  	 *
  	 * @var string
  	 */
! 	protected $sql_table		= TITANIA_CONTRIBS_TABLE;
  
  	/**
  	 * Primary sql identifier for the contribution object

Modified: trunk/titania/includes/objects/download.php
==============================================================================
*** trunk/titania/includes/objects/download.php (original)
--- trunk/titania/includes/objects/download.php Wed Jun 10 22:36:52 2009
***************
*** 32,38 ****
  	 *
  	 * @var string
  	 */
! 	protected $sql_table		= CDB_DOWNLOADS_TABLE;
  
  	/**
  	 * SQL identifier field
--- 32,38 ----
  	 *
  	 * @var string
  	 */
! 	protected $sql_table		= TITANIA_DOWNLOADS_TABLE;
  
  	/**
  	 * SQL identifier field
***************
*** 86,92 ****
  	/**
  	 * Allows to load data identified by object_id
  	 *
! 	 * @param int $download_type The type of download (check CDB_DOWNLOAD_ constants)
  	 * @param int $object_id The id of the item to download
  	 *
  	 * @return void
--- 86,92 ----
  	/**
  	 * Allows to load data identified by object_id
  	 *
! 	 * @param int $download_type The type of download (check TITANIA_DOWNLOAD_ constants)
  	 * @param int $object_id The id of the item to download
  	 *
  	 * @return void
***************
*** 123,135 ****
  		$column = ($validated) ? 'contrib_validated_revision' : 'contrib_revision';
  
  		$sql = 'SELECT ' . $column . '
! 			FROM ' . CDB_CONTRIBS_TABLE . '
  			WHERE contrib_id = ' . $contrib_id;
  		$result = phpbb::$db->sql_query($sql);
  		$revision_id = (int) phpbb::$db->sql_fetchfield($column);
  		phpbb::$db->sql_freeresult($result);
  
! 		$this->load(CDB_DOWNLOAD_CONTRIB, $revision_id);
  	}
  
  	/**
--- 123,135 ----
  		$column = ($validated) ? 'contrib_validated_revision' : 'contrib_revision';
  
  		$sql = 'SELECT ' . $column . '
! 			FROM ' . TITANIA_CONTRIBS_TABLE . '
  			WHERE contrib_id = ' . $contrib_id;
  		$result = phpbb::$db->sql_query($sql);
  		$revision_id = (int) phpbb::$db->sql_fetchfield($column);
  		phpbb::$db->sql_freeresult($result);
  
! 		$this->load(TITANIA_DOWNLOAD_CONTRIB, $revision_id);
  	}
  
  	/**

Modified: trunk/titania/includes/objects/faq.php
==============================================================================
*** trunk/titania/includes/objects/faq.php (original)
--- trunk/titania/includes/objects/faq.php Wed Jun 10 22:36:52 2009
***************
*** 32,38 ****
  	 *
  	 * @var string
  	 */
! 	protected $sql_table		= CDB_CONTRIB_FAQ_TABLE;
  
  	/**
  	 * SQL identifier field
--- 32,38 ----
  	 *
  	 * @var string
  	 */
! 	protected $sql_table		= TITANIA_CONTRIB_FAQ_TABLE;
  
  	/**
  	 * SQL identifier field
***************
*** 333,339 ****
  		global $db;
  
  		$sql = 'SELECT revision_id, revision_name
! 			FROM ' . CDB_REVISIONS_TABLE . "
  			WHERE contrib_id = $contrib_id
  			ORDER BY revision_name DESC";
  		$result = $db->sql_query($sql);
--- 333,339 ----
  		global $db;
  
  		$sql = 'SELECT revision_id, revision_name
! 			FROM ' . TITANIA_REVISIONS_TABLE . "
  			WHERE contrib_id = $contrib_id
  			ORDER BY revision_name DESC";
  		$result = $db->sql_query($sql);
***************
*** 360,371 ****
  		$sql_ary = array(
  			'SELECT'	=> 'f.*, r.revision_name, r.revision_time, c.contrib_author_id',
  			'FROM'		=> array(
! 				CDB_CONTRIB_FAQ_TABLE => 'f',
! 				CDB_CONTRIBS_TABLE 	=> 'c'
  			),
  			'LEFT_JOIN'	=> array(
  				array(
! 					'FROM'	=> array(CDB_REVISIONS_TABLE => 'r'),
  					'ON'	=> 'r.revision_id = f.revision_id
  							AND c.contrib_id = f.contrib_id',
  				),
--- 360,371 ----
  		$sql_ary = array(
  			'SELECT'	=> 'f.*, r.revision_name, r.revision_time, c.contrib_author_id',
  			'FROM'		=> array(
! 				TITANIA_CONTRIB_FAQ_TABLE => 'f',
! 				TITANIA_CONTRIBS_TABLE 	=> 'c'
  			),
  			'LEFT_JOIN'	=> array(
  				array(
! 					'FROM'	=> array(TITANIA_REVISIONS_TABLE => 'r'),
  					'ON'	=> 'r.revision_id = f.revision_id
  							AND c.contrib_id = f.contrib_id',
  				),
***************
*** 433,443 ****
  		$sql_ary = array(
  			'SELECT'	=> 'f.*, r.revision_name',
  			'FROM'		=> array(
! 					CDB_CONTRIB_FAQ_TABLE	=> 'f'
  			),
  			'LEFT_JOIN'	=> array(
  				array(
! 					'FROM'	=> array(CDB_REVISIONS_TABLE => 'r'),
  					'ON'	=> 'r.revision_id = f.revision_id',
  				),
  			),
--- 433,443 ----
  		$sql_ary = array(
  			'SELECT'	=> 'f.*, r.revision_name',
  			'FROM'		=> array(
! 					TITANIA_CONTRIB_FAQ_TABLE	=> 'f'
  			),
  			'LEFT_JOIN'	=> array(
  				array(
! 					'FROM'	=> array(TITANIA_REVISIONS_TABLE => 'r'),
  					'ON'	=> 'r.revision_id = f.revision_id',
  				),
  			),
***************
*** 483,489 ****
  
  		// informations about contrib
  		$sql = 'SELECT contrib_name, contrib_version, contrib_author_id
! 			FROM ' . CDB_CONTRIBS_TABLE . '
  			WHERE contrib_id = ' . $contrib_id;
  		$result = $db->sql_query($sql);
  		$contrib = $db->sql_fetchrow($result);
--- 483,489 ----
  
  		// informations about contrib
  		$sql = 'SELECT contrib_name, contrib_version, contrib_author_id
! 			FROM ' . TITANIA_CONTRIBS_TABLE . '
  			WHERE contrib_id = ' . $contrib_id;
  		$result = $db->sql_query($sql);
  		$contrib = $db->sql_fetchrow($result);

Modified: trunk/titania/includes/objects/rating.php
==============================================================================
*** trunk/titania/includes/objects/rating.php (original)
--- trunk/titania/includes/objects/rating.php Wed Jun 10 22:36:52 2009
***************
*** 32,38 ****
  	 *
  	 * @var string
  	 */
! 	protected $sql_table			= CDB_RATINGS_TABLE;
  
  	/**
  	 * SQL identifier field
--- 32,38 ----
  	 *
  	 * @var string
  	 */
! 	protected $sql_table			= TITANIA_RATINGS_TABLE;
  
  	/**
  	 * SQL identifier field
***************
*** 126,132 ****
  		{
  			case 'author' :
  				$this->rating_type_id = RATING_AUTHOR;
! 				$this->cache_table = CDB_AUTHORS_TABLE;
  				$this->cache_rating = 'author_rating';
  				$this->cache_rating_count = 'author_rating_count';
  				$this->object_column = 'author_id';
--- 126,132 ----
  		{
  			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';
  				$this->object_column = 'author_id';
***************
*** 134,140 ****
  
  			case 'contrib' :
  				$this->rating_type_id = RATING_CONTRIB;
! 				$this->cache_table = CDB_CONTRIBS_TABLE;
  				$this->cache_rating = 'contrib_rating';
  				$this->cache_rating_count = 'contrib_rating_count';
  				$this->object_column = 'contrib_id';
--- 134,140 ----
  
  			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';
  				$this->object_column = 'contrib_id';
***************
*** 193,199 ****
  	*/
  	public function add_rating($rating)
  	{
! 		if (!phpbb::$user->data['is_registered'] || !phpbb::$auth->acl_get('cdb_rate'))
  		{
  			return;
  		}
--- 193,199 ----
  	*/
  	public function add_rating($rating)
  	{
! 		if (!phpbb::$user->data['is_registered'] || !phpbb::$auth->acl_get('titania_rate'))
  		{
  			return;
  		}
***************
*** 264,270 ****
  	*/
  	public function reset_rating()
  	{
! 		if (!phpbb::$auth->acl_get('cdb_rate_reset'))
  		{
  			return;
  		}
--- 264,270 ----
  	*/
  	public function reset_rating()
  	{
! 		if (!phpbb::$auth->acl_get('titania_rate_reset'))
  		{
  			return;
  		}

Modified: trunk/titania/includes/tools/diff.php
==============================================================================
*** trunk/titania/includes/tools/diff.php (original)
--- trunk/titania/includes/tools/diff.php Wed Jun 10 22:36:52 2009
***************
*** 40,46 ****
  	 * @var string
  	 */
  	private $renderer_type;
! 	
  	/**
  	 * Identification for old and new
  	 * This is used by from_dir to add an identification to the diff file
--- 40,46 ----
  	 * @var string
  	 */
  	private $renderer_type;
! 
  	/**
  	 * Identification for old and new
  	 * This is used by from_dir to add an identification to the diff file
***************
*** 48,54 ****
  	 * @var string
  	 */
  	private $id_old, $id_new;
! 	
  	/**
  	 * constructor
  	 *
--- 48,54 ----
  	 * @var string
  	 */
  	private $id_old, $id_new;
! 
  	/**
  	 * constructor
  	 *
***************
*** 58,64 ****
  	{
  		$this->renderer_type = $renderer_type;
  	}
! 	
  	/**
  	 * Set id_old and id_new
  	 *
--- 58,64 ----
  	{
  		$this->renderer_type = $renderer_type;
  	}
! 
  	/**
  	 * Set id_old and id_new
  	 *
***************
*** 70,78 ****
  		$this->id_old = $id_old;
  		$this->id_new = $id_new;
  	}
! 	
  	// diff layers
! 	
  	/**
  	 * Create diff from file
  	 * Lowest layer
--- 70,78 ----
  		$this->id_old = $id_old;
  		$this->id_new = $id_new;
  	}
! 
  	// diff layers
! 
  	/**
  	 * Create diff from file
  	 * Lowest layer
***************
*** 85,96 ****
  	{
  	    $file_old = ($filename_old) ? self::file_contents($filename_old) : '';
  		$file_new = ($filename_new) ? self::file_contents($filename_new) : '';
! 		
  		// create renderer and process diff
  		$renderer = new $this->renderer_type();
  		return $renderer->render(new diff($file_old, $file_new));
  	}
! 	
  	/**
  	 * Create diff from dir
  	 *
--- 85,96 ----
  	{
  	    $file_old = ($filename_old) ? self::file_contents($filename_old) : '';
  		$file_new = ($filename_new) ? self::file_contents($filename_new) : '';
! 
  		// create renderer and process diff
  		$renderer = new $this->renderer_type();
  		return $renderer->render(new diff($file_old, $file_new));
  	}
! 
  	/**
  	 * Create diff from dir
  	 *
***************
*** 104,117 ****
  	    {
  			return false;
  		}
! 		
  		$result = '';
! 		
  		$files_old = array_flip(self::list_files($dir_old));
  		$files_new = array_flip(self::list_files($dir_new));
! 		
  		$files_merged = array_merge($files_old, $files_new);
! 		
  		while (list($filename) = each($files_merged))
  		{
  			// add a context header for the file
--- 104,117 ----
  	    {
  			return false;
  		}
! 
  		$result = '';
! 
  		$files_old = array_flip(self::list_files($dir_old));
  		$files_new = array_flip(self::list_files($dir_new));
! 
  		$files_merged = array_merge($files_old, $files_new);
! 
  		while (list($filename) = each($files_merged))
  		{
  			// add a context header for the file
***************
*** 119,125 ****
  			$result .= "===================================================================\n";
  			$result .= "--- $filename" . ($this->id_old ? "\t{$this->id_old}" : '') . "\n";
  			$result .= "+++ $filename" . ($this->id_new ? "\t{$this->id_new}" : '') . "\n";
! 			
  			if (isset($files_old[$filename]) && isset($files_new[$filename]))
  			{
  				// old and new files exist
--- 119,125 ----
  			$result .= "===================================================================\n";
  			$result .= "--- $filename" . ($this->id_old ? "\t{$this->id_old}" : '') . "\n";
  			$result .= "+++ $filename" . ($this->id_new ? "\t{$this->id_new}" : '') . "\n";
! 
  			if (isset($files_old[$filename]) && isset($files_new[$filename]))
  			{
  				// old and new files exist
***************
*** 136,145 ****
  				$result .= $this->from_file($dir_old . $filename, false) . "\n";
  			}
  		}
! 		
  		return $result;
  	}
! 	
  	/**
  	 * Create diff from zip
  	 *
--- 136,145 ----
  				$result .= $this->from_file($dir_old . $filename, false) . "\n";
  			}
  		}
! 
  		return $result;
  	}
! 
  	/**
  	 * Create diff from zip
  	 *
***************
*** 153,177 ****
  	    {
  			return false;
  		}
! 		
  		// temporary dirs
  		$tmp_old = TITANIA_ROOT . 'files/temp/' . basename($filename_old) . '/';
  		$tmp_new = TITANIA_ROOT . 'files/temp/' . basename($filename_new) . '/';
! 		
  		// extract files
  		$result_old = self::extract_zip($filename_old, $tmp_old);
  		$result_new = self::extract_zip($filename_new, $tmp_new);
! 		
  		// get diff
  		$result = $this->from_dir($tmp_old, $tmp_new);
! 		
  		// clean up
  		self::rmdir($tmp_old, true);
  		self::rmdir($tmp_new, true);
! 		
  		return $result;
  	}
! 	
  	/**
  	 * Create diff from revision
  	 *
--- 153,177 ----
  	    {
  			return false;
  		}
! 
  		// temporary dirs
  		$tmp_old = TITANIA_ROOT . 'files/temp/' . basename($filename_old) . '/';
  		$tmp_new = TITANIA_ROOT . 'files/temp/' . basename($filename_new) . '/';
! 
  		// extract files
  		$result_old = self::extract_zip($filename_old, $tmp_old);
  		$result_new = self::extract_zip($filename_new, $tmp_new);
! 
  		// get diff
  		$result = $this->from_dir($tmp_old, $tmp_new);
! 
  		// clean up
  		self::rmdir($tmp_old, true);
  		self::rmdir($tmp_new, true);
! 
  		return $result;
  	}
! 
  	/**
  	 * Create diff from revision
  	 *
***************
*** 183,190 ****
  	{
  		// get filenames
  		$sql = 'SELECT d.physical_filename
! 			FROM ' . CDB_DOWNLOADS_TABLE . ' d
! 			JOIN ' . CDB_REVISIONS_TABLE . ' r
  				ON d.revision_id = r.revision_id
  			WHERE ' . phpbb::$db->sql_in_set('d.revision_id', array($rev_old, $rev_new)) . '
  			ORDER BY r.revision_time ASC';
--- 183,190 ----
  	{
  		// get filenames
  		$sql = 'SELECT d.physical_filename
! 			FROM ' . TITANIA_DOWNLOADS_TABLE . ' d
! 			JOIN ' . TITANIA_REVISIONS_TABLE . ' r
  				ON d.revision_id = r.revision_id
  			WHERE ' . phpbb::$db->sql_in_set('d.revision_id', array($rev_old, $rev_new)) . '
  			ORDER BY r.revision_time ASC';
***************
*** 192,210 ****
  		$filename_old = phpbb::$db->sql_fetchfield('physical_filename');
  		$filename_new = phpbb::$db->sql_fetchfield('physical_filename');
  		phpbb::$db->sql_freeresult($result);
! 		
  		if (!$filename_old || !$filename_new)
  		{
  			return false;
  		}
! 		
  		$this->set_id("revision $rev_old", "revision $rev_new");
! 		
  		return $this->from_zip($filename_old, $filename_new);
  	}
! 	
  	// static api functions
! 	
  	/**
  	 * Extract a zip file
  	 *
--- 192,210 ----
  		$filename_old = phpbb::$db->sql_fetchfield('physical_filename');
  		$filename_new = phpbb::$db->sql_fetchfield('physical_filename');
  		phpbb::$db->sql_freeresult($result);
! 
  		if (!$filename_old || !$filename_new)
  		{
  			return false;
  		}
! 
  		$this->set_id("revision $rev_old", "revision $rev_new");
! 
  		return $this->from_zip($filename_old, $filename_new);
  	}
! 
  	// static api functions
! 
  	/**
  	 * Extract a zip file
  	 *
***************
*** 218,230 ****
  		{
  			mkdir($destination, 0777, true);
  		}
! 		
  		// extract files
  		$zip = new compress_zip('r', $filename);
  		$zip->extract($destination);
  		$zip->close();
  	}
! 	
  	/**
  	 * Recursively get all filenames from a dir
  	 *
--- 218,230 ----
  		{
  			mkdir($destination, 0777, true);
  		}
! 
  		// extract files
  		$zip = new compress_zip('r', $filename);
  		$zip->extract($destination);
  		$zip->close();
  	}
! 
  	/**
  	 * Recursively get all filenames from a dir
  	 *
***************
*** 243,249 ****
  				{
  					continue;
  				}
! 				
  				if (is_file($root . $dir . $file))
  				{
  					$files[] = $dir . $file;
--- 243,249 ----
  				{
  					continue;
  				}
! 
  				if (is_file($root . $dir . $file))
  				{
  					$files[] = $dir . $file;
***************
*** 253,265 ****
  					$files = array_merge($files, self::list_files($root, $dir . $file . '/'));
  				}
  			}
! 			
  			closedir($dh);
  		}
! 		
  		return $files;
  	}
! 	
  	/**
  	 * Recursively remove dir
  	 *
--- 253,265 ----
  					$files = array_merge($files, self::list_files($root, $dir . $file . '/'));
  				}
  			}
! 
  			closedir($dh);
  		}
! 
  		return $files;
  	}
! 
  	/**
  	 * Recursively remove dir
  	 *
***************
*** 279,291 ****
  				self::rmdir($dir . $filename . '/', true);
  			}
  		}
! 		
  		if ($rm_self)
  		{
  			rmdir($dir);
  		}
  	}
! 	
  	/**
  	 * Get contents of a file, don't mess up linefeeds
  	 *
--- 279,291 ----
  				self::rmdir($dir . $filename . '/', true);
  			}
  		}
! 
  		if ($rm_self)
  		{
  			rmdir($dir);
  		}
  	}
! 
  	/**
  	 * Get contents of a file, don't mess up linefeeds
  	 *
***************
*** 296,302 ****
  	{
  		return preg_replace('#\\r(?:\\n|)#s', "\n", file_get_contents($filename));
  	}
! 	
  	/**
  	 * @todo implement:
  	 * 1) Show diff from last submitted revision.
--- 296,302 ----
  	{
  		return preg_replace('#\\r(?:\\n|)#s', "\n", file_get_contents($filename));
  	}
! 
  	/**
  	 * @todo implement:
  	 * 1) Show diff from last submitted revision.

Modified: trunk/titania/install/index.php
==============================================================================
*** trunk/titania/install/index.php (original)
--- trunk/titania/install/index.php Wed Jun 10 22:36:52 2009
***************
*** 24,30 ****
  }
  
  $mod_name = 'CUSTOMISATION_DATABASE';
! $version_config_name = 'cdb_version';
  
  
  $versions = array(
--- 24,30 ----
  }
  
  $mod_name = 'CUSTOMISATION_DATABASE';
! $version_config_name = 'titania_version';
  
  
  $versions = array(
***************
*** 241,249 ****
  		),
  
  		'permission_add' => array(
! 			'cdb_',
! 			'cdb_rate',
! 			'cdb_rate_reset',
  		),
  	),
  
--- 241,249 ----
  		),
  
  		'permission_add' => array(
! 			'titania_',
! 			'titania_rate',
! 			'titania_rate_reset',
  		),
  	),
  

Modified: trunk/titania/modules/authors/authors_main.php
==============================================================================
*** trunk/titania/modules/authors/authors_main.php (original)
--- trunk/titania/modules/authors/authors_main.php Wed Jun 10 22:36:52 2009
***************
*** 106,112 ****
  		$sql_ary = array(
  			'SELECT'	=> 'a.*, u.user_lastvisit, u.username, u.user_posts, u.user_colour',
  			'FROM'		=> array(
! 				CDB_AUTHORS_TABLE => 'a',
  			),
  			'LEFT_JOIN'	=> array(
  				array(
--- 106,112 ----
  		$sql_ary = array(
  			'SELECT'	=> 'a.*, u.user_lastvisit, u.username, u.user_posts, u.user_colour',
  			'FROM'		=> array(
! 				TITANIA_AUTHORS_TABLE => 'a',
  			),
  			'LEFT_JOIN'	=> array(
  				array(
***************
*** 192,198 ****
  		$sql_ary = array(
  			'SELECT' => 'a.*, u.user_lastvisit, u.username, u.user_posts, u.user_colour',
  			'FROM'		=> array(
! 				CDB_AUTHORS_TABLE => 'a',
  			),
  			'LEFT_JOIN'	=> array(
  				array(
--- 192,198 ----
  		$sql_ary = array(
  			'SELECT' => 'a.*, u.user_lastvisit, u.username, u.user_posts, u.user_colour',
  			'FROM'		=> array(
! 				TITANIA_AUTHORS_TABLE => 'a',
  			),
  			'LEFT_JOIN'	=> array(
  				array(

Modified: trunk/titania/modules/mods/mods_details.php
==============================================================================
*** trunk/titania/modules/mods/mods_details.php (original)
--- trunk/titania/modules/mods/mods_details.php Wed Jun 10 22:36:52 2009
***************
*** 91,100 ****
  	{
  		$sql_ary = array(
  			'SELECT'	=> 'c.*, a.author_id, a.author_username, u.user_colour',
! 			'FROM'		=> array(CDB_CONTRIBS_TABLE => 'c'),
  			'LEFT_JOIN'	=> array(
  				array(
! 					'FROM'	=> array(CDB_AUTHORS_TABLE => 'a'),
  					'ON'	=> 'a.author_id = c.contrib_author_id',
  				),
  				array(
--- 91,100 ----
  	{
  		$sql_ary = array(
  			'SELECT'	=> 'c.*, a.author_id, a.author_username, u.user_colour',
! 			'FROM'		=> array(TITANIA_CONTRIBS_TABLE => 'c'),
  			'LEFT_JOIN'	=> array(
  				array(
! 					'FROM'	=> array(TITANIA_AUTHORS_TABLE => 'a'),
  					'ON'	=> 'a.author_id = c.contrib_author_id',
  				),
  				array(
***************
*** 163,169 ****
  		}
  
  		$sql = 'SELECT c.contrib_id, c.contrib_name
! 			FROM ' . CDB_CONTRIBS_TABLE . ' c
  			WHERE c.contrib_id = ' . (int) $mod_id . '
  				AND c.contrib_status = ' .  STATUS_APPROVED;
  		$result = phpbb::$db->sql_query($sql);
--- 163,169 ----
  		}
  
  		$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);
***************
*** 287,293 ****
  	{
  		if (isset(phpbb::$user->data['session_page']) && !phpbb::$user->data['is_bot'] && strpos(phpbb::$user->data['session_page'], "&{$param}={$contrib_id}") === false)
  		{
! 			$sql = 'UPDATE ' . CDB_CONTRIBS_TABLE . ' SET contrib_views = contrib_views + 1 WHERE contrib_id = ' . (int) $contrib_id;
  			phpbb::$db->sql_query($sql);
  		}
  
--- 287,293 ----
  	{
  		if (isset(phpbb::$user->data['session_page']) && !phpbb::$user->data['is_bot'] && strpos(phpbb::$user->data['session_page'], "&{$param}={$contrib_id}") === false)
  		{
! 			$sql = 'UPDATE ' . TITANIA_CONTRIBS_TABLE . ' SET contrib_views = contrib_views + 1 WHERE contrib_id = ' . (int) $contrib_id;
  			phpbb::$db->sql_query($sql);
  		}
  

Modified: trunk/titania/modules/mods/mods_faq.php
==============================================================================
*** trunk/titania/modules/mods/mods_faq.php (original)
--- trunk/titania/modules/mods/mods_faq.php Wed Jun 10 22:36:52 2009
***************
*** 83,89 ****
  					switch ($action)
  					{
  						case 'delete':
! 							$sql = 'DELETE FROM ' . CDB_CONTRIB_FAQ_TABLE . ' WHERE ' . $db->sql_in_set('faq_id', $faq_ids);
  							$db->sql_query($sql);
  						
  							$message = $user->lang['DELETE_FAQ_MARKED'];
--- 83,89 ----
  					switch ($action)
  					{
  						case 'delete':
! 							$sql = 'DELETE FROM ' . TITANIA_CONTRIB_FAQ_TABLE . ' WHERE ' . $db->sql_in_set('faq_id', $faq_ids);
  							$db->sql_query($sql);
  						
  							$message = $user->lang['DELETE_FAQ_MARKED'];

Modified: trunk/titania/modules/mods/mods_main.php
==============================================================================
*** trunk/titania/modules/mods/mods_main.php (original)
--- trunk/titania/modules/mods/mods_main.php Wed Jun 10 22:36:52 2009
***************
*** 155,168 ****
  
  		$sql_ary = array(
  			'SELECT'	=> 'c.*, a.author_id, a.author_username, u.user_colour',
! 			'FROM'		=> array(CDB_CONTRIBS_TABLE => 'c'),
  			'LEFT_JOIN'	=> array(
  				array(
! 					'FROM'	=> array(CDB_CONTRIB_TAGS_TABLE => 't'),
  					'ON'	=> 't.contrib_id = c.contrib_id',
  				),
  				array(
! 					'FROM'	=> array(CDB_AUTHORS_TABLE => 'a'),
  					'ON'	=> 'a.author_id = c.contrib_author_id',
  				),
  				array(
--- 155,168 ----
  
  		$sql_ary = array(
  			'SELECT'	=> 'c.*, a.author_id, a.author_username, u.user_colour',
! 			'FROM'		=> array(TITANIA_CONTRIBS_TABLE => 'c'),
  			'LEFT_JOIN'	=> array(
  				array(
! 					'FROM'	=> array(TITANIA_CONTRIB_TAGS_TABLE => 't'),
  					'ON'	=> 't.contrib_id = c.contrib_id',
  				),
  				array(
! 					'FROM'	=> array(TITANIA_AUTHORS_TABLE => 'a'),
  					'ON'	=> 'a.author_id = c.contrib_author_id',
  				),
  				array(




More information about the customisationdb-commits mailing list