vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Miscellaneous Hacks - CES Parser Permissions (https://vborg.vbsupport.ru/showthread.php?t=138476)

thincom2000 02-22-2008 12:26 AM

Well if this next build of mine still has issues for you, then I would probably have to see your code to know for sure.

cheesegrits 02-22-2008 04:59 PM

Strangely enough, I still have this problem if I disable my mod and just use the standard About Me. The problem seems to be that when the bbcode_parse_start hook is called, class_bbcode.pl, the $bbfoo variables are undefined because of these lines:

PHP Code:

            default:
                if (
intval($forumid))
                {
                    
$forum fetch_foruminfo($forumid);
                    
$dohtml $forum['allowhtml'];
                    
$dobbimagecode $forum['allowimages'];
                    
$dosmilies $forum['allowsmilies'];
                    
$dobbcode $forum['allowbbcode'];
                }
                
// else they'll basically just default to false -- saves a query in certain circumstances
                
break; 

... because $forumid is set to 'ces_profile' (not an intval), so as the comment says, they default to false. So then when we hit this part of ces_permissions_parse():

PHP Code:

        $dobbcode = ($check_ugp['can_bbcode_' $parser->ces_options['check_type']] AND $dobbcode);
        
$dosmilies = ($check_ugp['can_smilies_' $parser->ces_options['check_type']] AND $dosmilies);
        
$dobbimagecode = ($check_ugp['can_imgcode_' $parser->ces_options['check_type']] AND $dobbimagecode);
        
$dohtml = ($check_ugp['can_html_' $parser->ces_options['check_type']] AND $dohtml); 

... they of course all end up false, because none of the $bbfoo variables are true.

I'm puzzled how this could be working for anybody, unless I somehow have an older version of the code?

-- hugh

thincom2000 02-22-2008 05:55 PM

Because $forumid is set to 'ces_profile', yes you are correct that $dofoo all default to false. However, the permissions for 'ces_profile' are cached before entering $bbcode->parse, so the CES Permissions skips the entire $dofoo = ($checkugp AND $dofoo) branch (see function ces_permissions_customfields to verify).

PHP Code:

$pf_parser->ces_options['ces_profile'][$userinfo['userid']] = convert_bits_to_array($userinfo['permissions']['ces_parser_permissions'], $vbulletin->bf_ugp['ces_parser_permissions']); 

This is then caught in ces_permissions_parse by:
PHP Code:

if (!empty($parser->ces_options["$forumid"][$parser->ces_options['current_userid']])) 

and refills $bbfoo with the appropriate values.

cheesegrits 02-22-2008 07:46 PM

Which would be OK, if these lines:

PHP Code:

    if ($post['userid'] AND $parser->ces_options['current_userid'] != $post['userid'])
    {
        
$parser->ces_options['current_userid'] = $post['userid'];
    } 

... weren't resetting current_userid to the id of whoever happened to post the last Visitor Message. ;)

So the code after that is looking for the wrong cached permissions, not finding them, and executing the wrong branch (the stuff that AND's with the $bbfoo's).

EIDT ... changing that 'if' to this seems to fix it.

PHP Code:

    if ($forumid != 'ces_profile' AND $post['userid'] AND $parser->ces_options['current_userid'] != $post['userid']) 

Although as before, I haven't done any corner case testing, so who knows if that'll break something else ...

-- hugh

thincom2000 02-23-2008 02:02 AM

Ah thank you. Fixed in next build.

cheesegrits 02-23-2008 06:39 AM

No problem. I really like this mod, and I want to make my AboutMe stuff "CES Permissions aware", so I look forward to the next build. If you'd like me to do some pre-release testing, PM me and I'll give you my email.

-- hugh

Caerydd 02-24-2008 11:59 AM

This looks great. However, as you have to enable html for all forums - the posting rules will show html 'on' for usergroups that don't have permission to post html. Anyway around this, save hiding posting rules?

thincom2000 02-24-2008 04:06 PM

There is a plugin in the product that should take care of the posting rules. Is this just speculation of yours or can you confirm that the posting rules are not updated?

thincom2000 02-24-2008 09:15 PM

A number of plugins had to be added in order to circumvent the default VM restrictions, and I believe I had to break the "bb-code X is not allowed" error system, but I have made the VM system flexible so that individual BB-Codes can be disabled and simply won't parse (or appear in the editor).

@ cheesegrits, I made some small changes to the forumrules plugin since I sent you the test version.

thincom2000 02-25-2008 02:33 AM

Okay, for the users who experience a blank page on member.php, this has been confirmed to be a result of running PHP 4 when there is a call to a function that didn't exist until PHP 5. Until the next update, you can fix this issue by adding the following code under the header of the includes/ces_permissions.php file:
PHP Code:

if (!function_exists('htmlspecialchars_decode'))
{
    function 
htmlspecialchars_decode($string$quote_style ENT_COMPAT)
    {
        return 
strtr($stringarray_flip(get_html_translation_table(HTML_SPECIALCHARS$quote_style)));
    }




All times are GMT. The time now is 02:33 AM.

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.01315 seconds
  • Memory Usage 1,763KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (7)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete