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

Reply
 
Thread Tools Display Modes
  #1  
Old 05-28-2008, 08:17 PM
consolegaming consolegaming is offline
 
Join Date: Jan 2007
Posts: 168
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Trying to fix a plugin

Hi, I'm currently trying to figure out how to fix a plugin that we already have installed and which stopped working due to the security fix implemented in version 3.7.

I've learned a lot about the process of vBulletin Products and how they are created. And even managed to find exactly the part I wanted, I just don't know how to implement the fix for the CSRF as it's part of the vBulletin admincp options.

The Product in question is the Split Useronline :
https://vborg.vbsupport.ru/showthread.php?t=135771

The basic problem is that the saving of the settings no longer work. I presume this is due to the CSRF change. Though from what I've read about it the solution to the problems caused by it is to add the security token on an input element though I've looked at the source for the page and it's already there due to the options being added onto an existing options form. Forums Home Page Options to be precise. So I would have expected it to work.

Or is there something else that needs to be added to the extra form elements to make them work?

I know of how to alter the sections on the page now, though I've gotta say there is no info available on how to get there, documents mention about how to get into debug mode but didn't explain that extra options would appear in it lol. I'll be happy to provide whatever info is required.
Reply With Quote
  #2  
Old 05-29-2008, 06:24 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Does vBulletin throw an error complaining about the security token?
Reply With Quote
  #3  
Old 05-29-2008, 10:25 AM
consolegaming consolegaming is offline
 
Join Date: Jan 2007
Posts: 168
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No which actually surprised me, so does that mean it's not CSRF causing it?

I had my suspicions but it only stopped working after the 3.7 upgrade and that's the only issue concerning plugins/products I've heard mentioned. Especially as it effects a form lol. And it's not an isolated incident as others who replied to the Product thread are all experiencing the same issue since the upgrade.

So are there are any other issues that have occurred since the upgrade? Possibly more stringent error checks or something? Would it help posting the xml from the Product file used for the admin options section?
Reply With Quote
  #4  
Old 05-29-2008, 10:52 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you have questions/problems with a modification or style, then please post in the thread (or support forum/board) about that modification/style. Best chance to receive a reply from either the author or another member using the same modification/style.
Reply With Quote
  #5  
Old 05-29-2008, 10:53 AM
consolegaming consolegaming is offline
 
Join Date: Jan 2007
Posts: 168
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It seems the author no longer supports the plugin and everyone else seems just as clueless as to what is causing the issue. So I was attempting to take things into my own hands with a little guidance lol.
Reply With Quote
  #6  
Old 05-29-2008, 10:59 AM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by consolegaming View Post
No which actually surprised me, so does that mean it's not CSRF causing it?
Yes, thats exactly what it means. If it was the new CSRF then you would get the token error page.
Reply With Quote
  #7  
Old 05-29-2008, 11:15 AM
consolegaming consolegaming is offline
 
Join Date: Jan 2007
Posts: 168
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So are there any other known issues affecting forms (specifically forms in the admin options) that have occurred since the upgrade to 3.7?

As I assume any such issues would be posted in the coders forum which I wouldn't gain access to until after I have released some plugins. I was planning this to be the first lol (Though I'm not even sure if porting a mod between versions even counts but at the very least it would have been a good base to start from).

EDIT: If it helps the elements the form seems to be ignoring/not remembering are groups of tick boxes. Basically the plugin adds three sets of tickboxes per usergroup into the admincp home page options. it DOES seem to remember the radio button just before it ok which is also part of the plugin (only just noticed this after it was confirmed it wouldn't be CSRF). So it is only affecting the tickboxes.
Reply With Quote
  #8  
Old 05-29-2008, 11:19 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The only requirement added to forms is the CSRF token, of which you would have received an error from vBulletin if it was missing.
Reply With Quote
  #9  
Old 05-29-2008, 11:44 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It might help if you (again) only posted what problems you have (in detail), instead of asking for a solution that will not solve your problem.
Reply With Quote
  #10  
Old 05-29-2008, 12:59 PM
consolegaming consolegaming is offline
 
Join Date: Jan 2007
Posts: 168
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

(I wasn't aware it wasn't CSRF until Pauls post)

Well the issue is that on the Forum Home Page Options page (in the admincp vB options section) some of the form added by the above mentioned plugin doesn't have their values saved. The ones that don't work are 3 sets of checkboxes (a checkbox per usergroup in each setting).

Ive tried looking into it further now that I know it definitely isn't the CSRF fix causing it. I believe I've got it down to two sections of code that could be causing it, either the custom option code that was used for the checkboxes or the plugin that was attached to the admin_options_processing hook. I believe it's likely to be the former of the two possibilities.

I've included the code for both below:
PHP Code:
" . eval('foreach($vbulletin->usergroupcache AS $usergroupid => $usergroup)
{
    
$teamusergroups .= "\\t\\t<label for=\\"setting[$setting[varname]]$usergroupid\\" title=\\"usergroupid: $usergroupid\\"><input type=\\"checkbox\\" tabindex=\\"1\\" name=\\"setting[$setting[varname]]"."[]\\" id=\\"setting[$setting[varname]]$usergroupid\\" value=\\"$usergroupid\\"" . iif(strpos(",$setting[value],", ",$usergroupid,") !== false, \' checked="checked"\') . iif($vbulletin->debug, " title=\\"name=&quot;setting[$setting[varname]]&quot;\\"") . " />$usergroup[title]</label><br />\\n";
}
return "
<span class=\\"smallfont\\">\\n$teamusergroups\\t</span>";')  . "<input type=\"hidden\" name=\"setting[$setting[varname]][]\" value=\"0\" /> 
The above code is the Option code for the first of the three checkbox options in the admincp (gotten through debug mode). When I attempted to print out the $setting[value] array (the array used in the decision to display checked="checked" or not) it appeared to be empty for me. i.e. just displaying Array rather than any values.

The code attached to the admin_options_processing hook is as below:

PHP Code:
if (is_array($vbulletin->GPC['setting']['split_useronline_teamusers']))
{
    
$vbulletin->GPC['setting']['split_useronline_teamusers'] = implode(','$vbulletin->GPC['setting']['split_useronline_teamusers']);
}
if (
is_array($vbulletin->GPC['setting']['split_useronline_premiumusers']))
{
    
$vbulletin->GPC['setting']['split_useronline_premiumusers'] = implode(','$vbulletin->GPC['setting']['split_useronline_premiumusers']);
}
if (
is_array($vbulletin->GPC['setting']['split_useronline_vipusers']))
{
    
$vbulletin->GPC['setting']['split_useronline_vipusers'] = implode(','$vbulletin->GPC['setting']['split_useronline_vipusers']);

--------------- Added [DATE]1212105399[/DATE] at [TIME]1212105399[/TIME] ---------------

Done some further testing whilst waiting for some feedback anyway.

Did some print outs inside the above mentioned plugin (the one attached to the admin_options_processing hook) and the settings appear to make it that far just fine. i.e. the array is populated ok when boxes are ticked and after the implode lines it creates a string like "3,4,6". When does that hook get called though? only when saving the settings? And before or after the saving?

I'm asking this because I took a look into the database to see where the settings where saved and found the options in the datastore table. The relevant serialized section (ignoring the cyb part) being just below:

PHP Code:
s:23:"split_useronline_active";s:1:"1";s:26:"split_useronline_teamusers";s:5:"Array";
s:29:"split_useronline_premiumusers";s:5:"Array";s:25:"split_useronline_vipusers";
s:5:"Array"
As you can see it seems that even in the database it seems to be storing the value Array instead of the elements in that array. So I'm trying to find why that is occurring?
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 07:46 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07780 seconds
  • Memory Usage 2,276KB
  • 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
  • (3)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
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete