vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Insert PHP code in Style Manager (https://vborg.vbsupport.ru/showthread.php?t=279721)

zero477 03-08-2012 12:06 AM

Insert PHP code in Style Manager
 
Hello all,

I divided the forum in two columns using the Style Manager.

http://www.hyperlinkbuilding.org/seoforum.php

In the right column (where you can see some adds now), I want to display some info related to the user. So I need to insert some PHP code there. When I do it, the PHP code is displayed like a comment.


Greetings,
Eddie

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

Hello all,

I read in the manual the following:

Using PHP Functions in Template Conditionals
As a security precaution, to prevent malicious damage to either your database or your server itself, most PHP functions are disallowed in template conditionals.

This, for example, would be disallowed by the vBulletin template system, as it contains a call to a 'forbidden' function: mysql_query.
<vb:if condition="$my_variable = mysql_query('SELECT * FROM mytable')">
<!-- naughty naughty... -->
</vb:if>
At the time of writing, the list of allowed 'safe' functions is as follows:


Therefore .... How can we use mysql_query function?? is there an alternative way??? I am trying to adapt vbulltin to an old website with many tables and info... I need to use that function..

Someone knows what to do??

kh99 03-08-2012 08:34 PM

You need to create a plugin for your php code, create a new php file, or else edit one of the vbulletin files. It's preferable to use a plugin if possible since if you edit any vbulletin files you will need to make the changes again when you upgrade.

You can read about how to create a plugin in the manual, but you also need to find a hook location that lets you do what you want. You can do that by looking at the vbulletin code to fine the calls to fetch_hook(), or you can ask here and someone might be able to tell you.


All times are GMT. The time now is 09:08 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.00956 seconds
  • Memory Usage 1,710KB
  • 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
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete