xoops forums

ghia

Community Support Member
Posted on: 2010/11/29 1:21
ghia
ghia (Show more)
Community Support Member
Posts: 4954
Since: 2008/7/3 1
#11

Re: Avatars dont show in Admin?

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.

Cesagonchu

Moderator
Posted on: 2010/11/29 6:23
Cesagonchu
Cesagonchu (Show more)
Moderator
Posts: 869
Since: 2010/2/1 2
#12

Re: Avatars dont show in Admin?

My php version is :

PHP Version 5.2.10-2ubuntu6.5

ghia

Community Support Member
Posted on: 2010/11/29 9:27
ghia
ghia (Show more)
Community Support Member
Posts: 4954
Since: 2008/7/3 1
#13

Re: Avatars dont show in Admin?

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

Cesagonchu

Moderator
Posted on: 2010/11/29 22:46
Cesagonchu
Cesagonchu (Show more)
Moderator
Posts: 869
Since: 2010/2/1 2
#14

Re: Avatars dont show in Admin?

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

ghia

Community Support Member
Posted on: 2010/11/29 23:30
ghia
ghia (Show more)
Community Support Member
Posts: 4954
Since: 2008/7/3 1
#15

Re: Avatars dont show in Admin?

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

ghia

Community Support Member
Posted on: 2010/11/30 0:10
ghia
ghia (Show more)
Community Support Member
Posts: 4954
Since: 2008/7/3 1
#16

Re: Avatars dont show in Admin?

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!

Cesagonchu

Moderator
Posted on: 2010/11/30 5:49
Cesagonchu
Cesagonchu (Show more)
Moderator
Posts: 869
Since: 2010/2/1 2
#17

Re: Avatars dont show in Admin?

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

ghia

Community Support Member
Posted on: 2010/11/30 9:07
ghia
ghia (Show more)
Community Support Member
Posts: 4954
Since: 2008/7/3 1
#18

Re: Avatars dont show in Admin?

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

ForMusS

Core Developer
Posted on: 2011/9/13 21:20
ForMusS
ForMusS (Show more)
Core Developer
Posts: 146
Since: 2007/10/19
#19

Re: Avatars dont show in Admin?

Hello,

Fixed in SVN for 2.5.2

Thanks

Cesagonchu

Moderator
Posted on: 2011/9/30 0:05
Cesagonchu
Cesagonchu (Show more)
Moderator
Posts: 869
Since: 2010/2/1 2
#20

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/