Jump to content

Problem with PHP4 to PHP5 Upgrade


deejay123

Recommended Posts

I have just upgraded my Joomla site from PHP4 to PHP5. Everything looks okay, except for one problem with an add on component. Unfortunately, I cannot get any help from the component provider. The problem is with the "Member List" functionality.

 

I am not a programmer, so any help would be greatly appreciated. Thanks in advance.  :)

 

Here is the server Error Log File ...

 

[11-Mar-2010 13:10:24] PHP Notice:  Undefined index:  35 in

 

/home/earthian/public_html/components/com_comprofiler/comprofiler.html.php on line 938

[11-Mar-2010 13:10:24] PHP Notice:  Trying to get property of non-object in

 

/home/earthian/public_html/components/com_comprofiler/comprofiler.html.php on line 939

[11-Mar-2010 13:10:24] PHP Notice:  Trying to get property of non-object in

 

/home/earthian/public_html/components/com_comprofiler/comprofiler.html.php on line 943

[11-Mar-2010 13:10:24] PHP Notice:  Trying to get property of non-object in

 

/home/earthian/public_html/components/com_comprofiler/comprofiler.html.php on line 945

[11-Mar-2010 13:10:24] PHP Fatal error:  Cannot access empty property in

/home/earthian/public_html/components/com_comprofiler/comprofiler.html.php on line 945

 

______________________________________________________________________________________________________________________

 

 

 

Relevant Code in comprofiler.html.php ...

 

933       function getUserListCell( &$user, &$column, &$fields, $option_itemid ){

 

935 $htmlFields = array();

 

937 foreach ( $column->fields as $fieldId ) {

938 $field = $fields[$fieldId];

939 $name = $field->name;

$title = "";

 

942 if  ( $column->captions ) {

943 $title = getLangDefinition( $field->title ) . ': ';

}

945 $html[] = getFieldValue( $field->type, $user->$name, $user, $title, 0,

  ( $field->type=="predefined" ?

 

sefRelToAbs("index.php?option=com_comprofiler&task=userProfile&user=" . $user->id . $option_itemid ) : null )

 

);

}

return implode( '<br />', $html );

}

 

 

......... The above code will not even load the .css template in php5 ............

 

......... NOTE -- I changed line 937 to: "foreach ( $column->$fields as $fieldId )" by adding a $ in front of "fields"

 

the stylesheet now will load and is visible, and the list information loads, but is invisible (no text showing, but

 

the hyperlinks in the text work). The recordset is loading, just invisible.

 

______________________________________________________________________________________________________________________

 

 

 

 

Here is the whole "List Functions" section of comprofiler.html.php --

 

/******************************

List Functions

******************************/

 

function usersList( &$row, &$users, &$columns, &$allFields, &$lists, $listid, $search, $option_itemid,

 

$limitstart, $limit, $total ) {

global $_CB_database, $mosConfig_sitename, $ueConfig, $_PLUGINS, $_POST, $_GET, $_REQUEST, $my,

 

$mainframe;

 

$results = $_PLUGINS->trigger( 'onBeforeDisplayUsersList', array(

 

&$row, &$users, &$columns, &$allFields, &$lists, $listid, &$search, &$option_itemid, 1 ) ); // $uid = 1

 

// regroup parts of the different plugins:

$pluginAdditions = array( 'header', 'footer' );

$pluginAdditions['header'] = array();

$pluginAdditions['footer'] = array();

if ( is_array( $results ) && ( count( $results ) > 0 ) ) {

foreach ($results as $res ) {

if ( is_array( $res ) ) {

foreach ( $res as $k => $v ) {

$pluginAdditions[$k][] = $v;

}

}

}

}

 

if ( method_exists($mainframe,"setPageTitle")) {

$mainframe->setPageTitle( getLangDefinition($row->title) );

}

if ( method_exists($mainframe,"appendPathWay")) {

$mainframe->appendPathWay( htmlspecialchars(getLangDefinition($row->title)) );

}

 

$cbSpoofField = cbSpoofField();

$cbSpoofString = cbSpoofString();

 

$spoofAmp = "&" . $cbSpoofField . '=' . urlencode(

 

$cbSpoofString );

$ue_base_url = "index.php?option=com_comprofiler&task=usersList&listid=" .

 

$listid . $option_itemid; // . $spoofAmp; // Base URL string

$adminimagesdir = "components/com_comprofiler/images/";

 

 

?>

<form name="adminForm" method="post" action="<?php echo sefRelToAbs($ue_base_url."&action=search");?>" >

  <table width="100%" cellpadding="4" cellspacing="0" border="0" align="center" class="contentpane">

  <tr>

            <td colspan="2"><span class="contentheading"><?php echo getLangDefinition($row->title); ?></span></td>

  </tr>

<!--    DL- took out "total number of users" 

  <tr>

      <td valign="top" class="contentdescription" colspan="2">

  <?php

if ((isset($search) && $search != "") || ($row->filterfields!='')) {

echo "<b>" . $total . "</b> " . _UE_USERPENDAPPRACTION . ":";

} else {

echo $mosConfig_sitename . " " . _UE_HAS . ": <b>" . $total . "</b> " . _UE_USERS;

}

  ?></td>

</tr>

-->

<tr>

<td>

  <table width="100%" cellpadding="4" cellspacing="0" border="0" align="center" class="contentpane">

<tr>

<td style="width:50%;">

              <input type="text" name="search" class="inputbox" size="15" maxlength="100"<?php

if (isset($search)) echo " value=\"".htmlspecialchars($search)."\""; ?> />

              <input type="image" src="<?php echo $adminimagesdir; ?>search.gif" alt="<?php echo

 

_UE_SEARCH; ?>" align="top" style="border: 0px;" />

</td>

<td style="width:50%;text-align:right;">

<?php echo $lists['plists']; ?>

</td>

</tr>

  </table>

  <?php

echo cbGetSpoofInputTag( $cbSpoofString );

?>

</td>

  </tr>

  <tr>

    <td>

      <table width="100%" border="0" cellspacing="0" cellpadding="0">

        <tr>

    <td><a href="<?php echo sefRelToAbs($ue_base_url); ?>"

 

onclick="javascript:adminForm.search.value=''"><?php echo _UE_LIST_ALL; ?></a></td>

    <td align="right"></td>

        </tr>

      </table>

 

<?php

if ( count( $pluginAdditions['header'] ) ) {

echo '<div id="cbUserListHeader"><div>' . implode( '</div><div>', $pluginAdditions['header'] )

 

. '</div></div>';

}

if ( ( $limitstart != 0 ) || ( $limit <= $total ) ) {

?>

<div style="width:100%;text-align:center;"><?php echo writePagesLinks($limitstart, $limit, $total,

 

$ue_base_url.$spoofAmp, $search); ?></div>

<?php } ?>

 

      <hr size="1" />

<script type="text/javascript"><!--//--><![CDATA[//><!--

 

var cbW3CDOM = (document.createElement && document.getElementsByTagName);

var cbUserURLs = new Array(<?php

if (is_array($users)) {

foreach($users as $user) {

echo "\""

 

 

.unHtmlspecialchars(sefRelToAbs("index.php?option=com_comprofiler&task=userProfile&user=".$user->id.$option_it

 

emid))."\",";

}

}

?>"");

function cbInitUserClick()

{

if (!cbW3CDOM) return;

var nav = document.getElementById('cbUserTable');

var trs = nav.getElementsByTagName('tr');

for (var i=0;i<trs.length;i++)

{

if (trs.id) {

trs.onclick = cbUserClick;

}

}

}

 

function cbUserClick(thisevent)

{

/* ddumpObject(thisevent,"event",3,0); */

/*

 

alert("clicked!"+this.toString()+window.event.target+window.event.currentTarget+(window.event.target==window.event.cur

 

rentTarget));

*/

var mine;

if (thisevent) {

//

 

alert("event!"+thisevent.toString()+thisevent.target+thisevent.target.toString()+(thisevent.target.parentNode ==

 

this));

mine = (thisevent.target.parentNode == this);

} else if (window.event.target) {

//

 

alert("clickedWE!"+this.toString()+window.event.target+window.event.currentTarget+(window.event.target==window.event.c

 

urrentTarget));

mine = (window.event.target==window.event.currentTarget);

} else if (window.event.srcElement) {

//

 

alert("eventSRC!"+window.event.srcElement+window.event.srcElement.toString()+(window.event.srcElement.parentNode ==

 

this));

mine = (window.event.srcElement.parentNode == this);

}

if (mine) {

window.location=cbUserURLs[this.id.substr(3)]; // cbUxxx --> xxx

}

return !mine;

}

 

function cbAddEvent(obj, evType, fn){

if (obj.addEventListener){

  obj.addEventListener(evType, fn, true);

  return true;

} else if (obj.attachEvent){

  var r = obj.attachEvent("on"+evType, fn);

  return r;

} else {

  return false;

}

}

 

cbAddEvent(window, 'load', cbInitUserClick);

 

//--><!]]></script>

<table width="100%" border="0" cellspacing="0" cellpadding="0" id="cbUserTable">

<!--

<tr>

 

<?php

$colsNbr = count( $columns );

foreach ( $columns as $column ) {

echo "\t\t\t<th><b>" . getLangDefinition( $column->title) . "</b></th>\n";

}

?>

 

</tr>

-->

<?php

$i = 0;

if (is_array($users) && count($users)>0) {

foreach($users as $user) {

$class = "sectiontableentry" . ( 1 + ( $i % 2 ) ); // evenodd class

 

if($ueConfig['allow_profilelink']==1) {

$style = "style=\"cursor:hand;cursor:pointer;\"";

$style .= " id=\"cbU".$i."\"" ;

// $style .= "

 

onclick=\"javascript:window.location='".sefRelToAbs("index.php?option=com_comprofiler&task=userProfile&user=".

 

$user->id.$option_itemid)."'\"";

} else {

$style = "";

}

if ( $user->banned ) {

echo "\t\t<tr class=\"$class\"><td colspan=\"".$colsNbr."\"><span

 

class=\"error\" style=\"color:red;\">"._UE_BANNEDUSER." ("._UE_VISIBLE_ONLY_MODERATOR.") :</span></td></tr>";

}

echo "\t\t<tr class=\"$class\" ".$style.">\n";

 

foreach ( $columns as $column ) {

echo "\t\t\t<td valign='top'>" . HTML_comprofiler::getUserListCell( $user,

 

$column, $allFields, $option_itemid ) . "</td>\n";

}

echo "\t</tr>\n";

$i++;

}

} else {

echo "\t\t<tr class=\"sectiontableentry1\"><td

 

colspan=\"".$colsNbr."\">"._UE_NO_USERS_IN_LIST."</td></tr>";

}

?>

</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td> </td>

<td align="right"></td>

</tr>

</table>

<hr size="1" />

<?php if ( ( $limitstart != 0 ) || ( $limit <= $total ) ) {

?>

 

<div style="width:100%;text-align:center;"><?php echo writePagesLinks($limitstart, $limit, $total,

 

$ue_base_url.$spoofAmp, $search); ?></div>

<?php } ?>

 

  </td>

  </tr>

</table>

<?php

if ( count( $pluginAdditions['footer'] ) ) {

echo '<div id="cbUserListFooter"><div>' . implode( '</div><div>', $pluginAdditions['footer'] )

 

. '</div></div>';

}

?>

 

</form>

 

<?php

} // end function usersList

 

function getUserListCell( &$user, &$column, &$fields, $option_itemid ){

 

$htmlFields = array();

 

foreach ( $column->$fields as $fieldId ) {

$field = $fields[$fieldId];

$name = $field->name;

$title = "";

 

if  ( $column->captions ) {

$title = getLangDefinition( $field->title ) . ': ';

}

$html[] = getFieldValue( $field->$type, $user->$name, $user, $title, 0,

  ( $field->type=="predefined" ?

 

sefRelToAbs("index.php?option=com_comprofiler&task=userProfile&user=" . $user->id . $option_itemid ) : null )

 

);

}   

return implode( '<br />', $html );

}

 

 

Link to comment
https://forums.phpfreaks.com/topic/195445-problem-with-php4-to-php5-upgrade/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.