##############################################################
## MOD Title: User Website MOD
## MOD Author: battye < cricketmx@hotmail.com > (battye) http://www.online-scrabble.com
## MOD Description: This MOD allows your members to have a simple homepage hosted on the forum
##
## MOD Version: 0.1.4
##
## Installation Level: Easy
## Installation Time: 5 Minutes
##
## Files To Edit  (11): 		groupcp.php
##								viewtopic.php
##								memberlist.php
##
##								constants.php
##								usercp_register.php
##								usercp_viewprofile.php
##
##								lang_main.php
##								lang_admin.php
##
##								profile_add_body.tpl
##								memberlist_body.tpl
##								groupcp_info_body.tpl
##							
## Included Files (8+): Many, can vary due to html_templates
##
##############################################################
## 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: Not much to be added now :-)
## Run uwm_database.php to make the database changes.
##############################################################
## MOD History:  		v0.0.1 - June 9, 2005 		-	First release
##							v0.0.2 - June 9, 2005 		- 	Fixed database issue
##							v0.0.3 - June 10, 2005	 	- 	Minor bugs fixed, added option to choose background
##																	colour for pages
##							v0.0.4 - June 14, 2005 		- 	Added optional use of bbCode, and option to preview
##							v0.1.0 - June 28, 2005 		- 	Many features: ACP, Group Sites, Templates, CSS to name a few
##							v0.1.1 - July 10, 2005 		- 	Added the option for admin to add a footer and fixed a group bug
##							v0.1.2 - July 11, 2005 		- 	Hit Counters, it appears the table bug is also fixed
##							v0.1.3 - August 9, 2005 	- 	Directory features done
##							v0.1.4 - Nov 6, 2005		- 	Added the phpBB copyright line as standard, fixed minor lang issue.
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
############################################################## 

#
#-----[ SQL ]------------------------------------------
#
ALTER TABLE `phpbb_groups` ADD `user_website_html` TEXT NOT NULL,
ADD `user_website_title` VARCHAR( 100 ) NOT NULL, 
ADD `user_website_colour` VARCHAR( 30 ) NOT NULL,
ADD `user_website_hits` INT( 5 ) NOT NULL,
ADD `user_website_css` TEXT NOT NULL ;
ALTER TABLE `phpbb_users` ADD `user_website_html` TEXT NOT NULL,
ADD `user_website_title` VARCHAR( 100 ) NOT NULL, 
ADD `user_website_colour` VARCHAR( 30 ) NOT NULL,
ADD `user_website_hits` INT( 5 ) NOT NULL,
ADD `user_website_css` TEXT NOT NULL ;
INSERT INTO `phpbb_config` VALUES ('website_enabled', '1');
INSERT INTO `phpbb_config` VALUES ('website_group_enabled', '1');
INSERT INTO `phpbb_config` VALUES ('website_users_enabled', '1');
INSERT INTO `phpbb_config` VALUES ('website_minimum_posts', '0');
INSERT INTO `phpbb_config` VALUES ('website_banned_users', '');
INSERT INTO `phpbb_config` VALUES ('website_banned_groups', '');
INSERT INTO `phpbb_config` VALUES ('website_footer', 'Powered by phpBB 2.0.x');
INSERT INTO `phpbb_config` VALUES ('website_hits', '1');

#
#-----[ COPY ]------------------------------------------
#
COPY website.php to website.php
COPY admin/admin_website.php to admin/admin_website.php
COPY includes/functions_website.php to includes/functions_website.php
COPY html_templates to html_templates
COPY templates/subSilver/admin_website_body.tpl to templates/subSilver/admin_website_body.tpl
COPY templates/subSilver/admin_view_site_template_body.tpl to templates/subSilver/admin_view_site_template_body.tpl
COPY templates/subSilver/admin_consider_template_body.tpl to templates/subSilver/admin_consider_template_body.tpl
COPY templates/subSilver/admin/website_configuration_body.tpl to templates/subSilver/admin/website_configuration_body.tpl
COPY templates/subSilver/images/icon_website.gif to templates/subSilver/images/icon_website.gif

# 
#-----[ OPEN ]------------------------------------------ 
#
groupcp.php

# 
#-----[ FIND ]------------------------------------------ 
#
include($phpbb_root_path . 'common.'.$phpEx);

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
include($phpbb_root_path . '/includes/functions_website.'.$phpEx);

# 
#-----[ FIND ]------------------------------------------ 
#
	generate_user_info($group_moderator, $board_config['default_dateformat'], $is_moderator, $from, $posts, $joined, $poster_avatar, $profile_img, $profile, $search_img, $search, $pm_img, $pm, $email_img, $email, $www_img, $www, $icq_status_img, $icq_img, $icq, $aim_img, $aim, $msn_img, $msn, $yim_img, $yim);

	$s_hidden_fields .= '';
	
# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
	if(user_group_member($userdata['user_id'], $HTTP_GET_VARS[POST_GROUPS_URL]) ==  2)
	{
	$group_info_replaced = "<a href='" . append_sid("website.$phpEx?group_id=" . intval($HTTP_GET_VARS[POST_GROUPS_URL]) . "") . "'>" . $group_info['group_name'] . "</a>";
	}
	
	else
	{
	$group_info_replaced = '<a href=' . append_sid('website.' . $phpEx . '?group_id=' . intval($HTTP_GET_VARS[POST_GROUPS_URL]) . '') . '>' . $group_info['group_name'] . '</a>&nbsp;<a href=' . append_sid('website.' . $phpEx . '?mode=owner&group_id=' . $HTTP_GET_VARS['g'] . '') . '><img src="./templates/CricketMX.com/images/icon_website.gif" border="0"/></a>';
	}

# 
#-----[ FIND ]------------------------------------------ 
#
		'GROUP_NAME' => $group_info['group_name'],

# 
#-----[ REPLACE WITH ]------------------------------------------ 
#
		'GROUP_NAME' => $group_info_replaced,

# 
#-----[ FIND ]------------------------------------------ 
#
		'MOD_WWW' => $www,
	
# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
		'MOD_HOMEPAGE' => display_site_link($user_id, $phpEx),
		
# 
#-----[ FIND ]------------------------------------------ 
#
				'WWW' => $www,
	
# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
				'HOMEPAGE' => display_site_link($user_id, $phpEx),

# 
#-----[ OPEN ]------------------------------------------ 
#
includes/constants.php

# 
#-----[ FIND ]------------------------------------------ 
#
define('PAGE_TOPIC_OFFSET', 5000);

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
// User Website MOD
define('WEB_YES', '1');
define('WEB_NO', '0');
		
# 
#-----[ OPEN ]------------------------------------------ 
#
includes/usercp_register.php

# 
#-----[ FIND ]------------------------------------------ 
#
		'SMILIES_STATUS' => $smilies_status,

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
		'WEBSITE_TEXT' => "<a href='" . append_sid("website.$phpEx?mode=owner") . "'>" . $lang['Admin_website_profile'] . "</a>",

# 
#-----[ OPEN ]------------------------------------------ 
#
includes/usercp_viewprofile.php

# 
#-----[ FIND ]------------------------------------------ 
#
else
{
	$email_img = '&nbsp;';
	$email = '&nbsp;';
}

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
	if( $profiledata['user_website_html'] == '' ||  !isset($userdata['user_website_html']) )
	{
	$homepage_link = "";
	}
	
	else
	{
	$homepage_link = "&nbsp;<a href=" . append_sid("website.$phpEx?id=" . intval($profiledata['user_id']) . "") . "><img src='./templates/CricketMX.com/images/icon_website.gif' border='0'/></a>";
	}
	
# 
#-----[ FIND ]------------------------------------------ 
#
$www = ( $profiledata['user_website'] ) ? '<a href="' . $profiledata['user_website'] . '" target="_userwww">' . $profiledata['user_website'] . '</a>' : '&nbsp;';

# 
#-----[ REPLACE WITH ]------------------------------------------ 
#
$www = ( $profiledata['user_website'] ) ? '<a href="' . $profiledata['user_website'] . '" target="_userwww">' . $profiledata['user_website'] . '</a>' . $homepage_link . '' : '&nbsp;' . $homepage_link . '';
		
# 
#-----[ OPEN ]------------------------------------------ 
#
language/lang_english/lang_admin.php

# 
#-----[ FIND ]------------------------------------------ 
#
//
// Styles Admin
//	

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
// User Website MOD
$lang['Website_min_posts'] = 'Minimum Posts';
$lang['Website_min_posts_explain'] = '<b>If you wish for users to reach a certain post count before creating a website, enter the number of posts required here!</b>';
$lang['Website_banned_users'] = 'Banned Users';
$lang['Website_banned_users_explain'] = '<b>Enter the user id\'s of users restricted from making websites, separate with commas; (Eg. 1,2,3)</b>';
$lang['Website_banned_groups'] = 'Banned Usergroups';
$lang['Website_banned_groups_explain'] = '<b>Enter the group id\'s of usergroups restricted from making websites, separate with commas; (Eg. 1,2,3)</b>';
$lang['Website_mod_enabled'] = 'Enable / Disable User Website MOD';
$lang['Website_mod_enabled_explain'] = '<b>Enable or disable this MOD from being used.</b>';
$lang['Website_groups_enabled'] = 'Enable / Disable Usergroups';
$lang['Website_groups_enabled_explain'] = '<b>Enable or disable groups from making websites.</b>';
$lang['Website_users_enabled'] = 'Enable / Disable Users';
$lang['Website_users_enabled_explain'] = '<b>Enable or disable users from making websites.</b>';
$lang['Website_footer'] = 'Set A Footer';
$lang['Website_footer_explain'] = '<b>A short message that will be displayed at the bottom of all users websites</b>';
$lang['Website_description'] = 'Description';
$lang['Website_setting'] = 'Setting';
$lang['Website_enable'] = 'Enable';	
$lang['Website_disable'] = 'Disable';
$lang['Website_submit'] = 'Submit';
$lang['Website_config_updated'] = 'Website Configuration updated successfully!';
$lang['Website_footer'] = 'Set A Footer';
$lang['Website_footer_explain'] = '<b>A short message that will be displayed at the bottom of all users websites</b>';
$lang['Website_hit'] = 'Hit Counters';
$lang['Website_hit_explain'] = '<b>A counter to display the number of times a certain site has been visited</b>';

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

# 
#-----[ FIND ]------------------------------------------ 
#
$lang['Moderators'] = 'Moderators';

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
//
// User Website MOD
//
$lang['Admin_website_profile'] = '(Administer Website)';
$lang['No_website'] = 'No website has been configured at this address!';
$lang['No_website_chosen'] = 'No website has been entered';
$lang['MOD_provided_website'] = 'User Website MOD &copy; <a href=http://www.cricketmx.com>battye</a> 2005';
$lang['Admin_website'] = 'Administer Website';
$lang['Admin_sitename'] = 'Select an appropriate name for your website:';
$lang['Admin_sitetext'] = 'Enter the HTML for your site here:<br /><span class="genmed">Or use site %stemplates%s!';
$lang['Admin_website_updated'] = 'Website updated successfully!<br />Click %shere%s to view your site!';
$lang['Admin_website_colour'] = 'Choose a background colour for your site:';
$lang['Admin_website_nav'] = 'Administer Website';
$lang['Admin_website_back'] = 'Click <a href="javascript: history.go(-1)">here</a> to go back and make changes, or Submit!'; 
$lang['Admin_website_view_template'] = 'View Templates';
$lang['Admin_wesbite_theme_name'] = 'Template Name';
$lang['Admin_wesbite_theme_desc'] = 'Template Description';
$lang['Admin_wesbite_theme_auth'] = 'Template Author';
$lang['Admin_wesbite_use_temp'] = 'Use Template';
$lang['Admin_wesbite_preview_theme'] = 'Preview Template';
$lang['Admin_css'] = 'Enter the CSS for your site here:';
$lang['Admin_user_banned'] = 'You have been banned from creating a website!<br />Please contact an administrator for further details!';
$lang['Admin_group_banned'] = 'This usergroup has been banned from creating a website!<br />Please contact an administrator for further details!';
$lang['Admin_user_low_post'] = 'You need to have at least %s posts to create a website!<br />Please contact an administrator for further details!';
$lang['Admin_website_hits'] = 'This page has had %d hits!';
$lang['Admin_mod_off'] = 'This feature has been disabled by an administrator.'; 
$lang['Admin_user_not_enabled'] = 'Users are not allowed to have websites!';
$lang['Admin_group_not_enabled'] = 'Usergroups are not allowed to have websites!';
$lang['Admin_only_group_can_make_edit'] = 'Only group members can create and edit group websites';

# 
#-----[ OPEN ]------------------------------------------ 
#
memberlist.php

# 
#-----[ FIND ]------------------------------------------ 
#
include($phpbb_root_path . 'common.'.$phpEx);

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
include($phpbb_root_path . '/includes/functions_website.'.$phpEx);

# 
#-----[ FIND ]------------------------------------------ 
#
			'WWW' => $www,

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
			'HOMEPAGE' => display_site_link($row['user_id'], $phpEx),
# 
#-----[ OPEN ]------------------------------------------ 
#
templates/subSilver/groupcp_info_body.tpl

# 
#-----[ FIND ]------------------------------------------ 
#
{MOD_WWW_IMG}

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
&nbsp;{MOD_HOMEPAGE}

# 
#-----[ FIND ]------------------------------------------ 
#
{member_row.WWW_IMG}

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
&nbsp;{member_row.HOMEPAGE}
		
# 
#-----[ OPEN ]------------------------------------------ 
#
templates/subSilver/memberlist_body.tpl

# 
#-----[ FIND ]------------------------------------------ 
#
{memberrow.WWW_IMG}&nbsp;

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
{memberrow.HOMEPAGE}

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

# 
#-----[ FIND ]------------------------------------------ 
#
<input type="text" class="post"style="width: 200px"  name="website" size="25" maxlength="255" value="{WEBSITE}" />

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
<!-- BEGIN switch_edit_profile -->
{WEBSITE_TEXT}
<!-- END switch_edit_profile -->

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

# 
#-----[ FIND ]------------------------------------------ 
#
{postrow.WWW_IMG} 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
{postrow.HOMEPAGE} 

# 
#-----[ OPEN ]------------------------------------------ 
#
viewtopic.php

# 
#-----[ FIND ]------------------------------------------ 
#
include($phpbb_root_path . 'common.'.$phpEx);

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
include($phpbb_root_path . '/includes/functions_website.'.$phpEx);

# 
#-----[ FIND ]------------------------------------------ 
#
			'WWW' => $www,

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
			'HOMEPAGE' => display_site_link($postrow[$i]['user_id'], $phpEx),

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