vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Custom page Script... (https://vborg.vbsupport.ru/showthread.php?t=227974)

ForumsMods 11-15-2009 10:33 AM

Quote:

Originally Posted by ragtek (Post 1914475)
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.

winstone 11-15-2009 10:56 AM

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

cellarius 11-15-2009 10:59 AM

Quote:

Originally Posted by ragtek (Post 1914475)
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?

Paul M 11-15-2009 11:51 AM

Quote:

Originally Posted by HMBeaty (Post 1914392)
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 (Post 1914411)
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 ;)

Shadab 11-15-2009 03:15 PM

Quote:

Originally Posted by winstone (Post 1914536)
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()); 


AWMGolfer 11-15-2009 07:57 PM

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!

Adrian Schneider 11-16-2009 04:38 AM

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.

cory_booth 11-16-2009 10:31 PM

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.


All times are GMT. The time now is 03:41 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.01089 seconds
  • Memory Usage 1,765KB
  • 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
  • (3)bbcode_code_printable
  • (7)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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