vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Custom Avatars as Files (updated for vBulletin 2.2.2) (https://vborg.vbsupport.ru/showthread.php?t=11760)

Lordmusic 09-05-2001 12:01 AM

Unless this hack is done, none of my members can change their avatars :-/

Sven 09-06-2001 09:07 PM

^bump^this^a^little^ ;)

DarkReaper 09-06-2001 09:47 PM

You state that you can use .htaccess to prevent the files from being linked from outside my server...how would I do this? Place a .htaccess file in the forums directory with what contents? Thanks.

eva2000 09-06-2001 09:51 PM

Quote:

Originally posted by DarkReaper
You state that you can use .htaccess to prevent the files from being linked from outside my server...how would I do this? Place a .htaccess file in the forums directory with what contents? Thanks.
use http://faq.solutionscripts.com/misc/hot_linking.html

DarkReaper 09-06-2001 10:09 PM

Thanks :)

kaeros 09-07-2001 03:22 PM

I just recently installed this hack and now I notice that the forum doesn't update the numver of views where before it did. Is this happening to anyone else?

Lordmusic 09-15-2001 06:15 PM

This hack needs to be updated for 2.0.3 ! ! !

Cocomiel 09-15-2001 08:11 PM

Please Update the hack ... why you didnt yet ?
Its one of the bests hacks outhere

Cocomiel 09-15-2001 08:12 PM

Ok, i will code this one, will be ready in two days

DarkReaper 09-15-2001 09:56 PM

um..the installation link isn't loading.

dost 09-21-2001 02:44 PM

two days passed :P how is it going?

Cocomiel 09-21-2001 05:50 PM

you should look here :


http://www.vbulletin.com/forum/showt...threadid=28337

DarkReaper 11-02-2001 02:28 AM

How can I get this to work with 2.2.0?

psico 11-03-2001 09:33 AM

Not work with 2.2.0 !!!!

this code not exist!!!

showthread.php
and
private.php
and
announcement.php find this:

if ($post[hascustomavatar] and $avatarenabled) {
$avatarurl="avatar.php?s=$session[sessionhash]&userid=$post[userid]";
replace with this:

if ($post[hascustomavatar] and $avatarenabled) {
if ($usefileavatar) $avatarurl="custom_avatars/avatar$post[userid]_$post[avatarrevision].gif";
else $avatarurl="avatar.php?userid=$post[userid]";

Cocomiel 11-03-2001 02:38 PM

This hack was for 2.0, i dont have idea why they put 2.2.0

eva2000 11-03-2001 02:42 PM

must of been devine intervention since twice i tried to install this hack and when i read this thread my browser frooze and forced me to reboot my pc :)

eg_92901 11-15-2001 05:19 PM

Is this supported on vBulletin 2.2.0? I see different code than what is in the instructions for the function.php file.

ladyfyre 11-30-2001 02:49 AM

I would also be quite interested in the answer to that question :)

Since our database is already over 300MB it takes FOREVER to do a dump.sql file, and i will have to move to another server AGAIN in a few days, since we are finally ready to ship our colo box.

SirSteve 12-02-2001 10:41 PM

What about 2.2.1?

bira 12-03-2001 12:03 AM

OK, for those wishing to install this in 2.2.1:

Follow the instructions in post #1 except for the following change:

the instructions for file admin/functions.php should be:

Quote:

Find:

PHP Code:

// ###################### Start getavatarurl #######################
function getavatarurl($userid) {
  global 
$DB_site,$session;

  if (
$avatarinfo=$DB_site->query_first("SELECT user.avatarid,avatarpath,NOT ISNULL(avatardata) AS hascustom,customavatar.dateline
                                         FROM user
                                         LEFT JOIN avatar ON avatar.avatarid=user.avatarid
                                         LEFT JOIN customavatar ON customavatar.userid=user.userid
                                         WHERE user.userid='
$userid'")) {
    if (
$avatarinfo[avatarpath]!="") {
      return 
$avatarinfo[avatarpath];
    } else if (
$avatarinfo['hascustom']) {
      return 
"avatar.php?userid=$userid&dateline=$avatarinfo[dateline]";
    } else {
      return 
'';
    }
  }


Replace with:

PHP Code:

// ###################### Start getavatarurl #######################
function getavatarurl($userid) {
  global 
$DB_site,$session$usefileavatar;

  if (
$avatarinfo=$DB_site->query_first("SELECT user.avatarid,avatarpath,avatarrevision,NOT ISNULL(avatardata) AS hascustom,customavatar.dateline
                                         FROM user
                                         LEFT JOIN avatar ON avatar.avatarid=user.avatarid
                                         LEFT JOIN customavatar ON customavatar.userid=user.userid
                                         WHERE user.userid='
$userid'")) {
    if (
$avatarinfo[avatarpath]!="") {
      return 
$avatarinfo[avatarpath];
    } else if (
$avatarinfo['hascustom']) {
        if (
$usefileavatar) {
            return 
"custom_avatars/avatar$userid"."_$avatarinfo[avatarrevision].gif";
        } else {
            return 
"avatar.php?userid=$userid";
        }
    } else {
      return 
'';
    }
  }


Find:

PHP Code:

            if ($post[hascustomavatar] and $avatarenabled) {
                
$avatarurl="avatar.php?userid=$post[userid]&dateline=$post[avatardateline]"

Replace with:

PHP Code:

            if ($post[hascustomavatar] and $avatarenabled) {
                   if (
$usefileavatar) {                   
                       
$avatarurl="custom_avatars/avatar$post[userid]_$post[avatarrevision].gif";
                } else {
                    
$avatarurl="avatar.php?userid=$post[userid]&dateline=$post[avatardateline]";
                } 


And, no changes should be made to showthread.php.


That's it. All other instructions remain the same.

Cheers,

Bira

eva2000 12-03-2001 03:10 AM

thanks Bira :D

Dark Blaze 12-05-2001 06:31 PM

Great Hack Kier, congrats :)

Dark Blaze 12-05-2001 06:32 PM

Also, thanks Bira for making this hack available for 2.2.1 version forums :)

SirSteve 12-05-2001 06:47 PM

What happens to the current custom avatars my members are using if I install this hack?

bira 12-05-2001 09:56 PM

Quote:

Originally posted by SirSteve
What happens to the current custom avatars my members are using if I install this hack?
If you follow the hack's installation instructions accurately and run the script, the avatars will be converted to gif files. From the user standpoint, he will see absolutely no difference: his custom avatar will continue to show up as normal. The only difference is that instead of it being <img src="avatar.php?userid=xxx"> it will be <img src="custom_avatars/xxx.gif"> (or something like that)

DarkReaper 12-05-2001 10:25 PM

For those interested, I rewrote Kier(I think? maybe it was tubedogg...)'s version of the hack to 2.2.1. It works on mine just like the old one did. If you're interested, I could write up the code changes and post them...

bira 12-05-2001 10:30 PM

DarkReaper, I think that's what I did some 6 or so posts up :D

SirSteve 12-05-2001 10:34 PM

So you still change private.php and announcement.php? I don't have this code in mine:

if ($post[hascustomavatar] and $avatarenabled) {
$avatarurl="avatar.php?s=$session[sessionhash]&userid=$post[userid]";

bira 12-05-2001 10:38 PM

SirSteve, the respective code in those two files would be:

PHP Code:

    if ($post[hascustomavatar] and $avatarenabled) {
      
$avatarurl="avatar.php?userid=$post[userid]&dateline=$post[avatardateline]"


Lesane 12-15-2001 01:42 PM

Does this hack work in 2.0.3? ;)

Gutspiller 12-15-2001 02:30 PM

I have a problem. I am at the point of making the changes to my function.php file, but I don't have the code you specified to search for, but I do have this code:

Code:

function getavatarurl($userid) {
  global $DB_site,$session;

  if ($avatarinfo=$DB_site->query_first("SELECT user.avatarid,avatarpath,NOT ISNULL(avatardata) AS hascustom,customavatar.dateline
                                        FROM user
                                        LEFT JOIN avatar ON avatar.avatarid=user.avatarid
                                        LEFT JOIN customavatar ON customavatar.userid=user.userid
                                        WHERE user.userid='$userid'")) {
    if ($avatarinfo[avatarpath]!="") {
      return $avatarinfo[avatarpath];
    } else if ($avatarinfo['hascustom']) {
      return "avatar.php?userid=$userid&dateline=$avatarinfo[dateline]";
    } else {
      return '';
    }
  }
}

It's code for a smaller hack I installed that gives your avatar a url, so people can click on the avatar and be taking to their website or whereever they assign it to in their profile.

I would really like to install this hack, but since I have no idea what I am doing I need help. What part of the code do I replace, and what part of the code do I need to leave?

Any help will be greatly appreicated.

Thanks!

MaSTaKiLLaH 12-15-2001 05:33 PM

Hi,

i can't find the following code in the member.php :

Code:

$filenum=@fopen($filename,"r");
        $filestuff=@fread($filenum,$filesize);
        @fclose($filenum);

        @unlink($filename);

        if ($avexists=$DB_site->query_first("SELECT userid FROM customavatar WHERE userid=$bbuserinfo[userid]")) {
          $DB_site->query("UPDATE customavatar SET avatardata='".addslashes($filestuff)."' WHERE userid=$bbuserinfo[userid]");
        } else {
          $DB_site->query("INSERT INTO customavatar (userid,avatardata) VALUES ($bbuserinfo[userid],'".addslashes($filestuff)."')");
        }
      }
    } else {
      $avatarid=verifyid("avatar",$avatarid);
      $avatarinfo=$DB_site->query_first("SELECT minimumposts FROM avatar WHERE avatarid=$avatarid");
      if ($avatarinfo[minimumposts]>$bbuserinfo[posts]) {
        eval("standarderror(\"".gettemplate("error_avatarmoreposts")."\");");
        // not enough posts error
        exit;
      }
      $DB_site->query("DELETE FROM customavatar WHERE userid=$bbuserinfo[userid]");
    }
  } else {
    $avatarid=0;
    $DB_site->query("DELETE FROM customavatar WHERE userid=$bbuserinfo[userid]");
  }

Can anybody help me please ?

Sadie Frost 12-24-2001 12:51 AM

MaSTaKiLLaH, I had the same problem in 2.2.1

What I did (and seems to be working so far lol) is first off, look for

$filenum=@fopen($filename,"rb");

But what I did on this file and admin/user.php, is just compare the find & replace codes in the directions, and see what had changed. Then I only made those changes (so if there were other differences that were supposed to be there, I didn't mess them up.)

There are three changes to each file:

For member.php, (1) you just need to add this at the top, before $filenum=@fopen($filename,"rb"):

Quote:

if ($usefileavatar) {// store avatars as files

@unlink("custom_avatars/avatar$bbuserinfo[userid]_".($bbuserinfo[avatarrevision]).".gif");
copy($filename,"custom_avatars/avatar$bbuserinfo[userid]_".($bbuserinfo[avatarrevision]+1).".gif");
$DB_site->query("UPDATE user SET avatarrevision=avatarrevision+1 WHERE userid='$bbuserinfo[userid]'");

}
then after (2)

"exit;

}"

and after (3):

"$avatarid=0;"

add:

Quote:

if ($usefileavatar) @unlink("custom_avatars/avatar$bbuserinfo[userid]_".($bbuserinfo[avatarrevision]).".gif");

For admin/user.php, (1) you just need to add this at the top, before $filenum=@fopen($filename,"rb"):

Quote:

if ($usefileavatar) {// store avatars as files

@unlink("../custom_avatars/avatar$bbuserinfo[userid]_".($bbuserinfo[avatarrevision]).".gif");
copy($filename,"../custom_avatars/avatar$bbuserinfo[userid]_".($bbuserinfo[avatarrevision]+1).".gif");
$DB_site->query("UPDATE user SET avatarrevision=avatarrevision+1 WHERE userid='$bbuserinfo[userid]'");
}
then after (2)

"//exit;

//}"

and after (3):

"$avatarid=0;"

add:

Quote:

if ($usefileavatar) @unlink("custom_avatars/avatar$bbuserinfo[userid]_".($bbuserinfo[avatarrevision]).".gif");
Also, bira's instructions for 2.2.1 may need to be amended (though it also might have just been me as well)

She has:
Quote:

if ($usefileavatar) {

return "custom_avatars/avatar$userid"."_$avatarinfo[avatarrevision].gif";
But I got a parse error in the "if ($usefileavatar) {" line when I went to my admin cp options. So I made that line as in Kier's instructions - leaving out the "{".

I hope this is helpful - sorry if it's confusing :)

Spankers 12-24-2001 05:21 AM

Can someone please provide a link or post a reply here with a COMPLETE and CORRECT guide to the appropriate code replacements for this hack to support 2.2.1? I browsed through the pages of this thread and found all sorts of different posts referencing independent code replacements for individual files, many of which are STILL not correct.

Since this hack has the "v2.2.1" in the thread title, I think an updated installation guide would be appropriate. This is incredibly confusing and per the instructions and "reinstructions" provided I have yet to find all the correct code to replace.

Sadie Frost 12-26-2001 12:19 PM

bira's instructions work fine, actually

just look for "rb" instead of "r" and take out that extra {if you get a parse error

mvigod 01-11-2002 04:06 PM

Quote:

Originally posted by Spankers
Can someone please provide a link or post a reply here with a COMPLETE and CORRECT guide to the appropriate code replacements for this hack to support 2.2.1? I browsed through the pages of this thread and found all sorts of different posts referencing independent code replacements for individual files, many of which are STILL not correct.

Since this hack has the "v2.2.1" in the thread title, I think an updated installation guide would be appropriate. This is incredibly confusing and per the instructions and "reinstructions" provided I have yet to find all the correct code to replace.

A 2.2.1 update would be great because it seems like all the 2.2.1 updates here are scattered. I would love to install this but don't want to make a mistake.

PK-Fortis 01-14-2002 10:14 AM

I just wanted to say that this is a great hack. I have very limited space in my MySQL database, and for the longest time I had to take avatar submissions and manually ad them to the list with a name so they'd be reserved under the 'honor system'. Now, I can just let people pick their own avatars, and still get a chance to moderate them. Thanks.

Jawelin 01-15-2002 11:53 AM

Quote:

Originally posted by Dark Blaze
Also, thanks Bira for making this hack available for 2.2.1 version forums :)
Sorry but - me too - have found in this long thread a lot of CONFLICTING solutions and got confused at all.

Even, lookin' at Bira's homepage, I found the 2.0 hack only....
I agree the [2.2.1] prefix on the post means the hack itself is upgraded to work on that version.... THE HACK, not a dozen of answers from everybody to the original author..

Thank you

mvigod 01-15-2002 02:06 PM

Ok..I'll plead a little bit!

Bira, PLEASE put the correct changes into a new zip for download for all the 2.2.1 users. I know I could eventually figure it out but want to minimize the downtime risk and do it right the first time as we have 100-300 simulataneous users and they get unruly when your down for long!

Out of curiousity...is there a way to set this up so the avatars can be uploaded and served off of a dedicated image server instead of the server vbulletin is running on? I am looking to run webserver on dedicated server 1, database on server 2 and images on server 3.

THANKS!

ScottW 01-23-2002 03:45 AM

^ bump


All times are GMT. The time now is 12:58 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01495 seconds
  • Memory Usage 1,862KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (5)bbcode_php_printable
  • (10)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete