11
ghia
Re: Avatars dont show in Admin?
  • 2010/11/29 1:21

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


In general this should mean that your PHP version is too low.

Remark also that when the search string is at the beginning of the searched string, the returned position is 0 which leads to the wrong conclusion in your code.

12
Cesagonchu
Re: Avatars dont show in Admin?

My php version is :

PHP Version 5.2.10-2ubuntu6.5

13
ghia
Re: Avatars dont show in Admin?
  • 2010/11/29 9:27

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Could you test this tststrpos.php ?
$tst strpos ('abcdef''ghi');
$exp var_export($tsttrue);
if (
$tst === false)
{
  echo 
'ghi not found |'.$exp.'|';
  
}
else
{
  echo 
'found ghi |'.$exp.'|';
}
$tst strpos ('abcdef''abc');
$exp var_export($tsttrue);
if (
$tst === false)
{
  echo 
'abc not found |'.$exp.'|';
}
else
{
  echo 
'found abc |'.$exp.'|';
}
$tst strpos ('abcdef''cde');
$exp var_export($tsttrue);
if (
$tst === false)
{
  echo 
'cde not found |'.$exp.'|';
}
else
{
  echo 
'found cde |'.$exp.'|';
}
?>
Expected result is:
Quote:
ghi not found |false|
found abc |0|
found cde |2|

14
Cesagonchu
Re: Avatars dont show in Admin?

Result for me is :
ghi not found |falsefound abc |0found cde |2|


15
ghia
Re: Avatars dont show in Admin?
  • 2010/11/29 23:30

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Then there should be no reason to revert the code back from false === to 0 ===

16
ghia
Re: Avatars dont show in Admin?
  • 2010/11/30 0:10

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Humm, after looking into the code I get more convinced that it is a 2.5 bug and that the intention of
if (false === strpos($user_avatarpathrealpath(XOOPS_UPLOAD_PATH)) && is_file($user_avatarpath)) {
        
$oldavatar $xoopsUser->getVar('user_avatar');
        
$xoopsUser->setVar('user_avatar'$user_avatar);
        
$member_handler =& xoops_gethandler('member');
        if (!
$member_handler->insertUser($xoopsUser)) {
            include 
$GLOBALS['xoops']->path('header.php');
            echo 
$xoopsUser->getHtmlErrors();
            include 
$GLOBALS['xoops']->path('footer.php');
            exit();
        }
        if (
$oldavatar && preg_match("/^cavt/"strtolower(substr($oldavatar,8)))) {
            
$avatars $avt_handler->getObjects(new Criteria('avatar_file'$oldavatar));
            if (!empty(
$avatars) && count($avatars) == && is_object($avatars[0])) {
                
$avt_handler->delete($avatars[0]);
                
$oldavatar_path str_replace("""/"realpath(XOOPS_UPLOAD_PATH '/' $oldavatar));
                if (
false === strpos($oldavatar_pathrealpath(XOOPS_UPLOAD_PATH)) && is_file($oldavatar_path)) {
                    
unlink($oldavatar_path);
                }
            }
        }
        if (
$user_avatar != 'avatars/blank.gif') {
            
$avatars $avt_handler->getObjects(new Criteria('avatar_file'$user_avatar));
            if (
is_object($avatars[0])) {
                
$avt_handler->addUser($avatars[0]->getVar('avatar_id'), $xoopsUser->getVar('uid'));
            }
        }
    }
(was in 2.3.3
if (=== strpos($user_avatarpathrealpath(XOOPS_UPLOAD_PATH)) && is_file($user_avatarpath)) {
)
is to process the if block when the path starts with the XOOPS upload path and not something to do when the upload path is not present.

So all these 3 changes in /edituser.php and /modules/profile/edituser.php should be reverted!

17
Cesagonchu
Re: Avatars dont show in Admin?

Ok Ghia and thanks !
So it's a Xoops 2.5 bug.
What do I have to change?

18
ghia
Re: Avatars dont show in Admin?
  • 2010/11/30 9:07

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


As said before the three occurences of false === strpos to 0 === strpos in the 2 files.

19
ForMusS
Re: Avatars dont show in Admin?
  • 2011/9/13 21:20

  • ForMusS

  • Core Developer

  • Posts: 151

  • Since: 2007/10/19


Hello,

Fixed in SVN for 2.5.2

Thanks

20
Cesagonchu
Re: Avatars dont show in Admin?

Same problem with Xoops 2.5.2 RC1.

Solution :

1 - in edituser.php

replace (on line 368 and 383)
false === strpos
by
0 === strpos

2 - in /modules/profile/

replace (on line 226 and 241)
false === strpos
by
0 === strpos

3 - Remember to delete the file .htacces in the folders :

/uploads/

and

/uploads/avatars/

Login

Who's Online

176 user(s) are online (65 user(s) are browsing Support Forums)


Members: 0


Guests: 176


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Dec 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits