Hi all
On an old site, using the old (but good) Soapbox.
Xoops 2016 running PHP Version 5.2.9
Trying to submit or edit an article i´m having this error:
Fatal error: Using $this when not in object context in /home/wwws/public_html/modules/soapbox/admin/article.php on line 303
Follow a chunk of that file:
// Save to database
if ( !$articleID )
{
if ( $xoopsDB -> query( "INSERT INTO " . $xoopsDB -> prefix( "sbarticles" ) . " (articleID, columnID, headline, lead, bodytext, teaser, weight, html, smiley, xcodes, breaks, block, artimage, votes, rating, comments, offline, datesub ) VALUES ('', '$columnID', '$headline', '$lead', '$bodytext', '$teaser', '$weight', '$html', '$smiley', '$xcodes', '$breaks', '$block', '$artimage', '$votes', '$rating', '$comments', '$offline', '$date' )" ) )
{
$this -> db = & Database :: getInstance();
$newid = mysql_insert_id();
$result = $xoopsDB -> query( "SELECT columnID FROM " . $xoopsDB -> prefix( "sbarticles" ) . " WHERE articleID = '$newid'" );
list($columnID) = $xoopsDB -> fetchrow($result);
$result = $xoopsDB -> query( "SELECT name, total FROM " . $xoopsDB -> prefix( "sbcolumns" ) . " WHERE colid = '$columnID'" );
list( $name, $total ) = $xoopsDB -> fetchrow( $result );
$total++;
$tags = array();
$tags['ARTICLE_NAME'] = $headline;
$tags['ARTICLE_URL'] = XOOPS_URL . '/modules/' . $xoopsModule -> getVar( 'dirname' ) . '/index.php?art&lid=' . $newid;
$tags['COLUMN_NAME'] = $name;
$tags['COLUMN_URL'] = XOOPS_URL . '/modules/' . $xoopsModule -> getVar( 'dirname' ) . '/index.php?op=col&columnID=' . $columnID;
$notification_handler = & xoops_gethandler( 'notification' );
$notification_handler -> triggerEvent( 'global', 0, 'new_article', $tags );
$notification_handler -> triggerEvent( 'category', $columnID, 'new_article', $tags );
if ( $xoopsDB -> queryF( "UPDATE " . $xoopsDB -> prefix( "sbcolumns" ) . " SET total = '$total' WHERE columnID = '$columnID'" ) )
redirect_header( "index.php", 1, _AM_SB_ARTCREATEDOK );
}
else
{
redirect_header( "index.php", 1, _AM_SB_ARTNOTCREATED );
}
}
else // That is, $articleID exists, thus we're editing an article
{
if ( $xoopsDB -> query( "UPDATE " . $xoopsDB -> prefix( "sbarticles" ) . " SET columnID = '$columnID', headline = '$headline', lead = '$lead', bodytext = '$bodytext', teaser = '$teaser', weight = '$weight', html = '$html', smiley = '$smiley', xcodes = '$xcodes', breaks = '$breaks', block = '$block', artimage = '$artimage', votes = '$votes', rating = '$rating', comments = '$comments', offline = '$offline', datesub = '$date' WHERE articleID = '$articleID'" ) )
{
redirect_header( "index.php", 1, _AM_SB_ARTMODIFIED );
}
else
{
redirect_header( "index.php", 1, _AM_SB_ARTNOTUPDATED );
}
}
exit();
break;
The line spotted in the error is:
$this -> db = & Database :: getInstance();
So I ask, any "quick" fix for that fatal error?
I know that Soapbox is pretty old but it has some very interesting features and the site in question has lots of good articles on It...
thank you all in advance