changeset 4:6077ff381bf8 1.2-updates

Re #1: Create "root" directory to meet new packaging requirements
author IBBoard <dev@ibboard.co.uk>
date Sun, 07 Jun 2009 18:20:52 +0000
parents e3c4cd9d4938
children be38abf6b5fc
files Install.xml
diffstat 1 files changed, 55 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/Install.xml	Sun Jun 07 18:14:27 2009 +0000
+++ b/Install.xml	Sun Jun 07 18:20:52 2009 +0000
@@ -13,7 +13,9 @@
 		<title lang="en-gb">Multi-race rank themes</title>
 		<description lang="en-gb">This MOD will allow you to add, modify and remove rank themes.
 
-Rank themes are selectable collections of ranks that users can choose to use, allowing RPG forums to have different 'races' or allowing 'normal' forums to provide an set of alternative icon images for their users.</description>
+Rank themes are selectable collections of ranks that normal users can choose to use, allowing RPG forums to have different 'races' or allowing 'normal' forums to provide an set of alternative icon images for their users.
+
+Note that users with "special ranks" (normally Administrators etc.) will not get a theme selection in the UCP as the special rank is their rank theme. If users with special ranks want a themed rank image then you need to also install my "Special and Normal Rank Images" MOD.</description>
 		<author-notes lang="en-gb"><![CDATA[The following description is taken from digiTsai's phpBB2 'Rank themes' mod (with some minor modifications in the last paragraph), as I couldn't word it any better myself:
 
 Different ranking themes for your forum. Users are allowed to choose a ranking theme to their liking. For example, you can add two ranking themes named "Good" and "Evil" for your forum. The ranking then might look like this:
@@ -41,7 +43,7 @@
 		<link-group>
 			<link type="template" href="subsilver2.xml" lang="en-gb">subsilver2</link>
 		</link-group>
-		<mod-version>1.2.3</mod-version>
+		<mod-version>1.2.4</mod-version>
 		<installation>
 			<level>intermediate</level>
 			<time>2700</time>
@@ -49,6 +51,19 @@
 		</installation>
 		<history>
 			<entry>
+				<date>2009-05-31</date>
+				<rev-version>1.2.4</rev-version>
+				<changelog lang="en-gb">
+					<change>Fix: Use some extra constants instead of magic numbers to pass validation</change>
+					<change>Fix: Move some files in package because MOD packaging instructions keep changing</change>
+					<change>Fix: Don't hard-code link in rank themes text</change>
+					<change>Fix: Update finds of get_user_rank in memberlist.php to newer v3.0.4 parameters</change>
+					<change>Change: Make it clear that people with special ranks won't get a rank selection option in the description</change>
+					<change>Change: Make it clearer that deleting a theme deletes the ranks in it (since we can't guess where to put them and we need a standard confirm page so we can't ask the user)</change>
+					<change>Change: Make the default and special rank theme IDs slightly more flexible</change>
+				</changelog>
+			</entry>
+			<entry>
 				<date>2009-05-10</date>
 				<rev-version>1.2.3</rev-version>
 				<changelog lang="en-gb">
@@ -228,8 +243,8 @@
 INSERT INTO phpbb_rank_themes VALUES (-1, 'Special', 0);
 INSERT INTO phpbb_rank_themes VALUES (1, 'Default', 1);]]></sql>
 		<copy>
-			<file from="templates/prosilver/template/memberlist_ranks.html" to="styles/prosilver/template/memberlist_ranks.html" />
-			<file from="templates/prosilver/themes/images/icon_ranks.gif" to="styles/prosilver/themes/images/icon_ranks.gif" />
+			<file from="root/styles/prosilver/template/memberlist_ranks.html" to="styles/prosilver/template/memberlist_ranks.html" />
+			<file from="root/styles/prosilver/themes/images/icon_ranks.gif" to="styles/prosilver/themes/images/icon_ranks.gif" />
 		</copy>
 		<open src="adm/style/acp_ranks.html">
 			<edit>
@@ -350,9 +365,9 @@
 				//$special_rank = request_var('special_rank', 0);
 				$rank_theme = request_var('rank_theme', DEFAULT_RANK_THEME_ID);
 
-				if ($rank_theme < DEFAULT_RANK_THEME_ID)
+				if ($rank_theme <= 0)
 				{
-					$special_rank = 1;
+					$special_rank = 1; //Stick with the phpBB convention and use magic numbers for the "special rank" value
 					$rank_theme = SPECIAL_RANK_THEME_ID;
 				}
 				else
@@ -406,14 +421,14 @@
 			case 'save_theme':
 
 				$theme_title = utf8_normalize_nfc(request_var('title', '', true));
-				$theme_public = request_var('theme_public', 1);
+				$theme_public = request_var('theme_public', RANK_THEME_PUBLIC);
 
 				if (!$theme_title)
 				{
 					trigger_error($user->lang['NO_RANK_THEME_TITLE'] . adm_back_link($this->u_action), E_USER_WARNING);
 				}
 
-				if ($rank_id <= DEFAULT_RANK_THEME_ID && $rank_id != 0)
+				if ($rank_id == DEFAULT_RANK_THEME_ID || $rank_id == SPECIAL_RANK_THEME_ID || $rank_id <= 0)
 				{
 					trigger_error($user->lang['MUST_SELECT_RANK_THEME'] . adm_back_link($this->u_action), E_USER_WARNING);
 				}
@@ -548,8 +563,8 @@
 			$template->assign_block_vars('themes', array(
 				'RANK_THEME_TITLE'	=> $theme['rtheme_title'],
 				'S_THEME_PUBLIC'	=> $theme['rtheme_public'],
-				'U_EDIT_THEME'		=> ($theme['rtheme_id'] > 1 ? $this->u_action . '&amp;action=edit_theme&amp;id=' . $theme['rtheme_id'] : ''),
-				'U_DELETE_THEME'	=> ($theme['rtheme_id'] > 1 ? $this->u_action . '&amp;action=delete_theme&amp;id=' . $theme['rtheme_id'] : '')));
+				'U_EDIT_THEME'		=> (($theme['rtheme_id'] != DEFAULT_RANK_THEME_ID && $theme['rtheme_id'] != SPECIAL_RANK_THEME_ID) ? $this->u_action . '&amp;action=edit_theme&amp;id=' . $theme['rtheme_id'] : ''),
+				'U_DELETE_THEME'	=> (($theme['rtheme_id'] != DEFAULT_RANK_THEME_ID && $theme['rtheme_id'] != SPECIAL_RANK_THEME_ID) ? $this->u_action . '&amp;action=delete_theme&amp;id=' . $theme['rtheme_id'] : '')));
 
 			if (sizeof($ranks[$theme['rtheme_id']]) > 0)
 			{
@@ -578,11 +593,11 @@
 
 		global $db, $user;
 
-		$sql = 'SELECT * FROM ' . RANK_THEMES_TABLE. " WHERE rtheme_id > ".DEFAULT_RANK_THEME_ID." ORDER BY rtheme_title";
+		$sql = 'SELECT * FROM ' . RANK_THEMES_TABLE. ' WHERE rtheme_id <> ' . DEFAULT_RANK_THEME_ID . ' AND rtheme_id <> ' . SPECIAL_RANK_THEME_ID . ' ORDER BY rtheme_title';
 		$result = $db->sql_query($sql);
 
-		$this->rank_themes = array(SPECIAL_RANK_THEME_ID => array('rtheme_id' => SPECIAL_RANK_THEME_ID, 'rtheme_title' => $user->lang['SPECIAL_RANK_THEME'], 'rtheme_public' => false),
-									DEFAULT_RANK_THEME_ID => array('rtheme_id' => DEFAULT_RANK_THEME_ID, 'rtheme_title' => $user->lang['DEFAULT_RANK_THEME'], 'rtheme_public' => true));
+		$this->rank_themes = array(SPECIAL_RANK_THEME_ID => array('rtheme_id' => SPECIAL_RANK_THEME_ID, 'rtheme_title' => $user->lang['SPECIAL_RANK_THEME'], 'rtheme_public' => RANK_THEME_PRIVATE),
+									DEFAULT_RANK_THEME_ID => array('rtheme_id' => DEFAULT_RANK_THEME_ID, 'rtheme_title' => $user->lang['DEFAULT_RANK_THEME'], 'rtheme_public' => RANK_THEME_PUBLIC));
 
 		while ($row = $db->sql_fetchrow($result))
 		{
@@ -594,7 +609,7 @@
 		</open>
 		<open src="includes/cache.php">
 			<edit>
-				<find><![CDATA[$sql = 'SELECT *
+				<find><![CDATA[			$sql = 'SELECT *
 				FROM ' . RANKS_TABLE . '
 				ORDER BY rank_min DESC';]]></find>
 				<action type="replace-with"><![CDATA[			//Make sure we only pull data for public rank themes and the special theme
@@ -612,7 +627,7 @@
 					)
 				),
 
-				'WHERE'		=> 't.rtheme_public OR t.rtheme_id = ' . SPECIAL_RANK_THEME_ID,
+				'WHERE'		=> 't.rtheme_public = ' . RANK_THEME_PUBLIC . ' OR t.rtheme_id = ' . SPECIAL_RANK_THEME_ID,
 				'ORDER_BY'	=> 'r.rank_min DESC'
 			));]]></action>
 			</edit>
@@ -626,10 +641,12 @@
 				<find><![CDATA[// Additional constants]]></find>
 				<action type="after-add"><![CDATA[
 define('SPECIAL_RANK_THEME_ID', -1);
-define('DEFAULT_RANK_THEME_ID', 1);]]></action>
+define('DEFAULT_RANK_THEME_ID', 1);
+define('RANK_THEME_PRIVATE', 0);
+define('RANK_THEME_PUBLIC', 1);]]></action>
 			</edit>
 			<edit>
-				<find><![CDATA[define('RANKS_TABLE',				$table_prefix . 'ranks');]]></find>
+				<find><![CDATA[// Additional tables]]></find>
 				<action type="after-add"><![CDATA[define('RANK_THEMES_TABLE',			$table_prefix . 'rank_themes');]]></action>
 			</edit>
 		</open>
@@ -652,7 +669,9 @@
 				</inline-edit>
 			</edit>
 			<edit>
-				<find><![CDATA[		if (!empty($ranks['normal']))]]></find>
+				<find><![CDATA[		if (!empty($ranks['normal']))
+		{
+			foreach ($ranks['normal'] as $rank)]]></find>
 				<action type="replace-with"><![CDATA[		//Multi-rank theme: find our theme, defaulting to DEFAULT_RANK_THEME_ID if the user chose an invalid value
 		if (!empty($ranks[$rank_theme]))
 		{
@@ -664,11 +683,9 @@
 			$theme = $ranks[DEFAULT_RANK_THEME_ID];
 		}
 
-		if (!empty($theme))]]></action>
-			</edit>
-			<edit>
-				<find><![CDATA[		foreach ($ranks['normal'] as $rank)]]></find>
-				<action type="replace-with"><![CDATA[		foreach ($theme as $rank)]]></action>
+		if (!empty($theme))
+		{
+			foreach ($theme as $rank)]]></action>
 			</edit>
 		</open>
 		<open src="includes/ucp/ucp_profile.php">
@@ -708,7 +725,7 @@
 							RANK_THEMES_TABLE		=> 'r'
 						),
 
-						'WHERE'		=> 'rtheme_public = 1 AND rtheme_id > ' . DEFAULT_RANK_THEME_ID,
+						'WHERE'		=> 'rtheme_public = ' . RANK_THEME_PUBLIC . ' AND rtheme_id <> ' . DEFAULT_RANK_THEME_ID,
 
 						'ORDER_BY'	=> 'rtheme_title ASC',
 					));
@@ -773,7 +790,7 @@
 				RANK_THEMES_TABLE		=> 'r'
 			),
 
-			'WHERE'		=> 'rtheme_public = 1 AND rtheme_id > '.DEFAULT_RANK_THEME_ID,
+			'WHERE'		=> 'rtheme_public = ' . RANK_THEME_PUBLIC . ' AND rtheme_id <> '.DEFAULT_RANK_THEME_ID,
 
 			'ORDER_BY'	=> 'rtheme_title ASC',
 		));
@@ -827,7 +844,7 @@
 				<find><![CDATA[	'RANK_UPDATED'			=> 'The rank was successfully updated.',]]></find>
 				<action type="after-add"><![CDATA[	//Multi-rank theme: Rank theme specific language strings
 	'ADD_RANK_THEME'		=> 'Add new rank theme',
-	'ACP_RANK_THEMES_EXPLAIN'	=> 'Using this form you can add, edit, view and delete rank themes. Rank themes can be made private so that they are not selectable by users.',
+	'ACP_RANK_THEMES_EXPLAIN'	=> 'Using this page you can add, edit, view and delete rank themes. Rank themes can be made private so that they are not selectable by users. Deleting a rank theme will delete all ranks within it.',
 	'RANK_THEME_TITLE'		=> 'Rank theme title',
 	'RANK_THEME_PUBLIC'		=> 'Set as public rank theme',
 	'RANK_THEME'			=> 'Rank theme',
@@ -840,8 +857,8 @@
 		</open>
 		<open src="language/en/common.php">
 			<edit>
-				<find><![CDATA[	'YOU_NO_NEW_PM'		=> 'No new private messages are waiting for you.',]]></find>
-				<action type="after-add"><![CDATA[
+				<find><![CDATA[	'datetime'			=> array(]]></find>
+				<action type="before-add"><![CDATA[
 	//Multi-rank theme: Add in new rank naming
 	'DEFAULT_RANK_THEME'	=> 'Default theme',
 	'SPECIAL_RANK_THEME'	=> 'Special theme',
@@ -857,7 +874,7 @@
 ?>]]></find>
 				<action type="before-add"><![CDATA[// Multi-rank theme: Rank theme list information
 	'RANKTHEMES'		=> 'Rank Themes',
-	'RANKTHEME_TEXT'	=> 'Rank themes allow you to customise the name and image of the rank that is displayed beside your post. For a full list of the ranks within a scheme click on the scheme name. For more detail on ranks please see the <a href="faq.php#f15">FAQ</a>.',
+	'RANKTHEME_TEXT'	=> 'Rank themes allow you to customise the name and image of the rank that is displayed beside your post. For a full list of the ranks within a scheme click on the scheme name. For more detail on ranks please see the <a href="%1$s">FAQ</a>.',
 	'RANK_NAME'		=> 'Rank',
 	'RANK_IMG'		=> 'Rank image',
 	'RANK_POSTS'		=> 'Required post count',
@@ -888,7 +905,7 @@
 				<action type="after-add"><![CDATA[	case 'ranks':]]></action>
 			</edit>
 			<edit>
-				<find><![CDATA[			get_user_rank($row['user_rank'], $row['user_posts'], $rank_title, $rank_img, $rank_img_src);]]></find>
+				<find><![CDATA[			get_user_rank($row['user_rank'], (($row['user_id'] == ANONYMOUS) ? false : $row['user_posts']), $rank_title, $rank_img, $rank_img_src);]]></find>
 				<inline-edit>
 					<inline-find>$rank_img_src</inline-find>
 					<inline-action type="after-add"><![CDATA[, $row['user_rank_theme']]]></inline-action>
@@ -908,11 +925,15 @@
 			// Get list of rank themes
 			$sql = 'SELECT rtheme_id, rtheme_title
 				FROM ' . RANK_THEMES_TABLE . '
-				WHERE rtheme_public = 1
-					AND rtheme_id > ' . DEFAULT_RANK_THEME_ID . '
+				WHERE rtheme_public = ' . RANK_THEME_PUBLIC . '
+					AND rtheme_id <> ' . DEFAULT_RANK_THEME_ID . '
 				ORDER BY rtheme_title ASC';
 			$result = $db->sql_query($sql);
 
+			$template->assign_vars(array(
+				'L_RANKSET_TEXT' => sprintf($user->lang['RANKSET_TEXT'], append_sid("{$phpbb_root_path}faq.{$phpExt}#f15"))
+			));
+
 			$template->assign_block_vars('rankset', array(
 				'RANKSET_URL' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=ranks&amp;r=' . DEFAULT_RANK_THEME_ID),
 				'RANKSET_NAME' => $user->lang['DEFAULT_RANK_THEME']
@@ -932,7 +953,7 @@
 		{
 			$sql = 'SELECT rtheme_title
 				FROM ' . RANK_THEMES_TABLE . '
-				WHERE rtheme_public = 1
+				WHERE rtheme_public = ' . RANK_THEME_PUBLIC . '
 					AND rtheme_id = ' . $rank_theme;
 			$result = $db->sql_query($sql);
 			$row = $db->sql_fetchrow($result);
@@ -972,7 +993,7 @@
 	break;]]></action>
 			</edit>
 			<edit>
-				<find><![CDATA[	get_user_rank($data['user_rank'], $data['user_posts'], $rank_title, $rank_img, $rank_img_src);]]></find>
+				<find><![CDATA[	get_user_rank($data['user_rank'], (($user_id == ANONYMOUS) ? false : $data['user_posts']), $rank_title, $rank_img, $rank_img_src);]]></find>
 				<inline-edit>
 					<inline-find>$rank_img_src</inline-find>
 					<inline-action type="after-add"><![CDATA[, $data['user_rank_theme']]]></inline-action>