Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
How do i call dooutput() from files within admin directory? Details »»
How do i call dooutput() from files within admin directory?
Version: , by matthew tucker matthew tucker is offline
Developer Last Online: Apr 2008 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 03-27-2003 Last Update: Never Installs: 0
 
No support by the author.

I'm writing a hack based on a modified /admin/user.php that tracks an association's financial members details in a separate table of the vb database.

I am trying to call

PHP Code:
eval("dooutput(\"".gettemplate("members_expiresoon")."\");"); 
to be able to print "reminder" letters from a browser using a vb template "members_expiresoon".

If I put that code in another php file in /forums and call that file, it works well, but if I just include the above code in my main program (in forums/admin/) I get a blank screen. grrr

This seems like an "include" or a path issue but I can work it out. Any suggestions?

(I have the following code at the start of my program)
PHP Code:
require("./global.php");
require(
"./functions.php"); 

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 03-27-2003, 09:52 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The admin CP is not designed to use templates. You might have to use an iframe.
Reply With Quote
  #3  
Old 03-27-2003, 10:15 PM
matthew tucker's Avatar
matthew tucker matthew tucker is offline
 
Join Date: Nov 2002
Location: Sydney, Australia
Posts: 36
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

what's an iframe?

can't I just define doutput() somewhere else? Or is using templates in the admin area a security risk?
Reply With Quote
  #4  
Old 03-27-2003, 10:34 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP doesn't let you override functions, so you can't redefine it.

An iframe is a frame not bound to any sides of a window. Search around.
Reply With Quote
  #5  
Old 03-27-2003, 11:20 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

dooutput works in adminfiles as well, but as filburt said the gettemplate function makes problems, because it doesn't know which styleid to use and so on..
Reply With Quote
  #6  
Old 03-28-2003, 12:18 AM
matthew tucker's Avatar
matthew tucker matthew tucker is offline
 
Join Date: Nov 2002
Location: Sydney, Australia
Posts: 36
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Stefan

So, could I just define a modified gettemplate() function maybe (using another function name in my program file!) that would work?

I had a close look at gettemplate() in functions.php but it doesn't seem to reference anything like styleid - maybe I don't understand how that works?

Is there any security risk in calling templates from within the admin area?
Reply With Quote
  #7  
Old 03-28-2003, 12:55 AM
Brad Brad is offline
 
Join Date: Nov 2001
Posts: 4,765
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No there is no risk im aware of, but it will be alot of stuff to work around to use them. If i where you i would just use echo and some html to display the message in the admin cp.
Reply With Quote
  #8  
Old 03-28-2003, 01:09 AM
matthew tucker's Avatar
matthew tucker matthew tucker is offline
 
Join Date: Nov 2002
Location: Sydney, Australia
Posts: 36
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well I think I did it with the following hacked function. I used a sculptor's technique ... removed bits of code until it worked.

PHP Code:
// ###################### Start gettemplate #######################
function getmytemplate($templatename,$escape=1,$gethtmlcomments=1) {
  
// gets a template from the db or from the local cache
  
global $DB_site,$templatesetid,$addtemplatename;

    
$gettemp=$DB_site->query_first("SELECT template FROM template WHERE title='".addslashes($templatename)."' ");
    
$template=$gettemp[template];
 
  if (
$escape==1) {
    
$template=addslashes($template);
    
$template=str_replace("\\'","'",$template);
  }

  if (
$gethtmlcomments) {
    return 
"<!-- BEGIN MYTEMPLATE: $templatename -->\n$template\n<!-- END TEMPLATE: $templatename -->";
  }

  return 
$template;

I'm not too clear how the template cache works, or what the $templatesetid and $addtemplatename variables are for - and maybe this will bugger up some other code - but so far so good, I'm happy. Thanks for your responses.
Reply With Quote
  #9  
Old 03-28-2003, 01:50 AM
Brad Brad is offline
 
Join Date: Nov 2001
Posts: 4,765
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
I'm not too clear how the template cache works
Check out any file in the /forums folder, you'll most likely see a line that starts with $templatesused with a bunch of template names seprated by commas.

Basicly any template called in the file that is not in this line will add a query. however sometimes its better not to add a template here if it wont be used 90% of the time because it adds a bit of overhead.
Reply With Quote
  #10  
Old 03-28-2003, 11:03 AM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

the templatecache is irrelevant on adminfiles, because no templates are called normally.

just the templatesetid has to be specified, or you'd always get the original templates and not your modified ones.
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 04:11 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.04519 seconds
  • Memory Usage 2,294KB
  • Queries Executed 23 (?)
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
  • (3)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete