################################################################################### 
## 
## Hack Titel:   Neues Feld in Profil einfgen (BBcode, Smilees, HTML Nutzung mglich)
## Hack Version: 1.0.1 (ab phpBB 2.0.4)
## Author        Acid
## Support:	 http://www.phpbbhacks.com/forums oder http://www.phpbb.de/
##
## Beschreibung: Ein einfacher Weg um ein neues Feld ins Profil einzufgen,
##		 natrlich kann man "infos" mit "wasauchimmer" ersetzen, sollte
##		 dabei auf die verschiedene Schreibweise achten (z.B. "INFOS",
##		 "infos", "user_infos").
##		 Wenn man mehrere Felder einfgen will, muss man die folgenden
##		 Schritte duplizieren und dabei jeweils "infos" ndern (auf
##		 Schreibweise achten).
##		 Es werden HTML, BBcode und Smilees untersttzt.
##
## Dateien zu ndern:   8
##			admin/admin_users.php
##	                language/lang_german/lang_main.php
##              	includes/usercp_viewprofile.php 
##	                includes/usercp_register.php
##      	        includes/usercp_avatar.php 
##              	templates/xxx/admin/user_edit_body.tpl
## 	                templates/xxx/profile_add_body.tpl 
##      	        templates/xxx/profile_view_body.tpl 
## 
################################################################################### 
## 
## Installationsnotiz: 
## Vor jeglichen nderungen an Dateien oder Datenbank, solltest Du diese vorher
## sichern.
## 
## Mit diesem Hack werden zwei neue Felder in die 'users' Tabelle eingefgt. 
##
################################################################################### 
## 
## Versionen:
## 
## v1.0.1
##	- HTML-Status in profile_add_body.tpl/user_edit_body.tpl hinzugefgt
##	- BBcode wird nun im Adminbereich korrekt dargestellt
## v1.0.0
##	- Verffentlichung
## 
##########################################################################################
#
#-----[ SQL ]-------------------------------------------
#  
# Du solltest den Prefix angleichen.

ALTER TABLE phpbb_users ADD user_infos TEXT;
ALTER TABLE phpbb_users ADD user_infos_bbcode_uid VARCHAR (255);

## alternativ kannst Du auch die table_update.php benutzen, um die Datenbank
## anzugleichen (einfach hochladen und ausfhren).


# 
#-----[ FFNEN ]------------------------------------------ 
#  
# language/lang_german/lang_main.php
# 
#-----[ FINDE (nur ein Auszug) ]---------------------------------------------------
# 
$lang['Signature_explain'] = '

# 
#-----[ DARUNTER EINFGEN ]---------------------------------------------------
# 
$lang['Infos'] = 'Infos';
$lang['Infos_explain'] = 'Der eingetragene Text wird in deinem Profil angezeigt.';



# 
#-----[ FFNEN ]------------------------------------------ 
#  
# includes/usercp_viewprofile.php
# 
#-----[ FINDE ]---------------------------------------------------
# 
$page_title = $lang['Viewing_profile'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

# 
#-----[ DARUNTER EINFGEN ]---------------------------------------------------
# 
include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx);
$infos = (  $profiledata['user_infos'] != '' ) ? $profiledata['user_infos'] : '';
$infos_bbcode_uid = $profiledata['user_infos_bbcode_uid'];
if ( $board_config['allow_bbcode'] )
{
        if ( $infos != '' && $infos_bbcode_uid != '' )
        {
                $infos = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($infos, $infos_bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $infos);
        }
}
if ( $infos != '' )
{
        $infos = make_clickable($infos);
}
if ( $board_config['allow_smilies'] )
{
        if ( $profiledata['user_allowsmile'] && $infos != '' )
        {
                $infos = smilies_pass($infos);
        }
}
if ( $infos != '' )
{
        $infos = str_replace("\n", "\n<br />\n", $infos);
}

# 
#-----[ FINDE ]---------------------------------------------------
# 
	'INTERESTS' => ( $profiledata['user_interests'] ) ? $profiledata['user_interests'] : '&nbsp;',

# 
#-----[ DARUNTER EINFGEN ]---------------------------------------------------
# 
	'INFOS' => $infos,

# 
#-----[ FINDE ]---------------------------------------------------
# 
	'L_INTERESTS' => $lang['Interests'],

# 
#-----[ DARUNTER EINFGEN ]---------------------------------------------------
# 
	'L_INFOS' => $lang['Infos'],



# 
#-----[ FFNEN ]------------------------------------------ 
#  
# includes/usercp_register.php
# 
#-----[ FINDE (2x) ]---------------------------------------------------
# 
		$interests = stripslashes($interests);

# 
#-----[ DARUNTER EINFGEN (2x) ]---------------------------------------------------
# 
		$infos = stripslashes($infos);

# 
#-----[ FINDE ]---------------------------------------------------
# 
		$signature = prepare_message($signature, $allowhtml, $allowbbcode, $allowsmilies, $signature_bbcode_uid);
	}

# 
#-----[ DARUNTER EINFGEN ]---------------------------------------------------
# 
	if ( $infos != '' )
	{
		if ( $infos_bbcode_uid == '' )
		{
			$infos_bbcode_uid = ( $allowbbcode ) ? make_bbcode_uid() : '';
		}
		$infos = prepare_message($infos, $allowhtml, $allowbbcode, $allowsmilies, $infos_bbcode_uid);
	}

# 
#-----[ FINDE ]---------------------------------------------------
# 
			$sql = "UPDATE " . USERS_TABLE . "
				SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) ."', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_sig_bbcode_uid = '$signature_bbcode_uid', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_notify_pm = $notifypm, user_popup_pm = $popuppm, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_active = $user_active, user_actkey = '" . str_replace("\'", "''", $user_actkey) . "'" . $avatar_sql . "

# 
#-----[ FINDE in dieser Zeile ]---------------------------------------------------
# 
$interests) . "'

# 
#-----[ DANACH EINFGEN ]---------------------------------------------------
# 
, user_infos = '" . str_replace("\'", "''", $infos) . "', user_infos_bbcode_uid = '$infos_bbcode_uid'


# 
#-----[ FINDE ]---------------------------------------------------
# 
	$interests = $userdata['user_interests'];

# 
#-----[ DARUNTER EINFGEN ]---------------------------------------------------
# 
	$infos_bbcode_uid = $userdata['user_infos_bbcode_uid'];
	$infos = ( $infos_bbcode_uid != '' ) ? preg_replace("/:(([a-z0-9]+:)?)$infos_bbcode_uid\]/si", ']', $userdata['user_infos']) : $userdata['user_infos'];

# 
#-----[ FINDE ]---------------------------------------------------
# 
	display_avatar_gallery($mode, $avatar_category, $user_id, $email, $current_email, $coppa, $username, $email, $icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature, $viewemail, $notifypm, $popuppm, $notifyreply, $attachsig, $allowhtml, $allowbbcode, $allowsmilies, $allowviewonline, $user_style, $user_lang, $user_timezone, $user_dateformat);

# 
#-----[ FINDE in dieser Zeile ]---------------------------------------------------
# 
$user_dateformat

# 
#-----[ DANACH EINFGEN ]---------------------------------------------------
# 
, $infos

# 
#-----[ FINDE (nur ein Auszug) ]--------------------------
#
	$template->assign_vars(array(
		.
		.
		.
		.
		'INTERESTS' => $interests,

# 
#-----[ DARUNTER EINFGEN ]---------------------------------------------------
# 
      		'INFOS' => str_replace('<br />', "\n", $infos),
		'L_INFOS' => $lang['Infos'],
		'L_INFOS_EXPLAIN' => $lang['Infos_explain'],



# 
#-----[ FFNEN ]------------------------------------------ 
#  
# includes/usercp_avatar.php
# 
#-----[ FINDE ]---------------------------------------------------
# 
function display_avatar_gallery($mode, &$category, &$user_id, &$email, &$current_email, &$coppa, &$username, &$email, &$icq, &$aim, &$msn, &$yim, &$website, &$location, &$occupation, &$interests, &$signature, &$viewemail, &$notifypm, &$popuppm, &$notifyreply, &$attachsig, &$allowhtml, &$allowbbcode, &$allowsmilies, &$hideonline, &$style, &$language, &$timezone, &$dateformat) 

# 
#-----[ FINDE in dieser Zeile ]---------------------------------------------------
# 
&$dateformat

# 
#-----[ DANACH EINFGEN ]---------------------------------------------------
# 
, &$infos

# 
#-----[ FINDE ]---------------------------------------------------
# 
$params = array('coppa', 'user_id', 'username', 'email', 'current_email', 'icq', 'aim', 'msn', 'yim', 'website', 'location', 'occupation', 'interests', 'signature', 'viewemail', 'notifypm', 'popuppm', 'notifyreply', 'attachsig', 'allowhtml', 'allowbbcode', 'allowsmilies', 'hideonline', 'style', 'language', 'timezone', 'dateformat'); 

# 
#-----[ FINDE in dieser Zeile ]---------------------------------------------------
# 
'dateformat'

# 
#-----[ DANACH EINFGEN ]---------------------------------------------------
# 
, 'infos'



# 
#-----[ FFNEN ]------------------------------------------ 
#  
# admin/admin_users.php 
# 
#-----[ FINDE ]---------------------------------------------------
# 
		$interests = ( !empty($HTTP_POST_VARS['interests']) ) ? trim(strip_tags( $HTTP_POST_VARS['interests'] ) ) : '';

# 
#-----[ DARUNTER EINFGEN ]---------------------------------------------------
# 
		$infos = ( !empty($HTTP_POST_VARS['infos']) ) ? trim(str_replace('<br />', "\n", $HTTP_POST_VARS['infos'] ) ) : ''; 

# 
#-----[ FINDE (2x) ]---------------------------------------------------
# 
			$interests = htmlspecialchars(stripslashes($interests));

# 
#-----[ DARUNTER EINFGEN (2x) ]---------------------------------------------------
# 
			$infos = htmlspecialchars(stripslashes($infos));

# 
#-----[ FINDE ]---------------------------------------------------
# 
		//
		// Avatar stuff
		//

# 
#-----[ DAVOR EINFGEN ]---------------------------------------------------
# 
		if( $infos != "" )
		{
			if ( $infos_bbcode_uid == '' )
			{
				$infos_bbcode_uid = ( $allowbbcode ) ? make_bbcode_uid() : '';
			}
			$infos = prepare_message($infos, $allowhtml, $allowbbcode, $allowsmilies, $infos_bbcode_uid);
		}

# 
#-----[ FINDE ]---------------------------------------------------
# 
			$sql = "UPDATE " . USERS_TABLE . "
				SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) . "', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", $aim) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_sig_bbcode_uid = '$signature_bbcode_uid', user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowavatar = $user_allowavatar, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_allow_pm = $user_allowpm, user_notify_pm = $notifypm, user_popup_pm = $popuppm, user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_active = $user_status, user_rank = $user_rank" . $avatar_sql . "

# 
#-----[ FINDE in dieser Zeile ]---------------------------------------------------
# 
$interests) . "'

# 
#-----[ DANACH EINFGEN ]---------------------------------------------------
# 
, user_infos = '" . str_replace("\'", "''", $infos) . "', user_infos_bbcode_uid = '$infos_bbcode_uid'

# 
#-----[ FINDE ]---------------------------------------------------
# 
		$interests = htmlspecialchars($this_userdata['user_interests']);

# 
#-----[ DARUNTER EINFGEN ]---------------------------------------------------
# 
		$infos = ($this_userdata['user_infos_bbcode_uid'] != '') ? preg_replace('#:' . $this_userdata['user_infos_bbcode_uid'] . '#si', '', $this_userdata['user_infos']) : $this_userdata['user_infos'];
		$infos = preg_replace($html_entities_match, $html_entities_replace, $infos);

# 
#-----[ FINDE ]---------------------------------------------------
# 
			$s_hidden_fields .= '<input type="hidden" name="interests" value="' . str_replace("\"", "&quot;", $interests) . '" />';

# 
#-----[ DARUNTER EINFGEN ]---------------------------------------------------
# 
			$s_hidden_fields .= '<input type="hidden" name="infos" value="' . str_replace("\"", "&quot;", $infos) . '" />'; 


# 
#-----[ FINDE ]---------------------------------------------------
# 
			'INTERESTS' => $interests,

# 
#-----[ DARUNTER EINFGEN ]---------------------------------------------------
# 
			'INFOS' => str_replace('<br />', "\n", $infos),
			'L_INFOS' => $lang['Infos'],
			'L_INFOS_EXPLAIN' => $lang['Infos_explain'],



# 
#-----[ FFNEN ]------------------------------------------ 
#  
# templates/xxx/profile_add_body.tpl
# 
#-----[ FINDE ]---------------------------------------------------
# 
	<tr> 
	  <td class="row1"><span class="gen">{L_INTERESTS}:</span></td>
	  <td class="row2"> 
		<input type="text" class="post"style="width: 200px"  name="interests" size="35" maxlength="150" value="{INTERESTS}" />
	  </td>
	</tr>

# 
#-----[ DARUNTER EINFGEN ]---------------------------------------------------
# 
	<!-- BEGIN switch_edit_profile -->
	<tr> 
	  <td class="row1"><span class="gen">{L_INFOS}:</span><span class="gensmall"><br />{L_INFOS_EXPLAIN}<br /><br />{HTML_STATUS}<br />{BBCODE_STATUS}<br />{SMILIES_STATUS}</span></td>
	  <td class="row2"> 
		<textarea name="infos"style="width: 300px"  rows="6" cols="30" class="post">{INFOS}</textarea>
	  </td>
	</tr>
	<!-- END switch_edit_profile -->



# 
#-----[ FFNEN ]------------------------------------------ 
#  
# templates/xxx/profile_view_body.tpl
# 
#-----[ FINDE ]---------------------------------------------------
# 
		  //--></script><noscript>{ICQ_IMG}</noscript></td>
		</tr>
	  </table>
	</td>
  </tr>

# 
#-----[ DARUNTER EINFGEN ]---------------------------------------------------
# 
  <tr> 
	<td colspan="2" class="catLeft" align="center" height="28"><b><span class="gen">{L_INFOS} </span></b></td>
  </tr>
  <tr>
          <td colspan="2" class="row1"><span class="genmed">{INFOS}</span></td>
  </tr>



# 
#-----[ FFNEN ]------------------------------------------ 
#  
# templates/xxx/admin/user_edit_body.tpl
# 
#-----[ FINDE ]---------------------------------------------------
# 
	<tr> 
	  <td class="row1"><span class="gen">{L_INTERESTS}</span></td>
	  <td class="row2"> 
		<input type="text" name="interests" size="35" maxlength="150" value="{INTERESTS}" />
	  </td>
	</tr>

# 
#-----[ DARUNTER EINFGEN ]---------------------------------------------------
# 
	<tr> 
	  <td class="row1"><span class="gen">{L_INFOS}:</span><span class="gensmall"><br />{L_INFOS_EXPLAIN}<br /><br />{HTML_STATUS}<br />{BBCODE_STATUS}<br />{SMILIES_STATUS}</span></td>
	  <td class="row2"> <textarea class="post" name="infos"style="width: 300px"  rows="6" cols="30">{INFOS}</textarea> </td>
	</tr>

#############################################################################################################################################################################################
#############################################################################################################################################################################################
#############################################################################################################################################################################################
