Hack for XMB v1.05
##########################
Avatar Hack for XMB v1.05
Written by Dodo
http://regretless.com
##########################
This hack allows more control of the avatar function. Only members with certain number of posts may have avatars and all members must have the same size avatars.
You may customize the post number and the avatar size within the code. Please pay attention to my comments along the side.
======================================
Step 1 - take the avatar option off the registration form, so newbies can't have avatars.
======================================
Open member.php
find
<?
if($avastatus == "on") {
?>
<tr>
<td bgcolor="<?=$altbg1?>" class="tablerow"><?=$lang[textavatar]?></td>
<td bgcolor="<?=$altbg2?>" class="tablerow"><input type="text" name="avatar" size="25" /></td>
</tr>
<?
}
?>
replace it with
<?
if($avastatus == "on") {
?>
<?
}
?>
======================================
Step 2 - hack the edit profile avatar
======================================
find next
<?
if($avastatus == "on") {
?>
<tr>
<td bgcolor="<?=$altbg1?>" class="tablerow"><?=$lang[textavatar]?></td>
<td bgcolor="<?=$altbg2?>" class="tablerow"><input type="text" name="avatar" size="30" value="<?=$member[avatar]?>" /></td>
</tr>
<?
}
?>
replace
<?
if($avastatus == "on") {
$required_posts = 100;
// change the number if you want it higher or lower
if($member[postnum ] < $required_posts) {
print "";
} else {
?>
<tr>
<td bgcolor="<?=$altbg1?>" class="tablerow"><?=$lang[textavatar]?></td>
<td bgcolor="<?=$altbg2?>" class="tablerow"><input type="text" name="avatar" size="30" value="<?=$member[avatar]?>" /></td>
</tr>
<?
}
?>
save member.php and close
======================================
Step 3 - check the user's avatar's size
======================================
open viewthread.php
find
if($allowavatars == "yes") {
if($avarank != "" && $member[avatar] == "") {
$avatar = "<img src=\"$avarank\">";
} elseif($member[avatar] != "") {
$avatar = "<img src=\"$member[avatar]\">";
} else {
$avatar = "";
}
}
replace
if($allowavatars == "yes") {
if($avarank != "" && $member[avatar] == "") {
$avatar = "<img src=\"$avarank\">";
} elseif($member[avatar] != "") {
$required_width = 50;
$required_height = 50;
// please change the width and height to whatever you desire
$member_avatar_size = getimagesize($member[avatar]);
if(($member_avatar_size[0] != $required_width) || ($member_avatar_size[1] != $required_height)
$avatar = "avatar must be in<br>$required_width x $required_height<br>edit your profile";
else
$avatar = "<img src=\"$member[avatar]\">";
} else {
$avatar = "";
}
}
find:
if($allowavatars == "yes") {
if($avarank != "" && $member[avatar] == "" && $member[status] != "Administrator" && $member[status] != "Super Moderator" && $member[status] != "Moderator") {
$avatar = "<img src=\"$avarank\">";
} elseif($member[avatar] != "") {
$avatar = "<img src=\"$member[avatar]\">";
} else {
$avatar = "";
}
}
replace with:
if($allowavatars == "yes") {
if($avarank != "" && $member[avatar] == "" && $member[status] != "Administrator" && $member[status] != "Super Moderator" && $member[status] != "Moderator") {
$avatar = "<img src=\"$avarank\">";
} elseif($member[avatar] != "") {
$required_width = 50;
$required_height = 50;
// please change the width and height to whatever you desire
$member_avatar_size = getimagesize($member[avatar]);
if(($member_avatar_size[0] != $required_width) || ($member_avatar_size[1] != $required_height)
$avatar = "avatar must be in<br>$required_width x $required_height<br>edit your profile";
else
$avatar = "<img src=\"$member[avatar]\">";
} else {
$avatar = "";
}
}
save viewthread.php
upload member.php & viewthread.php
NOTE: this is a beta hack. let me (dodo@regretless.com) know if you have problems.
**************************************
XMB v1.05
CHECK IMAGE SIZE IN SIGNATURE
& SHOW SIGNATURE PREVIEWHACK
written by dodo
http://regretless.com
**************************************
Description:
This hack grabs the image in members signature and check their size. If it's over certain size, it will لا update the person's profile and tells the person to change the image.
File to hack: member.php
======================================
STEP 1 - check the image size of the image put in the signature, print error message if it's too big
SKIP THIS STEP IF YOU DO NOT WISH TO USE THIS PART OF THE HACK
======================================
Open member.php
find:
}
if($editsubmit) {
add below:
?>
<table cellspacing="0" cellpadding="0" border="0" width="<?=$tablewidth?>" align="center">
<tr><td bgcolor="<?=$bordercolor?>">
<table border="0" cellspacing="<?=$borderwidth?>" cellpadding="<?=$tablespace?>" width="100%">
<tr>
<td class="header">Profile</td>
</tr>
<tr>
<td bgcolor="<?=$altbg1?>" class="tablerow">
<?
/*****************************************
DODO SIGNATURE IMAGE TEST & PREVIEW HACK
******************************************/
$allowimagewidth = 110;
$allowimageheight = 31;
if(strstr($sig, "[img]")) {
$sigurl = strstr($sig, "[img]");
$sigurl = strstr($sigurl, "http://");
$sigurl = explode(" ", $sigurl);
$sigurl = stripslashes($sigurl[0]);
$sigurl = str_replace("\"", "", $sigurl);
$sigurl = str_replace("[/img]", "", $sigurl);
$sigsize = getimagesize($sigurl);
if($sigsize[0] > $allowimagewidth || $sigsize[1] > $allowimageheight) {
print "Sorry your profile is لا updated because the image in your signature is too big. According to the <a href=\"misc.php?action=faq#sign\">rule</a>, it must be smaller than 100 x 31 pixels.";
exit;
}
} elseif(strstr($sig, "<img src=")) {
$sigurl = strstr($sig, "<img src=");
$sigurl = strstr($sigurl, "http://");
$sigurl = explode(" ", $sigurl);
$sigurl = stripslashes($sigurl[0]);
$sigurl = str_replace("\"", "", $sigurl);
$sigsize = getimagesize($sigurl);
if($sigsize[0] > $allowimagewidth || $sigsize[1] > $allowimageheight) {
print "Sorry your profile is لا updated because the image in your signature is too big. According to the <a href=\"misc.php?action=faq#sign\">rule</a>, it must be smaller than 100 x 31 pixels.";
exit;
}
}
======================================
STEP 2 - allow members to see a preview of their signature after their profile is updated
======================================
find:
mysql_query("UPDATE $table_members SET password='$newpassword' WHERE username='$username'") or die(mysql_error());
}
add below:
/*************************************
this is the signature preview part
*************************************/
$sig = stripslashes($sig);
$sig = str_replace("\n", "<br>", $sig);
echo "<br><span class=\"12px \">Your signature has been changed to:<br><br>
<hr>
$sig.
<hr>
<br><br>";
======================================
STEP 3 - change the redirection time so members have more time to look at their signature preview
======================================
NEXT STEP IS OPTIONAL:
if you want to change the length of time the page stays before it redirect itself,
find:
<script>
function redirect()
{
window.location.replace("index.php");
}
setTimeout("redirect();", 1250);
</script>
change 1250 to something bigger, 5000 is a good choice.
======================================
STEP 4 - edit variables in STEP 1
======================================
BEFORE YOU SAVE member.php
*******************************************************************************************
MAKE SURE you change these two variables to the width and height you desire
$allowimagewidth = 110;
$allowimageheight = 31;
it's default to لا allow any images bigger than 110 pixel in width or 31 pixel in height
********************************************************************************************
That's all.