summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfisharebest <fisharebest@gmail.com>2011-02-21 18:21:31 +0000
committerfisharebest <fisharebest@gmail.com>2011-02-21 18:21:31 +0000
commitbfb659b3c14d514478b531cb4e1d66ad7647707b (patch)
tree7601dd3d441708009d1246ffcde5bba9dd5ae496
parent301d851d123036d091027e1ae17f9c0457e243b7 (diff)
downloadwebtrees-bfb659b3c14d514478b531cb4e1d66ad7647707b.tar.gz
webtrees-bfb659b3c14d514478b531cb4e1d66ad7647707b.tar.bz2
webtrees-bfb659b3c14d514478b531cb4e1d66ad7647707b.zip
Do not create a new gedcom with an empty name
-rw-r--r--admin_trees_manage.php30
1 files changed, 16 insertions, 14 deletions
diff --git a/admin_trees_manage.php b/admin_trees_manage.php
index 6de937978c..9872c2b19b 100644
--- a/admin_trees_manage.php
+++ b/admin_trees_manage.php
@@ -100,20 +100,22 @@ case 'add_ged':
exit;
case 'new_ged':
$ged_name=basename(safe_POST('ged_name'));
- $gedcom_id=get_id_from_gedcom($ged_name);
- // check it doesn't already exist before we create it
- if (!$gedcom_id) {
- $gedcom_id=get_id_from_gedcom($ged_name, true);
- // I18N: This should be a common/default/placeholder name of a person. Put slashes around the surname.
- $john_doe=WT_I18N::translate('John /DOE/');
- $note=WT_I18N::translate('Edit this individual and replace their details with your own');
- WT_DB::prepare("DELETE FROM `##gedcom_chunk` WHERE gedcom_id=?")->execute(array($gedcom_id));
- WT_DB::prepare(
- "INSERT INTO `##gedcom_chunk` (gedcom_id, chunk_data) VALUES (?, ?)"
- )->execute(array(
- $gedcom_id,
- "0 HEAD\n0 @I1@ INDI\n1 NAME {$john_doe}\n1 SEX M\n1 BIRT\n2 DATE 01 JAN 1850\n2 NOTE {$note}\n0 TRLR\n"
- ));
+ if ($ged_name) {
+ $gedcom_id=get_id_from_gedcom($ged_name);
+ // check it doesn't already exist before we create it
+ if (!$gedcom_id) {
+ $gedcom_id=get_id_from_gedcom($ged_name, true);
+ // I18N: This should be a common/default/placeholder name of a person. Put slashes around the surname.
+ $john_doe=WT_I18N::translate('John /DOE/');
+ $note=WT_I18N::translate('Edit this individual and replace their details with your own');
+ WT_DB::prepare("DELETE FROM `##gedcom_chunk` WHERE gedcom_id=?")->execute(array($gedcom_id));
+ WT_DB::prepare(
+ "INSERT INTO `##gedcom_chunk` (gedcom_id, chunk_data) VALUES (?, ?)"
+ )->execute(array(
+ $gedcom_id,
+ "0 HEAD\n0 @I1@ INDI\n1 NAME {$john_doe}\n1 SEX M\n1 BIRT\n2 DATE 01 JAN 1850\n2 NOTE {$note}\n0 TRLR\n"
+ ));
+ }
}
break;
case 'upload_ged':