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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 07-25-2014, 11:57 PM
b6gm6n's Avatar
b6gm6n b6gm6n is offline
 
Join Date: Aug 2002
Location: UK
Posts: 691
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK thanks for the help...

The plugin to allow PHP is called 'Product : Let PHP Live!' and looks like this:
Code:
if (!function_exists('let_php_live')) {
  function let_php_live($matches) {
	  $starter = $matches[1] ;
		$code = str_replace(array('\'', '\"'), array('\\\'', '"'), $matches[2]) ;
	
		return $starter == '<?=' ? "\".eval('return $code;').\"" : "\".eval('ob_start();$code;return ob_get_clean();').\"" ;
	}
}

$template = preg_replace_callback('/(<\?=|<\?php|<\?)(.*)\?>/Us', 'let_php_live', $template);
Seems to work OK or did...
The template I'm using is a custom one, see below:
Code:
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle]</title>
$headinclude
</head>
<body>
$header

$navbar

<table cellpadding="2" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<td width="100%"><img style="float:left" src="images/7ox10header.gif" border="0" /></td>
</table><br />
<div class="rounded-corners-forum">
<?
$cacheFile = 'top10.txt';

if ( (file_exists($cacheFile)) && ((fileatime($cacheFile) + 86400) > time()) )
{
    $content = file_get_contents($cacheFile);
} else
{
    ob_start();
    // write top10.txt file
    
$record = 1;
if (($handle = fopen("ftp://***", "r")) !== FALSE) {
    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
echo "<div class=\"cheatpagenation\"> </div><br /><div class=\"top10list\"><font color=grey>#0".$record." : </font><font color=white>".str_replace ("Umbra.PermaScore:Add(", " ", $data[0])."</font>_<font color=grey>KILLS-( <font color=CadetBlue>{$data[2]}</font><font color=grey> )_DEATHS-( <font color=FireBrick>{$data[3]}</font> <font color=grey>)_SUICIDES-( <font color=FireBrick>{$data[6]}</font> <font color=grey>)_HEADSHOTS-( <font color=CadetBlue>{$data[4]}</font> <font color=grey>)_DUELWINS-( <font color=Tomato>{$data[7]}</font> <font color=grey>)_LEVEL-( <font color=GoldenRod>{$data[9]}</font> <font color=grey>)</font></div>\n";
        $record++;
        if ($record > 100) { break; }
    }
    fclose($handle);
    }

    $content = ob_get_contents();
    ob_end_clean();
    file_put_contents($cacheFile,$content);
}

//    require_once('top10pagenation.php');
    $safe_functions[] = 'paginateRecords';
    $page=$_GET['page'];
    echo paginateRecords('top10.txt',$page);
    echo "<div class=\"cheatfooter\">TOP 100 UPDATED AUTOMATICALLY EVERY DAY</div>";
?>

</div><br />
<table cellpadding="2" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<td width="100%" align="left"><img src="images/top10.png" border="0" /></td>

<tr>
	<td class="shameheader"><font face="customfont4">&nbsp;&nbsp;? 7OX-10 PLAYERS - ( TOP 100 LISTED )</font></td>

</tr>

</table>

$footer
</body>
</html>

On my forum I just link to my php file which calls up my template:
Code:
<?php

error_reporting(E_ALL & ~E_NOTICE);

define('NO_REGISTER_GLOBALS', 1);

define('THIS_SCRIPT', 'top10');

$phrasegroups = array();

$specialtemplates = array();

$globaltemplates = array('top10',);

$actiontemplates = array();

require('global.php');

eval('$navbar = "' . fetch_template('navbar') . '";');

eval('print_output("' . fetch_template('top10') . '");');

?>
I've got that plugin with the custom-functions I want installed and there's no errors there, but my php top10 page is pure white at the moment, nothing shown... so dunno what to try next actually, but thanks for the help thus far.

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

Adding the hooks etc seems to work... just blank output

Code:
//    require_once('top10pagenation.php');
//    $page=$_GET['page'];
//  echo paginateRecords('top10.txt',$page);
That function when included from that file seemed relative to that $page variable on the next line down and so the echo was easy, but because the now safe function is running all the time for some reason the $page line isn't relative to that function anymore... and so balks and echos nothing... not sure.
Reply With Quote
 


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 01:35 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.07105 seconds
  • Memory Usage 2,989KB
  • Queries Executed 13 (?)
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
  • (16)bbcode_code
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (20)post_thanks_box
  • (2)post_thanks_box_bit
  • (20)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (20)post_thanks_postbit_info
  • (20)postbit
  • (2)postbit_attachment
  • (20)postbit_onlinestatus
  • (20)postbit_wrapper
  • (1)showthread_list
  • (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_threadedmode.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • 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_threaded
  • showthread_threaded_construct_link
  • 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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_attachment
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete