Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Bug Fixes
Author Message
chatserv
Member Emeritus



Joined: May 02, 2003
Posts: 1389
Location: Puerto Rico

PostPosted: Sat Jan 03, 2004 12:27 pm Reply with quote

Upon running tests on a stand-alone phpBB forum i noticed avatars get deleted even if they are not uploaded avatars, the avatar type does not get detected by the forum's profile. In the case of PHP-Nuke even while nothing in it causes the avatars to get deleted the avatar type does not get set when a user's info is saved to the database.
fix:
Open modules/Your_Account/index.php:

In function activate find:[/b]
Code:
   if ($check_num == $row[check_num]) {

       $db->sql_query("INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_password, user_avatar, user_regdate, user_lang) VALUES (NULL, '$row[username]', '$row[user_email]', '$row[user_password]', 'gallery/blank.gif', '$row[user_regdate]', '$language')");
       $db->sql_query("DELETE FROM ".$user_prefix."_users_temp WHERE username='$username' AND check_num='$check_num'");

Change to:
Code:
   if ($check_num == $row[check_num]) {

       $db->sql_query("INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_password, user_avatar, user_avatar_type,  user_regdate, user_lang) VALUES (NULL, '$row[username]', '$row[user_email]', '$row[user_password]', 'gallery/blank.gif', 3, '$row[user_regdate]', '$language')");
       $db->sql_query("DELETE FROM ".$user_prefix."_users_temp WHERE username='$username' AND check_num='$check_num'");

Find in function saveuser:
Code:
function saveuser($realname, $user_email, $femail, $user_website, $user_avatar, $user_icq, $user_aim, $user_yim, $user_msnm, $user_from, $user_occ, $user_interests, $newsletter, $user_viewemail, $user_allow_viewonline, $user_notify, $user_notify_pm, $user_popup_pm, $user_attachsig, $user_allowbbcode, $user_allowhtml, $user_allowsmile, $user_timezone, $user_dateformat, $user_sig, $bio, $user_password, $vpass, $username, $user_id) {

Change to:
Code:
function saveuser($realname, $user_email, $femail, $user_website, $user_avatar, $user_avatar_type, $user_icq, $user_aim, $user_yim, $user_msnm, $user_from, $user_occ, $user_interests, $newsletter, $user_viewemail, $user_allow_viewonline, $user_notify, $user_notify_pm, $user_popup_pm, $user_attachsig, $user_allowbbcode, $user_allowhtml, $user_allowsmile, $user_timezone, $user_dateformat, $user_sig, $bio, $user_password, $vpass, $username, $user_id) {

The following line varies between several Nuke versions:
In Nuke 6.5 find in function saveuser:
Code:
    $user_avatar = check_html($user_avatar, nohtml);

    $user_avatar = "gallery/$user_avatar";

Change to:
Code:
    $user_avatar = "$user_avatar";

    $user_avatar_type = "3";

In Nuke 6.7 find in function saveuser:
Code:
    $user_avatar = "gallery/$user_avatar";

Change to:
Code:
    $user_avatar = "$user_avatar";

    $user_avatar_type = "3";

In Nuke 6.8 and up find in function saveuser:
Code:
    $user_avatar = "$user_avatar";

Change to:
Code:
    $user_avatar = "$user_avatar";

    $user_avatar_type = "3";

At the moment i do not have a copy of Nuke 6.6 but i imagine the line will be like one of the above.

Find in function saveuser:
Code:
      $db->sql_query("UPDATE ".$user_prefix."_users SET name='$realname', user_email='$user_email', femail='$femail', user_website='$user_website', user_password='$user_password', bio='$bio', user_avatar='$user_avatar', user_icq='$user_icq', user_occ='$user_occ', user_from='$user_from', user_interests='$user_interests', user_sig='$user_sig', user_aim='$user_aim', user_yim='$user_yim', user_msnm='$user_msnm', newsletter='$newsletter', user_viewemail='$user_viewemail', user_allow_viewonline='$user_allow_viewonline', user_notify='$user_notify', user_notify_pm='$user_notify_pm', user_popup_pm='$user_popup_pm', user_attachsig='$user_attachsig', user_allowbbcode='$user_allowbbcode', user_allowhtml='$user_allowhtml', user_allowsmile='$user_allowsmile', user_timezone='$user_timezone', user_dateformat='$user_dateformat' WHERE user_id='$user_id'");

Change to:
Code:
      $db->sql_query("UPDATE ".$user_prefix."_users SET name='$realname', user_email='$user_email', femail='$femail', user_website='$user_website', user_password='$user_password', bio='$bio', user_avatar='$user_avatar', user_avatar_type='$user_avatar_type', user_icq='$user_icq', user_occ='$user_occ', user_from='$user_from', user_interests='$user_interests', user_sig='$user_sig', user_aim='$user_aim', user_yim='$user_yim', user_msnm='$user_msnm', newsletter='$newsletter', user_viewemail='$user_viewemail', user_allow_viewonline='$user_allow_viewonline', user_notify='$user_notify', user_notify_pm='$user_notify_pm', user_popup_pm='$user_popup_pm', user_attachsig='$user_attachsig', user_allowbbcode='$user_allowbbcode', user_allowhtml='$user_allowhtml', user_allowsmile='$user_allowsmile', user_timezone='$user_timezone', user_dateformat='$user_dateformat' WHERE user_id='$user_id'");

Find in function saveuser:
Code:
      $db->sql_query("UPDATE ".$user_prefix."_users SET name='$realname', user_email='$user_email', femail='$femail', user_website='$user_website', bio='$bio', user_avatar='$user_avatar', user_icq='$user_icq', user_occ='$user_occ', user_from='$user_from', user_interests='$user_interests', user_sig='$user_sig', user_aim='$user_aim', user_yim='$user_yim', user_msnm='$user_msnm', newsletter='$newsletter', user_viewemail='$user_viewemail', user_allow_viewonline='$user_allow_viewonline', user_notify='$user_notify', user_notify_pm='$user_notify_pm', user_popup_pm='$user_popup_pm', user_attachsig='$user_attachsig', user_allowbbcode='$user_allowbbcode', user_allowhtml='$user_allowhtml', user_allowsmile='$user_allowsmile', user_timezone='$user_timezone', user_dateformat='$user_dateformat' WHERE user_id='$user_id'");

Change to:
Code:
      $db->sql_query("UPDATE ".$user_prefix."_users SET name='$realname', user_email='$user_email', femail='$femail', user_website='$user_website', bio='$bio', user_avatar='$user_avatar', user_avatar_type='$user_avatar_type', user_icq='$user_icq', user_occ='$user_occ', user_from='$user_from', user_interests='$user_interests', user_sig='$user_sig', user_aim='$user_aim', user_yim='$user_yim', user_msnm='$user_msnm', newsletter='$newsletter', user_viewemail='$user_viewemail', user_allow_viewonline='$user_allow_viewonline', user_notify='$user_notify', user_notify_pm='$user_notify_pm', user_popup_pm='$user_popup_pm', user_attachsig='$user_attachsig', user_allowbbcode='$user_allowbbcode', user_allowhtml='$user_allowhtml', user_allowsmile='$user_allowsmile', user_timezone='$user_timezone', user_dateformat='$user_dateformat' WHERE user_id='$user_id'");

Find in case saveuser:
Code:
    case "saveuser":

   saveuser($realname, $user_email, $femail, $user_website, $user_avatar, $user_icq, $user_aim, $user_yim, $user_msnm, $user_from, $user_occ, $user_interests, $newsletter, $user_viewemail, $user_allow_viewonline, $user_notify, $user_notify_pm, $user_popup_pm, $user_attachsig, $user_allowbbcode, $user_allowhtml, $user_allowsmile, $user_timezone, $user_dateformat, $user_sig, $bio, $user_password, $vpass, $username, $user_id);
   break;

Change to:
Code:
    case "saveuser":

   saveuser($realname, $user_email, $femail, $user_website, $user_avatar, $user_avatar_type, $user_icq, $user_aim, $user_yim, $user_msnm, $user_from, $user_occ, $user_interests, $newsletter, $user_viewemail, $user_allow_viewonline, $user_notify, $user_notify_pm, $user_popup_pm, $user_attachsig, $user_allowbbcode, $user_allowhtml, $user_allowsmile, $user_timezone, $user_dateformat, $user_sig, $bio, $user_password, $vpass, $username, $user_id);
   break;


Last edited by chatserv on Sat Jan 10, 2004 9:07 am; edited 1 time in total 
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Sat Jan 03, 2004 12:32 pm Reply with quote

Hey stranger! I saw this and your other fix at NC and am going to look at it all this weekend. It's always great when you stop by!
 
View user's profile Send private message
chatserv







PostPosted: Sat Jan 03, 2004 12:50 pm Reply with quote

Hiyas and Happy New Year, check out the avatar CP, you might like it, had to change one line just now as i tend to forget not everyone uses the same php version, should be trouble-free now.
 
Raven







PostPosted: Sun Jan 04, 2004 12:05 am Reply with quote

chatserv wrote:
Hiyas and Happy New Year, check out the avatar CP, you might like it, had to change one line just now as i tend to forget not everyone uses the same php version, should be trouble-free now.
Well, all I can say is that you've outdone yourself this time!!! I will definitely be incorporating this into my customized version!! Thanks!!
 
chatserv







PostPosted: Sun Jan 04, 2004 12:16 pm Reply with quote

Glad that you liked it, let's see if my next project goes as well Wink
 
Raven







PostPosted: Sun Jan 04, 2004 12:17 pm Reply with quote

And that would be ???
 
chatserv







PostPosted: Sun Jan 04, 2004 1:05 pm Reply with quote

I'm working on a few at the time, mostly hacks to existing modules, whichever comes out working ok first will be it, the one for the downloads module might be sidelined or even dropped, too many hacks available already, i may attempt a port but that's still in the drawing board.
 
Stylee
New Member
New Member



Joined: Aug 15, 2003
Posts: 18

PostPosted: Mon Jan 05, 2004 1:26 pm Reply with quote

I just loaded the control panel, I am using 6.7 and it works like a CHAMP! Thank you very much.

One thing. This works GREAT when you access the avatars from "your account" and it is so nice that the avatars dont get deleted anymore when you switch them.

They do however still get deleted when users change their avatars in the "profile" section of the forum. Is there a fix for this yet? It is so annoying.

I figure between Chatserv and Raven, theres has to be a trick or a fix for it.

Once again, thank you very much for the control panel GREAT WORK!
 
View user's profile Send private message
Raven







PostPosted: Mon Jan 05, 2004 1:29 pm Reply with quote

See his other post right above that one on the front page.
 
chatserv







PostPosted: Mon Jan 05, 2004 2:02 pm Reply with quote

Seems i overlooked something in the avatar CP if they still get deleted, i will check on it and update the pack being distributed but as Raven mentioned what is posted above may help you apply the fix yourself.
 
Stylee







PostPosted: Mon Jan 05, 2004 3:02 pm Reply with quote

chatserv, the CP works fine, they do not get deleted when I use the CP at all.
WHen users use the CP from the "your account section" it works fine.

They only get deleted when users change the avatar from the "profile" section from with in the forum.

I am now looking at the sticky titled avatar fix II [ Only registered users can see links on this board! Get registered or login! ]
 
Raven







PostPosted: Mon Jan 05, 2004 3:05 pm Reply with quote

Don't try to use that after using CS fix. Use the other fix on the News page from Chat.
 
Stylee







PostPosted: Mon Jan 05, 2004 3:25 pm Reply with quote

lol, when I go to the fron page, and I look at the news post from Chatsrv.
Quote:
Proposed fix - Avatars get auto-deleted
Posted by Raven on Saturday, January 03 @ 11:33:08 MST (0 reads)
Topic Bugs - Fixed
chatserv writes: "When a user uploads an avatar through the forums and later decides to change to a new avatar the previously uploaded avatar gets deleted, by mistake Nuke's default profile manager saves any avatar selected from within it without saving to the users database table its avatar_type value, since no type is defined the type gets set to 0 which is the default value, in forum terms any avatar with a type value of 0 or 1 is presumed to have been uploaded and as such it gets marked as deletable even if it is a gallery avatar hence why any avatar gets deleted when a new one is selected through the forum's profile manager.
For my proposed fix go here."


The link takes me right back here Smile
 
Raven







PostPosted: Mon Jan 05, 2004 3:28 pm Reply with quote

You started out talking about the control panel, which is a separate post/news item. So, when you started discussing the deleted avatars, I [mis]assumed that you hadn't been working with the other patch of his.
 
chatserv







PostPosted: Sat Jan 10, 2004 9:10 am Reply with quote

Here's the final fix, it applies to all Nuke versions from 6.5 to present and standalone phpBB (at least the last 2 versions)

The forums are not detecting the avatar type and all avatars are seen equally so all get deleted, the following are the existing avatar types:
Code:
Type 0 = No Avatar

Type 1 = Uploaded avatar
Type 2 = Remote avatar
Type 3 = Gallery avatar


To fix this open includes/usercp_register.php and find two instances of:
Code:
                if ( @file_exists('./' . $board_config['avatar_path'] . '/' . $userdata['user_avatar']) )

Change to:
Code:
                if ( @file_exists('./' . $board_config['avatar_path'] . '/' . $userdata['user_avatar']) && $userdata['user_avatar_type'] == USER_AVATAR_UPLOAD )


On Nuke 7.0 the 2 lines will be:
Code:
                if ( @file_exists(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $userdata['user_avatar'])) )

And must be changed to:
Code:
                if ( @file_exists(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $userdata['user_avatar'])) && $userdata['user_avatar_type'] == USER_AVATAR_UPLOAD )


This fix applies to the standalone phpBB forums as well.
 
Raven







PostPosted: Sat Jan 10, 2004 9:15 am Reply with quote

As always, thanks Chat!
 
Stylee







PostPosted: Sat Jan 10, 2004 10:52 am Reply with quote

You have done it!!!! That fix along with the control panel fix corrects the deleted avatar issue in both the "your account" section in nuke, and the "profile" section in the nukebb module.

Thank you very much for this. You have just removed a MAJOR thorn in my side. I have been having to upload the entire avatar directory once a week due to users changing their avartars.

Thank you. Very Happy
 
chatserv







PostPosted: Sat Jan 10, 2004 2:04 pm Reply with quote

Much appreciated, i have been really busy while i have been offline (i still am *sniff*) so be on the lookout for some hacks and fixes that you might find useful. Wink
 
thesportsvoice
Client



Joined: Feb 26, 2004
Posts: 115

PostPosted: Tue Mar 09, 2004 3:35 pm Reply with quote

I have mad the changes and I get this error now after trying to upload an avatar

This is the error I'm getting:
Warning: move_uploaded_file(.//modules/Forums/images/avatars/538736884404e376a27112.jpg): failed to open stream: Permission denied in /home/thesport/public_html/includes/usercp_avatar.php on line 264

Warning: move_uploaded_file(): Unable to move '/tmp/php2uVOmy' to './/modules/Forums/images/avatars/538736884404e376a27112.jpg' in /home/thesport/public_html/includes/usercp_avatar.php on line 264
 
View user's profile Send private message Visit poster's website
Raven







PostPosted: Tue Mar 09, 2004 3:40 pm Reply with quote

Try it now. Your permissions on your folder were incorrect.
 
thesportsvoice







PostPosted: Tue Mar 09, 2004 3:48 pm Reply with quote

Thanks! it worked
 
thesportsvoice







PostPosted: Sun May 02, 2004 1:19 am Reply with quote

Raven I'm getting the same error on the new site I have up, what folder do I change and to what permisson?

Is it the usercp_avatar.php folder, and do I change it to 777?

Quote:

Warning: move_uploaded_file(./modules/Forums/images/avatars/18367007504094a0aeb98dd.jpg): failed to open stream: Permission denied in /home/thesport/public_html/thecivic/includes/usercp_avatar.php on line 264

Warning: move_uploaded_file(): Unable to move '/tmp/phpF4MuFi' to './modules/Forums/images/avatars/18367007504094a0aeb98dd.jpg' in /home/thesport/public_html/thecivic/includes/usercp_avatar.php on line 264
 
Raven







PostPosted: Sun May 02, 2004 7:59 am Reply with quote

Change the permissions on ALL folders (not files) in this path to 777 -> modules/Forums/images/avatars
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Bug Fixes

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©