Vlaggen mod
Geplaatst: 07 aug 2004, 09:48
Ik wil de vlaggen mod installeren, dit is de code:
Nou wil ik dat ik nog steeds mijn plaats (stad) op kan geven, dus land én stad.
Hoe doe ik dat?
Alvast bedankt!
Code: Selecteer alles
## EasyMod 0.0.7 compliant
########################################################
## Mod Title: Country Flags
## Mod Author: Nuttzy99 < pktoolkit@blizzhackers.com > (Nuttzy) http://www.blizzhackers.com
## Original By: John B. Abela < abela@4cm.com >
## Mod Description: This mod allows your registered board members
## to select the flag of their country. Their flag
## will then display thoughout the phpBB system.
## Mod Version: 2.2.0
## Rev Date: February 20, 2003
##
##
## Installation Level: Advanced Moders Only
## Installation Time: 20-30 Minutes
## Files To Edit: 12
## Included Files: 193 .gif Files
## admin_flags.php
## flags_list_body.tpl
## flags_edit_body.tpl
## flags.sql
## Flags-2-3-0.txt
########################################################
##
## Version History:
## 02/20/03 - version 2.2.0
## updated for phpBB 2.0.4
## added admin tools to edit/add/remove flags
## 08/13/02 - version 2.0.6
## made for 2.0.2 of phpBB
## made EasyMod alpha 2 compliant
## 05/18/02 - version 2.0.5
## fixed a bug with edit profile sometimes
## reinitializing the settings - thanks sj26!
## display flag when selecting from edit
## profile - coded by sj26
## flags can be changed when editing a
## user in the admin panel
## upgrade script from 2.0.4 released
## 04/14/02 - version 2.0.4
## release for phpBB 2.0 final
## 04/01/02 - Made RC4 complaint
## right justified flags in members listing
## 02/28/02 - Updated for phpBB 2.0 RC2 by Nuttzy
##
########################################################
##
## INSTALLATION:
## If you have phpBB 2.0.1 then you should use v2.0.5 of this
## mod. This version is only for use with 2.0.2
########################################################
## Author Notes:
## This MOD is not to be listed, downloaded or posted at
## -any- site except Official phpBB Web Sites.
## Thank You. JbA
##############################################################
## 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/downloads/ 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/downloads/
###############################################
#
#-----[ COPY ]------------------------------------------
#
copy flags/*.* to images/flags/
#
#-----[ COPY ]------------------------------------------
#
copy admin_flags.php.txt to admin/admin_flags.php
#
#-----[ COPY ]------------------------------------------
#
copy flags_list_body.tpl.txt to templates/subSilver/admin/flags_list_body.tpl
#
#-----[ COPY ]------------------------------------------
#
copy flags_edit_body.tpl.txt to templates/subSilver/admin/flags_edit_body.tpl
#
#-----[ ALTER SCHEMA ]------------------------------------------
#
Execute flags.sql - This will setup your db table
Using phpMyAdmin
open your DB
click sql
browse for the appropriate file
press GO
#
#-----[ OPEN ]------------------------------------------
#
includes/constants.php
#
#-----[ FIND ]------------------------------------------
#
define('VOTE_USERS_TABLE', $table_prefix.'vote_voters');
#
#-----[ AFTER, ADD ]------------------------------------------
#
// FLAGHACK-start
define('FLAG_TABLE', $table_prefix.'flags');
// FLAGHACK-end
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_viewprofile.php
#
#-----[ FIND ]------------------------------------------
#
# NOTE: the complete line to find is:
# $pm_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" border="0" /></a>';
#
$pm_img = '<a href="
#
#-----[ AFTER, ADD ]------------------------------------------
#
// FLAGHACK-start
$location = ( $profiledata['user_from'] ) ? $profiledata['user_from'] : ' ' ;
$flag = ( !empty($profiledata['user_from_flag']) ) ? " <img src=\"images/flags/" . $profiledata['user_from_flag'] . "\" alt=\"" . $profiledata['user_from_flag'] . "\">" : "";
$location .= $flag ;
// FLAGHACK-end
#
#-----[ FIND ]------------------------------------------
#
# NOTE: the complete line to find is:
# 'LOCATION' => ( $profiledata['user_from'] ) ? $profiledata['user_from'] : ' ',
#
'LOCATION' =>
#
#-----[ REPLACE WITH ]------------------------------------------
#
// FLAGHACK-start
'LOCATION' => $location,
// FLAGHACK-end
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_register.php
#
#-----[ FIND ]------------------------------------------
#
# NOTE: the complete line to find is:
# $user_timezone = ( isset($HTTP_POST_VARS['timezone']) ) ? doubleval($HTTP_POST_VARS['timezone']) : $board_config['board_timezone'];
#
$user_timezone = (
#
#-----[ AFTER, ADD ]------------------------------------------
#
// FLAGHACK-start
$user_flag = ( !empty($HTTP_POST_VARS['user_flag']) ) ? $HTTP_POST_VARS['user_flag'] : '' ;
// FLAGHACK-end
#
#-----[ FIND ]------------------------------------------
# Looking for the only UPDATE sql statement in the file; I'm not quoting the whole thing!!
#
$sql = "UPDATE " . USERS_TABLE . "
user_from = '" . str_replace("\'", "''", $location) . "',
#
#-----[ IN-LINE FIND ]------------------------------------------
#
user_from = '" . str_replace("\'", "''", $location) . "',
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
user_from_flag = '$user_flag',
#
#-----[ FIND ]------------------------------------------
#
# from the sql statement: $sql = "INSERT INTO " . USERS_TABLE . " (user_id...
# VALUES ($user_id, ...
#
$sql = "INSERT INTO " . USERS_TABLE
VALUES (
#
#-----[ IN-LINE FIND ]------------------------------------------
#
user_from,
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
user_from_flag,
#
#-----[ IN-LINE FIND ]------------------------------------------
#
'" . str_replace("\'", "''", $location) . "',
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
'$user_flag',
#
#-----[ FIND ]------------------------------------------
#
$location = $userdata['user_from'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
// FLAGHACK-start
$user_flag = $userdata['user_from_flag'];
// FLAGHACK-end
#
#-----[ FIND ]------------------------------------------
#
# from the function call to display_avatar_gallery(...)
#
display_avatar_gallery(
#
#-----[ IN-LINE FIND ]------------------------------------------
#
$location,
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
$user_flag,
#
#-----[ FIND ]------------------------------------------
#
if ( $mode == 'editprofile' )
{
$template->assign_block_vars('switch_edit_profile', array());
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
// FLAGHACK-start
// query to get the list of flags
$sql = "SELECT *
FROM " . FLAG_TABLE . "
ORDER BY flag_id";
if(!$flags_result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't obtain flags information.", "", __LINE__, __FILE__, $sql);
}
$flag_row = $db->sql_fetchrowset($ranksresult);
$num_flags = $db->sql_numrows($ranksresult) ;
// build the html select statement
$flag_start_image = 'blank.gif' ;
$selected = ( isset($user_flag) ) ? '' : ' selected="selected"' ;
$flag_select = "<select name=\"user_flag\" onChange=\"document.images['user_flag'].src = 'images/flags/'
+ this.value;\" >";
$flag_select .= "<option value=\"blank.gif\"$selected>" . $lang['Select_Country'] . "</option>";
for ($i = 0; $i < $num_flags; $i++)
{
$flag_name = $flag_row[$i]['flag_name'];
$flag_image = $flag_row[$i]['flag_image'];
$selected = ( isset( $user_flag) ) ? (($user_flag == $flag_image) ? 'selected="selected"' : '' ) : '' ;
$flag_select .= "\t<option value=\"$flag_image\"$selected>$flag_name</option>";
if ( isset( $user_flag) && ($user_flag == $flag_image))
{
$flag_start_image = $flag_image ;
}
}
$flag_select .= '</select>';
// FLAGHACK-end
#
#-----[ FIND ]------------------------------------------
#
'LOCATION' => $location,
#
#-----[ AFTER, ADD ]------------------------------------------
#
// FLAGHACK-start
'L_FLAG' => $lang['Country_Flag'],
'FLAG_SELECT' => $flag_select,
'FLAG_START' => $flag_start_image,
// FLAGHACK-end
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_avatar.php
#
#-----[ FIND ]------------------------------------------
#
# from the function declaration of display_avatar_gallery(...)
#
function display_avatar_gallery(
#
#-----[ IN-LINE FIND ]------------------------------------------
#
&$location,
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
&$user_flag,
#
#-----[ FIND ]------------------------------------------
#
# from the line $params = array(...)
#
$params = array(
#
#-----[ IN-LINE FIND ]------------------------------------------
#
'location',
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
'user_flag',
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
# from the sql statement starting as: $sql = "SELECT u.username
#
u.user_posts, u.user_from,
#
#-----[ IN-LINE FIND ]------------------------------------------
#
u.user_from,
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
u.user_from_flag,
#
#-----[ FIND ]------------------------------------------
#
# NOTE: the complete line to find is:
# $poster_from = ( $postrow[$i]['user_from'] && $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Location'] . ': ' . $postrow[$i]['user_from'] : '';
#
$poster_from = (
#
#-----[ AFTER, ADD ]------------------------------------------
#
// FLAGHACK-start
$poster_from_flag = ( $postrow[$i]['user_from_flag'] && $postrow[$i]['user_id'] != ANONYMOUS ) ? "<img src=\"images/flags/" . $postrow[$i]['user_from_flag'] . "\" alt=\"" . $postrow[$i]['user_from_flag'] . "\" border=\"0\" width=\"32\" height=\"20\" /><br />" : "";
// FLAGHACK-end
#
#-----[ FIND ]------------------------------------------
#
'POSTER_FROM' => $poster_from,
#
#-----[ AFTER, ADD ]------------------------------------------
#
// FLAGHACK-start
'POSTER_FROM_FLAG' => $poster_from_flag,
// FLAGHACK-end
#
#-----[ OPEN ]------------------------------------------
#
memberlist.php
#
#-----[ FIND ]------------------------------------------
#
# from the sql statement starting as: $sql = "SELECT username,
#
user_regdate, user_from,
#
#-----[ IN-LINE FIND ]------------------------------------------
#
user_from,
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
user_from_flag,
#
#-----[ FIND ]------------------------------------------
#
# NOTE: the complete line to find is:
# $from = ( !empty($row['user_from']) ) ? $row['user_from'] : ' ';
#
$from = (
#
#-----[ AFTER, ADD ]------------------------------------------
#
// FLAGHACK-start
$flag = ( !empty($row['user_from_flag']) ) ? " <img src=\"images/flags/" . $row['user_from_flag'] . "\" alt=\"" . $row['user_from_flag'] . "\">" : ' <img src="images/flags/blank.gif" alt="">';
// FLAGHACK-end
#
#-----[ FIND ]------------------------------------------
#
'FROM' => $from,
#
#-----[ AFTER, ADD ]------------------------------------------
#
// FLAGHACK-start
'FLAG' => $flag,
// FLAGHACK-end
#
#-----[ OPEN ]------------------------------------------
#
admin/admin_users.php
#
#-----[ FIND ]------------------------------------------
#
# NOTE: the complete line to find is:
# $user_timezone = ( isset( $HTTP_POST_VARS['timezone']) ) ? doubleval( $HTTP_POST_VARS['timezone'] ) : $board_config['board_timezone'];
#
$user_timezone = (
#
#-----[ AFTER, ADD ]------------------------------------------
#
// FLAGHACK-start
$user_flag = ( !empty($HTTP_POST_VARS['user_flag']) ) ? $HTTP_POST_VARS['user_flag'] : '' ;
// FLAGHACK-end
#
#-----[ FIND ]------------------------------------------
#
$sql = "UPDATE " . USERS_TABLE . "
user_from = '" . str_replace("\'", "''", $location) . "',
#
#-----[ IN-LINE FIND ]------------------------------------------
#
user_from = '" . str_replace("\'", "''", $location) . "',
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
user_from_flag = '$user_flag',
#
#-----[ FIND ]------------------------------------------
#
#
$location = htmlspecialchars($this_userdata['user_from']);
#
#-----[ AFTER, ADD ]------------------------------------------
#
// FLAGHACK-start
$user_flag = htmlspecialchars($this_userdata['user_from_flag']);
// FLAGHACK-end
#
#-----[ FIND ]------------------------------------------
#
# NOTE: the complete line to find is:
# $s_hidden_fields .= '<input type="hidden" name="location" value="' . str_replace("\"", """, $location) . '" />';
#
type="hidden" name="location"
#
#-----[ AFTER, ADD ]------------------------------------------
#
// FLAGHACK-start
$s_hidden_fields .= '<input type="hidden" name="user_flag" value="' . $user_flag . '" />';
// FLAGHACK-end
#
#-----[ FIND ]------------------------------------------
#
# NOTE: the complete line to find is:
# $form_enctype = ( !@$ini_val('file_uploads') || phpversion() == '4.0.4pl1' || !$board_config['allow_avatar_upload'] || ( phpversion() < '4.0.3' && @$ini_val('open_basedir') != '' ) ) ? '' : 'enctype="multipart/form-data"';
$form_enctype = (
#
#-----[ AFTER, ADD ]------------------------------------------
#
// FLAGHACK-start
// query to get the list of flags
$sql = "SELECT *
FROM " . FLAG_TABLE . "
ORDER BY flag_id";
if(!$flags_result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't obtain flags information.", "", __LINE__, __FILE__, $sql);
}
$flag_row = $db->sql_fetchrowset($ranksresult);
$num_flags = $db->sql_numrows($ranksresult) ;
// build the html select statement
$flag_start_image = 'blank.gif' ;
$selected = ( isset($user_flag) ) ? '' : ' selected="selected"' ;
$flag_select = "<select name=\"user_flag\" onChange=\"document.images['user_flag'].src = '../images/flags/'
+ this.value;\" >";
$flag_select .= "<option value=\"blank.gif\"$selected>" . $lang['Select_Country'] . "</option>";
for ($i = 0; $i < $num_flags; $i++)
{
$flag_name = $flag_row[$i]['flag_name'];
$flag_image = $flag_row[$i]['flag_image'];
$selected = ( isset( $user_flag) ) ? (($user_flag == $flag_image) ? 'selected="selected"' : '' ) : '' ;
$flag_select .= "\t<option value=\"$flag_image\"$selected>$flag_name</option>";
if ( isset( $user_flag) && ($user_flag == $flag_image))
{
$flag_start_image = $flag_image ;
}
}
$flag_select .= '</select>';
// FLAGHACK-end
#
#-----[ FIND ]------------------------------------------
#
# NOTE: the complete line to find is:
# 'LOCATION' => $location,
#
'LOCATION' =>
#
#-----[ AFTER, ADD ]------------------------------------------
#
// FLAGHACK-start
'L_FLAG' => $lang['Country_Flag'],
'FLAG_SELECT' => $flag_select,
'FLAG_START' => $flag_start_image,
// FLAGHACK-end
##
## --- NOTE: You will have to make the following changes to ALL languages that ---
## --- you plan to support on your board. I use "English" as an example ---
##
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
# NOTE: the complete line to find is:
# $lang['A_critical_error'] = 'A Critical Error Occurred';
#
$lang['A_critical_error']
#
#-----[ AFTER, ADD ]------------------------------------------
#
// FLAGHACK-start
$lang['Country_Flag'] = 'Country Flag';
$lang['Select_Country'] = 'SELECT COUNTRY' ;
// FLAGHACK-end
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_admin.php
#
#-----[ FIND ]------------------------------------------
#
# NOTE: the complete line to find is:
# $lang['Restore_DB'] = 'Restore Database';
$lang['Restore_DB']
#
#-----[ AFTER, ADD ]------------------------------------------
#
// FLAGHACK-start
$lang['Flags'] = 'Flags';
// FLAGHACK-end
#
#-----[ FIND ]------------------------------------------
#
# NOTE: the complete line to find is:
# $lang['Click_return_rankadmin'] = 'Click %sHere%s to return to Rank Administration';
#
$lang['Click_return_rankadmin']
#
#-----[ AFTER, ADD ]------------------------------------------
#
// FLAGHACK-start
//
// Flags admin
//
$lang['Flags_title'] = 'Flag Administration';
$lang['Flags_explain'] = 'Using this form you can add, edit, view and delete flags. You can also create custom flags which can be applied to a user via the user management facility';
$lang['Add_new_flag'] = 'Add new flag';
$lang['Flag_name'] = 'Flag Name';
$lang['Flag_pic'] = 'Image';
$lang['Flag_image'] = 'Flag Image (in the images/flags/ directory)';
$lang['Flag_image_explain'] = 'Use this to define a small image associated with the flag';
$lang['Must_select_flag'] = 'You must select a flag';
$lang['Flag_updated'] = 'The flag was successfully updated';
$lang['Flag_added'] = 'The flag was successfully added';
$lang['Flag_removed'] = 'The flag was successfully deleted';
$lang['No_update_flags'] = 'The flag was successfully deleted. However, user accounts using this flag were not updated. You will need to manually reset the flag on these accounts';
$lang['Flag_confirm'] = 'Delete Flag' ;
$lang['Confirm_delete_flag'] = 'Are you sure you want to remove the selected flag?' ;
$lang['Click_return_flagadmin'] = 'Click %sHere%s to return to Flag Administration';
// FLAGHACK-end
##
## --- NOTE: You will have to make this change to ALL themes you have ---
## --- installed. I use "subSilver" as an example. ---
##
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/viewtopic_body.tpl
#
#-----[ FIND ]------------------------------------------
#
{postrow.POSTER_FROM}</span><br />
#
#-----[ IN-LINE FIND ]------------------------------------------
#
{postrow.POSTER_FROM}</span><br />
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
{postrow.POSTER_FROM_FLAG}
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/profile_add_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="row1"><span class="gen">{L_LOCATION}:</span></td>
<td class="row2">
<input
</td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- FLAGHACK-start -->
<tr>
<td class="row1"><span class="gen">{L_FLAG}:</span></td>
<td class="row2"><span class="gensmall">
<table><tr>
<td>{FLAG_SELECT} </td>
<td><img src="images/flags/{FLAG_START}" width="32" height="20" name="user_flag" /></td>
</tr></table>
</span></td>
</tr>
<!-- FLAGHACK-end -->
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/memberlist_body.tpl
#
#-----[ FIND ]------------------------------------------
#
# NOTE: the complete line to find is:
# <td class="{memberrow.ROW_CLASS}" align="center" valign="middle"><span class="gen">{memberrow.FROM}</span></td>
#
{memberrow.FROM}
#
#-----[ IN-LINE FIND ]------------------------------------------
#
{memberrow.FROM}
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
<table class="gen"><tr><td align=center width="100%">
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
</td><td align=right>{memberrow.FLAG}</td></tr></table>
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/admin/user_edit_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="row1"><span class="gen">{L_LOCATION}</span></td>
<td class="row2">
<input
</td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- FLAGHACK-start -->
<tr>
<td class="row1"><span class="gen">{L_FLAG}:</span></td>
<td class="row2"><span class="gensmall">
<table><tr>
<td>{FLAG_SELECT} </td>
<td><img src="../images/flags/{FLAG_START}" width="32" height="20" name="user_flag" /></td>
</tr></table>
</span></td>
</tr>
<!-- FLAGHACK-end -->
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Hoe doe ik dat?
Alvast bedankt!