##############################################################
## MOD Title: Changes from all previous versions for PCP Only.
## MOD Author: Handyman < Francis@michaellewismusic.com > (Francis Lewis) http://michaellewismusic.com/forum
## MOD Description: This mod allows registered users to pick a city from
## within their profile and have the current and 5 day forecast displayed
## on the main phpbb page. If no city is selected or an invalid code is entered,
## then no weather is displayed. Guests see nothing. This mod also allows
## the admin to view what code a user has chosen through user management in the admin page.
## This mod is based on the weather_usa and real name mods.
## MOD Version: 1.3.2
##
## Installation Level: Intermediate
## Installation Time: 5 Minutes
## Files To Edit: 1
## profilecp/profilecp_register.php
## Included Files: 0
##############################################################
## 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:
##
## Copyright 2005  Handyman.
##
## Thanks to Matt (http://thehottub.net)
## and ozzie for some of the PCP integration.
## and Scanman20 for creating the original version of this mod.
##
## This mod will create a new field in your users table, Registering table
## (for PCP only) and in the profile section (PCP only).
## Registered members will see one of two things. Either "No City Selected"
## or their weather. Users can modify their city code via their profile and admins
## can edit them in the User Admin Management page. I have made the city codes hidden
## to everyone (except the admin) when you look at another user's profile.
## I don't think that should be public. As I designed this mod, only the main index.php
## page shows the weather. This can be altered, however, I don't think users would want
## to see their weather on every page.
## I decided to go with the CNN weather feed which uses city codes or zipcodes.
##
## I will not be able to offer support on any forum except for mine:
## "http://michaellewismusic.com/forum" as I don't have time to check the other forums.
##
## Thanks. Have fun and God Bless.
## http://michaellewismusic.com/pope (tribute to the great Pope John Paul II)
##############################################################
## MOD History:
##
## 2005-04-30 - Version 1.0.0
## - Original release
##
## 2005-05-25 - Version 1.1
## - Fixed the code to be compatible with heavily modded boards
##
## 2005-6-28 - Version 1.2
## - Fixed code to be compatible with different languages
##
## 2005-7-11 - Version 1.3
## - Fixed some Coding errors.
##
## 2005-7-23   - Version 1.3.1
## - Fixed some not critical code in the install file.
##
## 2005-8-17   - Version 1.3.2
## - Fixed an error where if you went to the registration page in PCP and
## you changed something and didn't type in the zipcode or weather code,
## your weather code would be erased from the database until you typed it
## in again.
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ OPEN ]------------------------------------------
#
profilecp/profilecp_register.php

#
#-----[ FIND ]------------------------------------------
#
$view_userdata['user_email'] = '';

#
#-----[ AFTER, ADD ]------------------------------------------
#
$view_userdata['user_zipcode'] = '';

#
#-----[ FIND ]------------------------------------------
#
$zipcode = ( !empty($HTTP_POST_VARS['zipcode']) ) ? trim(strip_tags( $HTTP_POST_VARS['zipcode'] ) ) : '';
    $zipcode = stripslashes($zipcode);

#
#-----[ REPLACE WITH ]------------------------------------------
#
$zipcode = trim(htmlspecialchars($HTTP_POST_VARS['zipcode']));

#
#-----[ FIND ]------------------------------------------
#
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Robot_flood_control'];
	}

#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start Zipcode Check
	// zipcode
	$zipcode_changed = false;
	$zipcode_error = false;

	// create : zipcode should be set
	if ( $create_user && empty($zipcode) )
	{
		$zipcode_error = true;
		$error = true;
		$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
	}

	// edit : check if a zipcode has been set
	if ( !empty($zipcode) )
	{
		if (!$zipcode_error)
		{
			$zipcode_changed = true;
		}
	}
// End Zipcode Check

#
#-----[ FIND ]------------------------------------------
#
$values['user_zipcode'] = $zipcode;

#
#-----[ REPLACE WITH ]------------------------------------------
#
if ( $zipcode_changed )  $values['user_zipcode'] = $zipcode;

#
#-----[ FIND ]------------------------------------------
#
'EMAIL_CONFIRM'		=> $view_userdata['user_email'],

#
#-----[ AFTER, ADD ]------------------------------------------
#
'ZIPCODE'			=> $view_userdata['user_zipcode'],

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