View Single Post
  #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
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01006 seconds
  • Memory Usage 1,792KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete