######################################################## ## Mod Title: Member Country Flags (aka: Flags) ## Mod Version: 2.0.5 ## Rev Date: May 18, 2002 ## ## Updated By: Nuttzy < pktoolkit@blizzhackers.com > ## Original By: John B. Abela < abela@4cm.com > ## Description: This mod allows your registered board ## members to select the flag country of ## their residence. Their flag will then ## display thoughout the phpBB system. ## ## Installation Level: Advanced Moders Only ## Installation Time: 20-30 Minutes ## Files To Edit: 12 ## Included Files: 193 .gif Files ## Flags.sql ## Flags-2-0-5.txt ## upgrade-Flags-2-0-5.txt ######################################################## ## EasyMod v0.4alpha compliant (automatic mod installer) ######################################################## ## ## ## UPGRADING FROM 1.X and 2.0 RC versions: ## If you had flaghack installed on phpBB 1.x then and ## then upgraded to 2.0, then you are in luck! You ## will need to rename some table field names, but all ## your data from 1.x should still be there and the ## new flaghack will use it! Just skip the flag.sql ## step and follow the rest of the install directions. ## ## ## UPGRADING FROM 2.0.4: ## If you installed the previous version, you should ## ignore ALL of the directions here and instead use ## the upgrade-Flags-2.0.5.txt to more simply upgrade ## what you already have. ## ## ## NEW INSTALLATION: ## Upload the /flag/ images to your server. Place ## them in a "flags" folder in the images folder. You ## should also have an "avatars" and "smilies" folders ## there. ## ## To execute the flag.sql file for MySQL, you can ## either have phpMyAdmin run it, or exexute the UNIX ## command line. ## ######################################################## ## ## Version History: ## 02/28/02 - Updated for phpBB 2.0 RC2 by Nuttzy ## 04/01/02 - Made RC4 complaint ## right justified flags in members listing ## 04/14/02 - version 2.0.4 ## release for phpBB 2.0 final ## 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 ## ######################################################## ## Author Notes: ## This MOD is not to be listed, downloaded or posted at ## -any- site except Official phpBB Web Sites. ## Thank You. JbA ######################################################## # #-----[ COPY IMAGES ]------------------------------------------ # copy flag images to /images/flags # #-----[ ALTER SCHEMA ]------------------------------------------ # Run flags.sql - This will setup your db table # #-----[ 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 ## ## --- 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 ]------------------------------------------ # // // That's all Folks! # #-----[ BEFORE, ADD ]------------------------------------------ # // FLAGHACK-start $lang['Country_Flag'] = "Country Flag"; $lang['Select_Country'] = "SELECT COUNTRY" ; // FLAGHACK-end # #-----[ OPEN ]------------------------------------------ # includes/usercp_viewprofile.php # #-----[ FIND ]------------------------------------------ # $pm_img = '" : ""; $location .= $flag ; // FLAGHACK-end # #-----[ FIND ]------------------------------------------ # 'LOCATION' => # #-----[ REPLACE ]------------------------------------------ # // FLAGHACK-start 'LOCATION' => $location, // FLAGHACK-end # #-----[ OPEN ]------------------------------------------ # includes/usercp_register.php # #-----[ FIND ]------------------------------------------ # $user_timezone = ( isset($HTTP_POST_VARS['timezone']) ) ? doubleval($HTTP_POST_VARS['timezone']) : $board_config['board_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 ]------------------------------------------ # NOTE: before and after the SQL statement I would add "// FLAGHACK-start-MOD" and "// FLAGHACK-end-MOD" without the quotes # 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 ]------------------------------------------ # NOTE: before and after the SQL statement I would add "// FLAGHACK-start-MOD" and "// FLAGHACK-end-MOD" without the quotes # '$user_flag', # #-----[ FIND ]------------------------------------------ # $location = htmlspecialchars($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 ]------------------------------------------ # NOTE: before and after the function call I would add "// FLAGHACK-start-MOD" and "// FLAGHACK-end-MOD" without the quotes # $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 = "'; // 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 ]------------------------------------------ # NOTE: before and after the function call I would add "// FLAGHACK-start-MOD" and "// FLAGHACK-end-MOD" without the quotes # &$user_flag, # #-----[ FIND ]------------------------------------------ # # from the line $params = array(...) # $params = array( # #-----[ IN-LINE FIND ]------------------------------------------ # 'location', # #-----[ IN-LINE AFTER, ADD ]------------------------------------------ # NOTE: before and after the function call I would add "// FLAGHACK-start-MOD" and "// FLAGHACK-end-MOD" without the quotes # '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 ]------------------------------------------ # NOTE: before and after the function call I would add "// FLAGHACK-start-MOD" and "// FLAGHACK-end-MOD" without the quotes # u.user_from_flag, # #-----[ FIND ]------------------------------------------ # $poster_from = ( $postrow[$i]['user_from'] && $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Location'] . ': ' . $postrow[$i]['user_from'] : ''; # #-----[ AFTER, ADD ]------------------------------------------ # // FLAGHACK-start $poster_from_flag = ( $postrow[$i]['user_from_flag'] && $postrow[$i]['user_id'] != ANONYMOUS ) ? "\""
" : ""; // 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 ]------------------------------------------ # NOTE: before and after the SQL statement I would add "// FLAGHACK-start-MOD" and "// FLAGHACK-end-MOD" without the quotes # user_from_flag, # #-----[ FIND ]------------------------------------------ # $from = ( !empty($row['user_from']) ) ? $row['user_from'] : ' '; # #-----[ AFTER, ADD ]------------------------------------------ # // FLAGHACK-start $flag = ( !empty($row['user_from_flag']) ) ? " \""" : ' '; // FLAGHACK-end # #-----[ FIND ]------------------------------------------ # 'FROM' => $from, # #-----[ AFTER, ADD ]------------------------------------------ # // FLAGHACK-start 'FLAG' => $flag, // FLAGHACK-end # #-----[ OPEN ]------------------------------------------ # admin/admin_users.php # #-----[ FIND ]------------------------------------------ # $user_timezone = ( isset( $HTTP_POST_VARS['timezone']) ) ? doubleval( $HTTP_POST_VARS['timezone'] ) : $board_config['board_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 ]------------------------------------------ # NOTE: before and after the SQL statement I would add "// FLAGHACK-start-MOD" and "// FLAGHACK-end-MOD" without the quotes # user_from_flag = '$user_flag', # #-----[ FIND ]------------------------------------------ # $location = $this_userdata['user_from']; # #-----[ AFTER, ADD ]------------------------------------------ # // FLAGHACK-start $user_flag = $this_userdata['user_from_flag']; // FLAGHACK-end # #-----[ FIND ]------------------------------------------ # # $s_hidden_fields .= ''; # #-----[ AFTER, ADD ]------------------------------------------ # // FLAGHACK-start $s_hidden_fields .= ''; // FLAGHACK-end # #-----[ FIND ]------------------------------------------ # $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 = "'; // 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 ## ## --- 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}
# #-----[ IN-LINE FIND ]------------------------------------------ # {postrow.POSTER_FROM}
# #-----[ IN-LINE AFTER, ADD ]------------------------------------------ # {postrow.POSTER_FROM_FLAG} # #-----[ OPEN ]------------------------------------------ # templates/subSilver/profile_add_body.tpl # #-----[ FIND ]------------------------------------------ # {L_LOCATION}: # #-----[ AFTER, ADD ]------------------------------------------ # {L_FLAG}:
{FLAG_SELECT}    
# #-----[ OPEN ]------------------------------------------ # templates/subSilver/memberlist_body.tpl # #-----[ FIND ]------------------------------------------ # {memberrow.FROM} # #-----[ REPLACE ]------------------------------------------ #
{memberrow.FROM} {memberrow.FLAG}
# #-----[ OPEN ]------------------------------------------ # templates/subSilver/admin/user_edit_body.tpl # #-----[ FIND ]------------------------------------------ # {L_LOCATION} # #-----[ AFTER, ADD ]------------------------------------------ # {L_FLAG}:
{FLAG_SELECT}    
# #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ # # EoM