-
Notifications
You must be signed in to change notification settings - Fork 1
/
editgedcoms.php
220 lines (200 loc) · 10.1 KB
/
editgedcoms.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
<?php
/**
* UI for online updating of the config file.
*
* Genmod: Genealogy Viewer
* Copyright (C) 2005 - 2012 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! > 12 September 2005
*
* @author Genmod Development Team
* @package Genmod
* @subpackage Admin
* @see index/gedcoms.php
* @version $Id: editgedcoms.php 29 2022-07-17 13:18:20Z Boudewijn $
*/
/**
* Inclusion of the configuration file
*/
require "config.php";
global $TEXT_DIRECTION;
if (!isset($action)) $action="";
if (!isset($ged)) $ged = "";
$message = "";
// NOTE: make sure that they have admin status before they can use this page
// NOTE: otherwise have them login again
if (!$gm_user->userGedcomAdmin()) {
if (LOGIN_URL == "") header("Location: login.php?url=editgedcoms.php");
else header("Location: ".LOGIN_URL."?url=editgedcoms.php");
exit;
}
PrintHeader(GM_LANG_gedcom_adm_head);
if ($action=="delete") {
if (isset($GEDCOMS[$delged])) {
PrivacyController::DeletePrivacy($delged);
AdminFunctions::DeleteGedcom($delged);
unset($GEDCOMS[$delged]);
AdminFunctions::StoreGedcoms();
GedcomConfig::DeleteGedcomConfig($delged);
if (isset($_SESSION["GEDCOMID"]) && $_SESSION["GEDCOMID"] == $delged) $_SESSION["GEDCOMID"] = $DEFAULT_GEDCOMID;
$message = str_replace("#GED#", $delged, GM_LANG_gedcom_deleted)."\n";
}
else $message = "<span class=\"Error\">".GM_LANG_gedcom_not_exist."</span>";
}
if (($action == "setdefault") && isset($default_ged)) {
$DEFAULT_GEDCOMID = $_POST["default_ged"];
AdminFunctions::StoreGedcoms();
}
if ($action == "deletecount") {
$sql = "DELETE FROM ".TBLPREFIX."counters WHERE c_id LIKE '%[".$GEDCOMS[$delged]["id"]."]%'";
$res = NewQuery($sql);
unset($_SESSION[$delged."gm_counter"]);
}
?>
<!-- Setup the left box -->
<div id="AdminColumnLeft">
<?php AdminFunctions::AdminLink("admin.php", GM_LANG_admin); ?>
<?php if ($gm_user->userIsAdmin()) { ?>
<?php AdminFunctions::AdminLink("editconfig_gedcom.php?source=add_form", GM_LANG_add_gedcom, "add_gedcom_help", "qm", "add_gedcom"); ?>
<?php AdminFunctions::AdminLink("editconfig_gedcom.php?source=upload_form", GM_LANG_upload_gedcom, "upload_gedcom_help", "qm", "upload_gedcom"); ?>
<?php AdminFunctions::AdminLink("editconfig_gedcom.php?source=add_new_form", GM_LANG_add_new_gedcom, "add_new_gedcom_help", "qm", "add_new_gedcom"); ?>
<?php AdminFunctions::AdminLink("uploadgedcom.php?action=merge_form", GM_LANG_merge_gedcom, "merge_gedcom_help", "qm", "merge_gedcom"); ?>
<?php } ?>
</div>
<!-- Setup the middle box -->
<div id="AdminColumnMiddle">
<form name="defaultform" method="post" action="editgedcoms.php">
<input type="hidden" name="action" value="setdefault" />
<table class="NavBlockTable AdminNavBlockTable">
<tr><td class="NavBlockHeader AdminNavBlockHeader" colspan="5">
<?php print "<span class=\"AdminNavBlockTitle\">".GM_LANG_current_gedcoms."</span>";
if (!empty($message)) print "<br />".$message;
?>
</td></tr>
<tr><td class="NavBlockLabel EditGedcomsAdminNavBlockLabel" colspan="5">
<?php
// Default gedcom choice
if (count($GEDCOMS)>0) {
if ($gm_user->userIsAdmin()) {
PrintHelpLink("default_gedcom_help", "qm");
print GM_LANG_DEFAULT_GEDCOM." ";
print "<select name=\"default_ged\" onchange=\"document.defaultform.submit();\">";
foreach($GEDCOMS as $gedc => $gedarray) {
if (empty($DEFAULT_GEDCOMID)) $DEFAULT_GEDCOM = $gedc;
print "<option value=\"".$gedc."\"";
if ($DEFAULT_GEDCOMID == $gedc) print " selected=\"selected\"";
print " onclick=\"document.defaultform.submit();\">";
print PrintReady($gedarray["title"])."</option>";
}
print "</select>";
}
}
?>
</td></tr>
<?php
$current_ged = GedcomConfig::$GEDCOMID;
$GedCount = 0;
// Print the table of available GEDCOMs
if (count($GEDCOMS)>0) {
foreach($GEDCOMS as $gedc=>$gedarray) {
if ($gm_user->userGedcomAdmin($gedc)) {
if (empty($DEFAULT_GEDCOMID)) $DEFAULT_GEDCOMID = $gedc;
// Row 0: Separator line
print "<tr>";
print "<td colspan=\"5\" class=\"NavBlockRowSpacer\"> ";
print "</td>";
print "</tr>";
$GedCount++;
// Row 1: Title
print "<tr>";
print "<td colspan=\"5\" class=\"NavBlockHeader\">";
if ($DEFAULT_GEDCOMID == $gedc) print PrintReady($gedarray["title"])."</td>";
else print PrintReady($gedarray["title"])."</td>";
print "</tr>";
// Row 2: Column headings
print "<tr>";
print "<td class=\"NavBlockColumnHeader AdminNavBlockColumnHeader\">".GM_LANG_id.": ".$gedarray["id"]."</td>";
print "<td class=\"NavBlockColumnHeader AdminNavBlockColumnHeader\">";
if (file_exists($gedarray["path"])) {
if ($TEXT_DIRECTION=="ltr") print $gedarray["path"]." (";
else print $gedarray["path"]." ‏(";
printf("%.2fKb", (filesize($gedarray["path"])/1024));
print ")";
$url = AdminFunctions::CheckGedcomDownloadable($gedarray["path"]);
if ($url!==false) {
print "<br /><span class=\"Error\">".GM_LANG_gedcom_downloadable." :</span>";
print "<br /><a href=\"$url\">$url</a>";
}
}
else print "<span class=\"Error\">".GM_LANG_file_not_found."</span>";
print "</td>";
print "<td class=\"NavBlockColumnHeader AdminNavBlockColumnHeader\">".GM_LANG_edit."</td>";
print "<td class=\"NavBlockColumnHeader AdminNavBlockColumnHeader\">".GM_LANG_view."</td>";
print "<td class=\"NavBlockColumnHeader AdminNavBlockColumnHeader\">".GM_LANG_delete."</td>";
print "</tr>";
// Row 3: Options
$imported = CheckForImport($gedc);
print "<tr>";
print "<td class=\"NavBlockLabel EditGedcomsAdminNavBlockLabel\"> </td>";
print "<td class=\"NavBlockLabel EditGedcomsAdminNavBlockLabel\">";
if (file_exists($gedarray["path"])) {
print "<a href=\"uploadgedcom.php?gedcomid=".$gedc."&verify=verify_gedcom&action=add_form&import_existing=1\">".GM_LANG_ged_import."</a>";
if (!$imported) {
print "<br /><span class=\"Error\">".GM_LANG_gedcom_not_imported."</span>";
}
}
else print " ";
print "</td>";
print "<td class=\"NavBlockLabel EditGedcomsAdminNavBlockLabel\"><a href=\"editconfig_gedcom.php?gedid=".$gedc."\">".GM_LANG_ged_config."</a></td>";
print "<td class=\"NavBlockLabel EditGedcomsAdminNavBlockLabel\"><a href=\"javascript: ".GM_LANG_view_searchlog."\" onclick=\"window.open('viewlog.php?cat=F&gedid=".$gedarray["id"]."', '', 'top=50,left=10,width=700,height=600,scrollbars=1,resizable=1'); return false;\">";
if (AdminFunctions::NewLogRecs("F", $gedc)) print "<span class=\"Error\">".GM_LANG_view_searchlog."</span>";
else print GM_LANG_view_searchlog;
print "</a></td>";
print "<td class=\"NavBlockLabel EditGedcomsAdminNavBlockLabel\"><a href=\"editgedcoms.php?action=delete&delged=".$gedc."\" onclick=\"return confirm('".GM_LANG_confirm_gedcom_delete." ".preg_replace("/'/", "\'", get_gedcom_from_id($gedc))."?');\">".GM_LANG_ged_gedcom."</a></td>";
print "</tr>";
// Row 4: Options
print "<tr>";
print "<td class=\"NavBlockLabel EditGedcomsAdminNavBlockLabel\"> </td>";
print "<td class=\"NavBlockLabel EditGedcomsAdminNavBlockLabel\">";
if ($imported) print "<a href=\"downloadgedcom.php?gedid=$gedc\">".GM_LANG_ged_download."</a>";
else print " ";
print "</td>";
print "<td class=\"NavBlockLabel EditGedcomsAdminNavBlockLabel\"><a href=\"edit_privacy.php?action=edit&gedid=".$gedc."\">".GM_LANG_ged_privacy."</a></td>";
print "<td class=\"NavBlockLabel EditGedcomsAdminNavBlockLabel\"><a href=\"javascript: ".GM_LANG_view_gedlog."\" onclick=\"window.open('viewlog.php?cat=G&gedid=".$gedarray["id"]."', '', 'top=50,left=10,width=700,height=600,scrollbars=1,resizable=1'); ChangeClass('gedlog".$GedCount."', ''); return false; \">";
if (AdminFunctions::NewLogRecs("G", $gedc)) print "<span id=\"gedlog".$GedCount."\" class=\"Error\">".GM_LANG_view_gedlog."</span>";
else print "<span id=\"gedlog".$GedCount."\">".GM_LANG_view_gedlog."</span>";
print "</a></td>";
print "<td class=\"NavBlockLabel EditGedcomsAdminNavBlockLabel\"><a href=\"editgedcoms.php?action=deletecount&delged=".$gedc."\" onclick=\"return confirm('".GM_LANG_confirm_count_delete." ".preg_replace("/'/", "\'", get_gedcom_from_id($gedc))."?');\">".GM_LANG_counters."</a></td>";
print "</tr>";
// Row 5: Options
print "<tr>";
print "<td class=\"NavBlockLabel EditGedcomsAdminNavBlockLabel\"> </td>";
print "<td class=\"NavBlockLabel EditGedcomsAdminNavBlockLabel\">";
print "<a href=\"editconfig_gedcom.php?source=reupload_form&gedid=$gedc\">".GM_LANG_ged_reupload."</a>";
print "</td>";
print "<td class=\"NavBlockLabel EditGedcomsAdminNavBlockLabel\"><a href=\"javascript: ".GM_LANG_submitter_record."\" onclick=\"window.open('edit_interface.php?action=submitter&gedfile=".$gedc."','','width=800,height=600,resizable=1,scrollbars=1'); return false;\">".GM_LANG_submitter_record."</a></td>";
print "<td class=\"NavBlockLabel EditGedcomsAdminNavBlockLabel\"> </td>";
print "<td class=\"NavBlockLabel EditGedcomsAdminNavBlockLabel\"> </td>";
print "</tr>";
}
}
}
if (isset($GEDCOMS[$current_ged])) SwitchGedcom($GEDCOMS[$current_ged]["gedcom"]);
print "</table></form>";
print "</div>";
PrintFooter();
?>