The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
PHP Parse Error?
hello!
I just viewed my error log and notice (i assume every time someone posts) there appears an error in the log which is: "[13-Mar-2016 20:16:28 UTC] PHP Parse error: syntax error, unexpected '=' in /home/forumaccount/public_html/showpost.php(258) : eval()'d code on line 71" line 71 is 70 - "$vbulletin->input->clean_array_gpc('r', array( 71 - 'highlight' => TYPE_STR, 72 - 'postcount' => TYPE_UINT, 73 - )); " does anyone know why this is? and could it be the reason for double posts? |
#2
|
|||
|
|||
It's caused by a plugin, not by the file showpost.php.
If you look at line 258 in showpost.php you will see that the showpost_post hook is called. Go to your plugin manager and find a plugin that uses the showpost_post hook. If there's more than one plugin using it, disable them one by one until you find which one is causing it. Once you found the culprit, past the code of the hook here and we can take a look. |
#3
|
|||
|
|||
Ok thank you! I found the code. It's from a long time ago a developer added additional script to our likes script. (I assume it's line 71 of this code though?)
see below: foreach( $data['dislikes'] as $key => $value ) { [line 71] if( ( ( $post['dislikes'] == 1 && $has['dislikes'] == 0 ) ) && $key != $vbulletin->userinfo['userid'] ) { $dislikesHTML .= '<a href="member.php?u=' . $key . '">' . trim( $value ) . '</a>, '; } elseif( $i < 10 && ( $i < ( $post['dislikes'] - 1 ) ) && $key != $vbulletin->userinfo['userid'] ) { |
#4
|
|||
|
|||
Hmm that piece of code looks fine to me.
|
#5
|
|||
|
|||
I did think it looked OK, no idea why it's giving off this error but sure am gunna have a Britney Spears kind of meltdown soon if I can't get to the bottom of this, lol.
|
#7
|
|||
|
|||
HTML Code:
$postLikes = $db->query_read('SELECT DISTINCT `live_dbtech_thanks_entry`.*, `live_user`.`username`, `live_user`.`displaygroupid` FROM `live_dbtech_thanks_entry` JOIN `live_user` ON (`live_user`.`userid` = `live_dbtech_thanks_entry` .`userid`) WHERE `contentid` = \'' . $post['postid'] . '\''); name="dbtech_thanks_button" data-postid="{$post[postid]}" data-button="{$button[varname]} $data = array('likes' => array(), 'dislikes' => array(), 'STFU' => array()); $has = array('likes' => 0, 'dislikes' => 0, 'STFU' => 0); while( ( $fetch = $db->fetch_array( $postLikes ) ) != false ) { $member = array( 'userid' => $fetch['userid'], 'username' => $fetch['username'], 'displaygroupid' => $fetch['displaygroupid'] ); $data[ strtolower( $button['varname'] ) ][ $fetch['userid'] ] = fetch_musername( $member ); if( $fetch['userid'] == $vbulletin->userinfo['userid'] ) { $has[ strtolower( $button['varname'] ) ] = 1; } } $post['hasLiked'] = $has['likes']; $post['hasDisliked'] = $has['dislikes']; $post['hasSTFU'] = $has['STFU']; $post['likes'] = count( $data['likes'] ); $post['dislikes'] = count( $data['dislikes'] ); $post['STFU'] = count( $data['STFU'] ); $likesHTML = ''; $dislikesHTML = ''; $STFUHTML = ''; if( $post['likes'] > 0 ) { $likesHTML = ( ( $has['likes'] == 1 ) ? '<span class="you">You' . ( $post['likes'] > 2 ? ',' : ' ' ) . ' </span> ' : '<span class="you"></span> ' ); $i = 0; $extraHTML = ''; $extra = 0; foreach( $data['likes'] as $key => $value ) { if( ( ( $post['likes'] == 1 && $has['likes'] == 0 ) ) && $key != $vbulletin->userinfo['userid'] ) { $likesHTML .= '<a href="member.php?u=' . $key . '">' . trim( $value ) . '</a>, '; } elseif( $i < 10 && ( $i < ( $post['likes'] - 1 ) ) && $key != $vbulletin->userinfo['userid'] ) { $likesHTML .= '<a href="member.php?u=' . $key . '">' . trim( $value ) . '</a>, '; } elseif( $i >= 10 && ( $i < $post['likes'] ) && $key != $vbulletin->userinfo['userid'] ) { $extraHTML .= trim( strip_tags( $value ) ) . ', '; ++$extra; } ++$i; } $lastUser = end( $data['likes'] ); $lastUserID = key( $data['likes'] ); $likesHTML = substr( $likesHTML, 0, -2 ) . ( ( ( ( $post['likes'] > 1 && $extra == 0 && $has['like'] == 0 ) || ( $post['likes'] > 2 && $extra == 0 && $has['like'] == 1 ) ) && $lastUserID != $vbulletin->userinfo['userid'] ) ? ' and <a href="member.php?u=' . $lastUserID . '">' . $lastUser . '</a>' : ( ( $post['likes'] > 1 && $extra > 0 ) ? ' and <a href="#" class="tooltip" title=\'' . substr( $extraHTML, 0, -2 ) . '\'>' . $extra . ' others</a>' : '') ) . ' ' . ( ( $has['likes'] == 0 && $post['likes'] > 1 ) ? 'like' : ( ( $has['likes'] == 0 && $post['likes'] == 1 ) ? 'likes' : 'like' ) ) . ' this'; } if( $post['dislikes'] > 0 ) { $dislikesHTML = ( ( $has['dislikes'] == 1 ) ? '<span class="you">You' . ( $post['dislikes'] > 2 ? ',' : ' ' ) . ' </span> ' : '<span class="you"></span> ' ); $i = 0; $extraHTML = ''; $extra = 0; foreach( $data['dislikes'] as $key => $value ) { if( ( ( $post['dislikes'] == 1 && $has['dislikes'] == 0 ) ) && $key != $vbulletin->userinfo['userid'] ) { $dislikesHTML .= '<a href="member.php?u=' . $key . '">' . trim( $value ) . '</a>, '; } elseif( $i < 10 && ( $i < ( $post['dislikes'] - 1 ) ) && $key != $vbulletin->userinfo['userid'] ) { $dislikesHTML .= '<a href="member.php?u=' . $key . '">' . trim( $value ) . '</a>, '; } elseif( $i >= 10 && ( $i < $post['dislikes'] ) && $key != $vbulletin->userinfo['userid'] ) { $extraHTML .= trim( strip_tags( $value ) ) . ', '; ++$extra; } ++$i; } $lastUser = end( $data['dislikes'] ); $lastUserID = key( $data['dislikes'] ); $dislikesHTML = substr( $dislikesHTML, 0, -2 ) . ( ( ( ( $post['dislikes'] > 1 && $extra == 0 && $has['like'] == 0 ) || ( $post['dislikes'] > 2 && $extra == 0 && $has['like'] == 1 ) ) && $lastUserID != $vbulletin->userinfo['userid'] ) ? ' and <a href="member.php?u=' . $lastUserID . '">' . $lastUser . '</a>' : ( ( $post['dislikes'] > 1 && $extra > 0 ) ? ' and <a href="#" class="tooltip" title=\'' . substr( $extraHTML, 0, -2 ) . '\'>' . $extra . ' others</a>' : '') ) . ' ' . ( ( $has['dislikes'] == 0 && $post['dislikes'] > 1 ) ? 'dislike' : ( ( $has['dislikes'] == 0 && $post['dislikes'] == 1 ) ? 'dislikes' : 'dislike' ) ) . ' this'; } if( $post['STFU'] > 0 ) { $STFUHTML = ( ( $has['STFU'] == 1 ) ? '<span class="you">You' . ( $post['STFU'] > 2 ? ',' : ' ' ) . ' </span> ' : '<span class="you"></span> ' ); $i = 0; $extraHTML = ''; $extra = 0; foreach( $data['STFU'] as $key => $value ) { if( ( ( $post['STFU'] == 1 && $has['STFU'] == 0 ) ) && $key != $vbulletin->userinfo['userid'] ) { $STFUHTML .= '<a href="member.php?u=' . $key . '">' . trim( $value ) . '</a>, '; } elseif( $i < 10 && ( $i < ( $post['STFU'] - 1 ) ) && $key != $vbulletin->userinfo['userid'] ) { $STFUHTML .= '<a href="member.php?u=' . $key . '">' . trim( $value ) . '</a>, '; } elseif( $i >= 10 && ( $i < $post['STFU'] ) && $key != $vbulletin->userinfo['userid'] ) { $extraHTML .= trim( strip_tags( $value ) ) . ', '; ++$extra; } ++$i; } $lastUser = end( $data['STFU'] ); $lastUserID = key( $data['STFU'] ); $STFUHTML = substr( $STFUHTML, 0, -2 ) . ( ( $post['STFU'] > 1 && $extra == 0 && $lastUserID != $vbulletin->userinfo['userid'] ) ? ' and <a href="member.php?u=' . $lastUserID . '">' . $lastUser . '</a>' : ( ( $post['STFU'] > 1 && $extra > 0 ) ? ' and <a href="#" class="tooltip" title="' . substr( $extraHTML, 0, -2 ) . '">' . $extra . ' others</a>' : '') ) . ' ' . ( ( $has['STFU'] == 0 && $post['STFU'] > 1 ) ? 'said' : ( ( $has['STFU'] == 0 && $post['STFU'] == 1 ) ? 'says' : 'say' ) ) . ' STFU'; } $post['likeshtml'] = $likesHTML; $post['dislikeshtml'] = $dislikesHTML; $post['STFUhtml'] = $STFUHTML; $post['systemhtml'] = ' <script>var admin = ' . ( ( $vbulletin->userinfo['displaygroupid'] == 6 ) ? 'true' : 'false' ) . '</script> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.js"></script> <script src="/assets/tipsy.js"></script> <script src="/assets/global.js"></script> <script src="clientscript/vbulletin_ajax_reputation.js?v=387" type="text/javascript" ></script> <style>@import url( /assets/likes.css );</style>'; |
#8
|
||||
|
||||
I ran that through the php lint and it didn't turn up any errors, but line 3 looks like it doesn't belong in a php file.
Line 3: Code:
name="dbtech_thanks_button" data-postid="{$post[postid]}" data-button="{$button[varname]} |
#9
|
|||
|
|||
Quote:
|
#10
|
|||
|
|||
So the following is still literally in the PHP code of the hook?
PHP Code:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|