[Customisation Database Commits] r600 - in /trunk/titania: ariel_convert.php contributions/manage.php download/file.php includes/constants.php

Nathan Guse exreaction at phpbb.com
Sun Feb 14 23:04:32 GMT 2010


Author: exreaction
Date: Sun Feb 14 23:04:31 2010
New Revision: 600

Log:
Converting 2.0 stuff as well now, just not putting them in any categories (only visible by viewing directly).


Modified:
    trunk/titania/ariel_convert.php
    trunk/titania/contributions/manage.php
    trunk/titania/download/file.php
    trunk/titania/includes/constants.php

Modified: trunk/titania/ariel_convert.php
==============================================================================
*** trunk/titania/ariel_convert.php (original)
--- trunk/titania/ariel_convert.php Sun Feb 14 23:04:31 2010
***************
*** 130,138 ****
  		while ($row = phpbb::$db->sql_fetchrow($result))
  		{
  			$ignore = array(-1, 3);
! 			if ($row['contrib_phpbb_version'][0] != '3' || in_array($row['contrib_status'], $ignore) || !in_array($row['contrib_type'], array_keys(titania_types::$types)))
  			{
! 				// Skip 2.0 mods, contribs that were denied or pulled and weird ones
  				continue;
  			}
  
--- 130,138 ----
  		while ($row = phpbb::$db->sql_fetchrow($result))
  		{
  			$ignore = array(-1, 3);
! 			if (in_array($row['contrib_status'], $ignore) || !in_array($row['contrib_type'], array_keys(titania_types::$types)))
  			{
! 				// Skip contribs that were denied or pulled and weird ones
  				continue;
  			}
  
***************
*** 186,191 ****
--- 186,197 ----
  				break;
  			}
  
+ 			// Set 2.0 mods to cleaned
+ 			if ($row['contrib_phpbb_version'][0] != '3')
+ 			{
+ 				$contrib_status = TITANIA_CONTRIB_CLEANED;
+ 			}
+ 
  			$sql_ary = array(
  				'contrib_id'					=> $row['contrib_id'],
  				'contrib_user_id'				=> $row['user_id'],
***************
*** 210,232 ****
  			// Insert
  			titania_insert(TITANIA_CONTRIBS_TABLE, $sql_ary);
  
! 			$sql = 'SELECT tag_id FROM ' . $ariel_prefix . 'contrib_tags
! 				WHERE contrib_id = ' . (int) $row['contrib_id'];
! 			$result1 = phpbb::$db->sql_query($sql);
! 			while ($tag_row = phpbb::$db->sql_fetchrow($result1))
  			{
! 				$sql_ary = array(
! 					'contrib_id'	=> $row['contrib_id'],
! 				);
! 
! 				if (isset($tags_to_cats[$tag_row['tag_id']]))
  				{
! 					$sql_ary['category_id'] = $tags_to_cats[$tag_row['tag_id']];
  
! 					titania_insert(TITANIA_CONTRIB_IN_CATEGORIES_TABLE, $sql_ary);
  				}
  			}
- 			phpbb::$db->sql_freeresult($result1);
  		}
  		phpbb::$db->sql_freeresult($result);
  
--- 216,242 ----
  			// Insert
  			titania_insert(TITANIA_CONTRIBS_TABLE, $sql_ary);
  
! 			// Convert 2.0 mods, but do not put them in any categories
! 			if ($row['contrib_phpbb_version'][0] == '3')
  			{
! 				$sql = 'SELECT tag_id FROM ' . $ariel_prefix . 'contrib_tags
! 					WHERE contrib_id = ' . (int) $row['contrib_id'];
! 				$result1 = phpbb::$db->sql_query($sql);
! 				while ($tag_row = phpbb::$db->sql_fetchrow($result1))
  				{
! 					$sql_ary = array(
! 						'contrib_id'	=> $row['contrib_id'],
! 					);
  
! 					if (isset($tags_to_cats[$tag_row['tag_id']]))
! 					{
! 						$sql_ary['category_id'] = $tags_to_cats[$tag_row['tag_id']];
! 
! 						titania_insert(TITANIA_CONTRIB_IN_CATEGORIES_TABLE, $sql_ary);
! 					}
  				}
+ 				phpbb::$db->sql_freeresult($result1);
  			}
  		}
  		phpbb::$db->sql_freeresult($result);
  
***************
*** 264,272 ****
  		while ($row = phpbb::$db->sql_fetchrow($result))
  		{
  			$ignore = array(-1, 3);
! 			if ($row['contrib_phpbb_version'][0] != '3' || in_array($row['contrib_status'], $ignore) || !in_array($row['contrib_type'], array_keys(titania_types::$types)))
  			{
! 				// Skip 2.0 mods, contribs that were denied or pulled and weird ones
  				continue;
  			}
  
--- 274,282 ----
  		while ($row = phpbb::$db->sql_fetchrow($result))
  		{
  			$ignore = array(-1, 3);
! 			if (in_array($row['contrib_status'], $ignore) || !in_array($row['contrib_type'], array_keys(titania_types::$types)))
  			{
! 				// Skip contribs that were denied or pulled and weird ones
  				continue;
  			}
  
***************
*** 301,306 ****
--- 311,328 ----
  					}
  				break;
  
+ 				case 'text/plain' :
+ 				case 'text/x-c' :
+ 				case 'text/x-c++' :
+ 				case 'text/x-pascal' :
+ 				case 'text/x-lisp' :
+ 				case 'application/xml' :
+ 					if (!strpos($row['revision_filename'], '.mod'))
+ 					{
+ 						$row['revision_filename'] .= '.mod';
+ 					}
+ 				break;
+ 
  				default :
  					echo $row['revision_filename'] . ' ' . $mime_type . ' ' . $filename . '<br />';
  					continue;
***************
*** 455,466 ****
  	break;
  
  	case 7 :
- 		$sync = new titania_sync;
- 
  		// Truncate index first
! 		//titania_search::truncate();
  
! 		//$sync->contribs('index');
  
  		$display_message = 'Indexing';
  	break;
--- 477,488 ----
  	break;
  
  	case 7 :
  		// Truncate index first
! 		titania_search::truncate();
  
! 		$sync = new titania_sync;
! 
! 		$sync->contribs('index');
  
  		$display_message = 'Indexing';
  	break;

Modified: trunk/titania/contributions/manage.php
==============================================================================
*** trunk/titania/contributions/manage.php (original)
--- trunk/titania/contributions/manage.php Sun Feb 14 23:04:31 2010
***************
*** 24,29 ****
--- 24,34 ----
  {
  	trigger_error('NO_AUTH');
  }
+ else if (titania::$contrib->contrib_status == TITANIA_CONTRIB_CLEANED && !(phpbb::$auth->acl_get('m_titania_contrib_mod') || titania_types::$types[titania::$contrib->contrib_type]->acl_get('moderate')))
+ {
+ 	// Editing cleaned contribs requires moderation permissions
+ 	trigger_error('NO_AUTH');
+ }
  
  // Set some main vars up
  $submit = (isset($_POST['submit']) || isset($_POST['new_revision'])) ? true : false;

Modified: trunk/titania/download/file.php
==============================================================================
*** trunk/titania/download/file.php (original)
--- trunk/titania/download/file.php Sun Feb 14 23:04:31 2010
***************
*** 37,43 ****
  
  if (!$download_id)
  {
! 	trigger_error('NO_ATTACHMENT_SELECTED');
  }
  
  $sql = 'SELECT *
--- 37,57 ----
  
  if (!$download_id)
  {
! 	// Mostly to make moving from Ariel easier
! 	$revision_id = request_var('rid', 0);
! 	if ($revision_id)
! 	{
! 		$sql = 'SELECT attachment_id FROM ' . TITANIA_REVISIONS_TABLE . '
! 			WHERE revision_id = ' . $revision_id;
! 		phpbb::$db->sql_query($sql);
! 		$download_id = phpbb::$db->sql_fetchfield('attachment_id');
! 		phpbb::$db->sql_freeresult();
! 	}
! 
! 	if (!$download_id)
! 	{
! 		trigger_error('NO_ATTACHMENT_SELECTED');
! 	}
  }
  
  $sql = 'SELECT *

Modified: trunk/titania/includes/constants.php
==============================================================================
*** trunk/titania/includes/constants.php (original)
--- trunk/titania/includes/constants.php Sun Feb 14 23:04:31 2010
***************
*** 56,62 ****
  // Contrib status
  define('TITANIA_CONTRIB_NEW', 1); // Does not have any validated revisions
  define('TITANIA_CONTRIB_APPROVED', 2); // Has at least one validated revision
! define('TITANIA_CONTRIB_CLEANED', 3); // From Ariel Conversion - Cleaned up old mods
  
  // Main TYPE constants (use whenever possible)
  define('TITANIA_CONTRIB', 1);
--- 56,62 ----
  // Contrib status
  define('TITANIA_CONTRIB_NEW', 1); // Does not have any validated revisions
  define('TITANIA_CONTRIB_APPROVED', 2); // Has at least one validated revision
! define('TITANIA_CONTRIB_CLEANED', 3); // Cleaned up old items
  
  // Main TYPE constants (use whenever possible)
  define('TITANIA_CONTRIB', 1);




More information about the customisationdb-commits mailing list