-
Notifications
You must be signed in to change notification settings - Fork 1
/
sanity.php
1811 lines (1736 loc) · 68.8 KB
/
sanity.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* Sanity check on Genmod.
*
* Genmod: Genealogy Viewer
* Copyright (C) 2002 to 2005 Genmod Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* This Page Is Valid XHTML 1.0 Transitional! > 30 August 2005
*
* @package Genmod
* @subpackage Admin
* @version $Id: sanity.php 29 2022-07-17 13:18:20Z Boudewijn $
*/
/**
* load configuration and context
*/
require "config.php";
global $TEXT_DIRECTION;
//-- make sure that they have gedcom admin status before they can use this page
//-- otherwise have them login again
if (!$gm_user->userGedcomAdmin()) {
if (LOGIN_URL == "") header("Location: login.php?url=sanity.php");
else header("Location: ".LOGIN_URL."?url=sanity.php");
exit;
}
PrintHeader("Genmod ".GM_LANG_sc_sanity_check_short);
// init vars
if (!isset($check_components)) $check_components = "";
$check_gedcoms = "";
foreach($GEDCOMS as $ged => $value) {
$var = "check_gedcoms".$value["id"];
if (isset($$var)) {
$check_gedcoms = "yes";
}
}
if (!isset($check_settings)) $check_settings = "";
if (!isset($check_filesys)) $check_filesys = "";
if (!isset($check_oldgeds)) $check_oldgeds = "";
if (!isset($check_gedtags)) $check_gedtags = "";
if (!isset($check_unlinked)) $check_unlinked = "";
if (!isset($check_cits)) $check_sits = "";
if (!isset($action)) $action = "";
$info_icon = "<img src=\"".GM_IMAGE_DIR."/".$GM_IMAGES["log"]["information"]."\" alt=\"".GM_LANG_information."\" title=\"".GM_LANG_information."\" /> ";
$warn_icon = "<img src=\"".GM_IMAGE_DIR."/".$GM_IMAGES["log"]["warning"]."\" alt=\"".GM_LANG_warning."\" title=\"".GM_LANG_warning."\" /> ";
$error_icon = "<img src=\"".GM_IMAGE_DIR."/".$GM_IMAGES["log"]["error"]."\" alt=\"".GM_LANG_error."\" title=\"".GM_LANG_error."\" /> ";
?>
<!-- Setup the left box -->
<div id="AdminColumnLeft">
<?php AdminFunctions::AdminLink("admin.php", GM_LANG_admin); ?>
<?php AdminFunctions::AdminLink("admin_maint.php", GM_LANG_administration_maintenance); ?>
<?php if (!empty($action)) {
AdminFunctions::AdminLink("sanity.php", GM_LANG_sc_sanity_check);
} ?>
</div>
<div id="AdminColumnMiddle">
<form action="<?php print SCRIPT_NAME; ?>" method="post">
<?php if (empty($action)) {
?><input type="hidden" name="action" value="checksanity" /> <?php
} ?>
<table class="NavBlockTable AdminNavBlockTable">
<tr>
<td colspan="2" class="NavBlockHeader AdminNavBlockHeader"><div class="AdminNavBlockTitle"><?php print GM_LANG_sc_sanity_check;?></div></td>
</tr>
<?php
// Display the options menu
if (empty($action)) {
?>
<tr>
<td colspan="2" class="NavBlockHeader"><?php print GM_LANG_options; ?></td>
</tr>
<tr>
<td class="NavBlockLabel AdminNavBlockLabel"><?php print GM_LANG_sc_check_components; ?></td>
<td class="NavBlockField AdminNavBlockField"><input type="checkbox" name="check_components" value="yes" /></td>
</tr>
<tr>
<td class="NavBlockLabel AdminNavBlockLabel"><?php print GM_LANG_sc_check_sys_settings; ?></td>
<td class="NavBlockField AdminNavBlockField"><input type="checkbox" name="check_settings" value="yes" /></td>
</tr>
<tr>
<td class="NavBlockLabel AdminNavBlockLabel"><?php print GM_LANG_sc_check_oldgeds; ?></td>
<td class="NavBlockField AdminNavBlockField"><input type="checkbox" name="check_oldgeds" value="yes" /></td>
</tr>
<?php if (count($GEDCOMS) > 0) { ?>
<tr>
<td class="NavBlockLabel AdminNavBlockLabel"><?php print GM_LANG_sc_ged_sets; ?></td>
<td class="NavBlockField AdminNavBlockField"><?php
foreach($GEDCOMS as $ged => $value) {
print "<input type=\"checkbox\" name=\"check_gedcoms".$value["id"]."\" value=\"yes\" /> ".$value["title"]."<br />";
}
print "<div class=\"Indent\">".GM_LANG_options."</div>";
print "<div class=\"Indent\"><input type=\"checkbox\" name=\"check_gedtags\" value=\"yes\" /> ".GM_LANG_sc_check_gedtags."</div>";
print "<div class=\"Indent\"><input type=\"checkbox\" name=\"check_cits\" value=\"yes\" /> ".GM_LANG_sc_cits."</div>";
print "<div class=\"Indent\"><input type=\"checkbox\" name=\"check_unlinked\" value=\"yes\" /> ".GM_LANG_sc_ged_displ_unlinked."</div>";
?>
</td>
</tr>
<?php } ?>
<tr>
<td class="NavBlockLabel AdminNavBlockLabel"><?php print GM_LANG_sc_fs_security; ?></td>
<td class="NavBlockField AdminNavBlockField"><input type="checkbox" name="check_filesys" value="yes" /></td>
</tr>
<tr>
<td class="NavBlockFooter" colspan="2"><button type="submit" name="submit"><?php print GM_LANG_sc_start; ?></button></td>
</tr>
</table>
</form>
</div>
<?php
PrintFooter();
exit;
}
//-- Include the requirements here
$min_php_version = "5.2";
$min_mysql_version = "5.1";
$min_memory_limit = "32";
$php_ini_settings = array(
"output_buffering"=>"4096",
"allow_call_time_pass_reference"=>"Off",
"register_globals"=>"Off",
"register_argc_argv"=>"Off",
"magic_quotes_gpc"=>"Off",
"session.auto_start"=>"0",
"memory_limit"=>"32",
"max_execution_time"=>"30"
);
//-- Array of translated boolean values
$boolean["off"] = "0";
$boolean["Off"] = "0";
$boolean[""] = "0";
$boolean["On"] = "1";
$boolean["on"] = "1";
$boolean["true"] = "1";
$boolean["false"] = "0";
$boolean["1"] = "1";
$boolean["0"] = "0";
//-- print header lines
if (!empty($check_components)) {
//-- Platform components
print "<tr><td colspan=\"2\" class=\"NavBlockHeader\">".GM_LANG_sc_check_components."</td></tr>";
print "<tr><td class=\"NavBlockColumnHeader AdminNavBlockColumnHeader\">".GM_LANG_sc_check."</td><td class=\"NavBlockColumnHeader AdminNavBlockColumnHeader\">".GM_LANG_sc_result."</td></tr>";
// Check versions
// PHP
print "<tr><td class=\"NavBlockLabel AdminNavBlockLabel\">".GM_LANG_sc_php."</td><td class=\"NavBlockLabel AdminNavBlockLabel\">";
if (phpversion()< $min_php_version) print $error_icon.GM_LANG_sc_php_low."<br />".GM_LANG_sc_ver_req." ".$min_php_version;
else print $info_icon.GM_LANG_sc_ok;
print "<br />".GM_LANG_sc_ver_found." ".phpversion()."</td></tr>";
// Presence of GD
print "<tr><td class=\"NavBlockLabel AdminNavBlockLabel\">".GM_LANG_sc_gd."</td><td class=\"NavBlockLabel AdminNavBlockLabel\">";
if (!defined("IMG_ARC_PIE")) print $warn_icon.GM_LANG_sc_gd_missing;
else {
print $info_icon.GM_LANG_sc_ok."<br />".GM_LANG_sc_ver_found." ";
$gd_data = gd_info();
print $gd_data["GD Version"];
}
print "</td></tr>";
// MySQL
print "<tr><td class=\"NavBlockLabel AdminNavBlockLabel\">".GM_LANG_sc_mysql."</td><td class=\"NavBlockLabel AdminNavBlockLabel\">";
if (substr(((is_null($___mysqli_res = mysqli_get_server_info($GLOBALS["___mysqli_ston"]))) ? false : $___mysqli_res), 0, strlen($min_mysql_version)) < $min_mysql_version) print $error_icon.GM_LANG_sc_mysql_low."<br />".GM_LANG_sc_ver_req." ".$min_mysql_version;
else print $info_icon.GM_LANG_sc_ok;
print "<br />".GM_LANG_sc_ver_found." ".((is_null($___mysqli_res = mysqli_get_server_info($GLOBALS["___mysqli_ston"]))) ? false : $___mysqli_res)."</td></tr>";
}
if (!empty($check_settings)) {
//-- PHP and MySQL settings
print "<tr><td colspan=\"2\" class=\"NavBlockHeader\">".GM_LANG_sc_check_sys_settings."</td></tr>";
print "<tr><td class=\"NavBlockColumnHeader AdminNavBlockColumnHeader\">".GM_LANG_sc_check."</td><td class=\"NavBlockColumnHeader AdminNavBlockColumnHeader\">".GM_LANG_sc_result."</td></tr>";
// PHP ini settings
print "<tr><td class=\"NavBlockLabel AdminNavBlockLabel\">".GM_LANG_sc_php_ini."</td><td class=\"NavBlockLabel AdminNavBlockLabel\">";
$error_printed = false;
foreach($php_ini_settings as $setting => $value) {
$equal = false;
$inival = trim(ini_get($setting));
if (isset($boolean[$value]) && isset($boolean[$inival])) {
if ($boolean[$inival] == $boolean[$value]) $equal = true;
}
else if (strtoupper($inival) == strtoupper($value)) $equal = true;
else if (is_numeric($inival) && is_numeric($value) && $inival >= $value) $equal = true;
else if ($setting == "memory_limit") {
$inival = preg_replace("/[a-zA-Z]+/", "", $inival);
if (is_numeric($value) && $inival >= $value) $equal = true;
}
if ($equal != true) {
if (!$error_printed) {
print $warn_icon.GM_LANG_sc_ini_faults;
$error_printed = true;
}
print "<br /><br />".GM_LANG_sc_ini_name." ".$setting."<br />";
print GM_LANG_sc_value_req." ".$value."<br />";
print GM_LANG_sc_value_found." ".$inival;
if (empty($inival)) print GM_LANG_sc_not_set;
}
}
if ($error_printed == false) print $info_icon.GM_LANG_sc_ok;
print "</td></tr>";
// MySQL connect user rights
print "<tr><td class=\"NavBlockLabel AdminNavBlockLabel\">".GM_LANG_sc_mysql_user."</td><td class=\"NavBlockLabel AdminNavBlockLabel\">";
$res = NewQuery("DROP TABLE ".TBLPREFIX."testsanity", true);
$res = NewQuery("CREATE TABLE ".TBLPREFIX."testsanity (s_text VARCHAR(255))", true);
if (!$res) print $error_icon.GM_LANG_sc_no_rights;
else {
$res = NewQuery("ALTER TABLE ".TBLPREFIX."testsanity CHANGE s_text s_text VARCHAR(200)", true);
if (!$res) print $error_icon.GM_LANG_sc_no_rights;
else {
$res = NewQuery("INSERT INTO ".TBLPREFIX."testsanity VALUES ('testdata1')", true);
$res = NewQuery("INSERT INTO ".TBLPREFIX."testsanity VALUES ('testdata2')", true);
if (!$res) print $error_icon.GM_LANG_sc_no_rights;
else {
$res = NewQuery("UPDATE ".TBLPREFIX."testsanity SET s_text='newtestdata' WHERE s_text='testdata1'", true);
if (!$res) print $error_icon.GM_LANG_sc_no_rights;
else {
$res = NewQuery("SELECT * FROM ".TBLPREFIX."testsanity", true);
if (!$res) print $error_icon.GM_LANG_sc_no_rights;
else {
$res->FreeResult();
$res = NewQuery("DELETE FROM ".TBLPREFIX."testsanity WHERE s_text='testdata2'", true);
if (!$res) print $error_icon.GM_LANG_sc_no_rights;
else {
$res = NewQuery("LOCK TABLES ".TBLPREFIX."testsanity WRITE", true);
if (!$res) {
print GM_LANG_sc_no_lock_rights;
$error = true;
}
else $res = NewQuery("UNLOCK TABLES", true);
$res = NewQuery("DROP TABLE ".TBLPREFIX."testsanity", true);
if (!$res) print GM_LANG_sc_no_rights;
else print $info_icon.GM_LANG_sc_ok;
}
}
}
}
}
}
print "</td></tr>";
// Obsolete MySQL user rights
print "<tr><td class=\"NavBlockLabel AdminNavBlockLabel\">".GM_LANG_sc_mysql_user_obs."</td><td class=\"NavBlockLabel AdminNavBlockLabel\">";
$errors = false;
$res = NewQuery("SELECT * FROM MYSQL.USER", true);
if ($res) {
$res->FreeResult();
print GM_LANG_sc_mysql_users."<br />";
$errors = true;
}
$res = NewQuery("SHOW DATABASES", true);
if ($res) {
if ($res->NumRows() > 1) {
// For MySQL 5 there is always usage access to INFORMATION_SCHEMA.
while ($row = $res->FetchRow()) {
if ($row[0] != "information_schema" && $row[0] != DBNAME) {
print $warn_icon.GM_LANG_sc_mysql_databases." ".DBNAME."."."<br />";
$errors = true;
break;
}
}
}
$res->FreeResult();
}
$res = NewQuery("CREATE DATABASE testsanity", true);
if ($res) {
print GM_LANG_sc_mysql_dbcreate."<br />";
$errors = true;
}
$res = NewQuery("DROP DATABASE testsanity", true);
if ($res) {
print GM_LANG_sc_mysql_dbdrop."<br />";
$errors = true;
}
if (!$errors) print $info_icon.GM_LANG_sc_ok;
print "</td></tr>";
// MySQL table optimization
print "<tr><td class=\"NavBlockLabel AdminNavBlockLabel\">".GM_LANG_sc_opt_tables."</td><td class=\"NavBlockLabel AdminNavBlockLabel\">";
$errors = false;
$res = NewQuery("SHOW TABLES", true);
if (!$res) print $warn_icon.GM_LANG_sc_opt_cannot;
else {
while ($row = $res->FetchRow()) {
NewQuery("OPTIMIZE TABLE ".$row[0], true);
if (!$res) {
print $warn_icon.GM_LANG_sc_opt_cannot." ".$row[0];
$errors = true;
}
}
print $info_icon.GM_LANG_sc_opt_tables_done;
}
print "</td></tr>";
}
if (!empty($check_oldgeds)) {
//-- Old gedcom id's: the gedcoms table is leading here
print "<tr><td colspan=\"2\" class=\"NavBlockHeader\">".GM_LANG_sc_check_oldgeds."</td></tr>";
print "<tr><td class=\"NavBlockColumnHeader AdminNavBlockColumnHeader\">".GM_LANG_sc_check."</td><td class=\"NavBlockColumnHeader AdminNavBlockColumnHeader\">".GM_LANG_sc_result."</td></tr>";
print "<tr><td class=\"NavBlockLabel AdminNavBlockLabel\">".GM_LANG_sc_check_invgeds."</td><td class=\"NavBlockLabel AdminNavBlockLabel\">";
$geds = array();
$ageds = array();
$gednames = array();
$agednames = array();
$errors = false;
foreach($GEDCOMS as $ged => $value) {
$ageds[] = $value["id"];
$agednames[] = $value["gedcom"];
}
$geds = implode(", ", $ageds);
$gednames = "'".implode("', '", $agednames)."'";
// Gedcheck:
// 1 - fieldname of the gedcom to which the record refers
// 2 - table name
// 3 - either 'geds' (gedcom is gedcom id) or 'gednames' (gedcom is gedcom names)
// 4 - Language variable name of the message that this table contains records of non-existent gedcoms
$gedcheck = array();
$gedcheck[] = array("a_file", "actions", "geds", "sc_oldged_actions");
$gedcheck[] = array("b_file", "blocks", "geds", "sc_oldged_blocks");
$gedcheck[] = array("ch_file", "changes", "geds", "sc_oldged_changes");
$gedcheck[] = array("d_file", "dates", "geds", "sc_oldged_dates");
$gedcheck[] = array("ge_file", "eventcache", "geds", "sc_oldged_cache");
$gedcheck[] = array("f_file", "families", "geds", "sc_oldged_fams");
$gedcheck[] = array("fv_file", "favorites", "geds", "sc_oldged_favs");
$gedcheck[] = array("gc_gedcomid", "gedconf", "geds", "sc_oldged_gedconf");
$gedcheck[] = array("i_file", "individuals", "geds", "sc_oldged_indis");
$gedcheck[] = array("if_file", "individual_family", "geds", "sc_oldged_indifamily");
$gedcheck[] = array("l_file", "log", "geds", "sc_oldged_log");
$gedcheck[] = array("m_file", "media", "geds", "sc_oldged_media");
$gedcheck[] = array("mm_file", "media_mapping", "geds", "sc_oldged_mediam");
$gedcheck[] = array("n_file", "names", "geds", "sc_oldged_names");
$gedcheck[] = array("n_username", "news", "geds", "sc_oldged_news");
$gedcheck[] = array("o_file", "other", "geds", "sc_oldged_other");
$gedcheck[] = array("om_file", "other_mapping", "geds", "sc_oldged_otherm");
$gedcheck[] = array("pl_file", "placelinks", "geds", "sc_oldged_pl");
$gedcheck[] = array("p_file", "places", "geds", "sc_oldged_places");
$gedcheck[] = array("pd_file", "pdata", "geds", "sc_oldged_plot");
$gedcheck[] = array("p_gedcomid", "privacy", "geds", "sc_oldged_privacy");
$gedcheck[] = array("s_file", "sources", "geds", "sc_oldged_sources");
$gedcheck[] = array("sm_file", "source_mapping", "geds", "sc_oldged_sourcesm");
$gedcheck[] = array("s_file", "soundex", "geds", "sc_oldged_soundex");
$gedcheck[] = array("gs_file", "statscache", "geds", "sc_oldged_stats");
$gedcheck[] = array("ug_file", "users_gedcoms", "geds", "sc_oldged_ug");
$users = UserController::GetUsers();
foreach($gedcheck as $key => $check) {
if (isset($cleanged) && isset($clean) && $cleanged == $check[1]) {
if (($check[2] == "geds" && !in_array($clean, $ageds)) || ($check[2] == "gednames" && !in_array($clean, $agednames))) {
$sql = "DELETE FROM ".TBLPREFIX.$check[1]." WHERE ".$check[0]."='".$clean."'";
$res = NewQuery($sql);
}
else print $error_icon.$error_icon.GM_LANG_sc_oldgedclean_error."<br />";
}
$sql = "SELECT DISTINCT ".$check[0]." FROM ".TBLPREFIX.$check[1];
if (count($GEDCOMS)>0) $sql .= " WHERE ".$check[0]." NOT IN (".${$check[2]}.")";
if ($check[1] == "log") {
if (count($GEDCOMS)>0) $sql .= " AND l_category<>'S'";
else $sql .= " WHERE l_category<>'S'";
}
$res = NewQuery($sql);
if ($res) {
if ($res->Numrows() > 0) {
while ($row = $res->FetchRow()) {
if (!(($check[1] == "blocks" || $check[1] == "news") && ($row[0] == "defaultuser" || array_key_exists($row[0], $users)))) {
$errors = true;
print constant("GM_LANG_".$check[3])." ".$row[0]." <a href=sanity.php?action=checksanity&check_oldgeds=yes&cleanged=$check[1]&clean=$row[0]>".GM_LANG_cleanup."</a><br />";
}
}
if ($errors) print "<br />";
}
}
}
if (!$errors) print $info_icon.GM_LANG_sc_oldged_ok;
print "</td></tr>";
}
if (!empty($check_gedcoms)) {
//-- GEDCOM settings
print "<tr><td colspan=\"2\" class=\"NavBlockHeader\">".GM_LANG_sc_ged_sets."</td></tr>";
print "<tr><td class=\"NavBlockColumnHeader AdminNavBlockColumnHeader\">".GM_LANG_sc_check."</td><td class=\"NavBlockColumnHeader AdminNavBlockColumnHeader\">".GM_LANG_sc_result."</td></tr>";
foreach ($GEDCOMS as $ged=>$value) {
$var = "check_gedcoms".$value["id"];
if (isset($$var)) {
// Check settings per GEDCOM
$id = $value["id"];
//-- As ReadGedcomConfig also changes the language, we must save and restore it after reading the config
$lang = $LANGUAGE;
SwitchGedcom($ged);
$LANGUAGE = $lang;
print "<tr><td class=\"NavBlockLabel AdminNavBlockLabel\" rowspan=\"24\">".$value["title"]."</td><td class=\"NavBlockLabel AdminNavBlockLabel\">";
// Get the partial indilist
$sql = "SELECT i_id, i_gedrec, i_file FROM ".TBLPREFIX."individuals WHERE i_file='".$id."'";
$res = NewQuery($sql);
if ($res) {
$indilist = array();
while ($row = $res->FetchAssoc()) {
$indilist[$row["i_id"]]{"gedcom"} = $row["i_gedrec"];
$indilist[$row["i_id"]]{"gedfile"} = $row["i_file"];
}
}
// Find unlinked indi's
if ($check_unlinked) {
$sql = "SELECT * FROM `gm_individuals` WHERE i_gedrec NOT LIKE '%1 FAMS%' AND i_file='".$id."' AND i_gedrec NOT LIKE '%1 FAMC%'";
$res = NewQuery($sql);
$found = false;
$num = 0;
if ($res) {
while ($row = $res->FetchAssoc()) {
$num++;
if (!$found) {
$found = true;
print $warn_icon.GM_LANG_sc_ged_unlink;
print "<br /><ul>";
}
$person =& Person::GetInstance($row["i_id"], $row, GedcomConfig::$GEDCOMID);
$person->PrintListPerson();
}
}
if (!$found) print $info_icon.GM_LANG_sc_ged_nounlink;
else print "</ul>".GM_LANG_sc_numrecs_found." ".$num;
}
else print $info_icon.GM_LANG_sc_ged_unlinked_noselect;
print "</td></tr>";
// Get the partial indilist with asso's and alia's
$sql = "SELECT i_id, i_gedrec FROM ".TBLPREFIX."individuals WHERE (i_gedrec LIKE '%ASSO @%' OR i_gedrec LIKE '%ALIA @') AND i_file='".$id."'";
$res = NewQuery($sql);
if ($res) {
$cirelalist = array();
while ($row = $res->FetchAssoc()) {
$cirelalist[$row["i_id"]]{"gedcom"} = $row["i_gedrec"];
}
}
// Get the partial famlist
$sql = "SELECT f_id, f_gedrec FROM ".TBLPREFIX."families WHERE f_file='".$id."'";
$res = NewQuery($sql);
if ($res) {
$cfamlist = array();
while ($row = $res->FetchAssoc()) {
$cfamlist[$row["f_id"]]["gedcom"] = $row["f_gedrec"];
}
}
// Get the partial famlist with asso's
$sql = "SELECT f_id, f_gedrec FROM ".TBLPREFIX."families WHERE (f_gedrec LIKE '%ASSO @%') AND f_file='".$id."'";
$res = NewQuery($sql);
if ($res) {
$cfrelalist = array();
while ($row = $res->FetchAssoc()) {
$cfrelalist[$row["f_id"]]["gedcom"] = $row["f_gedrec"];
}
}
// Get the partial sourcelist
$sql = "SELECT s_id, s_gedrec, s_file, s_name FROM ".TBLPREFIX."sources WHERE s_file='".$id."'";
$res = NewQuery($sql);
if ($res) {
$sourcelist = array();
while ($row = $res->FetchAssoc()) {
$csource = array();
$csource["gedcom"] = $row["s_gedrec"];
$csource["in_use"] = false;
$csource["gedfile"] = $row["s_file"];
$csource["name"] = stripslashes($row["s_name"]);
$sourcelist[$row["s_id"]] = $csource;
}
}
// Get the partial repolist
$sql = "SELECT o_id, o_gedrec FROM ".TBLPREFIX."other WHERE o_file='".$id."' AND o_type='REPO'";
$res = NewQuery($sql);
if ($res) {
$crepolist = array();
while ($row = $res->FetchAssoc()) {
$crepo = array();
$crepo["gedcom"] = $row["o_gedrec"];
$crepo["in_use"] = false;
$crepolist[$row["o_id"]] = $crepo;
}
}
// Get the partial level 0 notelist
$sql = "SELECT o_id, o_gedrec FROM ".TBLPREFIX."other WHERE o_file='".$id."' AND o_type='NOTE'";
$res = NewQuery($sql);
if ($res) {
$cnotelist = array();
while ($row = $res->FetchAssoc()) {
$cnote = array();
$cnote["gedcom"] = $row["o_gedrec"];
$cnote["in_use"] = false;
$cnotelist[$row["o_id"]] = $cnote;
}
}
// Get the partial MMlist
$sql = "SELECT m_media, m_gedrec, m_mfile, m_titl, m_file FROM ".TBLPREFIX."media WHERE m_file='".$id."'";
$res = NewQuery($sql);
if ($res) {
$cmedialist = array();
while ($row = $res->FetchAssoc()) {
$cmedia = array();
$cmedia["gedcom"] = $row["m_gedrec"];
$cmedia["file"] = $row["m_mfile"];
$cmedia["gedfile"] = $row["m_file"];
$cmedia["in_use"] = false;
$cmedia["title"] = $row["m_titl"];
$cmedialist[$row["m_media"]] = $cmedia;
}
}
// While doing the reference checking, we check the validity of fact tags on the fly
// And we can also check if every fact record has a source citation
$wrongfacts = array();
$no_cits = array();
$inv_noteref = array();
$numnc = 0; // check for source citations
$numcf = 0; // check for invalid tags
$numcn = 0; // check for note references
$rightfacts = array("CONT", "CONC");
$non_cits_facts = array("RESN", "CHAN", "NOTE", "SOUR", "FAMS", "FAMC", "_UID", "OBJE", "NAME", "SEX", "CHIL", "HUSB", "WIFE", "ASSO");
// Check for reference to non existing sources for indi's
print "<tr><td class=\"NavBlockLabel AdminNavBlockLabel\">";
$error = false;
$num = 0;
foreach($indilist as $key=>$gedlines) {
$numnci = 0; // Number of level 2 source citations per person.
$s = preg_match_all("/\n\d SOUR @(.+)@/", $gedlines["gedcom"], $match);
// if more use $match[1] as array
if ($s) {
foreach($match[1] as $key2=>$sid) {
$num++;
$sid = strtoupper($sid);
if (isset($sourcelist[$sid])) $sourcelist[$sid]["in_use"] = true;
else {
if (!$error) {
$error = true;
print $error_icon.GM_LANG_sc_inv_sref."<ul>";
}
$person =& Person::GetInstance($key, $gedlines["gedcom"], GedcomConfig::$GEDCOMID);
$person->PrintListPerson(true, false, GM_LANG_source.": ".$sid);
}
}
}
$s = preg_match_all("/\n\d NOTE @(.+)@/", $gedlines["gedcom"], $match);
// if more use $match[1] as array
if ($s) {
foreach($match[1] as $key2=>$oid) {
$numcn++;
$oid = strtoupper($oid);
if (isset($cnotelist[$oid])) $cnotelist[$oid]["in_use"] = true;
else {
$inv_noteref["INDI"][$key] = true;
}
}
}
// Now check the facts
if (!empty($check_gedtags) || !empty($check_cits)) {
$facts = GetAllSubrecords($gedlines["gedcom"], "", false, true, false);
foreach($facts as $keyf => $fact) {
// Tags
if (!empty($check_gedtags)) {
$subs = explode("\n", $fact);
foreach($subs as $keyf2 => $sub) {
preg_match("/(\d)\s(\w+)[\s.+\r\n|\r\n]/", $sub, $tags);
$numcf++;
if (isset($tags[2]) && !defined("GM_FACT_".$tags[2]) && !in_array($tags[2],$rightfacts)) $wrongfacts[$tags[2]][] = array($key, GedcomConfig::$GEDCOMID, "INDI");
}
}
// Source citations
if (!empty($check_cits)) {
if (substr($fact, 0, 1) > 0) {
$ft = preg_match("/^1\s(\w+)/", $fact, $match);
$type = $match[1];
$numnc++;
if (preg_match("/\n2 SOUR/", $fact) == 0) {
if (!in_array($type, $non_cits_facts)) {
$no_cits[$key."[".GedcomConfig::$GEDCOMID."]"] = array($key, GedcomConfig::$GEDCOMID, "INDI", $type, $gedlines["gedcom"]);
}
}
else $numnci++;
}
}
}
// If no level 2 citations found, there must be a level 1 citation
if ($numnci == 0) {
if (preg_match("/\n1 SOUR/", $gedlines["gedcom"]) == 0) {
$no_cits[$key."[".GedcomConfig::$GEDCOMID."]"] = array($key, GedcomConfig::$GEDCOMID, "INDI", GM_LANG_individual, $gedlines["gedcom"]);
}
}
}
}
if (!$error) print $info_icon.GM_LANG_sc_ok_sref." ";
else print "</ul>";
print GM_LANG_sc_numrecs_checked." ".$num;
print "</td></tr>";
// Check for ASSO/ALIA's that point to non existing indi's
print "<tr><td class=\"NavBlockLabel AdminNavBlockLabel\">";
$error = false;
$num = 0;
foreach($cirelalist as $key=>$gedlines) {
$s = preg_match_all("/\n\d ASSO @(.+)@/", $gedlines["gedcom"], $match);
// if more use $match[1] as array
if ($s) {
foreach($match[1] as $key2=>$pid) {
$num++;
$pid = strtoupper($pid);
if (!isset($indilist[$pid])) {
if (!$error) {
$error = true;
print $error_icon.GM_LANG_sc_inv_aref."<ul>";
}
$person =& Person::GetInstance($key, $gedlines["gedcom"], GedcomConfig::$GEDCOMID);
$person->PrintListPerson(true, false, GM_LANG_asso_alia.": ".$pid);
}
}
}
}
foreach($cfrelalist as $key=>$gedlines) {
$s = preg_match_all("/\n\d ASSO @(.+)@/", $gedlines["gedcom"], $match);
// if more use $match[1] as array
if ($s) {
foreach($match[1] as $key2=>$pid) {
$num++;
$pid = strtoupper($pid);
if (!isset($indilist[$pid])) {
if (!$error) {
$error = true;
print $error_icon.GM_LANG_sc_inv_aref."<ul>";
}
$family =& Family::GetInstance($key, $gedlines["gedcom"], GedcomConfig::$GEDCOMID);
$family->PrintListFamily(true, GM_LANG_asso_alia.": ".$pid);
}
}
}
}
if (!$error) print $info_icon.GM_LANG_sc_ok_aref." ";
else print "</ul>";
print GM_LANG_sc_numrecs_checked." ".$num;
print "</td></tr>";
// Check for reference to non existing sources for media
print "<tr><td class=\"NavBlockLabel AdminNavBlockLabel\">";
$error = false;
$num = 0;
foreach($cmedialist as $key=>$gedlines) {
$s = preg_match_all("/\n\d SOUR @(.+)@/", $gedlines["gedcom"], $match);
// if more use $match[1] as array
if ($s) {
foreach($match[1] as $key2=>$sid) {
$num++;
$sid = strtoupper($sid);
if (isset($sourcelist[$sid])) $sourcelist[$sid]["in_use"] = true;
else {
if (!$error) {
$error = true;
print $error_icon.GM_LANG_sc_inv_sref_media;
}
print "<br />".GM_LANG_source." ".$sid."<br />";
print GM_LANG_sc_media." ".$key."<br />";
}
}
}
$s = preg_match_all("/\n\d NOTE @(.+)@/", $gedlines["gedcom"], $match);
// if more use $match[1] as array
if ($s) {
foreach($match[1] as $key2=>$oid) {
$numcn++;
$oid = strtoupper($oid);
if (isset($cnotelist[$oid])) $cnotelist[$oid]["in_use"] = true;
else {
$inv_noteref["OBJE"][$key] = true;
}
}
}
// Now check the facts
if (!empty($check_gedtags)) {
$facts = GetAllSubrecords($gedlines["gedcom"], "", false, true, false);
foreach($facts as $keyf => $fact) {
$subs = explode("\n", $fact);
foreach($subs as $keyf2 => $sub) {
preg_match("/(\d)\s(\w+)[\s.+\r\n|\r\n]/", $sub, $tags);
$numcf++;
if (isset($tags[2]) && !defined("GM_FACT_".$tags[2]) && !in_array($tags[2],$rightfacts)) $wrongfacts[$tags[2]][] = array($key, GedcomConfig::$GEDCOMID, "MEDIA", $gedlines["gedcom"]);
}
}
}
}
if (!$error) print $info_icon.GM_LANG_sc_ok_sref_media." ";
else print "<br />";
print GM_LANG_sc_numrecs_checked." ".$num;
print "</td></tr>";
// Check for reference to non existing sources for fams
print "<tr><td class=\"NavBlockLabel AdminNavBlockLabel\">";
$error = false;
$num = 0;
foreach($cfamlist as $key=>$gedlines) {
$numncf = 0; // Number of level 2 source citations per family.
$s = preg_match_all("/\n\d SOUR @(.+)@/", $gedlines["gedcom"], $match);
// if more use $match[1] as array
if ($s) {
foreach($match[1] as $key2=>$sid) {
$num++;
$sid = strtoupper($sid);
if (isset($sourcelist[$sid])) $sourcelist[$sid]["in_use"] = true;
else {
if (!$error) {
$error = true;
print $error_icon.GM_LANG_sc_inv_sref_fam."<ul>";
}
$family =& Family::GetInstance($key, $gedlines["gedcom"], GedcomConfig::$GEDCOMID);
$family->PrintListFamily(true, GM_LANG_source." ".$sid);
}
}
}
$s = preg_match_all("/\n\d NOTE @(.+)@/", $gedlines["gedcom"], $match);
// if more use $match[1] as array
if ($s) {
foreach($match[1] as $key2=>$oid) {
$numcn++;
$oid = strtoupper($oid);
if (isset($cnotelist[$oid])) $cnotelist[$oid]["in_use"] = true;
else {
$inv_noteref["FAM"][$key] = true;
}
}
}
// Now check the facts
if (!empty($check_gedtags) || !empty($check_cits)) {
$facts = GetAllSubrecords($gedlines["gedcom"], "", false, true, false);
foreach($facts as $keyf => $fact) {
$inames = false;
$subs = explode("\n", $fact);
foreach($subs as $keyf2 => $sub) {
preg_match("/(\d)\s(\w+)[\s.+\r\n|\r\n]/", $sub, $tags);
$numcf++;
if (isset($tags[2]) && !defined("GM_FACT_".$tags[2]) && !in_array($tags[2],$rightfacts)) {
$wrongfacts[$tags[2]][] = array($key, GedcomConfig::$GEDCOMID, "FAM", $gedlines["gedcom"]);
$inames = true;
}
}
// Source citations
if (!empty($check_cits)) {
if (substr($fact, 0, 1) > 0) {
$ft = preg_match("/^1\s(\w+)/", $fact, $match);
$type = $match[1];
if (preg_match("/\n2 SOUR/", $fact) == 0) {
if (!in_array($type, $non_cits_facts)) {
$no_cits[$key."[".GedcomConfig::$GEDCOMID."]"] = array($key, GedcomConfig::$GEDCOMID, "FAM", $type, $gedlines["gedcom"]);
$numnc++;
$inames = true;
}
}
else $numncf++;
}
}
if ($inames) {
$parents = array();
$ct = preg_match("/1 HUSB @(.*)@/", $gedlines["gedcom"], $match);
if ($ct>0) $parents["HUSB"] = $match[1];
else $parents["HUSB"] = "";
$ct = preg_match("/1 WIFE @(.*)@/", $gedlines["gedcom"], $match);
if ($ct>0) $parents["WIFE"]=$match[1];
else $parents["WIFE"] = "";
if (!empty($parents["HUSB"])) $indilist[$parents["HUSB"]]["names"] = NameFunctions::GetIndiNames($indilist[$parents["HUSB"]]["gedcom"]);
if (!empty($parents["WIFE"])) $indilist[$parents["WIFE"]]["names"] = NameFunctions::GetIndiNames($indilist[$parents["WIFE"]]["gedcom"]);
}
}
// If no level 2 citations found, there must be a level 1 citation
if ($numncf == 0) {
if (preg_match("/\n1 SOUR/", $gedlines["gedcom"]) == 0) {
$no_cits[$key."[".GedcomConfig::$GEDCOMID."]"] = array($key, GedcomConfig::$GEDCOMID, "FAM", GM_LANG_family, $gedlines["gedcom"]);
}
}
}
}
if (!$error) print $info_icon.GM_LANG_sc_ok_sref_fam." ";
else print "</ul>";
print GM_LANG_sc_numrecs_checked." ".$num;
print "</td></tr>";
// Check for reference to non existing repo for sources
print "<tr><td class=\"NavBlockLabel AdminNavBlockLabel\">";
$error = false;
$num = 0;
foreach($sourcelist as $key=>$source) {
$s = preg_match_all("/REPO @(.+)@/", $source["gedcom"], $match);
// if more use $match[1] as array
if ($s) {
foreach($match[1] as $key2=>$rid) {
$num++;
$rid = strtoupper($rid);
if (isset($crepolist[$rid])) $crepolist[$rid]["in_use"] = true;
else {
if (!$error) {
$error = true;
print $error_icon.GM_LANG_sc_inv_rref_sour."<ul>";
}
$source =& Source::GetInstance($key, $sourcelist[$key]["gedcom"], GedcomConfig::$GEDCOMID);
$source->PrintListSource(true, 1, GM_LANG_repo." ".$rid);
}
}
}
$s = preg_match_all("/\n\d NOTE @(.+)@/", $source["gedcom"], $match);
// if more use $match[1] as array
if ($s) {
foreach($match[1] as $key2=>$oid) {
$numcn++;
$oid = strtoupper($oid);
if (isset($cnotelist[$oid])) $cnotelist[$oid]["in_use"] = true;
else {
$inv_noteref["SOUR"][$key] = true;
}
}
}
// Now check the facts
if (!empty($check_gedtags)) {
$facts = GetAllSubrecords($source["gedcom"], "", false, true, false);
foreach($facts as $keyf => $fact) {
$subs = explode("\n", $fact);
foreach($subs as $keyf2 => $sub) {
preg_match("/(\d)\s(\w+)[\s.+\r\n|\r\n]/", $sub, $tags);
$numcf++;
if (isset($tags[2]) && !defined("GM_FACT_".$tags[2]) && !in_array($tags[2],$rightfacts)) $wrongfacts[$tags[2]][] = array($key, GedcomConfig::$GEDCOMID, "SOUR");
}
}
}
}
if (!$error) print $info_icon.GM_LANG_sc_ok_rref_sour." ";
else print "</ul>";
print GM_LANG_sc_numrecs_checked." ".$num;
print" </td></tr>";
// Check for sources with no reference to a repository
print "<tr><td class=\"NavBlockLabel AdminNavBlockLabel\">";
$error = false;
$num = 0;
foreach($sourcelist as $key=>$source) {
$num++;
$s = preg_match_all("/REPO @(.+)@/", $source["gedcom"], $match);
// if more use $match[1] as array
if ($s == 0) {
if (!$error) {
$error = true;
print $warn_icon.GM_LANG_sc_noref_sour_repo;
print "<ul>";
}
$source =& Source::GetInstance($key, $sourcelist[$key]["gedcom"], GedcomConfig::$GEDCOMID);
$source->PrintListSource();
}
}
if (!$error) print $info_icon.GM_LANG_sc_ok_sour_repo_ref." ";
else print "</ul>";
print GM_LANG_sc_numrecs_checked." ".$num;
print" </td></tr>";
// Check for unreferenced sources
print "<tr><td class=\"NavBlockLabel AdminNavBlockLabel\">";
$error = false;
$num = 0;
foreach($sourcelist as $sid=>$value) {
$num++;
if (!$value["in_use"]) {
if (!$error) {
$error = true;
print $warn_icon.GM_LANG_sc_unu_sref;
print "<ul>";
}
$source =& Source::GetInstance($sid, $sourcelist[$sid]["gedcom"], GedcomConfig::$GEDCOMID);
$source->PrintListSource();
}
}
if (!$error) print $info_icon.GM_LANG_sc_ok_all_sref." ";
else print "</ul>";
print GM_LANG_sc_numrecs_checked." ".$num;
print "</td></tr>";
// Check for unreferenced repositories
print "<tr><td class=\"NavBlockLabel AdminNavBlockLabel\">";
$error = false;
$num = 0;
foreach($crepolist as $rid=>$value) {
$num++;
if (!$value["in_use"]) {
if (!$error) {
$error = true;
print $warn_icon.GM_LANG_sc_unu_rref."<ul>";
}
$repo =& Repository::GetInstance($rid, $value["gedcom"], GedcomConfig::$GEDCOMID);
$repo->PrintListRepository(true, 1, false);
}
$s = preg_match_all("/\n\d NOTE @(.+)@/", $value["gedcom"], $match);
// if more use $match[1] as array
if ($s) {
foreach($match[1] as $key2=>$oid) {
$numcn++;
$oid = strtoupper($oid);
if (isset($cnotelist[$oid])) $cnotelist[$oid]["in_use"] = true;
else {
$inv_noteref["REPO"][$rid] = true;
}
}
}
// Now check the facts
if (!empty($check_gedtags)) {
$facts = GetAllSubrecords($value["gedcom"], "", false, true, false);
foreach($facts as $keyf => $fact) {
$subs = explode("\n", $fact);
foreach($subs as $keyf2 => $sub) {
preg_match("/(\d)\s(\w+)[\s.+\r\n|\r\n]/", $sub, $tags);
$numcf++;
if (isset($tags[2]) && !defined("GM_FACT_".$tags[2]) && !in_array($tags[2],$rightfacts)) $wrongfacts[$tags[2]][] = array($rid, GedcomConfig::$GEDCOMID, "REPO", $value["gedcom"]);
}
}
}
}
if (!$error) print $info_icon.GM_LANG_sc_ok_all_rref." ";
else print "</ul>";
print GM_LANG_sc_numrecs_checked." ".$num;
print "</td></tr>";
// Print the non-existent facts
print "<tr><td class=\"NavBlockLabel AdminNavBlockLabel\">";
if (!empty($check_gedtags)) {
if (count($wrongfacts) == 0) print $info_icon.GM_LANG_sc_nowrongfacts." ";
else {
print $error_icon.GM_LANG_sc_haswrongfacts."<br />";
foreach ($wrongfacts as $fact => $records) {
print GM_LANG_sc_facttag." ".$fact."<ul>";
foreach ($records as $key => $wfact) {
if ($wfact[2] == "INDI") {
$person =& Person::GetInstance($wfact[0], "", $wfact[1]);
$person->PrintListPerson();
}
else if ($wfact[2] == "FAM") {
$family =& Family::GetInstance($wfact[0], $wfact[3], $wfact[1]);
$family->PrintListFamily();
}
else if ($wfact[2] == "SOUR") {
$source =& Source::GetInstance($wfact[0], $sourcelist[$wfact[0]]["gedcom"], $wfact[1]);
$source->PrintListSource();
}
else if ($wfact[2] == "REPO") {
$repo =& Repository::GetInstance($key, $wfact[3], $wfact[1]);
$repo->PrintListRepository(true, 1, false);
}
else if ($wfact[2] == "MEDIA") {
$media =& MediaItem::GetInstance($wfact[0], $wfact[3], $wfact[1]);
$media->PrintListMedia();
}
}
print "</ul>";
}
}
print GM_LANG_sc_numrecs_checked." ".$numcf;
}
else print $info_icon.GM_LANG_sc_nocheck_gedtags;
print "</td></tr>";
// Print the records with no source citations
print "<tr><td class=\"NavBlockLabel AdminNavBlockLabel\">";
if (!empty($check_cits)) {
if (count($no_cits) == 0) print $info_icon.GM_LANG_sc_cits_ok." ";
else {
print $warn_icon.GM_LANG_sc_hasno_cits."<ul>";
foreach ($no_cits as $key => $rec) {
if ($rec[2] == "INDI") {
$person =& Person::GetInstance($rec[0], $rec[4], $rec[1]);
$person->PrintListPerson(true, false, $rec[3]);
}
else if ($rec[2] == "FAM") {
$family =& Family::GetInstance($rec[0], $rec[4], $rec[1]);
$family->PrintListFamily(true, $rec[3]);