<?php

///////////////////////////////////////////////////////////////////////////////////////////////////////
// BotBanish 6.0.11
// Randem Systems: https://randemsystems.support
// BotBanish PHP Information Viewing
// Date: 02/12/2025
// Usage:
//
// Function: Shows the PHP Information
///////////////////////////////////////////////////////////////////////////////////////////////////////

	if (isset($_GET['dir']))
		BotBanishPHPInfoShow($_GET['dir']);

function BotBanishPHPInfoShow($dir = '') {
	
	global $BotBanishSettings, $context, $scripturl, $sourcedir, $BotBanishText, $txt;
	
	$dir = empty($dir) ? $BotBanishSettings['BOTBANISH_DOCS_DIR'] : $dir;
	
	ob_start();
	phpinfo();
	$variable = ob_get_contents();
	ob_get_clean();
	
	$fh = fopen($dir . 'PHPInfo.html', 'w');
	fwrite($fh, $variable);
	fclose($fh);
	
	if (defined('SMF')) {
		
		require_once($sourcedir . '/ManageServer.php');

		$txt = array_merge($txt, $BotBanishText);	// Need to add our text to SMF text because we are using an SMF template
		loadTemplate('BotBanishPHPInfo');
		$context['sub_template'] = 'show_phpinfo';
		$context['post_url'] = $scripturl . '?action=botbanish;area=showphpinfo';
		
	} else {
		
		echo $variable;
	}
}
?>