''); foreach (get_all_gedcoms() as $ged_id=>$ged_name) { $all_dirs[dirname(get_gedcom_setting($ged_id, 'path')).'/']=''; } $all_geds=array(); foreach ($all_dirs as $key=>$value) { $dir=opendir($key); while ($file=readdir($dir)) if (!is_dir($key.$file) && is_readable($key.$file)) { $h=fopen($key.$file, 'r'); if (preg_match('/0.*HEAD/i', fgets($h,255))) $all_geds[$file]=$key.$file; fclose($h); } closedir($dir); } if (count($all_geds)==0) { $all_geds[]='-'; } else { uasort($all_geds, 'utf8_strcasecmp'); } //////////////////////////////////////////////////////////////////////////////// // User parameters //////////////////////////////////////////////////////////////////////////////// $critical=0; $error=1; $warning=2; $info=3; $levels=array( $critical=>i18n::translate('Critical'), $error =>i18n::translate('Error'), $warning =>i18n::translate('Warning'), $info =>i18n::translate('Info'), ); // Default values if (isset($GEDCOM) && array_key_exists($GEDCOM, $all_geds)) $default_ged=$GEDCOM; // Current gedcom else { $tmp=array_keys($all_geds); $default_ged=$tmp[0]; // First gedcom in directory } $ged =safe_POST('ged', array_keys($all_geds), $default_ged); $err_level =safe_POST('err_level', '[0-3]', $critical); // Higher numbers are more picky. $openinnew =safe_POST('openinnew', '[01]', '0'); // Open links in same/new tab/window $context_lines=safe_POST('context_lines','[0-5]', '2'); // Lines of context to display $showall =safe_POST('showall', '[01]', '0'); // Show details of records with no problems echo '
', i18n::translate('This module checks the format of a GEDCOM file against the 5.5.1 GEDCOM Specification. It also checks for a number of common errors in your data. Note that there are lots of versions, extensions and variations on the specification so you should not be concerned with any issues other than those flagged as "Critical". The explanation for all the line-by-line errors can be found in the specification, so please check there before asking for help.'), '
Internal error: REGEXP failed on "', htmlspecialchars($value), '"
'; } fclose($handle); //////////////////////////////////////////////////////////////////////////////// // Check the file at a syntactic level, line-by-line //////////////////////////////////////////////////////////////////////////////// // Gedcom files are english, left-to-right, whatever the page language echo '
';
for ($i=max($num-$context_lines, $last_err_num+$context_lines+1); $i<$num; ++$i)
printf("%07d %s\n", $i+1, $gedfile[$i]);
} else {
echo '';
for ($i=max(0,$num-$context_lines); $i<$num; ++$i)
printf("%07d %s\n", $i+1, $gedfile[$i]);
}
printf("%07d[[%s]] %s; ".i18n::translate('see')." %s\n", $num+1, htmlspecialchars($gedfile[$num]), $err, pgv_href($curr_l0tag, $curr_xref));
flush();
$last_err_num=$num;
} else
if (isset($last_err_num) && $num-$last_err_num<=$context_lines)
printf("%07d %s\n", $num+1, $gedfile[$num]);
}
if (isset($last_err_num)) {
echo '';
} else {
echo i18n::translate('No errors found at this level.');
}
echo '