Title: Australian Flag Selection v1.0

Author: John Briggs

Copyright:  2009 John Briggs. All rights reserved.

Description:
This modification will provide an option to select which Australian Flag you are from in your member control panel.
This modification will display your selected Australian flag image in your profile, control panel and threads.

Compatability: XMB 1.9.11

Install Note: Before adding this modification to your forum, you should back up all files related to this modification.

License Note: This modification is released under the GPL License. A copy is provided with this software package.

=======================================================================================================================
=======
Step 1:
=======
==============================
Go To Admin Panel -> Insert Raw SQL
==============================

Upload provided file named "SQL.txt" & click "Submit Changes" button.

=======================================================================================================================
=======
Step 2:
=======
=================
Edit File: member.php
=================
==========
Find Code:
==========

loadtemplates(

===============
Add Code Below:
===============

'member_profile_australia',

==========
Find Code:
==========

                $langfileselect = createLangFileSelect($langfile);

===============
Add Code Below:
===============

                // Australian Flag Selection Mod Begin
                $afs = array();
                $afs[] = '<option value="">'.$lang['australianone'].'</option>';
                $dp = opendir('./images/australia');
                while($file = readdir($dp)) {
                    if ($file != '.' And $file != '..' And $file != 'index.html') {
                        $australianame = $file;
                        $australianame = str_replace(array('.gif','.jpg','.png','.bmp','_'), array('','','','',' '), $australianame);
                        $afs[] = '<option value="'.$file.'">'.$australianame.'</option>';
                    }
                }
                closedir($dp);
                natcasesort($afs);
                $australiaselect = '<select name="australia">'.implode("\n", $afs).'</select>';
                // Australian Flag Selection Mod End

==========
Find Code:
==========

                $sig = postedVar('sig', 'javascript', ($SETTINGS['sightml']=='off'), TRUE, TRUE);

===============
Add Code Below:
===============

                // Australian Flag Selection Mod Begin
                $australia = postedVar('australia', 'javascript', TRUE, TRUE, TRUE);
                // Australian Flag Selection Mod End

====================
Find Code (1st Instance):
====================

) VALUES ('$username',

==========================
Replace Code With (1st Instance):
==========================

, australia) VALUES ('$username',

=======================================
Find Code At End Of Query Statement (1st Instance):
=======================================

)");

==========================
Replace Code With (1st Instance):
==========================

, '')");

====================
Find Code (2nd Instance):
====================

) VALUES ('$username',

==========================
Replace Code With (2nd Instance):
==========================

, australia) VALUES ('$username',

=======================================
Find Code At End Of Query Statement (2nd Instance):
=======================================

)");

==========================
Replace Code With (2nd Instance):
==========================

, '$australia')");

==========
Find Code:
==========

        if ($memberinfo['customstatus'] != '') {
            $showtitle = $rank['title'];
            $customstatus = '<br />'.censor($memberinfo['customstatus']);
        } else {
            $showtitle = $rank['title'];
            $customstatus = '';
        }

===============
Add Code Below:
===============

        // Australian Flag Selection Mod Begin
        $australiablock = '';
        if ($memberinfo['australia'] != '') {
            $australianame = $memberinfo['australia'];
            $australianame = str_replace(array('.gif','.jpg','.png','.bmp','_'), array('','','','',' '), $australianame);
            if (@file_exists('./images/australia/'.$memberinfo['australia'])) {
                $australiaimg = '<img src="./images/australia/'.$memberinfo['australia'].'" alt="'.$australianame.'" border="0" />';
                $memberinfo['australia'] = $australiaimg;
                eval('$australiablock = "'.template('member_profile_australia').'";');
            }
        }
        // Australian Flag Selection Mod End

=======================================================================================================================
=======
Step 3:
=======
=================
Edit File: memcp.php
=================
==========
Find Code:
==========

        $langfileselect = createLangFileSelect($member['langfile']);

===============
Add Code Below:
===============

        // Australian Flag Selection Mod Begin
        $afs = array();
        $afs[] = '<option value="">'.$lang['australianone'].'</option>';
        $dp = opendir(ROOT.'images/australia');
        while($file = readdir($dp)) {
            if ($file != '.' And $file != '..' And $file != 'index.html') {
                $australianame = $file;
                $australianame = str_replace(array('.gif','.jpg','.png','.bmp','_'), array('','','','',' '), $australianame);
                if ($member['australia'] == $file) {
                    $afs[] = '<option value="'.$file.'" '.$selHTML.'>'.$australianame.'</option>';
                } else {
                    $afs[] = '<option value="'.$file.'">'.$australianame.'</option>';
                }
            }
        }
        closedir($dp);
        natcasesort($afs);
        $australiaselect = '<select name="australia">'.implode("\n", $afs).'</select>';
        // Australian Flag Selection Mod End

==========
Find Code:
==========

        $sig = postedVar('newsig', 'javascript', ($SETTINGS['sightml']=='off'), TRUE, TRUE);

===============
Add Code Below:
===============

        // Australian Flag Selection Mod Begin
        $australia = postedVar('australia', 'javascript', TRUE, TRUE, TRUE);
        // Australian Flag Selection Mod End

==========
Find Code:
==========

        $db->query("UPDATE ".X_PREFIX."members SET $pwtxt

==========================================
Find Code In-Line At End Of Above Query australiament:
==========================================

 WHERE username='$xmbuser'");

================
Replace Code With:
================

, australia='$australia' WHERE username='$xmbuser'");

==========
Find Code:
==========

    if ($member['mood'] != '') {
        $member['mood'] = postify($member['mood'], 'no', 'no', 'yes', 'no', 'yes', 'no', true, 'yes');
    } else {
        $member['mood'] = '';
    }

===============
Add Code Below:
===============

    // Australian Flag Selection Mod Begin
    if ($member['australia'] != '') {
        $australianame = $member['australia'];
        $australianame = str_replace(array('.gif','.jpg','.png','.bmp','_'), array('','','','',' '), $australianame);
        if (@file_exists('./images/australia/'.$member['australia'])) {
            $australiaimg = '<img src="./images/australia/'.$member['australia'].'" alt="'.$australianame.'" border="0" />';
            $member['australia'] = $australiaimg;
        }
    }
    // Australian Flag Selection Mod End

=======================================================================================================================
=======
Step 4:
=======
===================
Edit File: editprofile.php
===================
==========
Find Code:
==========

    $langfileselect = createLangFileSelect($member['langfile']);

===============
Add Code Below:
===============

    // Australian Flag Selection Mod Begin
    $afs = array();
    $afs[] = '<option value="">'.$lang['australianone'].'</option>';
    $dp = opendir(ROOT.'images/australia');
    while($file = readdir($dp)) {
        if ($file != '.' And $file != '..' And $file != 'index.html') {
            $australianame = $file;
            $australianame = str_replace(array('.gif','.jpg','.png','.bmp','_'), array('','','','',' '), $australianame);
            if ($member['australia'] == $file) {
                $afs[] = '<option value="'.$file.'" '.$selHTML.'>'.$australianame.'</option>';
            } else {
                $afs[] = '<option value="'.$file.'">'.$australianame.'</option>';
            }
        }
    }
    closedir($dp);
    natcasesort($afs);
    $australiaselect = '<select name="australia">'.implode("\n", $afs).'</select>';
    // Australian Flag Selection Mod End

==========
Find Code:
==========

    $sig = postedVar('newsig', 'javascript', ($SETTINGS['sightml']=='off'), TRUE, TRUE);

===============
Add Code Below:
===============

    // Australian Flag Selection Mod Begin
    $australia = postedVar('australia', 'javascript', TRUE, TRUE, TRUE);
    // Australian Flag Selection Mod End

==========
Find Code:
==========

$db->query("UPDATE ".X_PREFIX."members SET status='$status',

========================================
Find Code In-Line At End Of Above Query Statement:
========================================

 WHERE username='$user'");

==================
Replace Code With:
==================

, australia='$australia' WHERE username='$user'");

=======================================================================================================================
=======
Step 5:
=======
===================
Edit File: viewthread.php
===================
==========
Find Code:
==========

            if ($post['location'] != '') {
                $post['location'] = censor($post['location']);
                $location = '<br />'.$lang['textlocation'].' '.$post['location'];
            } else {
                $location = '';
            }

===============
Add Code Below:
===============

            // Australian Flag Selection Mod Begin
            if ($post['australia'] != '') {
                $australianame = $post['australia'];
                $australianame = str_replace(array('.gif','.jpg','.png','.bmp','_'), array('','','','',' '), $australianame);
                if (@file_exists('./images/australia/'.$post['australia'])) {
                    $australiaimg = '<img src="./images/australia/'.$post['australia'].'" alt="'.$australianame.'" border="0" />';
                    $post['australia'] = '<br />'.$lang['australia'].' '.$australiaimg;
                }
            }
            // Australian Flag Selection Mod End

==========
Find Code:
==========

            $profilelink = $post['author'];

===============
Add Code Below:
===============

            // Australian Flag Selection Mod Begin
            $post['australia'] = '';
            // Australian Flag Selection Mod End

=======================================================================================================================
=======
Step 6:
=======
==============================================
Go To Admin Panel -> Translations & Download Language File
==============================================
=======================
Edit File: lang/English.lang.php
=======================
============================
Add Code To End Of File Above ?>
============================

// Australian Flag Selection Mod Begin
$lang['australia'] = 'Australian Flag:';
$lang['australianone'] = '--- Select Australian Flag ---';
// Australian Flag Selection Mod End

============================================
Go To Admin Panel -> Translations & Upload Language File
============================================

=======================================================================================================================
=======
Step 7:
=======
==========================
Go To Admin Panel -> Templates
==========================
===========================
Edit Template: admintool_editprofile
===========================
==========
Find Code:
==========

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[textlocation]</td>
<td bgcolor="$altbg2"><input type="text" name="newlocation" size="25" value="$member[location]" /></td>
</tr>

===============
Add Code Below:
===============

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[australia]</td>
<td bgcolor="$THEME[altbg2]">$australiaselect</td>
</tr>

=======================================================================================================================
=======
Step 8:
=======
==========================
Go To Admin Panel -> Templates
==========================
===========================
Edit Template: member_reg_optional
===========================
==========
Find Code:
==========

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[textlocation]</td>
<td bgcolor="$altbg2"><input type="text" name="location" size="25" value="" /></td>
</tr>

===============
Add Code Below:
===============

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[australia]</td>
<td bgcolor="$THEME[altbg2]">$australiaselect</td>
</tr>

=======================================================================================================================
=======
Step 9:
=======
==========================
Go To Admin Panel -> Templates
==========================
=======================
Edit Template: memcp_profile
=======================

==========
Find Code:
==========

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[textlocation]</td>
<td bgcolor="$altbg2"><input type="text" name="newlocation" size="25" value="$member[location]" /></td>
</tr>

===============
Add Code Below:
===============

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[australia]</td>
<td bgcolor="$THEME[altbg2]">$australiaselect</td>
</tr>

=======================================================================================================================
========
Step 10:
========
==========================
Go To Admin Panel -> Templates
==========================
========================
Edit Template: viewthread_post
========================

==========
Find Code:
==========

$location

===============
Add Code Below:
===============

$post[australia]

=======================================================================================================================
========
Step 11:
========
==========================
Go To Admin Panel -> Templates
=======================
Edit Template: member_profile
=======================
==========
Find Code:
==========

<tr class="tablerow">
<td bgcolor="$altbg1">$lang[textlocation]</td>
<td bgcolor="$altbg2">$memberinfo[location]</td>
</tr>

===============
Add Code Below:
===============

$australiablock

=======================================================================================================================
========
Step 12:
========
==========================
Go To Admin Panel -> Templates
==========================
====================================
Create New Template: member_profile_australia
====================================
===========================
Add Code & Click Submit Changes
===========================

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%" valign="top">$lang[australia]</td>
<td bgcolor="$THEME[altbg2]">$memberinfo[australia]</td>
</tr>

=======================================================================================================================
========
Step 13:
========
==========================
Go To Admin Panel -> Templates
==========================
======================
Edit Template: memcp_home
==========================
==========
Find Code:
==========

<td bgcolor="$altbg1" valign="top">&nbsp;</td>
<td bgcolor="$altbg2" valign="top">&nbsp;</td>

==================
Replace Code With:
==================

<td bgcolor="$THEME[altbg1]" valign="top">$lang[australia]</td>
<td bgcolor="$THEME[altbg2]" valign="top">$member[australia]</td>

=======================================================================================================================
========
Step 14:
========

Now upload provided folder named "/australia/" to your forum "/images/" directory.

=======================================================================================================================
Enjoy!