Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 11-15-2009, 10:33 AM
ForumsMods ForumsMods is offline
 
Join Date: Aug 2007
Location: Argentina
Posts: 667
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ragtek View Post
1. forgett define('NO_REGISTER_GLOBALS', 1);
2. include the csrf protection


We shouldn't start posting the outdated stuff
1. Yes, I forgot to remove NO_REGISTER_GLOBALS.
Anyway, vBulletin reverse the effects of register_globals. It automatically unsets the globals.
PHP Code:
if (@ini_get('register_globals') OR !@ini_get('gpc_order'))
        {
            foreach (
$this->superglobal_lookup AS $arrayname)
            {
                
$registry->superglobal_size["$arrayname"] = sizeof($GLOBALS["$arrayname"]);

                foreach (
array_keys($GLOBALS["$arrayname"]) AS $varname)
                {
                    
// make sure we dont unset any global arrays like _SERVER
                    
if (!in_array($varname$this->superglobal_lookup))
                    {
                        unset(
$GLOBALS["$varname"]);
                    }
                }
            }
        } 
2. Also I forgot it. I only copy and paste header and modifiy the body of the PHP.

I am going to update the script, and will create a tutorial with more things.
Reply With Quote
  #12  
Old 11-15-2009, 10:56 AM
winstone winstone is offline
 
Join Date: Dec 2006
Posts: 68
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks a lot Shadab, it works the way you coded

however there is one little problem, if I register a variable in the code which is used in 'sidebar_1' template, I can't get it to show in the output using {vb:raw VariableInMySideBar} method

this is the code:
PHP Code:
##The variable to be used in 'my_sidebar_1' template
$ExVariable'SomeAutoGeneratedContent';

$templater vB_Template::create('TEST');

$templater->register_page_templates();
$templater->register('navbar'$navbar);

$templater->register('my_sidebar_1'vB_Template::create('sidebar_1')->render());

##Register the variable
$templater->register('VariableInMySideBar'$ExVariable);

print_output($templater->render()); 

in the template 'TEST',
Code:
{vb:raw my_sidebar_1}
works fine

in 'sidebar_1' template:
Code:
{vb:raw VariableInMySideBar}
doesn't work

and surprisingly
Code:
{$ExVariable}
works fine, but I guess I shouldn't use it like that
Reply With Quote
  #13  
Old 11-15-2009, 10:59 AM
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Posts: 1,987
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ragtek View Post
1. forgett define('NO_REGISTER_GLOBALS', 1);
2. include the csrf protection


We shouldn't start posting the outdated stuff
I totally agree, and that's why you really should add
PHP Code:
define('CSRF_PROTECTION'true); 
after
PHP Code:
define('NO_REGISTER_GLOBALS'1); 
define('THIS_SCRIPT''test'); 

Thinking of it - I havn't seen NO_REGISTER_GLOBALS set in vB's core scripts since what, 3.0? I just checked and it vanished with 3.5, and in 4.0 there is no single reference to NO_REGISTER_GLOBALS that I can trace. Could it be that in fact this constant has been outdated for years but still makes it's way into modification codes because it was once needed years ago?
Reply With Quote
  #14  
Old 11-15-2009, 11:51 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 HMBeaty View Post
Actually, to make a quick correction (if I remember correctly)...

This
PHP Code:
error_reporting(E_ALL & ~E_NOTICE); 
Should be
PHP Code:
error_reporting(E_ALL & ~E_NOTICE & ~8192); 
Quote:
Originally Posted by Dismounted View Post
No need to suppress E_DEPRECATED warnings now, as they should be fixed.
And even if you do, it should be -E_DEPRECATED , not -8192
Reply With Quote
  #15  
Old 11-15-2009, 03:15 PM
Shadab's Avatar
Shadab Shadab is offline
 
Join Date: Apr 2007
Location: Bhopal
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by winstone View Post
Thanks a lot Shadab, it works the way you coded

however there is one little problem, if I register a variable in the code which is used in 'sidebar_1' template, I can't get it to show in the output using {vb:raw VariableInMySideBar} method
Your code was registering the variable with the main (TEST) template, instead of the sidebar template.
Try this:

PHP Code:
##The variable to be used in 'my_sidebar_1' template
$ExVariable 'SomeAutoGeneratedContent';

$mainTemplate vB_Template::create('TEST');
$sidebar vB_Template::create('sidebar_1');

$mainTemplate->register_page_templates();
$mainTemplate->register('navbar'$navbar);

$sidebar->register('VariableInMySideBar'$ExVariable);

$mainTemplate->register('my_sidebar_1'$sidebar->render());

print_output($mainTemplate->render()); 
Reply With Quote
  #16  
Old 11-15-2009, 07:57 PM
AWMGolfer AWMGolfer is offline
 
Join Date: Dec 2007
Posts: 120
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What would be really cool is if we could have the widgets display on these pages. The CMS is great and I will be using it but it just lacks in a few areas that a couple of quickly made pages using this would work great, then to add some widgets would just be perfect!
Reply With Quote
  #17  
Old 11-16-2009, 04:38 AM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The new v4 code will be leaning towards that, though it'll be more of a transitional release. I don't see us coding "pages" like this for long... we should be able to tap into the routing, controllers, modules, etc.

AFAIK this part of the code is still highly volatile.
Reply With Quote
  #18  
Old 11-16-2009, 10:31 PM
cory_booth cory_booth is offline
 
Join Date: Jul 2006
Posts: 224
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This hack has saved me from loss of vbAdvanced!
Thanks soooo much. I was tearing up my head trying to figure out how to do this with the CMS. Yes, adding a widget or two would be perfect.
Reply With Quote
Reply


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 06:08 PM.


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.04297 seconds
  • Memory Usage 2,268KB
  • 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_code
  • (7)bbcode_php
  • (5)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
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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