';
// Consts
define('SEPARATOR', '; ');
define('DEFINED_FIELD_PRE', '');
define('DEFINED_FIELD_POST', '');
define('UNDEFINED_FIELD_PRE', '');
define('UNDEFINED_FIELD_POST', '');
$errors_found = false;
$files = getAllHtmlFiles('./');
$files = array_filter($files, 'is_allowed_file');
if (!in_array('./'.NOTFOUND_NAME.CFG_EXTENSION, $files))
$files[] = './'.NOTFOUND_NAME.CFG_EXTENSION; // Static file
if (!in_array('./'.INDEX_NAME.CFG_EXTENSION, $files))
$files[] = './'.INDEX_NAME.CFG_EXTENSION; // Static file
asort($files);
$all_dirs = array();
// Fehlerseiten von Unterverzeichnissen hinzufügen
if ((is_array($files)) && (count($files) > 0)) {
foreach ($files as $file) {
$tmp_directory = dir_add_trailing_slash(dirname($file));
if (!isset($all_dirs[$tmp_directory])) {
$tmp_dir = remove_beginning($tmp_directory, './');
if ($tmp_dir === false) $tmp_dir = '';
if ($tmp_dir != '') { // die Static File ist bereits dabei
$tmp = $tmp_dir.NOTFOUND_NAME.CFG_EXTENSION;
if (file_exists($tmp)) $files[] = $tmp;
unset($tmp);
}
unset($tmp_dir);
$all_dirs[$tmp_directory] = true;
}
unset($tmp_directory);
}
unset($all_dirs);
foreach ($files as $file) {
$filename = basename($file);
$tmp_directory = dir_add_trailing_slash(dirname($file));
if (!file_exists($file)) {
$result .= '
'.$tmp_directory.$filename.' |
Required static file not found! |
';
$errors_found = true;
} else {
$content = file_get_contents($file);
$tmp_directory_blank = remove_beginning($tmp_directory, './');
// Für magic constants in Metatags
if ($tmp_directory_blank === false) $tmp_directory_blank = '';
// Title
$TITLE = findoutTitle($content);
$TITLE = strip_tags($TITLE);
if ($TITLE == LNG_UNKNOWN_TITLE) { // Hier keine htmlentities()
$TITLE = ''.$TITLE.'';
$errors_found = true;
} else {
$TITLE = ''.$TITLE.'';
}
// Interrupts
if (getMetatag('interrupts', $content) === false) {
$a = UNDEFINED_FIELD_PRE;
$b = UNDEFINED_FIELD_POST;
} else {
$a = DEFINED_FIELD_PRE;
$b = DEFINED_FIELD_POST;
}
$interrupts = '';
$inter_ary = findoutInterrupts($content, $tmp_directory_blank);
if ((is_array($inter_ary)) && (count($inter_ary) > 0)) {
foreach ($inter_ary as $inter) {
if ($inter == '*empty*') {
$inter = $a.$inter.$b;
} else if (file_exists($inter.CFG_EXTENSION)) {
$inter = $a.''.htmlentities($inter).''.$b;
} else {
$inter = $a.''.htmlentities($inter).''.$b;
$errors_found = true;
}
$interrupts .= $inter.SEPARATOR;
unset($inter);
}
}
unset($inter_ary);
if ($interrupts == '') {
$interrupts = 'none';
} else {
$interrupts = substr($interrupts, 0, strlen($interrupts)-strlen(SEPARATOR));
}
unset($a);
unset($b);
if (!is_no_errorpage($file)) {
$filename = ''.htmlentities($tmp_directory_blank.$filename).'';
} else {
$filename = ''.htmlentities($tmp_directory_blank.$filename).'';
}
// Design
if (getMetatag('design', $content) === false) {
$a = UNDEFINED_FIELD_PRE;
$b = UNDEFINED_FIELD_POST;
} else {
$a = DEFINED_FIELD_PRE;
$b = DEFINED_FIELD_POST;
}
$design = findoutDesign($content, $tmp_directory_blank);
if ($design == '') {
$design = 'none';
} else {
if ($design == '*empty*') {
$design = $a.$design.$b;
} else if (file_exists($design.CFG_EXTENSION)) {
$design = $a.''.htmlentities($design).''.$b;
} else {
$design = $a.''.htmlentities($design).''.$b;
$errors_found = true;
}
}
unset($a);
unset($b);
// Menu
if (getMetatag('menues', $content) === false) {
$a = UNDEFINED_FIELD_PRE;
$b = UNDEFINED_FIELD_POST;
} else {
$a = DEFINED_FIELD_PRE;
$b = DEFINED_FIELD_POST;
}
$menues = '';
$menu_ary = findoutMenues($content, $tmp_directory_blank);
if ((is_array($menu_ary)) && (count($menu_ary) > 0)) {
foreach ($menu_ary as $menu) {
if ($menu == '*empty*') {
$menu = $a.$menu.$b;
} else if (file_exists($menu.CFG_EXTENSION)) {
$menu = $a.''.htmlentities($menu).''.$b;
} else {
$menu = $a.''.htmlentities($menu).''.$b;
$errors_found = true;
}
$menues .= $menu.SEPARATOR;
}
unset($menu);
}
unset($menu_ary);
if ($menues == '') {
$menues = 'none';
} else {
$menues = substr($menues, 0, strlen($menues)-strlen(SEPARATOR));
}
unset($a);
unset($b);
// Metatags
if (getMetatag('metatags', $content) === false) {
$a = UNDEFINED_FIELD_PRE;
$b = UNDEFINED_FIELD_POST;
} else {
$a = DEFINED_FIELD_PRE;
$b = DEFINED_FIELD_POST;
}
$metatags = '';
$meta_ary = findoutMetatags($content, $tmp_directory_blank);
if ((is_array($files)) && (count($files) > 0)) {
foreach ($meta_ary as $meta) {
if ($meta == '*empty*') {
$meta = $a.$meta.$b;
} else if (file_exists($meta.CFG_EXTENSION)) {
$meta = $a.''.htmlentities($meta).''.$b;
} else {
$meta = $a.''.htmlentities($meta).''.$b;
$errors_found = true;
}
$metatags .= $meta.SEPARATOR;
}
unset($meta);
}
unset($meta_ary);
if ($metatags == '') {
$metatags = 'none';
} else {
$metatags = substr($metatags, 0, strlen($metatags)-strlen(SEPARATOR));
}
unset($a);
unset($b);
// Table row
$result .= "
$filename |
$TITLE |
$interrupts |
$design |
$menues |
$metatags |
";
unset($tmp_directory_blank);
unset($content);
unset($TITLE);
unset($interrupts);
unset($design);
unset($menu);
unset($metatags);
}
unset($filename);
unset($tmp_directory);
}
$result .= '';
$result .= ''.my_version().'
© Copyright 2009 - '.date('Y').' ViaThinkSoft.
';
unset($file);
}
unset($files);
// ------------
$pre = 'MarxEngine Vitality
';
$pre .= '';
if ($errors_found) {
$pre .= 'ERRORS FOUND!';
header('X-Engine-Vitality: Error');
} else {
$pre .= 'Everything OK!';
header('X-Engine-Vitality: OK');
}
$pre .= '
';
unset($errors_found);
// Output
$TITLE = 'MarxEngine Vitality Check';
echo $pre;
echo $result;
unset($pre);
unset($result);
?>