############################################################## 
## MOD Title: WPM
## MOD Author: Duvelske < Duvelske@vitrax.org > (Richard Wagtmans) http://www.vitrax.org
## MOD Description: This mod gives you in the admin section a panel to control a welcome message
## on registration. You can disable it with the admin panel and type the message send by the mod.
## MOD Support site: www.vitrax.org, www.phpbb.nl, www.phpbb2.de, www.phpbb.com
## MOD Version: 	1.0.10
## MOD Compatibility:	2.0.4 - 2.0.19
##############################################################
## Installation Level: easy
## Installation Time: ~3 minutes
##
## Files To Edit: 2
##		  includes/usercp_register.php
##		  includes/constants.php
##
## Included Files: 10
## 		   admin_wpm.php
## 		   wpm_body.tpl
##		   functions_wpm.php
## 		   lang_admin_wpm.php (English,Dutch & German)
##		   wpm_db_update.php
##		   wpm_db_install.php
##		   uninstallwpm.php
##		   
############################################################## 
## MOD History:
##   2006-02-02 - Version 1.0.10
##	-  Submitted it to phpbb
##
##   2005-09-17 - Version 1.0.9
##	-  Changed some coding. This for fixing bugs for letting it work with other mods.
##	-  Changed the zip file. So it is easier for peeps to find the correct install.
##	-  Still have to look about the nuke install file.
##
##   2004-05-07 - Version 1.0.8
##	-  Changed some of the code. For better working with some new mods and older ones.
##	-  Fixed some little typo's in the install.txt file.
##
##   2004-04-05 - Version 1.0.7
##	-  Fixed the bug with the pop-up when receving a wpm
##	-  Because the how-to working of the wpm mod changed in the 1.0.6
##	   version some bugs where solved.
##
##   2004-03-15 - Version 1.0.6
##	-  Fixed some errors in admin_wpm.php
##	-  Fixed some typo's in the lang files
##	-  Made an wpmuninstall file
##	-  Replaced several txt files into one called 
##	   READMEBEFOREINSTALL.txt
##
##   2004-01-28 - Version 1.0.5
##	-  Changed the way the mod works. Now it should
##	   also be compatible most portal and premodded versions
##	   of phpbb
##	-  Changed the place in the acp menu. Now it is with general
##	-  Fixed a little pop up error (didn't show up)
##	-  Changed some minor things in the lang files
##
##   2004-01-13 - Version 1.0.4
##	-  ' Bug fixed
##	-  Some minor changes to admin_wpm.php
##	-  Changes to the install script
##
##   2003-12-24 - Version 1.0.3
##	-  Quote fix (thnx by Elo)
##	-  Lang Files fix. (forgot some entries)
##	-  Admin_wpm.php solved some bugs
##
##   2003-12-17 - Version 1.0.2
##	-  Added some changes in the working of the mod
##	-  Fixed some minor bugs with other mods
##	-  New function added with the Name wich sendt the PM
##
##
##   2003-11-28 - Version 1.0.1
##	-  Added some code to the install file.
##	-  Some minor fixes in the admin_wpm.php file &
##	   in the wpm_body.tpl
##	
##   2004-11-09 - Version 1.0.0
##	-  initial release
##     	-  An added request for disabling the mod
##     	-  EM Ready
##
##   2003-10-16 - Version 0.9.0
##	-  initial BETA release
##	
##
############################################################## 
## This MOD is released under the GPL License. 
## Intellectual Property is retained by the MOD Author(s) listed above 
############################################################## 
## 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: 
##	Please Run before you mod the files the wpm_db_update.php file in the root of your forum
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
##############################################################

#
#-----[ SQL ]-------------------------------------------------
#
CREATE TABLE phpbb_wpm (name varchar(255) NOT NULL default '', value text NOT NULL) TYPE=MyISAM;
INSERT INTO phpbb_wpm VALUES ('wpm_version', '1.0.9');
INSERT INTO phpbb_wpm VALUES ('active_wpm', '1');
INSERT INTO phpbb_wpm VALUES ('wpm_username', 'Anonymous');
INSERT INTO phpbb_wpm VALUES ('wpm_userid', '-1');
INSERT INTO phpbb_wpm VALUES ('wpm_subject', 'Welcome to [sitename]!');
INSERT INTO phpbb_wpm VALUES ('wpm_message', 'Hi, there [username]!
I hope you enjoy your stay here at [sitename]!
If you have any questions about the site, please ask. If it goes about this mod please
visit: http://www.vitrax.vze.com thnx you!');

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

# 
#-----[ FIND ]------------------------------------------ 
# 
define('VOTE_USERS_TABLE', $table_prefix.'vote_voters'); 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
define('WPM', $table_prefix.'wpm');
# 
#-----[ OPEN ]------------------------------------------ 
#
includes/usercp_register.php

# 
#-----[ FIND ]------------------------------------------ 
#
			message_die(GENERAL_MESSAGE, $message);
		} // if mode == register
	}
} // End of submit

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
#
			//
			// START wpm mod by Duvelske (http://www.vitrax.vze.com)
			{
				$sql = "SELECT *
					FROM " . WPM;
				if(!$result = $db->sql_query($sql))
				{
					message_die(GENERAL_ERROR, "", "", __LINE__, __FILE__, $sql);
				}
				else
				{
					while($row = $db->sql_fetchrow($result))
					{
						$swpm_config[$row['name']] = $row['value'];
					}
				}
				if($swpm_config['active_wpm'])
				{
				// add functions wpm
				include_once($phpbb_root_path . 'includes/functions_wpm.' . $phpEx);

				// Just a couple of replaces for better customisation on a per user basis
				// no point making a special function since there are so few needed

				$wpm_subject = str_replace("[username]", $username, $swpm_config['wpm_subject']);
				$wpm_subject = str_replace("[user_id]", $user_id, $wpm_subject);
				$wpm_subject = str_replace("[sitename]", $board_config['sitename'], $wpm_subject);

				$wpm_message = str_replace("[username]", $username, $swpm_config['wpm_message']);
				$wpm_message = str_replace("[user_id]", $user_id, $wpm_message);
				$wpm_message = str_replace("[sitename]", $board_config['sitename'], $wpm_message);

				// Will not send a pm notification via email (already sent the standard welcome email)
				// Simply change the 0 to a 1 to turn it on
				wpm_send_pm($user_id, $wpm_subject, $wpm_message, 0);
				}
			}
			// END wpm mod
			//
# 
#-----[ OPEN ]------------------------------------------ 
#
language/lang_english/lang_main.php

# 
#-----[ FIND ]------------------------------------------ 
#
?>
# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
$lang['not_delete_pm'] = 'Could not delete your oldest privmsgs';
$lang['non_existing_user'] = 'Tried obtaining data for a non-existent user';
$lang['No_entry_wpm'] = 'Thank you for register at [sitename]!';
$lang['no_sent_pm_insert'] = 'Could not insert private message sent info!';
# 
#-----[ OPEN ]------------------------------------------ 
#
language/lang_spanish/lang_main.php

# 
#-----[ FIND ]------------------------------------------ 
#
?>
# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
$lang['not_delete_pm'] = 'No se pudieron eliminar tus antiguos Mensajes Privados';
$lang['non_existing_user'] = 'Se intent obtener datos de un usuario no existente';
$lang['No_entry_wpm'] = 'Gracias por registrarte en [sitename]!';
$lang['no_sent_pm_insert'] = 'No se pudo insertar la informacin del Mensaje Privado enviado';
#
#-----[ COPY ]------------------------------------------
#
copy root/admin/admin_wpm.php to admin/admin_wpm.php
copy root/includes/functions_wpm.php to includes/functions_wpm.php
copy root/templates/sibSilver/admin/wpm_body.tpl to templates/subSilver/admin/wpm_body.tpl
copy root/language/lang_english/lang_admin_wpm.php to language/lang_english/lang_admin_wpm.php
copy root/language/lang_dutch/lang_admin_wpm.php to language/lang_dutch/lang_admin_wpm.php
copy root/language/lang_german/lang_admin_wpm.php to language/lang_german/lang_admin_wpm.php
copy root/language/lang_french/lang_admin_wpm.php to language/lang_french/lang_admin_wpm.php
copy root/language/lang_russian/lang_admin_wpm.php to language/lang_russian/lang_admin_wpm.php
copy root/language/lang_spanish/lang_admin_wpm.php to language/lang_spanish/lang_admin_wpm.php# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
#

# EoM