Title: Zodiac Sign Selection v2.0

Author: John Briggs

Description:
This modification will provide an option to select a Zodiac Sign image in your member control panel.
This modification will display your selected Zodiac Sign image in your profile, control panel and threads.

Copyright:  2006 John Briggs. All rights reserved.

Compatability: XMB 1.9.8 SP3

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.

Author Note:
You downloaded this hack from XMBGarage.com, the #1 source for XMB related downloads.
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_zodiac',

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

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

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

                // Zodiac Sign Selection Mod Begin
                $zss = array();
                $zss[] = '<option value="">'.$lang['zodiacnone'].'</option>';
                $dp = opendir(ROOT.'images/zodiac');
                while ($file = readdir($dp)) {
                    if ($file != '.' AND $file != '..' AND $file != 'index.html') {
                        $zodiacname = $file;
                        $zodiacname = str_replace(array('.gif','.jpg','.png','_'), array('','','',' '), $zodiacname);
                        if ($memberinfo['zodiac'] == $file) {
                            $zss[] = '<option value="'.$file.'" selected="selected">'.$zodiacname.'</option>';
                        } else {
                            $zss[] = '<option value="'.$file.'">'.$zodiacname.'</option>';
                        }
                    }
                }
                closedir($dp);
                natcasesort($zss);
                $zodiacselect = '<select name="zodiac" onchange="document.getElementById(\'zodiacimg\').src = (this.options[this.selectedIndex].value != \'\') ? \'images/zodiac/\'+this.options[this.selectedIndex].value : \'./images/pixel.gif\';" />'.implode("\n", $zss).'</select>';
                $zodiacimg  = '<img src="'.ROOT.'images/pixel.gif" id="zodiacimg" alt="" />';
                if ($memberinfo['zodiac'] != '') {
                    $zodiacimg = '<img src="'.ROOT.'images/zodiac/'.$memberinfo['zodiac'].'" alt="'.str_replace(array('.gif','.jpg','.png','_'), array('','','',' '), $memberinfo['zodiac']).'" id="zodiacimg" />';
                }
                // Zodiac Sign Selection Mod End

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

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

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

                // Zodiac Sign Selection Mod Begin
                $zodiac = postedVar('zodiac', 'javascript', TRUE, TRUE, TRUE);
                // Zodiac Sign Selection Mod End

===================
Find Code (2 instances):
===================

) VALUES ('$username',

=========================
Replace Code With (2 instances):
=========================

, zodiac) VALUES ('$username',

=================================
Find Code At End Of Both Query Statements:
=================================

)");

===========================
Replace Code With (Both Instances):
===========================

, '$zodiac')");

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

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

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

                // Zodiac Sign Selection Mod Begin
                $zodiacblock = '';
                if ($memberinfo['zodiac'] != '') {
                    $zodiacname = $memberinfo['zodiac'];
                    $zodiacname = str_replace('.gif', '', $zodiacname);
                    $zodiacname = str_replace('_', ' ', $zodiacname);
                    if (file_exists(ROOT.'images/zodiac/'.$memberinfo['zodiac'])) {
                        $zodiacimg = '<img src="./images/zodiac/'.$memberinfo['zodiac'].'" alt="'.$zodiacname.'" title="'.$zodiacname.'" border="0" /><br />'.$zodiacname;
                        $memberinfo['zodiac'] = $zodiacimg;
                        eval('$zodiacblock = "'.template('member_profile_zodiac').'";');
                    }
                }
                // Zodiac Sign Selection Mod End

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

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

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

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

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

        // Zodiac Sign Selection Mod Begin
        $zss = array();
        $zss[] = '<option value="">'.$lang['zodiacnone'].'</option>';
        $dp = opendir(ROOT.'images/zodiac');
        while ($file = readdir($dp)) {
            if ($file != '.' AND $file != '..' AND $file != 'index.html') {
                $zodiacname = $file;
                $zodiacname = str_replace(array('.gif','.jpg','.png','_'), array('','','',' '), $zodiacname);
                if ($member['zodiac'] == $file) {
                    $zss[] = '<option value="'.$file.'" selected="selected">'.$zodiacname.'</option>';
                } else {
                    $zss[] = '<option value="'.$file.'">'.$zodiacname.'</option>';
                }
            }
        }
        closedir($dp);
        natcasesort($zss);
        $zodiacselect = '<select name="newzodiac" onchange="document.getElementById(\'zodiacimg\').src = (this.options[this.selectedIndex].value != \'\') ? \'images/zodiac/\'+this.options[this.selectedIndex].value : \'./images/pixel.gif\';" />'.implode("\n", $zss).'</select>';
        $zodiacimg  = '<img src="'.ROOT.'images/pixel.gif" id="zodiacimg" alt="" />';
        if ($member['zodiac'] != '') {
            $zodiacimg = '<img src="'.ROOT.'images/zodiac/'.$member['zodiac'].'" alt="'.str_replace(array('.gif','.jpg','.png','_'), array('','','',' '), $member['zodiac']).'" id="zodiacimg" />';
        }
        // Zodiac Sign Selection Mod End

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

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

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

        // Zodiac Sign Selection Mod Begin
        $newzodiac = formVar('newzodiac');
        $zodiac = $newzodiac ? checkInput($newzodiac, 'no', 'yes', 'javascript', false) : '';
        // Zodiac Sign Selection Mod End

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

        $sig = addslashes($sig);

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

        // Zodiac Sign Selection Mod Begin
        $zodiac = addslashes($zodiac);
        // Zodiac Sign Selection Mod End

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

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

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

 WHERE username='$xmbuser'");

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

, zodiac='$zodiac' 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'] = '';
    }

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

    // Zodiac Sign Selection Mod Begin
    if ($member['zodiac'] != '') {
        $zodiacname = $member['zodiac'];
        $zodiacname = str_replace('.gif', '', $zodiacname);
        $zodiacname = str_replace('_', ' ', $zodiacname);
        if (file_exists(ROOT.'images/zodiac/'.$member['zodiac'])) {
            $zodiacimg = '<img src="'.ROOT.'images/zodiac/'.$member['zodiac'].'" alt="'.$zodiacname.'" title="'.$zodiacname.'" border="0" /><br />'.$zodiacname;
            $member['zodiac'] = $zodiacimg;
        }
    }
    // Zodiac Sign Selection Mod End

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

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

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

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

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

    // Zodiac Sign Selection Mod Begin
    $zss = array();
    $zss[] = '<option value="">'.$lang['zodiacnone'].'</option>';
    $dp = opendir(ROOT.'images/zodiac');
    while ($file = readdir($dp)) {
        if ($file != '.' AND $file != '..' AND $file != 'index.html') {
            $zodiacname = $file;
            $zodiacname = str_replace(array('.gif','.jpg','.png','_'), array('','','',' '), $zodiacname);
            if ($member['zodiac'] == $file) {
                $zss[] = '<option value="'.$file.'" selected="selected">'.$zodiacname.'</option>';
            } else {
                    $zss[] = '<option value="'.$file.'">'.$zodiacname.'</option>';
            }
        }
    }
    closedir($dp);
    natcasesort($zss);
    $zodiacselect = '<select name="newzodiac" onchange="document.getElementById(\'zodiacimg\').src = (this.options[this.selectedIndex].value != \'\') ? \'images/zodiac/\'+this.options[this.selectedIndex].value : \'./images/pixel.gif\';" />'.implode("\n", $zss).'</select>';
    $zodiacimg  = '<img src="'.ROOT.'images/pixel.gif" id="zodiacimg" alt="" />';
    if ($member['zodiac'] != '') {
        $zodiacimg = '<img src="'.ROOT.'images/zodiac/'.$member['zodiac'].'" alt="'.str_replace(array('.gif','.jpg','.png','_'), array('','','',' '), $member['zodiac']).'" id="zodiacimg" />';
    }
    // Zodiac Sign Selection Mod End

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

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

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

    // Zodiac Sign Selection Mod Begin
    $newzodiac = formVar('newzodiac');
    $zodiac = $newzodiac ? checkInput($newzodiac, 'no', 'yes', 'javascript', false) : '';
    // Zodiac Sign Selection Mod End

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

    $sig = addslashes($sig);

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

    // Zodiac Sign Selection Mod Begin
    $zodiac = addslashes($zodiac);
    // Zodiac Sign Selection Mod End

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

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

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

 WHERE username='$user'");

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

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

            // Zodiac Sign Selection Mod Begin
            if ($post['zodiac'] != '') {
                $zodiacname = $post['zodiac'];
                $zodiacname = str_replace(array('.gif','.jpg','.png','_'), array('','','',' '), $zodiacname);
                if (file_exists(ROOT.'images/zodiac/'.$post['zodiac'].'')) {
                    $zodiacimg = '<img src="'.ROOT.'images/zodiac/'.$post['zodiac'].'" alt="'.$zodiacname.'" title="'.$zodiacname.'" border="0" /><br />'.$zodiacname.'<br />';
                    $post['zodiac'] = '<br />'.$lang['zodiac'].' '.$zodiacimg;
                }
            }
            // Zodiac Sign Selection Mod End

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

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

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

            // Zodiac Sign Selection Mod Begin
            $post['zodiac'] = '';
            // Zodiac Sign Selection Mod End

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

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

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

// Zodiac Sign Selection Mod Begin
$lang['zodiac'] = "Zodiac Sign:";
$lang['zodiacnone'] = "--Select Zodiac Sign--";
// Zodiac Sign Selection Mod End

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

=======================================================
Go To Admin Panel -> Templates -> 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[zodiac]</td>
<td bgcolor="$THEME[altbg2]">$zodiacselect&nbsp;<img id="zodiacimg" src="./images/zodiac/$member[zodiac]" alt="$zodiacname" title="$zodiacname" border="0" /></td>
</tr>

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

==========================================
Go To Admin Panel -> Templates -> 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[zodiac]</td>
<td bgcolor="$THEME[altbg2]">$zodiacselect&nbsp;<img id="zodiacimg" src="./images/pixel.gif" alt="$zodiacname" title="$zodiacname" border="0" /></td>
</tr>

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

===============================================
Go To Admin Panel -> Templates -> 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[zodiac]</td>
<td bgcolor="$THEME[altbg2]">$zodiacselect&nbsp;$zodiacimg</td>
</tr>

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

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

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

$location

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

$post[zodiac]

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

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

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

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

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

$zodiacblock

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

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

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

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" widht="22%" valign="top">$lang[zodiac]</td>
<td bgcolor="$THEME[altbg2]">$memberinfo[zodiac]</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="$THEME[altbg1]" valign="top">$lang[zodiac]</td>
<td bgcolor="$THEME[altbg2]" valign="top" align="center">$member[zodiac]</td>

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

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

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