Mod Title: Personal Photo v1.0

Mod Author: John Briggs

Last Updated: 05/13/06

Mod Description:
This mod provides an option to add a personal photo in your profile similiar to how avatars work.
This mod provides a height and width size control in admin panel settings.
This mod provides an on/off control in admin panel settings.

Supported Version: XMB 1.9.5 Nexus Final

Installation 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.

Author Note:
For security purposes, Please Check: http://www.xmbgarage.com for the latest version of this mod.
Downloading this mod from other sites could cause malicious code to enter into your XMB Forum software.
As such, XMB Garage will not offer support for mods not offered in our Hack Request List.

=======================================================================================================================
=======
Step 1:
=======

===========================================
Go To Administration Panel-->Insert Raw SQL
===========================================

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

=======================================================================================================================
=======
Step 2:
=======

=================
Edit File: cp.php
=================

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

        $avchecked[0] = $avchecked[1] = $avchecked[2] = false;

        if (!empty($avatarlist)) {
            $avchecked[1] = true;
        } elseif (!empty($avataroff)) {
            $avchecked[2] = true;
        } else {
            $avchecked[0] = true;
        }

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

        // Personal Photo Mod Begin
        $photo_on = $photo_off = '';
        switch ($SETTINGS['photostatus']) {
            case 'on':
                $photo_on = $selHTML;
                break;
            default:
                $photo_off = $selHTML;
                break;
        }
        // Personal Photo Mod End

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

        $lang['spell_checker'] .= $spell_off_reason;

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

        // Personal Photo Mod Begin
        $max_photo_sizes = explode('x', $SETTINGS['max_photo_size']);
        // Personal Photo Mod End

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

        printsetting1($lang['doublee'], 'doubleenew', $doubleeon, $doubleeoff);

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

        ?>

        <!-- Personal Photo Mod Begin -->
        <tr>
        <td class="tablerow" bgcolor="<?php echo $THEME['altbg2']?>" colspan="2">&nbsp;</td>
        </tr>
        <tr>
        <td bgcolor="<?php echo $THEME['altbg1']?>" colspan="2" class="category"><strong><font color="<?php echo $cattext?>">&raquo;&nbsp;<?php echo $lang['photo_main_settings']?></font></strong></td>
        </tr>

        <?php
        printsetting1($lang['photostatus'], 'photostatusnew', $photo_on, $photo_off);
        printsetting2($lang['max_photo_size_w'], "max_photo_size_w_new", $max_photo_sizes[0], 4);
        printsetting2($lang['max_photo_size_h'], "max_photo_size_h_new", $max_photo_sizes[1], 4);
        // Personal Photo Mod End

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

        $spellchecknew = ($spellchecknew == 'on' && defined('PSPELL_FAST')) ? 'on' : 'off';

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

        // Personal Photo Mod Begin
        $max_photo_size_w_new = (int) $max_photo_size_w_new;
        $max_photo_size_h_new = (int) $max_photo_size_h_new;
        $photostatusnew = ($photostatusnew == 'on') ? 'on' : 'off';
        // Personal Photo Mod End

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

$db->query("UPDATE $table_settings SET langfile='$langfilenew'

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

");

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

, photostatus='$photostatusnew', max_photo_size='${max_photo_size_w_new}x${max_photo_size_h_new}'");

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

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

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

,'admintool_editprofile');

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

,'admintool_editprofile','memcp_profile_photourl');

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

        eval("\$avatar = \"".template("memcp_profile_avatarlist")."\";");
        closedir($dir1);
    }

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

    // Personal Photo Mod Begin
    $photobox = '';
    if ($SETTINGS['photostatus'] == 'on') {
        eval("\$photobox = \"".template("memcp_profile_photourl")."\";");
    }
    // Personal Photo Mod End

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

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

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

    // Personal Photo Mod Begin
    $newphoto       = isset($newphoto) ? ereg_replace(' ', '%20', $newphoto) : ''; // Problem with spaces in photo url
    $photo	           = isset($photo) ? checkInput($photo, '', '', 'javascript', false) : '';
    // Personal Photo Mod End

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

    $memlocation    = addslashes($memlocation);

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

    // Personal Photo Mod Begin
    $photo	= addslashes($photo);
    // Personal Photo Mod End

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

    $max_size = explode('x', $SETTINGS['max_avatar_size']);
    if($max_size[0] > 0 && $max_size[1] > 0) {
        $size = @getimagesize($avatar);
        if($size === false ) {
            $avatar = '';
        } elseif(($size[0] > $max_size[0] && $max_size[0] > 0) || ($size[1] > $max_size[1] && $max_size[1] > 0)) {
            error($lang['avatar_too_big'] . $SETTINGS['max_avatar_size'] . 'px', false);
        }
    }

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

    // Personal Photo Mod Begin
    $photosize = @getimagesize($photo);
    $max_photosize = explode('x', $SETTINGS['max_photo_size']);
    if ($photosize === false && ($max_photosize['0'] > 0 && $max_photosize['1'] > 0)) {
        $photo = '';
    } elseif (($max_photosize['0'] > 0 && $max_photosize['1'] > 0) && ($photosize['0'] > $max_photosize['0'] || $photosize['1'] > $max_photosize['1']) && !X_SADMIN) {
        error($lang['photo_too_big'] . $SETTINGS['max_photo_size'] . 'px', false);
    }
    // Personal Photo Mod End

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

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

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

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

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

, 'memcp_subscriptions_row'

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

, 'memcp_subscriptions_row', 'memcp_profile_photourl'

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

        eval("\$avatar = \"".template("memcp_profile_avatarlist")."\";");
            closedir($dir1);
        }

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

        // Personal Photo Mod Begin
        $photobox = '';
        if ($SETTINGS['photostatus'] == 'on') {
            eval("\$photobox = \"".template("memcp_profile_photourl")."\";");
        }
        // Personal Photo Mod End

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

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

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

        // Personal Photo Mod Begin
        $newphoto       = isset($newphoto) ? ereg_replace(' ', '%20', $newphoto) : ''; // Problem with spaces in photo url
        $photo          = isset($photo) ? checkInput($photo, '', '', 'javascript', false) : '';
        // Personal Photo Mod End

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

        $memlocation    = addslashes($memlocation);

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

        // Personal Photo Mod Begin
        $photo	= addslashes($photo);
        // Personal Photo Mod End

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

                error($lang['avatar_too_big'] . $SETTINGS['max_avatar_size'] . 'px', false);
            }
        }

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

        // Personal Photo Mod Begin
        $photosize = @getimagesize($photo);
        $max_photosize = explode('x', $SETTINGS['max_photo_size']);
        if ($photosize === false && ($max_photosize['0'] > 0 && $max_photosize['1'] > 0)) {
            $photo = '';
        } elseif (($max_photosize['0'] > 0 && $max_photosize['1'] > 0) && ($photosize['0'] > $max_photosize['0'] || $photosize['1'] > $max_photosize['1']) && !X_SADMIN) {
            error($lang['photo_too_big'] . $SETTINGS['max_photo_size'] . 'px', false);
        }
        // Personal Photo Mod End

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

, photo='$newphoto' 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 Above:
===============

    // Personal Photo Mod Begin
    if (!empty($member['photo'])) {
        $member['photo'] = '<img src="'.$member['photo'].'" alt="'.$lang['photoalt'].'" title="'.$lang['photoalt'].'" border="0" />';
    } else {
        $member['photo'] = '';
    }
    // Personal Photo Mod End

=======================================================================================================================
=======
Step 5:
=======

=====================
Edit File: member.php
=====================

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

,'misc_feature_notavailable'

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

,'misc_feature_notavailable','member_reg_photourl','member_profile_photo'

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

            if ($sightml == "on") {
                $htmlis = $lang['texton'];
            } else {
                $htmlis = $lang['textoff'];
            }

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

            // Personal Photo Mod Begin
            $photobox = '';
            if ($SETTINGS['photostatus'] == 'on') {
                eval("\$photobox = \"".template("member_reg_photourl")."\";");
            }
            // Personal Photo Mod End

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

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

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

        // Personal Photo Mod Begin
        $photo       = isset($newphoto) ? checkInput($newphoto, '', '', "javascript", false) : '';
        // Personal Photo Mod End

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

        $locationnew   = addslashes($locationnew);

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

        // Personal Photo Mod Begin
        $newphoto	= addslashes($newphoto);
        // Personal Photo Mod End

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

        $size = @getimagesize($avatar);
        $max_size = explode('x', $SETTINGS['max_avatar_size']);
        if ($size === false) {
            $avatar = '';
        } elseif (($size[0] > $max_size[0] || $size[1] > $max_size[1]) && !X_SADMIN) {
            error($lang['avatar_too_big'] . $SETTINGS['max_avatar_size'] . 'px');
        }

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

        // Personal Photo Mod Begin
        $photosize = @getimagesize($photo);
        $max_photosize = explode('x', $SETTINGS['max_photo_size']);
        if ($photosize === false && ($max_photosize[0] > 0 && $max_photosize[1] > 0)) {
            $photo = '';
        } elseif (($max_photosize[0] > 0 && $max_photosize[1] > 0) && ($photosize['0'] > $max_photosize['0'] || $photosize['1'] > $max_photosize['1']) && !X_SADMIN) {
            error($lang['photo_too_big'] . $SETTINGS['max_photo_size'] . 'px');
        }
        // Personal Photo Mod End

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

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

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

) VALUES ('', '$username'

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

, photo) VALUES ('', '$username'

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

)");

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

, '$photo')");

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

            if ($memberinfo['avatar'] != '') {
                if (false !== ($pos = strpos($memberinfo['avatar'], ",")) && substr($memberinfo['avatar'], $pos-4, 4) == '.swf') {
                    $flashavatar = explode(",",$memberinfo['avatar']);
                    $memberinfo['avatar'] = '<object type="application/x-shockwave-flash" data="'.$flashavatar[0].'" width="'.$flashavatar[1].'" height="'.$flashavatar[2].'"><param name="movie" value="'.$flashavatar[0].'" AllowScriptAccess="never" /></object>';
                } else {
                    $memberinfo['avatar'] = '<img src="'.$memberinfo['avatar'].'" alt="'.$lang['altavatar'].'" border="0" />';
                }
            }

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

            // Personal Photo Mod Begin
            $memberinfo['photo'] = trim($memberinfo['photo']);
            $photoblock = '';
            if (!empty($memberinfo['photo'])) {
                $memberinfo['photo'] = '<img src="'.$memberinfo['photo'].'" alt="'.$lang['photoalt'].'" title="'.$lang['photoalt'].'" border="0" />';
                eval("\$photoblock = \"".template("member_profile_photo")."\";");
            }
            // Personal Photo Mod End

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

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

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

?>

===============
Add Code Above:
===============

// Personal Photo Mod Begin
$lang['photoalt'] = "Personal Photo";
$lang['phototext'] = "Personal Photo:";
$lang['photostatus'] = "Personal Photo Status:";
$lang['photo_main_settings'] = "Personal Photo Settings";
$lang['max_photo_size_w'] = "The maximum personal photo Width (in pixels):";
$lang['max_photo_size_h'] = "The maximum personal photo Height (in pixels):";
$lang['photo_too_big'] = "Your personal photo is too big! The maximum allowed personal photo size on this board is: ";
// Personal Photo Mod End

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

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

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

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

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

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

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

<tr class="tablerow">
<td bgcolor="$altbg1" valign="top" wifth="22%">$lang[phototext]</a></td>
<td bgcolor="$altbg2" valign="top">$memberinfo[photo]</td>
</tr>

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

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

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

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

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

================================================
Go to admin panel -> templates -> member_profile
================================================

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

<tr>
<td bgcolor="$altbg1" class="tablerow" valign="top">$lang[textstatus]<br /><a href="$sitelink" target="_blank">$memberinfo[avatar]</a></td>
<td bgcolor="$altbg2" class="tablerow">$showtitle$customstatus<br />$stars<br /><br />$rank[avatarrank]</td>
</tr>

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

$photoblock

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

===============================================
Go to admin panel -> templates -> memcp_profile
===============================================

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

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

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

$photobox

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

=======================================================
Go to admin panel -> templates -> admintool_editprofile
=======================================================

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

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

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

$photobox

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

============================================
Go to admin panel -> templates -> memcp_home
============================================

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

<td bgcolor="$altbg1" valign="top">$lang[textcusstatus]</td>
<td bgcolor="$altbg2" valign="top">$member[customstatus]</td>
<td bgcolor="$altbg1" valign="top">&nbsp;</td>
<td bgcolor="$altbg2" valign="top">&nbsp;</td>

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

<td bgcolor="$altbg1" valign="top">$lang[textcusstatus]</td>
<td bgcolor="$altbg2" valign="top">$member[customstatus]</td>
<td bgcolor="$altbg1" valign="top">$lang[phototext]</td>
<td bgcolor="$altbg2" align="center">$member[photo]</td>

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

============================================
Go to admin panel -> templates -> member_reg
============================================

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

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

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

$photobox

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