addBreadCrumb(['link' => ADMIN.'phpinfo.php'.fusion_get_aidlink(), 'title' => $locale['400']]);
$allowed_section = ['general', 'phpsettings', 'folderpermission', 'details'];
$_GET['section'] = isset($_GET['section']) && in_array($_GET['section'], $allowed_section) ? $_GET['section'] : 'general';
$master_tab_title['title'][] = $locale['401'];
$master_tab_title['id'][] = 'general';
$master_tab_title['icon'][] = "";
$master_tab_title['title'][] = $locale['420'];
$master_tab_title['id'][] = 'phpsettings';
$master_tab_title['icon'][] = "";
$master_tab_title['title'][] = $locale['440'];
$master_tab_title['id'][] = 'folderpermission';
$master_tab_title['icon'][] = "";
$master_tab_title['title'][] = $locale['450'];
$master_tab_title['id'][] = 'details';
$master_tab_title['icon'][] = "";
if (isset($_GET['section'])) {
switch ($_GET['section']) {
case "phpsettings":
BreadCrumbs::getInstance()->addBreadCrumb(['link' => FUSION_REQUEST, 'title' => $locale['420']]);
break;
case "folderpermission":
BreadCrumbs::getInstance()->addBreadCrumb(['link' => FUSION_REQUEST, 'title' => $locale['440']]);
break;
case "details":
BreadCrumbs::getInstance()->addBreadCrumb(['link' => FUSION_REQUEST, 'title' => $locale['450']]);
break;
default:
break;
}
}
opentable($locale['400']);
echo opentab($master_tab_title, $_GET['section'], 'general', TRUE, 'nav-tabs m-b-15');
switch ($_GET['section']) {
case "phpsettings":
phpsettings();
break;
case "folderpermission":
folderpermission();
break;
case "details":
details();
break;
default:
general();
break;
}
echo closetab();
closetable();
//General info
function general() {
$locale = fusion_get_locale('', LOCALE.LOCALESET."admin/phpinfo.php");
$settings = fusion_get_settings();
$phpinfo = "
\n";
$phpinfo .= "\n".$locale['402']." | ".php_uname()." |
\n";
$phpinfo .= "\n".$locale['403']." | ".$_SERVER['SERVER_SOFTWARE']." |
\n";
$phpinfo .= "\n".$locale['404']." | ".phpversion()." |
\n";
$phpinfo .= "\n".$locale['405']." | ".php_sapi_name()." |
\n";
$phpinfo .= "\n".$locale['406']." | ".dbconnection()->getServerVersion()." |
\n";
$phpinfo .= "\n".$locale['406a']." | ".str_replace('\\PHPFusion\\Database\Driver\\', '', \PHPFusion\Database\DatabaseFactory::getDriverClass())." |
\n";
$phpinfo .= "\n".$locale['407']." | ".$settings['version']." |
\n";
$phpinfo .= "\n".$locale['408']." | ".DB_PREFIX." |
\n";
$phpinfo .= "\n".$locale['409']." | ".COOKIE_PREFIX." |
\n";
$phpinfo .= "\n".$locale['410']." | ".stripinput($_SERVER['HTTP_USER_AGENT'])." |
\n";
$phpinfo .= "
\n
";
echo $phpinfo;
}
function phpsettings() {
$locale = fusion_get_locale('', LOCALE.LOCALESET."admin/phpinfo.php");
//Check GD version
if (function_exists('gd_info')) {
$gd_ver = gd_info();
preg_match('/[0-9]+.[0-9]+/', $gd_ver['GD Version'], $gd_ver);
} else {
$gd_ver = '';
}
$phpinfo = "\n";
$phpinfo .= "\n".$locale['423']." | ".(ini_get('safe_mode') ? $locale['yes'] : $locale['no'])." |
\n";
$phpinfo .= "\n".$locale['424']." | ".(ini_get('register_globals') ? $locale['yes'] : $locale['no'])." |
\n";
$phpinfo .= "\n".$locale['425']." GD (".$locale['431'].") | ".(extension_loaded('gd') ? $locale['yes']." (".$gd_ver[0].")" : $locale['no'])." |
\n";
$phpinfo .= "\n".$locale['425']." zlib | ".(extension_loaded('zlib') ? $locale['yes'] : $locale['no'])." |
\n";
$phpinfo .= "\n".$locale['425']." Magic_quotes_gpc | ".(ini_get('magic_quotes_gpc') ? $locale['yes'] : $locale['no'])." |
\n";
$phpinfo .= "\n".$locale['426']." | ".(ini_get('file_uploads') ? $locale['yes']." (".ini_get('upload_max_filesize')."B)" : $locale['no'])." |
\n";
$phpinfo .= "\n".$locale['428']." | ".(ini_get('display_errors') ? $locale['yes'] : $locale['no'])." |
\n";
$phpinfo .= "\n".$locale['429']." | ".(ini_get('disable_functions') ? str_replace(',', ', ', ini_get('disable_functions')) : $locale['430'])." |
\n";
$phpinfo .= "
\n
";
echo $phpinfo;
}
function folderpermission() {
$locale = fusion_get_locale('', LOCALE.LOCALESET."admin/phpinfo.php");
$status = '';
$folders = [
//path => have to be writeable or not
'administration/db_backups/' => TRUE,
'images/' => TRUE,
'images/imagelist.js' => TRUE,
'images/avatars/' => TRUE,
'images/smiley/' => TRUE,
'robots.txt' => TRUE,
'config.php' => FALSE
];
$infusions = \PHPFusion\Admins::getInstance()->getFolderPermissions();
foreach ($infusions as $value) {
$folders += $value;
}
add_to_head("\n");
//Check file/folder writeable
$i = 0;
foreach ($folders as $folder => $writeable) {
$status .= "\n ".$folder." | ";
if (is_writable(BASEDIR.$folder) == TRUE) {
$status .= "".$locale['441']."";
} else {
$status .= "".$locale['442']."";
}
$status .= " (".substr(sprintf('%o', fileperms(BASEDIR.$folder)), -4).") |
\n";
$i++;
}
$phpinfo = "\n";
$phpinfo .= $status;
$phpinfo .= "
\n
";
echo $phpinfo;
}
function details() {
$locale = fusion_get_locale('', LOCALE.LOCALESET."admin/phpinfo.php");
if (!stristr(ini_get('disable_functions'), "phpinfo")) {
//Generating new phpinfo style, compatible with PHP-Fusion styles
ob_start();
phpinfo();
$phpinfo = ob_get_contents();
ob_end_clean();
$phpinfo = preg_replace('%^.*(.*).*$%ms', '$1', $phpinfo);
$phpinfo = preg_replace('%.*%', "$2
", $phpinfo);
$phpinfo = preg_replace('%%', "$2
", $phpinfo);
$phpinfo = preg_replace('%(.*)
%', "$1
", $phpinfo);
$phpinfo = preg_replace('%(.*) | %', "$1 | ", $phpinfo);
$phpinfo = str_replace('', '', $phpinfo);
$phpinfo = str_replace("", '', $phpinfo);
$phpinfo = str_replace('class="h"', "class='tbl2 center'", $phpinfo);
$phpinfo = str_replace('class="e"', "class='tbl2'", $phpinfo);
$phpinfo = str_replace('class="v"', "class='tbl1'", $phpinfo);
} else {
$phpinfo = "".$locale['451']."
\n";
}
echo $phpinfo;
}
require_once THEMES.'templates/footer.php';