Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 03-15-2016, 06:47 PM
greigeh greigeh is offline
 
Join Date: Jan 2015
Posts: 113
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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?
Reply With Quote
  #2  
Old 03-15-2016, 06:52 PM
Dave Dave is offline
 
Join Date: May 2010
Posts: 2,583
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
2 благодарности(ей) от:
greigeh, MarkFL
  #3  
Old 03-15-2016, 07:15 PM
greigeh greigeh is offline
 
Join Date: Jan 2015
Posts: 113
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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'] )
{
Reply With Quote
  #4  
Old 03-15-2016, 07:56 PM
Dave Dave is offline
 
Join Date: May 2010
Posts: 2,583
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm that piece of code looks fine to me.
Reply With Quote
  #5  
Old 03-15-2016, 08:38 PM
greigeh greigeh is offline
 
Join Date: Jan 2015
Posts: 113
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #6  
Old 03-15-2016, 08:44 PM
squidsk's Avatar
squidsk squidsk is offline
 
Join Date: Nov 2010
Posts: 969
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Could you post the entire code in that plugin in case you're counting lines incorrectly.
Reply With Quote
Благодарность от:
greigeh
  #7  
Old 03-15-2016, 09:02 PM
greigeh greigeh is offline
 
Join Date: Jan 2015
Posts: 113
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>';
Reply With Quote
  #8  
Old 03-15-2016, 09:26 PM
squidsk's Avatar
squidsk squidsk is offline
 
Join Date: Nov 2010
Posts: 969
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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]}
This looks like it belongs to a template, not php code.
Reply With Quote
  #9  
Old 03-15-2016, 09:37 PM
greigeh greigeh is offline
 
Join Date: Jan 2015
Posts: 113
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by squidsk View Post
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]}
This looks like it belongs to a template, not php code.
Just realised the snippet of code you posted is missing the " at the end of data-button which has resolved the issue. Crazy.
Reply With Quote
  #10  
Old 03-15-2016, 09:44 PM
Dave Dave is offline
 
Join Date: May 2010
Posts: 2,583
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So the following is still literally in the PHP code of the hook?
PHP Code:
name="dbtech_thanks_button" data-postid="{$post[postid]}data-button="{$button[varname]}
If that's the case, you have to remove it since it's not PHP code.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:07 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04365 seconds
  • Memory Usage 2,277KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (1)bbcode_html
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (3)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete