View file dcmssocialguard/guard/sys_test.php

File size: 2.07Kb
<?php
include 'inc/head.php';
$sys->head('Проверка системы - SiteGuard');
// показываем только фатальные ошибки 
 ini_set('error_reporting', E_ALL); 

 // непосредственно, включаем показ ошибок 
 ini_set('display_errors', true);
 include H.'guard/inc/guard.php';
 
 
if (empty($ps['guard'])) 
	{
	$err=true;
	echo $sys->icon('err').' Вставьте код: 
	<b>include H.\'guard/inc/guard.php\';</b> в файл /sys/inc/thead.php после <&#63 (2 строка) и обновите страницу<br />';
	}
	else
	echo $sys->icon('ok').' include H.\'guard/inc/guard.php\'; (успешно)<br />';

if (empty($ps['janitor']))
	{
	$err=true;
	echo $sys->icon('err').' Вставьте код: <b>include H.\'guard/inc/janitor.php\';</b> в файл /sys/inc/tfoot.php после <&#63 (2 строка) и обновите страницу';
	}
else
echo $sys->icon('ok').' include H.\'guard/inc/janitor.php\'; (успешно)';
echo '<br />';

function permissions($filez)
	{
	return decoct(@fileperms("$filez")) % 1000;
	}

function test_chmod($df,$chmod)
	{
	global $err,$user;
	if (isset($user) && $user['level']==10)
		$show_df=preg_replace('#^'.preg_quote(H).'#', '/', $df);
		else 
		$show_df=$df;
	@list($f_chmod1,$f_chmod2,$f_chmod3)=str_split(permissions($df));
	list($n_chmod1,$n_chmod2,$n_chmod3)=str_split($chmod);
	if ($f_chmod1<$n_chmod1 || $f_chmod2<$n_chmod2 || $f_chmod3<$n_chmod3)
		{
		$err[]="Установите CHMOD $n_chmod1$n_chmod2$n_chmod3 на файл $show_df";
		echo "<span class='off'>$show_df : [$f_chmod1$f_chmod2$f_chmod3] - >$n_chmod1$n_chmod2$n_chmod3</span><br />\n";
		}
		else
		{
		echo "<span class='on'>$show_df ($n_chmod1$n_chmod2$n_chmod3) : $f_chmod1$f_chmod2$f_chmod3 (OK)</span><br />\n";
		}
	}
test_chmod(H.'guard/system.ini','666');
test_chmod(H.'guard/sets.ini','666');
test_chmod(H.'guard/logs/','777');
err();

$ps['guard']=false;
$ps['janitor']=false;
include H.'guard/inc/janitor.php';
include 'inc/foot.php';
?>