[Customisation Database Commits] r1080 - in /trunk/titania: ./ authors/ contributions/ includes/ includes/core/ includes/tools/ manage/

Nathan Guse exreaction at phpbb.com
Sun Apr 18 02:11:05 BST 2010


Author: exreaction
Date: Sun Apr 18 02:11:04 2010
New Revision: 1080

Log:
No more using the attachment extensions table from phpBB (it causes some issues it seems) #60495

Added:
    trunk/titania/includes/dynamic_constants.php   (with props)
Modified:
    trunk/titania/authors/create.php
    trunk/titania/common.php
    trunk/titania/contributions/faq.php
    trunk/titania/contributions/manage.php
    trunk/titania/contributions/revision.php
    trunk/titania/contributions/support.php
    trunk/titania/includes/constants.php
    trunk/titania/includes/core/cache.php
    trunk/titania/includes/core/config.php
    trunk/titania/includes/functions_install.php
    trunk/titania/includes/tools/attachment.php
    trunk/titania/includes/tools/posting.php
    trunk/titania/includes/tools/uploader.php
    trunk/titania/manage/queue.php

Modified: trunk/titania/authors/create.php
==============================================================================
*** trunk/titania/authors/create.php (original)
--- trunk/titania/authors/create.php Sun Apr 18 02:11:04 2010
***************
*** 56,62 ****
  // Screenshots
  $screenshot = new titania_attachment(TITANIA_SCREENSHOT, titania::$contrib->contrib_id);
  $screenshot->load_attachments();
! $screenshot->upload(TITANIA_ATTACH_EXT_SCREENSHOTS, 175);
  $error = array_merge($error, $screenshot->error);
  
  if ($screenshot->uploaded || isset($_POST['preview']) || $submit)
--- 56,62 ----
  // Screenshots
  $screenshot = new titania_attachment(TITANIA_SCREENSHOT, titania::$contrib->contrib_id);
  $screenshot->load_attachments();
! $screenshot->upload(175);
  $error = array_merge($error, $screenshot->error);
  
  if ($screenshot->uploaded || isset($_POST['preview']) || $submit)

Modified: trunk/titania/common.php
==============================================================================
*** trunk/titania/common.php (original)
--- trunk/titania/common.php Sun Apr 18 02:11:04 2010
***************
*** 25,30 ****
--- 25,33 ----
  	define('PHPBB_MSG_HANDLER', 'titania_msg_handler');
  }
  
+ // Include the non-dynamic constants
+ require(TITANIA_ROOT . 'includes/constants.' . PHP_EXT);
+ 
  // Include core classes
  require(TITANIA_ROOT . 'includes/core/phpbb.' . PHP_EXT);
  require(TITANIA_ROOT . 'includes/core/titania.' . PHP_EXT);
***************
*** 48,55 ****
  	titania::read_config_file('../' . TITANIA_ROOT . 'config.' . PHP_EXT);
  }
  
! // Include the constants (after reading the Titania config file, but before loading the phpBB common file)
! titania::_include('constants');
  
  // Include common phpBB files and functions.
  if (!file_exists(PHPBB_ROOT_PATH . 'common.' . PHP_EXT))
--- 51,58 ----
  	titania::read_config_file('../' . TITANIA_ROOT . 'config.' . PHP_EXT);
  }
  
! // Include the dynamic constants (after reading the Titania config file, but before loading the phpBB common file)
! titania::_include('dynamic_constants');
  
  // Include common phpBB files and functions.
  if (!file_exists(PHPBB_ROOT_PATH . 'common.' . PHP_EXT))

Modified: trunk/titania/contributions/faq.php
==============================================================================
*** trunk/titania/contributions/faq.php (original)
--- trunk/titania/contributions/faq.php Sun Apr 18 02:11:04 2010
***************
*** 59,65 ****
  			'attachments'	=> true,
  		));
  		$message->set_settings(array(
! 			'attachments_group'		=> TITANIA_ATTACH_EXT_FAQ,
  		));
  
  		// Submit check...handles running $faq->post_data() if required
--- 59,65 ----
  			'attachments'	=> true,
  		));
  		$message->set_settings(array(
! 			'attachments_group'		=> TITANIA_FAQ,
  		));
  
  		// Submit check...handles running $faq->post_data() if required

Modified: trunk/titania/contributions/manage.php
==============================================================================
*** trunk/titania/contributions/manage.php (original)
--- trunk/titania/contributions/manage.php Sun Apr 18 02:11:04 2010
***************
*** 82,88 ****
  // Screenshots
  $screenshot = new titania_attachment(TITANIA_SCREENSHOT, titania::$contrib->contrib_id);
  $screenshot->load_attachments();
! $screenshot->upload(TITANIA_ATTACH_EXT_SCREENSHOTS, 175);
  $error = array_merge($error, $screenshot->error);
  if ($screenshot->uploaded)
  {
--- 82,88 ----
  // Screenshots
  $screenshot = new titania_attachment(TITANIA_SCREENSHOT, titania::$contrib->contrib_id);
  $screenshot->load_attachments();
! $screenshot->upload(175);
  $error = array_merge($error, $screenshot->error);
  if ($screenshot->uploaded)
  {

Modified: trunk/titania/contributions/revision.php
==============================================================================
*** trunk/titania/contributions/revision.php (original)
--- trunk/titania/contributions/revision.php Sun Apr 18 02:11:04 2010
***************
*** 96,102 ****
  			// Upload the revision
  			$revision_attachment = new titania_attachment(TITANIA_CONTRIB, titania::$contrib->contrib_id);
  			$revision_attachment->is_orphan = false;
! 			$revision_attachment->upload(TITANIA_ATTACH_EXT_CONTRIB);
  			$revision_version = utf8_normalize_nfc(request_var('revision_version', '', true));
  			$queue_allow_repack = request_var('queue_allow_repack', 0);
  
--- 96,102 ----
  			// Upload the revision
  			$revision_attachment = new titania_attachment(TITANIA_CONTRIB, titania::$contrib->contrib_id);
  			$revision_attachment->is_orphan = false;
! 			$revision_attachment->upload();
  			$revision_version = utf8_normalize_nfc(request_var('revision_version', '', true));
  			$queue_allow_repack = request_var('queue_allow_repack', 0);
  

Modified: trunk/titania/contributions/support.php
==============================================================================
*** trunk/titania/contributions/support.php (original)
--- trunk/titania/contributions/support.php Sun Apr 18 02:11:04 2010
***************
*** 63,69 ****
  }
  
  // Handle replying/editing/etc
! $posting_helper = new titania_posting(TITANIA_ATTACH_EXT_SUPPORT);
  $posting_helper->act('contributions/contribution_support_post.html', titania::$contrib->contrib_id, titania::$contrib->get_url('support'), TITANIA_SUPPORT);
  
  phpbb::$user->add_lang('viewforum');
--- 63,69 ----
  }
  
  // Handle replying/editing/etc
! $posting_helper = new titania_posting();
  $posting_helper->act('contributions/contribution_support_post.html', titania::$contrib->contrib_id, titania::$contrib->get_url('support'), TITANIA_SUPPORT);
  
  phpbb::$user->add_lang('viewforum');

Modified: trunk/titania/includes/constants.php
==============================================================================
*** trunk/titania/includes/constants.php (original)
--- trunk/titania/includes/constants.php Sun Apr 18 02:11:04 2010
***************
*** 22,58 ****
  	define('IN_PHPBB', true);
  }
  
- // Some often used path constants
- define('PHPBB_ROOT_PATH', TITANIA_ROOT . titania::$config->phpbb_root_path);
- 
- // phpBB 3.x compatibility
- global $phpbb_root_path, $phpEx;
- $phpbb_root_path = PHPBB_ROOT_PATH;
- $phpEx = PHP_EXT;
- 
- // Table names
- $table_prefix = titania::$config->table_prefix;
- define('TITANIA_ATTACHMENTS_TABLE',				$table_prefix . 'attachments');
- define('TITANIA_ATTENTION_TABLE',				$table_prefix . 'attention');
- define('TITANIA_AUTOMOD_QUEUE_TABLE',			$table_prefix . 'automod_queue');
- define('TITANIA_AUTHORS_TABLE',					$table_prefix . 'authors');
- define('TITANIA_CATEGORIES_TABLE',				$table_prefix . 'categories');
- define('TITANIA_CONTRIBS_TABLE',				$table_prefix . 'contribs');
- define('TITANIA_CONTRIB_COAUTHORS_TABLE',		$table_prefix . 'contrib_coauthors');
- define('TITANIA_CONTRIB_FAQ_TABLE',				$table_prefix . 'contrib_faq');
- define('TITANIA_CONTRIB_IN_CATEGORIES_TABLE',	$table_prefix . 'contrib_in_categories');
- define('TITANIA_POSTS_TABLE',					$table_prefix . 'posts');
- define('TITANIA_QUEUE_TABLE',					$table_prefix . 'queue');
- define('TITANIA_RATINGS_TABLE',					$table_prefix . 'ratings');
- define('TITANIA_REVISIONS_TABLE',				$table_prefix . 'revisions');
- define('TITANIA_REVISIONS_PHPBB_TABLE',			$table_prefix . 'revisions_phpbb');
- define('TITANIA_TAG_APPLIED_TABLE',				$table_prefix . 'tag_applied');
- define('TITANIA_TAG_FIELDS_TABLE',				$table_prefix . 'tag_fields');
- define('TITANIA_TAG_TYPES_TABLE',				$table_prefix . 'tag_types');
- define('TITANIA_TOPICS_TABLE',					$table_prefix . 'topics');
- define('TITANIA_TRACK_TABLE',					$table_prefix . 'track');
- define('TITANIA_WATCH_TABLE',					$table_prefix . 'watch');
- 
  // Contribution revision/queue status
  define('TITANIA_QUEUE_DENIED', -2); // Special case to hide denied revisions from the queue
  define('TITANIA_QUEUE_APPROVED', -1); // Special case to hide approved revisions from the queue
--- 22,27 ----
***************
*** 86,97 ****
  define('TITANIA_AUTHOR_HIDDEN', 0);
  define('TITANIA_AUTHOR_VISIBLE', 1);
  
- // Attachment extension groups; use the group_name stored in the phpbb extension groups table
- define('TITANIA_ATTACH_EXT_CONTRIB', 'Titania Contributions');
- define('TITANIA_ATTACH_EXT_SCREENSHOTS', 'Titania Screenshots');
- define('TITANIA_ATTACH_EXT_FAQ', 'Titania Posts: FAQ');
- define('TITANIA_ATTACH_EXT_SUPPORT', 'Titania Posts: Support');
- 
  // Access Levels
  define('TITANIA_ACCESS_TEAMS', 0);
  define('TITANIA_ACCESS_AUTHORS', 1);
--- 55,60 ----

Modified: trunk/titania/includes/core/cache.php
==============================================================================
*** trunk/titania/includes/core/cache.php (original)
--- trunk/titania/includes/core/cache.php Sun Apr 18 02:11:04 2010
***************
*** 272,310 ****
  		// Store the updated cache data
  		$this->put($author_block_name, $author_block);
  	}
- 
- 	/**
- 	* Obtain allowed extensions
- 	*
- 	* @return array allowed extensions array.
- 	*/
- 	public function obtain_attach_extensions()
- 	{
- 		if (($extensions = $this->get('_titania_extensions')) === false)
- 		{
- 			$extensions = array();
- 
- 			$sql = 'SELECT e.extension, g.*
- 				FROM ' . EXTENSIONS_TABLE . ' e, ' . EXTENSION_GROUPS_TABLE . ' g
- 				WHERE e.group_id = g.group_id';
- 			$result = phpbb::$db->sql_query($sql);
- 
- 			while ($row = phpbb::$db->sql_fetchrow($result))
- 			{
- 				$extension = strtolower(trim($row['extension']));
- 
- 				$extensions[$row['group_name']][$extension] = array(
- 					'display_cat'	=> (int) $row['cat_id'],
- 					'download_mode'	=> (int) $row['download_mode'],
- 					'upload_icon'	=> trim($row['upload_icon']),
- 					'max_filesize'	=> (int) $row['max_filesize'],
- 				);
- 			}
- 			 phpbb::$db->sql_freeresult($result);
- 
- 			$this->put('_titania_extensions', $extensions);
- 		}
- 
- 		return $extensions;
- 	}
  }
--- 272,275 ----

Modified: trunk/titania/includes/core/config.php
==============================================================================
*** trunk/titania/includes/core/config.php (original)
--- trunk/titania/includes/core/config.php Sun Apr 18 02:11:04 2010
***************
*** 40,62 ****
  			'upload_path'				=> array('default' => TITANIA_ROOT . 'files/'),
  			'contrib_temp_path'			=> array('default' => TITANIA_ROOT . 'files/contrib_temp/'),
  			'language_path'				=> array('default' => TITANIA_ROOT . 'language/'),
  
  			// Path to demo board we will install styles on
  			'demo_style_path'			=> array('default' => ''),
  			'demo_style_url'			=> array('default' => ''),
  
! 			'phpbbcom_profile'			=> array('default' => true),
! 			'phpbbcom_viewprofile_url'	=> array('default' => 'http://www.phpbb.com/community/memberlist.php?mode=viewprofile&u=%u'),
! 
! 			'table_prefix'				=> array('default' => 'customisation_'),
! 
  			'style'						=> array('default' => 'default'),
  
  			'team_groups'				=> array('default' => array(5)),
  
  			'max_rating'				=> array('default' => 5),
  
! 			'display_backtrace'			=> array('default' => 2), // Display backtrace? 0 = never, 1 = for administrators, 2 = for TITANIA_ACCESS_TEAMS, 3 = for all
  
  			// Search backend (zend or solr (if solr, set the correct ip/port))
  			'search_backend'			=> array('default' => 'zend'),
--- 40,76 ----
  			'upload_path'				=> array('default' => TITANIA_ROOT . 'files/'),
  			'contrib_temp_path'			=> array('default' => TITANIA_ROOT . 'files/contrib_temp/'),
  			'language_path'				=> array('default' => TITANIA_ROOT . 'language/'),
+ 			'table_prefix'				=> array('default' => 'customisation_'),
  
  			// Path to demo board we will install styles on
  			'demo_style_path'			=> array('default' => ''),
  			'demo_style_url'			=> array('default' => ''),
  
! 			// Style to display
  			'style'						=> array('default' => 'default'),
  
+ 			// Groups who receive TITANIA_ACCESS_TEAMS level auth
  			'team_groups'				=> array('default' => array(5)),
  
+ 			// Maximum rating allowed when rating stuff
  			'max_rating'				=> array('default' => 5),
  
! 			'phpbbcom_profile'			=> array('default' => true),
! 			'phpbbcom_viewprofile_url'	=> array('default' => 'http://www.phpbb.com/community/memberlist.php?mode=viewprofile&u=%u'),
! 
! 			// Mod/style database release forums (receive announcements on updates/approval)
! 			'forum_mod_database'		=> array('default' => 0),
! 			'forum_style_database'		=> array('default' => 0),
! 
! 			// Accounts to use for posting in the forum
! 			'forum_mod_robot'			=> array('default' => 0),
! 			'forum_style_robot'			=> array('default' => 0),
! 
! 			// Show the support/discussion panel to the public?
! 			'support_in_titania'		=> array('default' => true),
! 
! 			// Display backtrace? 0 = never, 1 = for administrators, 2 = for TITANIA_ACCESS_TEAMS, 3 = for all
! 			'display_backtrace'			=> array('default' => 2),
  
  			// Search backend (zend or solr (if solr, set the correct ip/port))
  			'search_backend'			=> array('default' => 'zend'),
***************
*** 67,84 ****
  			'require_validation'		=> array('default' => true),
  			'use_queue'					=> array('default' => true),
  
- 			'upload_max_filesize'		=> array('default' => array(
- 				// Cannot use constants because they are included later
- 				'Titania Contributions'		=> 10485760, // 10 MiB
- 				'Titania Screenshots'		=> 524288, // 512 Kib
- 			)),
- 
  			// phpBB versions array
  			'phpbb_versions'			=> array('default' => array(
  				'20'	=> array('latest_revision' => '23', 'name' => 'phpBB 2.0.x', 'allow_uploads' => false),
  				'30'	=> array('latest_revision' => '7-pl1', 'name' => 'phpBB 3.0.x', 'allow_uploads' => true),
  			)),
  
  			'mpv_server_list'			=> array('default' => array(
  				array(
  					'host'		=> 'mpv.phpbb.com',
--- 81,93 ----
  			'require_validation'		=> array('default' => true),
  			'use_queue'					=> array('default' => true),
  
  			// phpBB versions array
  			'phpbb_versions'			=> array('default' => array(
  				'20'	=> array('latest_revision' => '23', 'name' => 'phpBB 2.0.x', 'allow_uploads' => false),
  				'30'	=> array('latest_revision' => '7-pl1', 'name' => 'phpBB 3.0.x', 'allow_uploads' => true),
  			)),
  
+ 			// MPV server(s)
  			'mpv_server_list'			=> array('default' => array(
  				array(
  					'host'		=> 'mpv.phpbb.com',
***************
*** 87,98 ****
  				),
  			)),
  
! 			'forum_mod_database'		=> array('default' => 0),
! 			'forum_style_database'		=> array('default' => 0),
! 			'forum_mod_robot'			=> array('default' => 0),
! 			'forum_style_robot'			=> array('default' => 0),
  
! 			'support_in_titania'		=> array('default' => 1), // Show the support/discussion panel to the public?
  		));
  	}
  }
--- 96,140 ----
  				),
  			)),
  
! 			/**
! 			* Attachments -------
! 			*/
! 			'upload_max_filesize'		=> array('default' => array(
! 				TITANIA_CONTRIB		=> 10485760, // 10 MiB
! 				TITANIA_SCREENSHOT	=> 524288, // 512 Kib
! 			)),
  
! 			// Extensions allowed
! 			'upload_allowed_extensions'	=> array('default' => array(
! 				TITANIA_CONTRIB				=> array('zip'),
! 				TITANIA_SCREENSHOT			=> array('jpg', 'jpeg', 'gif', 'png', 'tif', 'tiff'),
! 				TITANIA_SUPPORT				=> array(
! 					'zip', 'tar', 'gz', '7z', 'bz2', 'gtar',
! 					'jpg', 'jpeg', 'gif', 'png', 'tif', 'tiff'
! 				),
! 				TITANIA_QUEUE				=> array(
! 					'zip', 'tar', 'gz', '7z', 'bz2', 'gtar',
! 					'jpg', 'jpeg', 'gif', 'png', 'tif', 'tiff'
! 				),
! 				TITANIA_QUEUE_DISCUSSION	=> array(
! 					'zip', 'tar', 'gz', '7z', 'bz2', 'gtar',
! 					'jpg', 'jpeg', 'gif', 'png', 'tif', 'tiff'
! 				),
! 				TITANIA_FAQ					=> array(
! 					'zip', 'tar', 'gz', '7z', 'bz2', 'gtar',
! 					'jpg', 'jpeg', 'gif', 'png', 'tif', 'tiff'
! 				),
! 			)),
! 
! 			// Attachment directory names
! 			'upload_directory'	=> array('default' => array(
! 				TITANIA_CONTRIB				=> 'revisions',
! 				TITANIA_SCREENSHOT			=> 'screenshots',
! 				TITANIA_SUPPORT				=> 'support',
! 				TITANIA_QUEUE				=> 'queue',
! 				TITANIA_QUEUE_DISCUSSION	=> 'queue_discussion',
! 				TITANIA_FAQ					=> 'faq',
! 			)),
  		));
  	}
  }

Added: trunk/titania/includes/dynamic_constants.php
==============================================================================
*** trunk/titania/includes/dynamic_constants.php (added)
--- trunk/titania/includes/dynamic_constants.php Sun Apr 18 02:11:04 2010
***************
*** 0 ****
--- 1,48 ----
+ <?php
+ /**
+ *
+ * @package Titania
+ * @version $Id$
+ * @copyright (c) 2008 phpBB Customisation Database Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ *
+ */
+ 
+ /**
+  * @ignore
+  */
+ if (!defined('IN_TITANIA'))
+ {
+ 	exit;
+ }
+ 
+ // Some often used path constants
+ define('PHPBB_ROOT_PATH', TITANIA_ROOT . titania::$config->phpbb_root_path);
+ 
+ // phpBB 3.x compatibility
+ global $phpbb_root_path, $phpEx;
+ $phpbb_root_path = PHPBB_ROOT_PATH;
+ $phpEx = PHP_EXT;
+ 
+ // Table names
+ $table_prefix = titania::$config->table_prefix;
+ define('TITANIA_ATTACHMENTS_TABLE',				$table_prefix . 'attachments');
+ define('TITANIA_ATTENTION_TABLE',				$table_prefix . 'attention');
+ define('TITANIA_AUTOMOD_QUEUE_TABLE',			$table_prefix . 'automod_queue');
+ define('TITANIA_AUTHORS_TABLE',					$table_prefix . 'authors');
+ define('TITANIA_CATEGORIES_TABLE',				$table_prefix . 'categories');
+ define('TITANIA_CONTRIBS_TABLE',				$table_prefix . 'contribs');
+ define('TITANIA_CONTRIB_COAUTHORS_TABLE',		$table_prefix . 'contrib_coauthors');
+ define('TITANIA_CONTRIB_FAQ_TABLE',				$table_prefix . 'contrib_faq');
+ define('TITANIA_CONTRIB_IN_CATEGORIES_TABLE',	$table_prefix . 'contrib_in_categories');
+ define('TITANIA_POSTS_TABLE',					$table_prefix . 'posts');
+ define('TITANIA_QUEUE_TABLE',					$table_prefix . 'queue');
+ define('TITANIA_RATINGS_TABLE',					$table_prefix . 'ratings');
+ define('TITANIA_REVISIONS_TABLE',				$table_prefix . 'revisions');
+ define('TITANIA_REVISIONS_PHPBB_TABLE',			$table_prefix . 'revisions_phpbb');
+ define('TITANIA_TAG_APPLIED_TABLE',				$table_prefix . 'tag_applied');
+ define('TITANIA_TAG_FIELDS_TABLE',				$table_prefix . 'tag_fields');
+ define('TITANIA_TAG_TYPES_TABLE',				$table_prefix . 'tag_types');
+ define('TITANIA_TOPICS_TABLE',					$table_prefix . 'topics');
+ define('TITANIA_TRACK_TABLE',					$table_prefix . 'track');
+ define('TITANIA_WATCH_TABLE',					$table_prefix . 'watch');
\ No newline at end of file

Propchange: trunk/titania/includes/dynamic_constants.php
------------------------------------------------------------------------------
    svn:keywords = Revision Author Date Id

Modified: trunk/titania/includes/functions_install.php
==============================================================================
*** trunk/titania/includes/functions_install.php (original)
--- trunk/titania/includes/functions_install.php Sun Apr 18 02:11:04 2010
***************
*** 104,111 ****
  			titania_search::truncate();
  		break;
  	}
- 
- 	titania_ext_groups($action);
  }
  
  function titania_tags()
--- 104,109 ----
***************
*** 351,464 ****
  	);
  
  	$umil->table_row_insert(TITANIA_CATEGORIES_TABLE, $categories);
! }
! 
! function titania_ext_groups($action)
! {
! 	$ext_groups = array(
! 		TITANIA_ATTACH_EXT_CONTRIB		=> array('default_set' => array('zip'), 'sql' => array('upload_icon' => 'zip.png')),
! 		TITANIA_ATTACH_EXT_SCREENSHOTS	=> array('default' => 'Images'),
! 		TITANIA_ATTACH_EXT_SUPPORT		=> array('default' => array('Archives', 'Images')),
! 		TITANIA_ATTACH_EXT_FAQ			=> array('default' => array('Archives', 'Images')),
! 	);
! 
! 	switch ($action)
! 	{
! 		case 'update' :
! 			titania_ext_groups('uninstall');
! 			titania_ext_groups('install');
! 		break;
! 
! 		case 'install' :
! 			// Add Titania ext groups.
! 			foreach ($ext_groups as $group_name => $extra)
! 			{
! 				$sql_ary = array(
! 					'group_name'		=> $group_name,
! 					'cat_id'			=> 0,
! 					'allow_group'		=> 0,
! 					'download_mode'		=> 1,
! 					'upload_icon'		=> '',
! 					'max_filesize'		=> 0,
! 					'allowed_forums'	=> '',
! 					'allow_in_pm'		=> 0,
! 				);
! 				if (isset($extra['sql']))
! 				{
! 					$sql_ary = array_merge($sql_ary, $extra['sql']);
! 				}
! 
! 				phpbb::$db->sql_query('INSERT INTO ' . EXTENSION_GROUPS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary));
! 				$group_id = phpbb::$db->sql_nextid();
! 
! 				if (isset($extra['default']))
! 				{
! 					$sql_ary = array(
! 						'SELECT'	=> 'e.extension',
! 
! 						'FROM'		=> array(EXTENSION_GROUPS_TABLE 	=> 'g'),
! 
! 						'LEFT_JOIN'	=> array(
! 							array(
! 								'FROM'	=> array(EXTENSIONS_TABLE 		=> 'e'),
! 								'ON'	=> 'e.group_id = g.group_id'
! 							),
! 						),
! 
! 						'WHERE'		=> ((is_array($extra['default'])) ? phpbb::$db->sql_in_set('g.group_name', $extra['default']) : "g.group_name = '{$extra['default']}'"),
! 					);
! 					$sql = phpbb::$db->sql_build_query('SELECT', $sql_ary);
! 					$result = phpbb::$db->sql_query($sql);
! 
! 					$sql_ary = array();
! 
! 					while ($row = phpbb::$db->sql_fetchrow($result))
! 					{
! 						$sql_ary[] = array(
! 							'group_id'		=> $group_id,
! 							'extension'		=> $row['extension'],
! 						);
! 					}
! 
! 					phpbb::$db->sql_freeresult($result);
! 
! 					phpbb::$db->sql_multi_insert(EXTENSIONS_TABLE, $sql_ary);
! 				}
! 				else if (isset($extra['default_set']))
! 				{
! 					$sql_ary = array();
! 					foreach ($extra['default_set'] as $extension)
! 					{
! 						$sql_ary[] = array(
! 							'group_id'		=> $group_id,
! 							'extension'		=> $extension,
! 						);
! 					}
! 					phpbb::$db->sql_multi_insert(EXTENSIONS_TABLE, $sql_ary);
! 				}
! 			}
! 		break;
! 
! 		case 'uninstall':
! 			// Get group ids Titania ext groups.
! 			$sql = 'SELECT group_id
! 				FROM ' . EXTENSION_GROUPS_TABLE . '
! 				WHERE ' . phpbb::$db->sql_in_set('group_name', array_keys($ext_groups));
! 			$result = phpbb::$db->sql_query($sql);
! 
! 			while ($row = phpbb::$db->sql_fetchrow($result))
! 			{
! 				$sql = 'DELETE FROM ' . EXTENSIONS_TABLE . '
! 					WHERE group_id = ' . $row['group_id'];
! 				phpbb::$db->sql_query($sql);
! 			}
! 			phpbb::$db->sql_freeresult($result);
! 
! 			$sql = 'DELETE FROM ' . EXTENSION_GROUPS_TABLE . '
! 				WHERE ' . phpbb::$db->sql_in_set('group_name', array_keys($ext_groups));
! 			phpbb::$db->sql_query($sql);
! 		break;
! 	}
! 
! 	phpbb::$cache->destroy('_titania_extensions');
! }
--- 349,352 ----
  	);
  
  	$umil->table_row_insert(TITANIA_CATEGORIES_TABLE, $categories);
! }
\ No newline at end of file

Modified: trunk/titania/includes/tools/attachment.php
==============================================================================
*** trunk/titania/includes/tools/attachment.php (original)
--- trunk/titania/includes/tools/attachment.php Sun Apr 18 02:11:04 2010
***************
*** 256,265 ****
  	/**
  	* Upload any files we attempted to attach
  	*
- 	* @param string $ext_group The name of the extension group to allow (see TITANIA_ATTACH_EXT_ constants)
  	* @param bool|int $max_thumbnail_width The maximum thumbnail width (if we create one)
  	*/
! 	public function upload($ext_group, $max_thumbnail_width = false)
  	{
  		// First, we shall handle the items already attached
  		$attached_ids = request_var($this->form_name . '_attachments', array(0));
--- 256,264 ----
  	/**
  	* Upload any files we attempted to attach
  	*
  	* @param bool|int $max_thumbnail_width The maximum thumbnail width (if we create one)
  	*/
! 	public function upload($max_thumbnail_width = false)
  	{
  		// First, we shall handle the items already attached
  		$attached_ids = request_var($this->form_name . '_attachments', array(0));
***************
*** 309,315 ****
  		if ((isset($_FILES[$this->form_name]) && $_FILES[$this->form_name]['name'] != 'none' && trim($_FILES[$this->form_name]['name'])))
  		{
  			// Setup uploader tool.
! 			$this->uploader = new titania_uploader($this->form_name, $ext_group);
  
  			// Try uploading the file.
  			$this->uploader->upload_file();
--- 308,314 ----
  		if ((isset($_FILES[$this->form_name]) && $_FILES[$this->form_name]['name'] != 'none' && trim($_FILES[$this->form_name]['name'])))
  		{
  			// Setup uploader tool.
! 			$this->uploader = new titania_uploader($this->form_name, $this->object_type);
  
  			// Try uploading the file.
  			$this->uploader->upload_file();

Modified: trunk/titania/includes/tools/posting.php
==============================================================================
*** trunk/titania/includes/tools/posting.php (original)
--- trunk/titania/includes/tools/posting.php Sun Apr 18 02:11:04 2010
***************
*** 18,35 ****
  
  class titania_posting
  {
- 	/**
- 	* Attachments Extension Group
- 	*
- 	* @var string|bool Constant for the extension group or bool false to not allow attachments
- 	*/
- 	public $attachments_group;
- 
- 	public function __construct($attachments_group = false)
- 	{
- 		$this->attachments_group = $attachments_group;
- 	}
- 
  	public function act($template_body, $parent_id = false, $parent_url = false, $post_type = false, $s_post_action = false)
  	{
  		$action = request_var('action', '');
--- 18,23 ----
***************
*** 145,151 ****
  		));
  		$message_object->set_settings(array(
  			'display_captcha'			=> (!phpbb::$user->data['is_registered']) ? true : false,
! 			'attachments_group'			=> $this->attachments_group,
  		));
  
  		// Call our common posting handler
--- 133,139 ----
  		));
  		$message_object->set_settings(array(
  			'display_captcha'			=> (!phpbb::$user->data['is_registered']) ? true : false,
! 			'attachments_group'			=> $post_object->topic->topic_type,
  		));
  
  		// Call our common posting handler
***************
*** 207,213 ****
  		$message_object->set_settings(array(
  			'display_captcha'			=> (!phpbb::$user->data['is_registered']) ? true : false,
  			'subject_default_override'	=> 'Re: ' . $post_object->topic->topic_subject,
! 			'attachments_group'			=> $this->attachments_group,
  		));
  
  		// Call our common posting handler
--- 195,201 ----
  		$message_object->set_settings(array(
  			'display_captcha'			=> (!phpbb::$user->data['is_registered']) ? true : false,
  			'subject_default_override'	=> 'Re: ' . $post_object->topic->topic_subject,
! 			'attachments_group'			=> $post_object->topic->topic_type,
  		));
  
  		// Call our common posting handler
***************
*** 272,278 ****
  			'attachments'	=> phpbb::$auth->acl_get('u_titania_post_attach'),
  		));
  		$message_object->set_settings(array(
! 			'attachments_group'			=> $this->attachments_group,
  		));
  
  		// Call our common posting handler
--- 260,266 ----
  			'attachments'	=> phpbb::$auth->acl_get('u_titania_post_attach'),
  		));
  		$message_object->set_settings(array(
! 			'attachments_group'			=> $post_object->topic->topic_type,
  		));
  
  		// Call our common posting handler

Modified: trunk/titania/includes/tools/uploader.php
==============================================================================
*** trunk/titania/includes/tools/uploader.php (original)
--- trunk/titania/includes/tools/uploader.php Sun Apr 18 02:11:04 2010
***************
*** 43,49 ****
  	 * Class constructor
  	 *
  	 * @param string $form_name Form name from where we can find the file.
! 	 * @param string $ext_group The name of the extension group (TITANIA_ATTACH_EXT_ constants)
  	 */
  	public function __construct($form_name, $ext_group)
  	{
--- 43,49 ----
  	 * Class constructor
  	 *
  	 * @param string $form_name Form name from where we can find the file.
! 	 * @param string $ext_group The extension type (use the same as what is in titania::$config->upload_allowed_extensions)
  	 */
  	public function __construct($form_name, $ext_group)
  	{
***************
*** 71,78 ****
  			return false;
  		}
  
! 		$extensions = titania::$cache->obtain_attach_extensions();
! 		$this->set_allowed_extensions(array_keys($extensions[$this->ext_group]));
  
  		$file = $this->form_upload($this->form_name);
  
--- 71,84 ----
  			return false;
  		}
  
! 		if (!isset(titania::$config->upload_allowed_extensions[$this->ext_group]))
! 		{
! 			$this->filedata['error'][] = phpbb::$user->lang['NO_UPLOAD_FORM_FOUND'];
! 
! 			return false;
! 		}
! 
! 		$this->set_allowed_extensions(titania::$config->upload_allowed_extensions[$this->ext_group]);
  
  		$file = $this->form_upload($this->form_name);
  
***************
*** 99,105 ****
  		$file->clean_filename('unique', phpbb::$user->data['user_id'] . '_');
  
  		// Move files into their own directory depending on the extension group assigned.  Should keep at least some of it organized.
! 		$move_dir = preg_replace('#[^a-z0-9_/]#', '', str_replace(' ', '_', utf8_strtolower($this->ext_group)));
  
  		if (!file_exists(titania::$config->upload_path . $move_dir))
  		{
--- 105,117 ----
  		$file->clean_filename('unique', phpbb::$user->data['user_id'] . '_');
  
  		// Move files into their own directory depending on the extension group assigned.  Should keep at least some of it organized.
! 		if (!isset(titania::$config->upload_directory[$this->ext_group]))
! 		{
! 			$this->filedata['error'][] = phpbb::$user->lang['NO_UPLOAD_FORM_FOUND'];
! 
! 			return false;
! 		}
! 		$move_dir = titania::$config->upload_directory[$this->ext_group];
  
  		if (!file_exists(titania::$config->upload_path . $move_dir))
  		{

Modified: trunk/titania/manage/queue.php
==============================================================================
*** trunk/titania/manage/queue.php (original)
--- trunk/titania/manage/queue.php Sun Apr 18 02:11:04 2010
***************
*** 91,97 ****
  ));
  
  // Handle replying/editing/etc
! $posting_helper = new titania_posting(TITANIA_ATTACH_EXT_SUPPORT);
  $posting_helper->act('manage/queue_post.html');
  
  // Main output
--- 91,97 ----
  ));
  
  // Handle replying/editing/etc
! $posting_helper = new titania_posting();
  $posting_helper->act('manage/queue_post.html');
  
  // Main output




More information about the customisationdb-commits mailing list