Om het wat makkelijker te maken voor jullie hier is die mod die ik geïnstalleerd heb:
Code: Selecteer alles
##############################################################
## MOD Title: Country
## MOD Author: Hartois < hartois@pisem.net >
## MOD Description: This mod will add a Country field into
## users' profile. It display "Country: |flag_image|"
## in posts.
## MOD Version: 1.0
## Compatibility: 2.0.*
##
## Installation Level: Moderate
## Installation Time: 20 to 30 Minutes (1mn by EasyMOD of Nuttzy)
## Files To Edit: 10
## viewtopic.php
## includes/functions_selects.php
## includes/usercp_avatar.php
## includes/usercp_register.php
## includes/usercp_viewprofile.php
## admin/admin_users.php
## templates/subSliver/viewtopic_body.tpl
## templates/subSliver/profile_add_body.tpl
## templates/subSilver/profile_view_body.tpl
## templates/subSilver/admin/user_edit_body.tpl
## language/lang_russian/lang_main.php
##
## Included Files: 193
## images/flags/*.gif
## country_db_inst.php (only for install)
##
##############################################################
## Author Notes:
##
## This MOD was tested on PHPbb v 2.0.10
##
##############################################################
## MOD History:
## 2004-08-23 - Version 1.00
## - First release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
##
## Upload country_db_inst.php -> open it -> delete it!
##
##############################################################
#
#-----[ OPEN ]---------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]---------------------------------------------
#
$sql = "SELECT u.username, u.user_id,
#
#-----[ IN-LINE FIND ]-------------------------------------
#
, p.*
#
#-----[ IN-LINE BEFORE, ADD ]-------------------------------
#
, u.user_country
#
#-----[ FIND ]---------------------------------------------
#
$poster_from = ( $postrow[$i]['user_from'] && $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Location'] . ': ' . $postrow[$i]['user_from'] : '';
#
#-----[ AFTER, ADD ]---------------------------------------
#
$poster_country = ( $postrow[$i]['user_country'] && $postrow[$i]['user_id'] != ANONYMOUS ) ? $postrow[$i]['user_country'] . "<br /> <img SRC=" . $phpbb_root_path . "images/flags/" . $postrow[$i]['user_country'] . ".gif align=ABSMIDDLE> " : "Íå âûáðàíà";
#
#-----[ FIND ]---------------------------------------------
#
'POSTER_FROM' => $poster_from,
#
#-----[ AFTER, ADD ]---------------------------------------
#
'POSTER_COUNTRY' => $poster_country,
#
#-----[ OPEN ]---------------------------------------------
#
admin/admin_users.php
#
#-----[ FIND ]---------------------------------------------
#
$user_lang = ( $HTTP_POST_VARS['language'] ) ? $HTTP_POST_VARS['language'] : $board_config['default_lang'];
#
#-----[ AFTER, ADD ]---------------------------------------
#
$user_country = ( $HTTP_POST_VARS['country'] ) ? $HTTP_POST_VARS['country'] : 'nospec';
#
#-----[ FIND ]---------------------------------------------
#
$user_lang = stripslashes($user_lang);
#
#-----[ AFTER, ADD ]---------------------------------------
#
$user_country = stripslashes($user_country);
#
#-----[ FIND ]---------------------------------------------
#
$sql = "UPDATE " . USERS_TABLE . "
SET " .
#
#-----[ IN-LINE FIND ]-------------------------------------
#
user_lang = '" . str_replace("\'", "''", $user_lang) . "',
#
#-----[ IN-LINE AFTER, ADD ]-------------------------------
#
user_country = '" . str_replace("\'", "''", $user_country) . "',
#
#-----[ FIND ]---------------------------------------------
#
$user_lang = stripslashes($user_lang);
#
#-----[ AFTER, ADD ]---------------------------------------
#
$user_country = stripslashes($user_country);
#
#-----[ FIND ]---------------------------------------------
#
$user_lang = $this_userdata['user_lang'];
#
#-----[ AFTER, ADD ]---------------------------------------
#
$user_country = $this_userdata['user_country'];
#
#-----[ FIND ]---------------------------------------------
#
$s_hidden_fields .= '<input type="hidden" name="language" value="' . $user_lang . '" />';
#
#-----[ AFTER, ADD ]---------------------------------------
#
$s_hidden_fields .= '<input type="hidden" name="country" value="' . $user_country . '" />';
#
#-----[ FIND ]---------------------------------------------
#
'LANGUAGE_SELECT' => language_select($user_lang),
#
#-----[ AFTER, ADD ]---------------------------------------
#
'COUNTRY_SELECT' => country_select($user_country),
#
#-----[ FIND ]---------------------------------------------
#
'L_BOARD_LANGUAGE' => $lang['Board_lang'],
#
#-----[ AFTER, ADD ]---------------------------------------
#
'L_COUNTRY' => $lang['Country'],
#
#-----[ OPEN ]---------------------------------------------
#
includes/functions_selects.php
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_avatar.php
#
#-----[ FIND ]------------------------------------------
#
function display_avatar_gallery($mode, &$category, &$user_id, &$email, &$current_email, &$coppa, &$username, &$email, &$new_password, &$cur_password, &$password_confirm, &$icq, &$aim, &$msn, &$yim, &$website, &$location, &$occupation, &$interests, &$signature, &$viewemail, &$notifypm, &$popup_pm, &$notifyreply, &$attachsig, &$allowhtml, &$allowbbcode, &$allowsmilies, &$hideonline, &$style, &$language, &$timezone, &$dateformat, &$session_id)
#
#-----[ IN-LINE FIND ]------------------------------------------
#
&$location,
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
&$user_country,
#
#-----[ FIND ]---------------------------------------------
#
function language_select($default, $select_name = "language", $dirname="language")
{
global $phpEx, $phpbb_root_path;
$dir = opendir($phpbb_root_path . $dirname);
$lang = array();
while ( $file = readdir($dir) )
{
if (preg_match('#^lang_#i', $file) && !is_file(@phpbb_realpath($phpbb_root_path . $dirname . '/' . $file)) && !is_link(@phpbb_realpath($phpbb_root_path . $dirname . '/' . $file)))
{
$filename = trim(str_replace("lang_", "", $file));
$displayname = preg_replace("/^(.*?)_(.*)$/", "\\1 [ \\2 ]", $filename);
$displayname = preg_replace("/\[(.*?)_(.*)\]/", "[ \\1 - \\2 ]", $displayname);
$lang[$displayname] = $filename;
}
}
closedir($dir);
@asort($lang);
@reset($lang);
$lang_select = '<select name="' . $select_name . '">';
while ( list($displayname, $filename) = @each($lang) )
{
$selected = ( strtolower($default) == strtolower($filename) ) ? ' selected="selected"' : '';
$lang_select .= '<option value="' . $filename . '"' . $selected . '>' . ucwords($displayname) . '</option>';
}
$lang_select .= '</select>';
return $lang_select;
}
#
#-----[ AFTER, ADD ]---------------------------------------------
#
function country_select($default, $select_name = "country")
{
global $phpEx, $phpbb_root_path;
$country=array();
$countrydir = opendir($phpbb_root_path . 'images/flags/');
while ($file = readdir($countrydir)) {
if ($file != "." && $file != "..") {
$filename = $file;
$displayname = trim(str_replace(".gif", "", $filename));
$country[$displayname] = $displayname;
}
}
closedir($countrydir);
@asort($country);
@reset($country);
$country_select = '<select name="' . $select_name . '">';
while ( list($displayname, $filename) = @each($country) )
{
$selected = ( strtolower($default) == strtolower($filename) ) ? ' selected="selected"' : '';
$country_select .= '<option value="' . $displayname . '"' . $selected . '>' . ucwords($displayname) . '</option>';
}
$country_select .= '</select>';
return $country_select;
}
#
#-----[ OPEN ]---------------------------------------------
#
includes/usercp_register.php
#
#-----[ FIND ]---------------------------------------------
#
$strip_var_list = array('username' => 'username', 'email' => 'email', 'icq' => 'icq', 'aim' => 'aim',
#
#-----[ IN-LINE FIND ]-------------------------------------
#
);
#
#-----[ IN-LINE BEFORE, ADD ]-------------------------------
#
, 'country' => 'country'
#
#-----[ FIND ]----------------------------------------------
#
validate_optional_fields($icq, $aim, $msn, $yim, $website, $location,
#
#-----[ IN-LINE FIND ]--------------------------------------
#
$location,
#
#-----[ IN-LINE AFTER, ADD ]--------------------------------
#
$country,
#
#-----[ FIND ]----------------------------------------------
#
if ( !empty($HTTP_POST_VARS['language']) )
{
if ( preg_match('/^[a-z_]+$/i', $HTTP_POST_VARS['language']) )
{
$user_lang = htmlspecialchars($HTTP_POST_VARS['language']);
}
else
{
$error = true;
$error_msg = $lang['Fields_empty'];
}
}
else
{
$user_lang = $board_config['default_lang'];
}
#
#-----[ AFTER, ADD ]----------------------------------------------
#
if ( !empty($HTTP_POST_VARS['country']) )
{
if ( preg_match('/^[a-z_]+$/i', $HTTP_POST_VARS['country']) )
{
$user_country = htmlspecialchars($HTTP_POST_VARS['country']);
}
else
{
$error = true;
$error_msg = $country['Fields_empty'];
}
}
else
{
$user_country = 'nospec';
}
#
#-----[ FIND ]----------------------------------------------
#
$user_lang = stripslashes($user_lang);
#
#-----[ AFTER, ADD ]----------------------------------------
#
$user_country = stripslashes($user_country);
#
#-----[ FIND ]----------------------------------------------
#
$sql = "UPDATE " . USERS_TABLE . "
SET " .
#
#-----[ IN-LINE FIND ]--------------------------------------
#
. $avatar_sql . "
#
#-----[ IN-LINE AFTER, ADD ]--------------------------------
#
, user_country = '" . str_replace("\'", "''", $user_country) . "'
#
#-----[ FIND ]----------------------------------------------
#
$sql = "INSERT INTO " . USERS_TABLE . " (user_id,
#
#-----[ IN-LINE FIND ]--------------------------------------
#
user_active, user_actkey
#
#-----[ IN-LINE BEFORE, ADD ]-------------------------------
#
user_country,
#
#-----[ FIND ]----------------------------------------------
#
VALUES ($user_id,
#
#-----[ IN-LINE FIND ]--------------------------------------
#
";
#
#-----[ IN-LINE BEFORE, ADD ]-------------------------------
#
'$user_country',
#
#-----[ FIND ]----------------------------------------------
#
'FROM' => $location,
#
#-----[ AFTER, ADD ]----------------------------------------
#
'COUNTRY' => $country,
#
#-----[ FIND ]----------------------------------------------
#
$location = stripslashes($location);
#
#-----[ AFTER, ADD ]----------------------------------------
#
$user_country = stripslashes($user_country);
#
#-----[ FIND ]----------------------------------------------
#
$user_lang = $userdata['user_lang'];
#
#-----[ AFTER, ADD ]----------------------------------------
#
$user_country = $userdata['user_country'];
#
#-----[ FIND ]----------------------------------------------
#
display_avatar_gallery($mode
#
#-----[ IN-LINE FIND ]--------------------------------------
#
$location,
#
#-----[ IN-LINE AFTER, ADD ]--------------------------------
#
$user_country,
#
#-----[ FIND ]----------------------------------------------
#
'LANGUAGE_SELECT' => language_select($user_lang, 'language'),
#
#-----[ AFTER, ADD ]----------------------------------------
#
'COUNTRY_SELECT' => country_select($user_country, 'country'),
#
#-----[ FIND ]----------------------------------------------
#
'L_LOCATION' => $lang['Location'],
#
#-----[ AFTER, ADD ]----------------------------------------
#
'L_COUNTRY' => $lang['Country'],
#
#-----[ OPEN ]----------------------------------------------
#
includes/usercp_viewprofile.php
#
#-----[ FIND ]----------------------------------------------
#
'LOCATION' => ( $profiledata['user_from'] ) ? $profiledata['user_from'] : ' ',
#
#-----[ AFTER, ADD ]----------------------------------------
#
'COUNTRY' => ( $profiledata['user_country'] ) ? $profiledata['user_country'] . " <img SRC=" . $phpbb_root_path . "images/flags/" . $profiledata['user_country'] . ".gif align=ABSMIDDLE> " : 'Íå âûáðàíà',
#
#-----[ FIND ]----------------------------------------------
#
'L_LOCATION' => $lang['Location'],
#
#-----[ AFTER, ADD ]----------------------------------------
#
'L_COUNTRY' => $lang['Country'],
#
#-----[ OPEN ]----------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]----------------------------------------------
#
//
// That's all, Folks!
// -------------------------------------------------
#
#-----[ BEFORE, ADD ]----------------------------------------
#
$lang['Country'] = "Country";
#
#-----[ OPEN ]----------------------------------------------
#
templates/subSilver/profile_add_body.tpl
#
#-----[ FIND ]----------------------------------------------
#
<tr>
<td class="row1"><span class="gen">{L_WEBSITE}:</span></td>
<td class="row2">
<input type="text" class="post"style="width: 200px" name="website" size="25" maxlength="255" value="{WEBSITE}" />
</td>
</tr>
#
#-----[ AFTER, ADD ]----------------------------------------
#
<tr>
<td class="row1"><span class="gen">{L_COUNTRY}:</span></td>
<td class="row2">
{COUNTRY_SELECT}
</td>
</tr>
#
#-----[ OPEN ]----------------------------------------------
#
templates/subSilver/viewtopic_body.tpl
#
#-----[ FIND ]----------------------------------------------
#
<td width="150" align="left" valign="top" class="{postrow.ROW_CLASS}"><span class="name">
#
#-----[ IN-LINE FIND ]--------------------------------------
#
{postrow.POSTER_FROM}
#
#-----[ IN-LINE AFTER, ADD ]-------------------------------
#
<br />Country: {postrow.POSTER_COUNTRY}
#
#-----[ OPEN ]----------------------------------------------
#
templates/subSilver/admin/user_edit_body.tpl
#
#-----[ FIND ]----------------------------------------------
#
<tr>
<td class="row1"><span class="gen">{L_WEBSITE}</span></td>
<td class="row2">
<input class="post" type="text" name="website" size="35" maxlength="255" value="{WEBSITE}" />
</td>
</tr>
#
#-----[ AFTER, ADD ]----------------------------------------
#
<tr>
<td class="row1"><span class="gen">{L_COUNTRY}:</span></td>
<td class="row2">
{COUNTRY_SELECT}
</td>
</tr>
#
#-----[ OPEN ]----------------------------------------------
#
templates/subSilver/profile_view_body.tpl
#
#-----[ FIND ]----------------------------------------------
#
<tr>
<td valign="middle" align="right" nowrap="nowrap"><span class="gen">{L_LOCATION}: </span></td>
<td><b><span class="gen">{LOCATION}</span></b></td>
</tr>
#
#-----[ AFTER, ADD ]----------------------------------------
#
<tr>
<td valign="middle" align="right" nowrap="nowrap"><span class="gen">{L_COUNTRY}: </span></td>
<td><b><span class="gen">{COUNTRY}</span></b></td>
</tr>
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
# EoM