Title: Harry Potter Character Selection v1.0

Author: WormHole

Description:
This mod will provide an option to select a Harry Potter character image in your member control panel.
This mod will display your selected Harry Potter character image in your profile, control panel and threads.

Copyright:  2006 John Briggs. All rights reserved.

Compatability: XMB 1.9.5 Final

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

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

Author Note:
You downloaded this hack from XMBGarage.com.
Please visit http://www.xmbgarage.com/ for support.

=======================================================================================================================================================
=======
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(

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

loadtemplates('member_profile_hpchar',

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

            $lfs = array();
            $dir = opendir(ROOT.'/lang/');
            while($file = readdir($dir)) {
                if (is_file(ROOT.'/lang/'.$file) && false !== strpos($file, '.lang.php')) {
                    $file = str_replace('.lang.php', '', $file);
                    if ($file == $SETTINGS['langfile']) {
                        $lfs[] = '<option value="' .$file. '" selected="selected">'.$file.'</option>';
                    } else {
                        $lfs[] = '<option value="' .$file. '">'.$file.'</option>';
                    }
                }
            }
            natcasesort($lfs);
            $langfileselect = '<select name="newlangfile">'.implode("\n", $lfs).'</select>';

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

            $hps = array();
            $hps[] = '<option value="">'.$lang['hpcharnone'].'</option>';
            $dp = opendir(ROOT.'images/hpchar');
            while ($file = readdir($dp)) {
                if ($file != '.' AND $file != '..' AND $file != 'index.html') {
                    $hpcharname = $file;
                    $hpcharname = str_replace('.gif', '', $hpcharname);
                    $hpcharname = str_replace('_', ' ', $hpcharname);
                    $hps[] = '<option value="'.$file.'">'.$hpcharname.'</option>';
                }
            }
            closedir($dp);
            natcasesort($hps);
            $hpcharselect = '<select name="hpchar">'.implode("\n", $hps).'</select>';

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

        $sig         = checkInput($_POST['sig']);

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

        $hpchar     = isset($hpchar) ? checkInput($hpchar, '', '', 'javascript', false) : '';

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

        $locationnew    = addslashes($locationnew);

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

        $hpchar         = addslashes($hpchar);

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

        $db->query("INSERT INTO $table_members (uid,

=====================================
Find Code In-Line In Above Statement:
=====================================

) VALUES ('', '$username',

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

, hpchar) VALUES ('', '$username',

==========================================
Find Code At End Of Above Query Statement:
==========================================

)");

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

, '$hpchar')");

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

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

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

            $hpcharblock = '';
            if ($memberinfo['hpchar'] != '') {
                $hpcharname = $memberinfo['hpchar'];
                $hpcharname = str_replace('.gif', '', $hpcharname);
                $hpcharname = str_replace('_', ' ', $hpcharname);
                if (file_exists(ROOT.'images/hpchar/'.$memberinfo['hpchar'])) {
                    $hpcharimg = '<img src="./images/hpchar/'.$memberinfo['hpchar'].'" alt="'.$hpcharname.'" title="'.$hpcharname.'" border="0" />';
                    $memberinfo['hpchar'] = $hpcharimg;
                    eval('$hpcharblock = "'.template('member_profile_hpchar').'";');
                }
            }

=======================================================================================================================================
=======
Step 3:
=======

====================
Edit File: memcp.php
====================

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

        $lfs = array();
        $dir = opendir(ROOT.'/lang/');
        while($file = readdir($dir)) {
            if (is_file(ROOT.'/lang/'.$file) && false !== strpos($file, '.lang.php')) {
                $file = str_replace('.lang.php', '', $file);
                if ($file == $member['langfile']) {
                    $lfs[] = '<option value="' .$file. '" selected="selected">'.$file.'</option>';
                } else {
                    $lfs[] = '<option value="' .$file. '">'.$file.'</option>';
                }
            }
        }
        natcasesort($lfs);
        $langfileselect = '<select name="langfilenew">'.implode("\n", $lfs).'</select>';

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

        $hps = array();
        $hps[] = '<option value="">'.$lang['hpcharnone'].'</option>';
        $dp = opendir(ROOT.'images/hpchar');
        while ($file = readdir($dp)) {
            if ($file != '.' AND $file != '..' AND $file != 'index.html') {
                $hpcharname = $file;
                $hpcharname = str_replace('.gif', '', $hpcharname);
                $hpcharname = str_replace('_', ' ', $hpcharname);
                if ($member['hpchar'] == $file) {
                    $hps[] = '<option value="'.$file.'" selected="selected">'.$hpcharname.'</option>';
                } else {
                    $hps[] = '<option value="'.$file.'">'.$hpcharname.'</option>';
                }
            }
        }
        closedir($dp);
        natcasesort($hps);
        $hpcharselect = '<select name="hpchar">'.implode("\n", $hps).'</select>';

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

        $sig            = isset($newsig) ? checkInput($newsig, '', $SETTINGS['sightml'], '', false) : '';

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

        $hpchar        = isset($hpchar) ? checkInput($hpchar, '', '', 'javascript', false) : '';

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

        $memlocation    = addslashes($memlocation);

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

        $hpchar         = addslashes($hpchar);

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

$db->query("UPDATE $table_members SET $pwtxt email='$email',

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

 WHERE username='$xmbuser'");

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

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

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

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

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

    if ($member['hpchar'] != '') {
        $hpcharname = $member['hpchar'];
        $hpcharname = str_replace('.gif', '', $hpcharname);
        $hpcharname = str_replace('_', ' ', $hpcharname);
        if (file_exists(ROOT.'images/hpchar/'.$member['hpchar'])) {
            $hpcharimg = '<img src="./images/hpchar/'.$member['hpchar'].'" alt="'.$hpcharname.'" title="'.$hpcharname.'" border="0" />';
            $member['hpchar'] = $hpcharimg;
        }
    }

=======================================================================================================================================
=======
Step 4:
=======

==========================
Edit File: editprofile.php
==========================

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

    $langfileselect = "<select name=\"langfilenew\">\n";
    $dir = opendir("lang");
    while ( $thafile = readdir($dir) )
    {
        if ( is_file("lang/$thafile") && false !== strpos($thafile, '.lang.php') )
        {
            $thafile = str_replace(".lang.php", "", $thafile);
            if ( $thafile == $member['langfile'] )
            {
                $langfileselect .= "<option value=\"" .$thafile. "\" selected=\"selected\">" .$thafile. "</option>\n";
            }
            else
            {
                $langfileselect .= "<option value=\"" .$thafile. "\">" .$thafile. "</option>\n";
            }
        }
    }
    $langfileselect .= "</select>";

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

    $hps = array();
    $hps[] = '<option value="">'.$lang['hpcharnone'].'</option>';
    $dp = opendir(ROOT.'images/hpchar');
    while ($file = readdir($dp)) {
        if ($file != '.' AND $file != '..' AND $file != 'index.html') {
            $hpcharname = $file;
            $hpcharname = str_replace('.gif', '', $hpcharname);
            $hpcharname = str_replace('_', ' ', $hpcharname);
            if ($member['hpchar'] == $file) {
                $hps[] = '<option value="'.$file.'" selected="selected">'.$hpcharname.'</option>';
            } else {
                $hps[] = '<option value="'.$file.'">'.$hpcharname.'</option>';
            }
        }
    }
    closedir($dp);
    natcasesort($hps);
    $hpcharselect = '<select name="hpchar">'.implode("\n", $hps).'</select>';

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

    $sig            = isset($newsig) ? checkInput($newsig, '', $SETTINGS['sightml'], '', false) : '';

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

    $hpchar        = isset($hpchar) ? checkInput($hpchar, '', '', 'javascript', false) : '';

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

    $memlocation    = addslashes($newmemlocation);

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

    $hpchar         = addslashes($hpchar);

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

$db->query("UPDATE $table_members SET email='$email',

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

 WHERE username='$user'");

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

, hpchar='$hpchar' 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:
===============

            if ($post['hpchar'] != '') {
                $hpcharname = $post['hpchar'];
                $hpcharname = str_replace('.gif', '', $hpcharname);
                $hpcharname = str_replace('_', ' ', $hpcharname);
                if (file_exists(ROOT.'images/hpchar/'.$post['hpchar'].'')) {
                    $hpcharimg = '<img src="./images/hpchar/'.$post['hpchar'].'" alt="'.$hpcharname.'" title="'.$hpcharname.'" border="0" />';
                    $post['hpchar'] = '<br />'.$lang['hpchar'].' '.$hpcharimg;
                }
            }

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

            $location = '';
            $mood = '';

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

            $post['hpchar'] = '';

=======================================================================================================================================
=======
Step 6:
=======

=================================
Edit File: lang/English.lang.php
=================================

====================
Add Code To End Of File:
====================

$lang['hpchar'] = "Harry Potter Character:";
$lang['hpcharnone'] = "--Select Harry Potter Character--";

=======================================================================================================================================
=======
Step 7:
=======

=======================================================
Go To Admin Panel -> Templates -> admintool_editprofile
=======================================================

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

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

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

<tr>
<td bgcolor="$altbg1" width="22%" class="tablerow">$lang[hpchar]</td>
<td bgcolor="$altbg2" class="tablerow">$hpcharselect</td>
</tr>

=======================================================================================================================================
=======
Step 8:
=======

============================================
Go To Admin Panel -> Templates -> member_reg
============================================

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

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

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

<tr>
<td bgcolor="$altbg1" class="tablerow" width="22%">$lang[hpchar]</td>
<td bgcolor="$altbg2" class="tablerow">$hpcharselect</td>
</tr>

=======================================================================================================================================
=======
Step 9:
=======

===============================================
Go To Admin Panel -> Templates -> memcp_profile
===============================================

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

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

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

<tr>
<td bgcolor="$altbg1" width="22%" class="tablerow">$lang[hpchar]</td>
<td bgcolor="$altbg2" class="tablerow">$hpcharselect</td>
</tr>

=======================================================================================================================================
========
Step 10:
========

=================================================
Go To Admin Panel -> Templates -> viewthread_post
=================================================

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

$location

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

$post[hpchar]

=======================================================================================================================================
========
Step 11:
========

================================================
Go To Admin Panel -> Templates -> member_profile
================================================

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

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

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

$hpcharblock

=======================================================================================================================================
========
Step 12:
========

================================================================================
Go to admin panel -> templates -> create template name -> member_profile_hpchar
================================================================================

================================
Add Code & Click Submit Changes:
================================

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

=======================================================================================================================================
========
Step 13:
========

============================================
Go To Admin Panel -> Templates -> memcp_home
============================================

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

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

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

<td bgcolor="$altbg1" valign="top">$lang[hpchar]</td>
<td bgcolor="$altbg2" valign="top" align="center">$member[hpchar]</td>

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

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

=======================================================================================================================================