##############################################################
## MOD Title:		Update Forumtitle as Weblink
## MOD Author: OXPUS < webmaster@oxpus.de > (Karsten Ude) http://www.oxpus.de
## MOD Description:	Update from 1.0.0 to 1.1.0
## MOD Version:		1.0.2
##
## Installation Level:	Easy
## Installation Time:	3-5 Minutes
## Files To Edit:	6
##			index.php
##			admin/admin_forums.php
##			language/lang_english/lang_admin.php
##			language/lang_german/lang_admin.php
##			templates/subSilver/index_body.tpl
##			templates/subSilver/admin/forum_edit_body.tpl
##
## Included Files:	n/a
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
## Instead entering the given SQL-Statement, you can upload the file db_update_1_1_0.php
## to your phpbb root directory and run this with your browser.
## This file will do all nessassary changes in the database for you.
## After using this file, please delete it to avoid errors.
##
## If you have installed the Categories Hierarchy Mod, don't install this mod, too!
## Creating a forum as a weblink is possible with the Categories Hierarchy Mod!
##
##############################################################
## MOD History:
##
##   2004-02-08 - Version 1.0.2
##      - Fixed a typo in the HowTo
##
##   2004-01-25 - Version 1.0.1
##      - Passed through the phpBB.com Mod Validator
##
##   2004-01-21 - Version 1.0.0
##      - First release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ SQL ]------------------------------------------
#
ALTER TABLE `phpbb_forums` ADD `forum_link_icon` VARCHAR( 200 ) NOT NULL;

#
#-----[ OPEN ]------------------------------------------
#
index.php

#
#-----[ FIND ]------------------------------------------
#
								'POSTS' => $forum_data[$j]['forum_posts'],
								'TOPICS' => $forum_data[$j]['forum_topics'],
								'LAST_POST' => $last_post,

#
#-----[ REPLACE WITH ]------------------------------------------
#
								'POSTS' => ( $forum_data[$j]['forum_link_icon'] != '' && $forum_data[$j]['title_is_link'] == 1 ) ? '' : $forum_data[$j]['forum_posts'],
								'TOPICS' => ( $forum_data[$j]['forum_link_icon'] != '' && $forum_data[$j]['title_is_link'] == 1 ) ? '' : $forum_data[$j]['forum_topics'],
								'LAST_POST' => ( $forum_data[$j]['forum_link_icon'] != '' && $forum_data[$j]['title_is_link'] == 1 ) ? '' : $last_post,


#
#-----[ FIND ]------------------------------------------
#
								'FORUM_FOLDER_IMG' => $folder_image,

#
#-----[ REPLACE WITH ]------------------------------------------
#
								'FORUM_FOLDER_IMG' => ( $forum_data[$j]['title_is_link'] == 1 && $forum_data[$j]['forum_link_icon'] != '' ) ? $forum_data[$j]['forum_link_icon'] : $folder_image,

#
#-----[ OPEN ]------------------------------------------
#
admin/admin_forums.php

#
#-----[ FIND ]------------------------------------------
#
				$forum_is_link = $row['title_is_link'];
				$forum_weblink = $row['weblink'];

#
#-----[ AFTER, ADD ]------------------------------------------
#
				$forum_link_icon = $row['forum_link_icon'];

#
#-----[ FIND ]------------------------------------------
#
				'L_FORUM_WEBLINK' => $lang['Forum_weblink'],

#
#-----[ AFTER, ADD ]------------------------------------------
#
				'L_FORUM_LINK_ICON' => $lang['Forum_link_icon'],

#
#-----[ FIND ]------------------------------------------
#
				'FORUM_WEBLINK' => $forum_weblink)

#
#-----[ REPLACE WITH ]------------------------------------------
#
				'FORUM_WEBLINK' => $forum_weblink,
				'FORUM_LINK_ICON' => $forum_link_icon)

#
#-----[ FIND ]------------------------------------------
#
			$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, prune_enable" . $field_sql . ", title_is_link, weblink)
				VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ", $forum_is_link, '$weblink')";

#
#-----[ REPLACE WITH ]------------------------------------------
#
			$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, prune_enable" . $field_sql . ", title_is_link, weblink, forum_link_icon)
				VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ", " . intval($HTTP_POST_VARS['forum_is_link']) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['weblink']) . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forum_link_icon']) . "')";

#
#-----[ FIND ]------------------------------------------
#
			$sql = "UPDATE " . FORUMS_TABLE . "
				SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . ", title_is_link = " . intval($HTTP_POST_VARS['forum_is_link']) . ", weblink = '" . str_replace("\'", "''", $HTTP_POST_VARS['forum_weblink']) . "'
				WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);

#
#-----[ REPLACE WITH ]------------------------------------------
#
			$sql = "UPDATE " . FORUMS_TABLE . "
				SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . ", title_is_link = " . intval($HTTP_POST_VARS['forum_is_link']) . ", weblink = '" . str_replace("\'", "''", $HTTP_POST_VARS['forum_weblink']) . "', forum_link_icon = '" . str_replace("\'", "''", $HTTP_POST_VARS['forum_link_icon']) . "'
				WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);

#
#-----[ FIND ]------------------------------------------
#
					'NUM_TOPICS' => $forum_rows[$j]['forum_topics'],
					'NUM_POSTS' => $forum_rows[$j]['forum_posts'],

#
#-----[ REPLACE WITH ]------------------------------------------
#
					'NUM_TOPICS' => ( $forum_rows[$j]['forum_link_icon'] != '' && $forum_rows[$j]['title_is_link'] == 1 ) ? (( substr($forum_rows[$j]['forum_link_icon'],0,4) == 'http' || substr($forum_rows[$j]['forum_link_icon'],0,4) == 'HTTP' ) ? '<img src="'.$forum_rows[$j]['forum_link_icon'].'" border="0">' : '<img src="./../'.$forum_rows[$j]['forum_link_icon'].'" border="0">') : $forum_rows[$j]['forum_topics'],
					'NUM_POSTS' => ( $forum_rows[$j]['forum_link_icon'] != '' && $forum_rows[$j]['title_is_link'] == 1 ) ? '' : $forum_rows[$j]['forum_posts'],

#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_admin.php

#
#-----[ FIND ]------------------------------------------
#
?>

#
#-----[ BEFORE, ADD ]------------------------------------------
#
$lang['Forum_link_icon'] = 'Icon for this forum. This will replace the default icon in the forum index.<br />You can enter an image from your phpBB directories (without leading "/") or an external link (Full path!).';

#
#-----[ OPEN ]------------------------------------------
#
language/lang_german/lang_admin.php

#
#-----[ FIND ]------------------------------------------
#
?>

#
#-----[ BEFORE, ADD ]------------------------------------------
#
$lang['Forum_link_icon'] = 'Icon fr dieses Forum. Dieses ersetzt das Standard-Icon auf der Foren-bersicht.<br />Du kannst ein Icon innerhalb Deines phpBB (ohne fhrendem "/") oder einen externen Link verwenden (Volle Pfadangabe!).';

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/index_body.tpl

#
#-----[ FIND ]------------------------------------------
#
	<td class="row1" align="center" valign="middle" height="50"><img src="{catrow.forumrow.FORUM_FOLDER_IMG}" width="46" height="25" alt="{catrow.forumrow.L_FORUM_FOLDER_ALT}" title="{catrow.forumrow.L_FORUM_FOLDER_ALT}" /></td>

#
#-----[ REPLACE WITH ]------------------------------------------
#
	<td class="row1" align="center" valign="middle" height="50"><img src="{catrow.forumrow.FORUM_FOLDER_IMG}" alt="{catrow.forumrow.L_FORUM_FOLDER_ALT}" title="{catrow.forumrow.L_FORUM_FOLDER_ALT}" /></td>

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/admin/forum_edit_body.tpl

#
#-----[ FIND ]------------------------------------------
#
	<tr>
	  <td class="row1">{L_FORUM_WEBLINK}</td>
	  <td class="row2"><input class="post" type="text" size="25" maxlength="200" name="forum_weblink" value="{FORUM_WEBLINK}" /></td>
	</tr>

#
#-----[ AFTER, ADD ]------------------------------------------
#
	<tr>
	  <td class="row1">{L_FORUM_LINK_ICON}</td>
	  <td class="row2"><input class="post" type="text" size="25" maxlength="200" name="forum_link_icon" value="{FORUM_LINK_ICON}" /></td>
	</tr>


#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM