diff --git a/conf/config.ini.php b/conf/config.ini.php
new file mode 100755
index 0000000..78c6d31
--- /dev/null
+++ b/conf/config.ini.php
@@ -0,0 +1,7 @@
+; DO NOT DELETE THIS LINE
+dbhost="localhost"
+dbport="3306"
+dbuser="__dbuser__"
+dbpass="__dbpass__"
+dbname="__dbname__"
+tblpfx="wt_"
diff --git a/conf/nginx.conf b/conf/nginx.conf
new file mode 100644
index 0000000..160240c
--- /dev/null
+++ b/conf/nginx.conf
@@ -0,0 +1,37 @@
+location YNH_WWW_PATH {
+
+ # Path to source
+ alias YNH_WWW_ALIAS ;
+
+ # Example PHP configuration (remove if not used)
+ index index.php;
+
+
+ if ($scheme = http) {
+ rewrite ^ https://$server_name$request_uri? permanent;
+ }
+ # Common parameter to increase upload size limit in conjuction with dedicated php-fpm file
+ #client_max_body_size 50M;
+
+ try_files $uri $uri/ index.php;
+ location ~ [^/]\.php(/|$) {
+ fastcgi_split_path_info ^(.+?\.php)(/.*)$;
+ fastcgi_pass unix:/var/run/php5-fpm.sock;
+
+ # Filename to be changed if dedicated php-fpm process is required
+ # This is to be used INSTEAD of line above
+ # Don't forget to adjust scripts install/upgrade/remove/backup accordingly
+ #
+ #fastcgi_pass unix:/var/run/php5-fpm-YNH_WWW_APP.sock;
+
+ fastcgi_index index.php;
+ include fastcgi_params;
+ fastcgi_param REMOTE_USER $remote_user;
+ fastcgi_param PATH_INFO $fastcgi_path_info;
+ fastcgi_param SCRIPT_FILENAME $request_filename;
+ }
+ # PHP configuration end
+
+ # Include SSOWAT user panel.
+ include conf.d/yunohost_panel.conf.inc;
+}
diff --git a/conf/sql/admin.sql b/conf/sql/admin.sql
new file mode 100644
index 0000000..127ed0c
--- /dev/null
+++ b/conf/sql/admin.sql
@@ -0,0 +1,3 @@
+INSERT INTO `wt_user` (`user_id`, `user_name`, `real_name`, `email`, `password`) VALUES (NULL, '__USER_NAME__', '__NAME__', '__USER_EMAIL__', '__PASSWORD__');
+INSERT INTO `wt_user_setting` (`user_id`, `setting_name`, `setting_value`) VALUES ('1', 'canadmin', '1'), ('1', 'verified', '1'), ('1', 'verified_by_admin', '1');
+
diff --git a/conf/sql/webtrees.sql b/conf/sql/webtrees.sql
new file mode 100644
index 0000000..07b2c33
--- /dev/null
+++ b/conf/sql/webtrees.sql
@@ -0,0 +1,1298 @@
+-- phpMyAdmin SQL Dump
+-- version 4.6.6
+-- https://www.phpmyadmin.net/
+--
+-- Host: localhost
+-- Generation Time: Jun 29, 2017 at 09:45 PM
+-- Server version: 10.0.30-MariaDB-0+deb8u2
+-- PHP Version: 5.6.30-0+deb8u1
+
+SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
+SET time_zone = "+00:00";
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8mb4 */;
+
+--
+-- Database: `my_webapp`
+--
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_block`
+--
+
+CREATE TABLE `wt_block` (
+ `block_id` int(11) NOT NULL,
+ `gedcom_id` int(11) DEFAULT NULL,
+ `user_id` int(11) DEFAULT NULL,
+ `xref` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `location` enum('main','side') COLLATE utf8_unicode_ci DEFAULT NULL,
+ `block_order` int(11) NOT NULL,
+ `module_name` varchar(32) COLLATE utf8_unicode_ci NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Dumping data for table `wt_block`
+--
+
+INSERT INTO `wt_block` (`block_id`, `gedcom_id`, `user_id`, `xref`, `location`, `block_order`, `module_name`) VALUES
+(1, NULL, -1, NULL, 'main', 1, 'todays_events'),
+(2, NULL, -1, NULL, 'main', 2, 'user_messages'),
+(3, NULL, -1, NULL, 'main', 3, 'user_favorites'),
+(4, NULL, -1, NULL, 'side', 1, 'user_welcome'),
+(5, NULL, -1, NULL, 'side', 2, 'random_media'),
+(6, NULL, -1, NULL, 'side', 3, 'upcoming_events'),
+(7, NULL, -1, NULL, 'side', 4, 'logged_in'),
+(8, -1, NULL, NULL, 'main', 1, 'gedcom_stats'),
+(9, -1, NULL, NULL, 'main', 2, 'gedcom_news'),
+(10, -1, NULL, NULL, 'main', 3, 'gedcom_favorites'),
+(11, -1, NULL, NULL, 'main', 4, 'review_changes'),
+(12, -1, NULL, NULL, 'side', 1, 'gedcom_block'),
+(13, -1, NULL, NULL, 'side', 2, 'random_media'),
+(14, -1, NULL, NULL, 'side', 3, 'todays_events'),
+(15, -1, NULL, NULL, 'side', 4, 'logged_in');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_block_setting`
+--
+
+CREATE TABLE `wt_block_setting` (
+ `block_id` int(11) NOT NULL,
+ `setting_name` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
+ `setting_value` longtext COLLATE utf8_unicode_ci NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_change`
+--
+
+CREATE TABLE `wt_change` (
+ `change_id` int(11) NOT NULL,
+ `change_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `status` enum('accepted','pending','rejected') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'pending',
+ `gedcom_id` int(11) NOT NULL,
+ `xref` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
+ `old_gedcom` longtext COLLATE utf8_unicode_ci NOT NULL,
+ `new_gedcom` longtext COLLATE utf8_unicode_ci NOT NULL,
+ `user_id` int(11) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_dates`
+--
+
+CREATE TABLE `wt_dates` (
+ `d_day` tinyint(4) NOT NULL,
+ `d_month` char(5) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `d_mon` tinyint(4) NOT NULL,
+ `d_year` smallint(6) NOT NULL,
+ `d_julianday1` mediumint(9) NOT NULL,
+ `d_julianday2` mediumint(9) NOT NULL,
+ `d_fact` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
+ `d_gid` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
+ `d_file` int(11) NOT NULL,
+ `d_type` enum('@#DGREGORIAN@','@#DJULIAN@','@#DHEBREW@','@#DFRENCH R@','@#DHIJRI@','@#DROMAN@','@#DJALALI@') COLLATE utf8_unicode_ci DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_default_resn`
+--
+
+CREATE TABLE `wt_default_resn` (
+ `default_resn_id` int(11) NOT NULL,
+ `gedcom_id` int(11) NOT NULL,
+ `xref` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `tag_type` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `resn` enum('none','privacy','confidential','hidden') COLLATE utf8_unicode_ci NOT NULL,
+ `comment` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Dumping data for table `wt_default_resn`
+--
+
+INSERT INTO `wt_default_resn` (`default_resn_id`, `gedcom_id`, `xref`, `tag_type`, `resn`, `comment`, `updated`) VALUES
+(1, -1, NULL, 'SSN', 'confidential', NULL, '2017-06-29 18:43:22'),
+(2, -1, NULL, 'SOUR', 'privacy', NULL, '2017-06-29 18:43:22'),
+(3, -1, NULL, 'REPO', 'privacy', NULL, '2017-06-29 18:43:22'),
+(4, -1, NULL, 'SUBM', 'confidential', NULL, '2017-06-29 18:43:22'),
+(5, -1, NULL, 'SUBN', 'confidential', NULL, '2017-06-29 18:43:22');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_families`
+--
+
+CREATE TABLE `wt_families` (
+ `f_id` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
+ `f_file` int(11) NOT NULL,
+ `f_husb` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `f_wife` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `f_gedcom` longtext COLLATE utf8_unicode_ci NOT NULL,
+ `f_numchil` int(11) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_favorite`
+--
+
+CREATE TABLE `wt_favorite` (
+ `favorite_id` int(11) NOT NULL,
+ `user_id` int(11) DEFAULT NULL,
+ `gedcom_id` int(11) NOT NULL,
+ `xref` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `favorite_type` enum('INDI','FAM','SOUR','REPO','OBJE','NOTE','URL') COLLATE utf8_unicode_ci NOT NULL,
+ `url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `title` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `note` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_gedcom`
+--
+
+CREATE TABLE `wt_gedcom` (
+ `gedcom_id` int(11) NOT NULL,
+ `gedcom_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+ `sort_order` int(11) NOT NULL DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Dumping data for table `wt_gedcom`
+--
+
+INSERT INTO `wt_gedcom` (`gedcom_id`, `gedcom_name`, `sort_order`) VALUES
+(-1, 'DEFAULT_TREE', 0);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_gedcom_chunk`
+--
+
+CREATE TABLE `wt_gedcom_chunk` (
+ `gedcom_chunk_id` int(11) NOT NULL,
+ `gedcom_id` int(11) NOT NULL,
+ `chunk_data` longblob NOT NULL,
+ `imported` tinyint(1) NOT NULL DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_gedcom_setting`
+--
+
+CREATE TABLE `wt_gedcom_setting` (
+ `gedcom_id` int(11) NOT NULL,
+ `setting_name` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
+ `setting_value` varchar(255) COLLATE utf8_unicode_ci NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Dumping data for table `wt_gedcom_setting`
+--
+
+INSERT INTO `wt_gedcom_setting` (`gedcom_id`, `setting_name`, `setting_value`) VALUES
+(-1, 'ADVANCED_NAME_FACTS', 'NICK,_AKA'),
+(-1, 'ADVANCED_PLAC_FACTS', ''),
+(-1, 'ALLOW_THEME_DROPDOWN', '1'),
+(-1, 'CALENDAR_FORMAT', 'gregorian'),
+(-1, 'CHART_BOX_TAGS', ''),
+(-1, 'DEFAULT_PEDIGREE_GENERATIONS', '4'),
+(-1, 'EXPAND_RELATIVES_EVENTS', '0'),
+(-1, 'EXPAND_SOURCES', '0'),
+(-1, 'FAM_FACTS_ADD', 'CENS,MARR,RESI,SLGS,MARR_CIVIL,MARR_RELIGIOUS,MARR_PARTNERS,RESN'),
+(-1, 'FAM_FACTS_QUICK', 'MARR,DIV,_NMR'),
+(-1, 'FAM_FACTS_UNIQUE', 'NCHI,MARL,DIV,ANUL,DIVF,ENGA,MARB,MARC,MARS,_NMR'),
+(-1, 'FAM_ID_PREFIX', 'F'),
+(-1, 'FORMAT_TEXT', 'markdown'),
+(-1, 'FULL_SOURCES', '0'),
+(-1, 'GEDCOM_ID_PREFIX', 'I'),
+(-1, 'GEDCOM_MEDIA_PATH', ''),
+(-1, 'GENERATE_UIDS', '0'),
+(-1, 'HIDE_GEDCOM_ERRORS', '1'),
+(-1, 'HIDE_LIVE_PEOPLE', '1'),
+(-1, 'INDI_FACTS_ADD', 'AFN,BIRT,DEAT,BURI,CREM,ADOP,BAPM,BARM,BASM,BLES,CHRA,CONF,FCOM,ORDN,NATU,EMIG,IMMI,CENS,PROB,WILL,GRAD,RETI,DSCR,EDUC,IDNO,NATI,NCHI,NMR,OCCU,PROP,RELI,RESI,SSN,TITL,BAPL,CONL,ENDL,SLGC,_MILI,ASSO,RESN'),
+(-1, 'INDI_FACTS_QUICK', 'BIRT,BURI,BAPM,CENS,DEAT,OCCU,RESI'),
+(-1, 'INDI_FACTS_UNIQUE', ''),
+(-1, 'KEEP_ALIVE_YEARS_BIRTH', ''),
+(-1, 'KEEP_ALIVE_YEARS_DEATH', ''),
+(-1, 'LANGUAGE', 'en-US'),
+(-1, 'MAX_ALIVE_AGE', '120'),
+(-1, 'MAX_DESCENDANCY_GENERATIONS', '15'),
+(-1, 'MAX_PEDIGREE_GENERATIONS', '10'),
+(-1, 'MEDIA_DIRECTORY', 'media/'),
+(-1, 'MEDIA_ID_PREFIX', 'M'),
+(-1, 'MEDIA_UPLOAD', '1'),
+(-1, 'META_DESCRIPTION', ''),
+(-1, 'META_TITLE', 'webtrees'),
+(-1, 'NO_UPDATE_CHAN', '0'),
+(-1, 'NOTE_FACTS_ADD', 'SOUR,RESN'),
+(-1, 'NOTE_FACTS_QUICK', ''),
+(-1, 'NOTE_FACTS_UNIQUE', ''),
+(-1, 'NOTE_ID_PREFIX', 'N'),
+(-1, 'PEDIGREE_FULL_DETAILS', '1'),
+(-1, 'PEDIGREE_LAYOUT', '1'),
+(-1, 'PEDIGREE_ROOT_ID', ''),
+(-1, 'PEDIGREE_SHOW_GENDER', '0'),
+(-1, 'PREFER_LEVEL2_SOURCES', '1'),
+(-1, 'QUICK_REQUIRED_FACTS', 'BIRT,DEAT'),
+(-1, 'QUICK_REQUIRED_FAMFACTS', 'MARR'),
+(-1, 'REPO_FACTS_ADD', 'PHON,EMAIL,FAX,WWW,RESN'),
+(-1, 'REPO_FACTS_QUICK', ''),
+(-1, 'REPO_FACTS_UNIQUE', 'NAME,ADDR'),
+(-1, 'REPO_ID_PREFIX', 'R'),
+(-1, 'REQUIRE_AUTHENTICATION', '0'),
+(-1, 'SAVE_WATERMARK_IMAGE', '0'),
+(-1, 'SAVE_WATERMARK_THUMB', '0'),
+(-1, 'SHOW_AGE_DIFF', '0'),
+(-1, 'SHOW_COUNTER', '1'),
+(-1, 'SHOW_DEAD_PEOPLE', '2'),
+(-1, 'SHOW_EST_LIST_DATES', '0'),
+(-1, 'SHOW_FACT_ICONS', '1'),
+(-1, 'SHOW_GEDCOM_RECORD', '0'),
+(-1, 'SHOW_HIGHLIGHT_IMAGES', '1'),
+(-1, 'SHOW_LDS_AT_GLANCE', '0'),
+(-1, 'SHOW_LEVEL2_NOTES', '1'),
+(-1, 'SHOW_LIVING_NAMES', '1'),
+(-1, 'SHOW_MEDIA_DOWNLOAD', '0'),
+(-1, 'SHOW_NO_WATERMARK', '1'),
+(-1, 'SHOW_PARENTS_AGE', '1'),
+(-1, 'SHOW_PEDIGREE_PLACES', '9'),
+(-1, 'SHOW_PEDIGREE_PLACES_SUFFIX', '0'),
+(-1, 'SHOW_PRIVATE_RELATIONSHIPS', '1'),
+(-1, 'SHOW_RELATIVES_EVENTS', '_BIRT_CHIL,_BIRT_SIBL,_MARR_CHIL,_MARR_PARE,_DEAT_CHIL,_DEAT_PARE,_DEAT_GPAR,_DEAT_SIBL,_DEAT_SPOU'),
+(-1, 'SOUR_FACTS_ADD', 'NOTE,REPO,SHARED_NOTE,RESN'),
+(-1, 'SOUR_FACTS_QUICK', 'TEXT,NOTE,REPO'),
+(-1, 'SOUR_FACTS_UNIQUE', 'AUTH,ABBR,TITL,PUBL,TEXT'),
+(-1, 'SOURCE_ID_PREFIX', 'S'),
+(-1, 'SUBLIST_TRIGGER_I', '200'),
+(-1, 'SURNAME_LIST_STYLE', 'style2'),
+(-1, 'SURNAME_TRADITION', 'paternal'),
+(-1, 'THUMBNAIL_WIDTH', '100'),
+(-1, 'USE_RIN', '0'),
+(-1, 'USE_SILHOUETTE', '1'),
+(-1, 'WATERMARK_THUMB', '0'),
+(-1, 'WEBTREES_EMAIL', 'webtrees-noreply@datamol.tk'),
+(-1, 'WORD_WRAPPED_NOTES', '0');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_hit_counter`
+--
+
+CREATE TABLE `wt_hit_counter` (
+ `gedcom_id` int(11) NOT NULL,
+ `page_name` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
+ `page_parameter` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
+ `page_count` int(11) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_individuals`
+--
+
+CREATE TABLE `wt_individuals` (
+ `i_id` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
+ `i_file` int(11) NOT NULL,
+ `i_rin` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
+ `i_sex` enum('U','M','F') COLLATE utf8_unicode_ci NOT NULL,
+ `i_gedcom` longtext COLLATE utf8_unicode_ci NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_link`
+--
+
+CREATE TABLE `wt_link` (
+ `l_file` int(11) NOT NULL,
+ `l_from` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
+ `l_type` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
+ `l_to` varchar(20) COLLATE utf8_unicode_ci NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_log`
+--
+
+CREATE TABLE `wt_log` (
+ `log_id` int(11) NOT NULL,
+ `log_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `log_type` enum('auth','config','debug','edit','error','media','search') COLLATE utf8_unicode_ci NOT NULL,
+ `log_message` longtext COLLATE utf8_unicode_ci NOT NULL,
+ `ip_address` varchar(45) COLLATE utf8_unicode_ci NOT NULL,
+ `user_id` int(11) DEFAULT NULL,
+ `gedcom_id` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Dumping data for table `wt_log`
+--
+
+INSERT INTO `wt_log` (`log_id`, `log_time`, `log_type`, `log_message`, `ip_address`, `user_id`, `gedcom_id`) VALUES
+(1, '2017-06-29 18:43:18', 'config', 'Site preference \"INDEX_DIRECTORY\" set to \"data/\"', '182.77.62.2', NULL, NULL),
+(2, '2017-06-29 18:43:18', 'config', 'Site preference \"USE_REGISTRATION_MODULE\" set to \"1\"', '182.77.62.2', NULL, NULL),
+(3, '2017-06-29 18:43:18', 'config', 'Site preference \"ALLOW_USER_THEMES\" set to \"1\"', '182.77.62.2', NULL, NULL),
+(4, '2017-06-29 18:43:18', 'config', 'Site preference \"ALLOW_CHANGE_GEDCOM\" set to \"1\"', '182.77.62.2', NULL, NULL),
+(5, '2017-06-29 18:43:18', 'config', 'Site preference \"SESSION_TIME\" set to \"7200\"', '182.77.62.2', NULL, NULL),
+(6, '2017-06-29 18:43:18', 'config', 'Site preference \"SMTP_ACTIVE\" set to \"internal\"', '182.77.62.2', NULL, NULL),
+(7, '2017-06-29 18:43:18', 'config', 'Site preference \"SMTP_HOST\" set to \"localhost\"', '182.77.62.2', NULL, NULL),
+(8, '2017-06-29 18:43:18', 'config', 'Site preference \"SMTP_PORT\" set to \"25\"', '182.77.62.2', NULL, NULL),
+(9, '2017-06-29 18:43:18', 'config', 'Site preference \"SMTP_AUTH\" set to \"1\"', '182.77.62.2', NULL, NULL),
+(10, '2017-06-29 18:43:18', 'config', 'Site preference \"SMTP_SSL\" set to \"none\"', '182.77.62.2', NULL, NULL),
+(11, '2017-06-29 18:43:18', 'config', 'Site preference \"SMTP_HELO\" set to \"datamol.tk\"', '182.77.62.2', NULL, NULL),
+(12, '2017-06-29 18:43:18', 'config', 'Site preference \"SMTP_FROM_NAME\" set to \"datamol.tk\"', '182.77.62.2', NULL, NULL),
+(13, '2017-06-29 18:43:18', 'config', 'Site preference \"FV_SCHEMA_VERSION\" set to \"1\"', '182.77.62.2', NULL, NULL),
+(14, '2017-06-29 18:43:19', 'config', 'Site preference \"FV_SCHEMA_VERSION\" set to \"2\"', '182.77.62.2', NULL, NULL),
+(15, '2017-06-29 18:43:19', 'config', 'Site preference \"FV_SCHEMA_VERSION\" set to \"3\"', '182.77.62.2', NULL, NULL),
+(16, '2017-06-29 18:43:19', 'config', 'Site preference \"FV_SCHEMA_VERSION\" set to \"4\"', '182.77.62.2', NULL, NULL),
+(17, '2017-06-29 18:43:19', 'config', 'Site preference \"NB_SCHEMA_VERSION\" set to \"1\"', '182.77.62.2', NULL, NULL),
+(18, '2017-06-29 18:43:19', 'config', 'Site preference \"NB_SCHEMA_VERSION\" set to \"2\"', '182.77.62.2', NULL, NULL),
+(19, '2017-06-29 18:43:20', 'config', 'Site preference \"NB_SCHEMA_VERSION\" set to \"3\"', '182.77.62.2', NULL, NULL),
+(20, '2017-06-29 18:43:20', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"1\"', '182.77.62.2', NULL, NULL),
+(21, '2017-06-29 18:43:20', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"2\"', '182.77.62.2', NULL, NULL),
+(22, '2017-06-29 18:43:20', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"3\"', '182.77.62.2', NULL, NULL),
+(23, '2017-06-29 18:43:20', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"4\"', '182.77.62.2', NULL, NULL),
+(24, '2017-06-29 18:43:20', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"5\"', '182.77.62.2', NULL, NULL),
+(25, '2017-06-29 18:43:20', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"6\"', '182.77.62.2', NULL, NULL),
+(26, '2017-06-29 18:43:20', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"7\"', '182.77.62.2', NULL, NULL),
+(27, '2017-06-29 18:43:20', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"8\"', '182.77.62.2', NULL, NULL),
+(28, '2017-06-29 18:43:21', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"9\"', '182.77.62.2', NULL, NULL),
+(29, '2017-06-29 18:43:21', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"10\"', '182.77.62.2', NULL, NULL),
+(30, '2017-06-29 18:43:21', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"11\"', '182.77.62.2', NULL, NULL),
+(31, '2017-06-29 18:43:21', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"12\"', '182.77.62.2', NULL, NULL),
+(32, '2017-06-29 18:43:21', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"13\"', '182.77.62.2', NULL, NULL),
+(33, '2017-06-29 18:43:21', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"14\"', '182.77.62.2', NULL, NULL),
+(34, '2017-06-29 18:43:21', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"15\"', '182.77.62.2', NULL, NULL),
+(35, '2017-06-29 18:43:21', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"16\"', '182.77.62.2', NULL, NULL),
+(36, '2017-06-29 18:43:21', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"17\"', '182.77.62.2', NULL, NULL),
+(37, '2017-06-29 18:43:21', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"18\"', '182.77.62.2', NULL, NULL),
+(38, '2017-06-29 18:43:21', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"19\"', '182.77.62.2', NULL, NULL),
+(39, '2017-06-29 18:43:21', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"20\"', '182.77.62.2', NULL, NULL),
+(40, '2017-06-29 18:43:21', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"21\"', '182.77.62.2', NULL, NULL),
+(41, '2017-06-29 18:43:21', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"22\"', '182.77.62.2', NULL, NULL),
+(42, '2017-06-29 18:43:21', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"23\"', '182.77.62.2', NULL, NULL),
+(43, '2017-06-29 18:43:22', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"24\"', '182.77.62.2', NULL, NULL),
+(44, '2017-06-29 18:43:22', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"25\"', '182.77.62.2', NULL, NULL),
+(45, '2017-06-29 18:43:22', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"26\"', '182.77.62.2', NULL, NULL),
+(46, '2017-06-29 18:43:22', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"27\"', '182.77.62.2', NULL, NULL),
+(47, '2017-06-29 18:43:22', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"28\"', '182.77.62.2', NULL, NULL),
+(48, '2017-06-29 18:43:22', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"29\"', '182.77.62.2', NULL, NULL),
+(49, '2017-06-29 18:43:22', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"30\"', '182.77.62.2', NULL, NULL),
+(50, '2017-06-29 18:43:22', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"31\"', '182.77.62.2', NULL, NULL),
+(51, '2017-06-29 18:43:22', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"32\"', '182.77.62.2', NULL, NULL),
+(52, '2017-06-29 18:43:22', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"33\"', '182.77.62.2', NULL, NULL),
+(53, '2017-06-29 18:43:22', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"34\"', '182.77.62.2', NULL, NULL),
+(54, '2017-06-29 18:43:23', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"35\"', '182.77.62.2', NULL, NULL),
+(55, '2017-06-29 18:43:26', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"36\"', '182.77.62.2', NULL, NULL),
+(56, '2017-06-29 18:43:27', 'config', 'Site preference \"WT_SCHEMA_VERSION\" set to \"37\"', '182.77.62.2', NULL, NULL);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_media`
+--
+
+CREATE TABLE `wt_media` (
+ `m_id` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
+ `m_ext` varchar(6) COLLATE utf8_unicode_ci NOT NULL,
+ `m_type` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
+ `m_titl` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+ `m_filename` varchar(512) COLLATE utf8_unicode_ci NOT NULL,
+ `m_file` int(11) NOT NULL,
+ `m_gedcom` longtext COLLATE utf8_unicode_ci NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_message`
+--
+
+CREATE TABLE `wt_message` (
+ `message_id` int(11) NOT NULL,
+ `sender` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
+ `ip_address` varchar(45) COLLATE utf8_unicode_ci NOT NULL,
+ `user_id` int(11) NOT NULL,
+ `subject` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+ `body` longtext COLLATE utf8_unicode_ci NOT NULL,
+ `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_module`
+--
+
+CREATE TABLE `wt_module` (
+ `module_name` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
+ `status` enum('enabled','disabled') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'enabled',
+ `tab_order` int(11) DEFAULT NULL,
+ `menu_order` int(11) DEFAULT NULL,
+ `sidebar_order` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Dumping data for table `wt_module`
+--
+
+INSERT INTO `wt_module` (`module_name`, `status`, `tab_order`, `menu_order`, `sidebar_order`) VALUES
+('ahnentafel_report', 'enabled', NULL, NULL, NULL),
+('ancestors_chart', 'enabled', NULL, NULL, NULL),
+('batch_update', 'enabled', NULL, NULL, NULL),
+('bdm_report', 'enabled', NULL, NULL, NULL),
+('birth_report', 'enabled', NULL, NULL, NULL),
+('cemetery_report', 'enabled', NULL, NULL, NULL),
+('change_report', 'enabled', NULL, NULL, NULL),
+('charts', 'enabled', NULL, NULL, NULL),
+('ckeditor', 'enabled', NULL, NULL, NULL),
+('clippings', 'enabled', NULL, 20, 60),
+('compact_tree_chart', 'enabled', NULL, NULL, NULL),
+('death_report', 'enabled', NULL, NULL, NULL),
+('descendancy', 'enabled', NULL, NULL, 30),
+('descendancy_chart', 'enabled', NULL, NULL, NULL),
+('descendancy_report', 'enabled', NULL, NULL, NULL),
+('extra_info', 'enabled', NULL, NULL, 10),
+('fact_sources', 'enabled', NULL, NULL, NULL),
+('families', 'enabled', NULL, NULL, 50),
+('family_book_chart', 'enabled', NULL, NULL, NULL),
+('family_group_report', 'enabled', NULL, NULL, NULL),
+('family_nav', 'enabled', NULL, NULL, 20),
+('fan_chart', 'enabled', NULL, NULL, NULL),
+('faq', 'enabled', NULL, 40, NULL),
+('gedcom_block', 'enabled', NULL, NULL, NULL),
+('gedcom_favorites', 'enabled', NULL, NULL, NULL),
+('gedcom_news', 'enabled', NULL, NULL, NULL),
+('gedcom_stats', 'enabled', NULL, NULL, NULL),
+('GEDFact_assistant', 'enabled', NULL, NULL, NULL),
+('googlemap', 'enabled', 80, NULL, NULL),
+('hourglass_chart', 'enabled', NULL, NULL, NULL),
+('html', 'enabled', NULL, NULL, NULL),
+('individual_ext_report', 'enabled', NULL, NULL, NULL),
+('individual_report', 'enabled', NULL, NULL, NULL),
+('individuals', 'enabled', NULL, NULL, 40),
+('lifespans_chart', 'enabled', NULL, NULL, NULL),
+('lightbox', 'enabled', 60, NULL, NULL),
+('logged_in', 'enabled', NULL, NULL, NULL),
+('login_block', 'enabled', NULL, NULL, NULL),
+('marriage_report', 'enabled', NULL, NULL, NULL),
+('media', 'enabled', 50, NULL, NULL),
+('missing_facts_report', 'enabled', NULL, NULL, NULL),
+('notes', 'enabled', 40, NULL, NULL),
+('occupation_report', 'enabled', NULL, NULL, NULL),
+('page_menu', 'enabled', NULL, 10, NULL),
+('pedigree_chart', 'enabled', NULL, NULL, NULL),
+('pedigree_report', 'enabled', NULL, NULL, NULL),
+('personal_facts', 'enabled', 10, NULL, NULL),
+('random_media', 'enabled', NULL, NULL, NULL),
+('recent_changes', 'enabled', NULL, NULL, NULL),
+('relationships_chart', 'enabled', NULL, NULL, NULL),
+('relative_ext_report', 'enabled', NULL, NULL, NULL),
+('relatives', 'enabled', 20, NULL, NULL),
+('review_changes', 'enabled', NULL, NULL, NULL),
+('sitemap', 'enabled', NULL, NULL, NULL),
+('sources_tab', 'enabled', 30, NULL, NULL),
+('statistics_chart', 'enabled', NULL, NULL, NULL),
+('stories', 'enabled', 55, 30, NULL),
+('theme_select', 'enabled', NULL, NULL, NULL),
+('timeline_chart', 'enabled', NULL, NULL, NULL),
+('todays_events', 'enabled', NULL, NULL, NULL),
+('todo', 'enabled', NULL, NULL, NULL),
+('top10_givnnames', 'enabled', NULL, NULL, NULL),
+('top10_pageviews', 'enabled', NULL, NULL, NULL),
+('top10_surnames', 'enabled', NULL, NULL, NULL),
+('tree', 'enabled', 68, NULL, NULL),
+('upcoming_events', 'enabled', NULL, NULL, NULL),
+('user_blog', 'enabled', NULL, NULL, NULL),
+('user_favorites', 'enabled', NULL, NULL, NULL),
+('user_messages', 'enabled', NULL, NULL, NULL),
+('user_welcome', 'enabled', NULL, NULL, NULL),
+('yahrzeit', 'enabled', NULL, NULL, NULL);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_module_privacy`
+--
+
+CREATE TABLE `wt_module_privacy` (
+ `module_name` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
+ `gedcom_id` int(11) NOT NULL,
+ `component` enum('block','chart','menu','report','sidebar','tab','theme') COLLATE utf8_unicode_ci NOT NULL,
+ `access_level` tinyint(4) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Dumping data for table `wt_module_privacy`
+--
+
+INSERT INTO `wt_module_privacy` (`module_name`, `gedcom_id`, `component`, `access_level`) VALUES
+('ahnentafel_report', -1, 'report', 2),
+('ancestors_chart', -1, 'chart', 2),
+('bdm_report', -1, 'report', 2),
+('birth_report', -1, 'report', 2),
+('cemetery_report', -1, 'report', 2),
+('change_report', -1, 'report', 1),
+('charts', -1, 'block', 2),
+('clippings', -1, 'menu', 1),
+('clippings', -1, 'sidebar', 1),
+('compact_tree_chart', -1, 'chart', 2),
+('death_report', -1, 'report', 2),
+('descendancy', -1, 'sidebar', 2),
+('descendancy_chart', -1, 'chart', 2),
+('descendancy_report', -1, 'report', 2),
+('extra_info', -1, 'sidebar', 2),
+('fact_sources', -1, 'report', 1),
+('families', -1, 'sidebar', 2),
+('family_book_chart', -1, 'chart', 2),
+('family_group_report', -1, 'report', 2),
+('family_nav', -1, 'sidebar', 2),
+('fan_chart', -1, 'chart', 2),
+('faq', -1, 'menu', 2),
+('gedcom_block', -1, 'block', 2),
+('gedcom_favorites', -1, 'block', 2),
+('gedcom_news', -1, 'block', 2),
+('gedcom_stats', -1, 'block', 2),
+('googlemap', -1, 'chart', 2),
+('googlemap', -1, 'tab', 2),
+('hourglass_chart', -1, 'chart', 2),
+('html', -1, 'block', 2),
+('individual_ext_report', -1, 'report', 1),
+('individual_report', -1, 'report', 2),
+('individuals', -1, 'sidebar', 2),
+('lifespans_chart', -1, 'chart', 2),
+('lightbox', -1, 'tab', 2),
+('logged_in', -1, 'block', 2),
+('login_block', -1, 'block', 2),
+('marriage_report', -1, 'report', 2),
+('media', -1, 'tab', 2),
+('missing_facts_report', -1, 'report', 1),
+('notes', -1, 'tab', 2),
+('occupation_report', -1, 'report', 1),
+('page_menu', -1, 'menu', 2),
+('pedigree_chart', -1, 'chart', 2),
+('pedigree_report', -1, 'report', 2),
+('personal_facts', -1, 'tab', 2),
+('random_media', -1, 'block', 2),
+('recent_changes', -1, 'block', 2),
+('relationships_chart', -1, 'chart', 2),
+('relative_ext_report', -1, 'report', 2),
+('relatives', -1, 'tab', 2),
+('review_changes', -1, 'block', 2),
+('sources_tab', -1, 'tab', 2),
+('statistics_chart', -1, 'chart', 2),
+('stories', -1, 'menu', -1),
+('stories', -1, 'tab', -1),
+('theme_select', -1, 'block', 2),
+('timeline_chart', -1, 'chart', 2),
+('todays_events', -1, 'block', 2),
+('todo', -1, 'block', 2),
+('top10_givnnames', -1, 'block', 2),
+('top10_pageviews', -1, 'block', 2),
+('top10_surnames', -1, 'block', 2),
+('tree', -1, 'chart', 2),
+('tree', -1, 'tab', 2),
+('upcoming_events', -1, 'block', 2),
+('user_blog', -1, 'block', 2),
+('user_favorites', -1, 'block', 2),
+('user_messages', -1, 'block', 2),
+('user_welcome', -1, 'block', 2),
+('yahrzeit', -1, 'block', 2);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_module_setting`
+--
+
+CREATE TABLE `wt_module_setting` (
+ `module_name` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
+ `setting_name` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
+ `setting_value` longtext COLLATE utf8_unicode_ci NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_name`
+--
+
+CREATE TABLE `wt_name` (
+ `n_file` int(11) NOT NULL,
+ `n_id` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
+ `n_num` int(11) NOT NULL,
+ `n_type` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
+ `n_sort` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+ `n_full` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+ `n_surname` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `n_surn` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `n_givn` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `n_soundex_givn_std` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `n_soundex_surn_std` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `n_soundex_givn_dm` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `n_soundex_surn_dm` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_news`
+--
+
+CREATE TABLE `wt_news` (
+ `news_id` int(11) NOT NULL,
+ `user_id` int(11) DEFAULT NULL,
+ `gedcom_id` int(11) DEFAULT NULL,
+ `subject` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `body` longtext COLLATE utf8_unicode_ci NOT NULL,
+ `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_next_id`
+--
+
+CREATE TABLE `wt_next_id` (
+ `gedcom_id` int(11) NOT NULL,
+ `record_type` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
+ `next_id` decimal(20,0) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_other`
+--
+
+CREATE TABLE `wt_other` (
+ `o_id` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
+ `o_file` int(11) NOT NULL,
+ `o_type` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
+ `o_gedcom` longtext COLLATE utf8_unicode_ci NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_placelinks`
+--
+
+CREATE TABLE `wt_placelinks` (
+ `pl_p_id` int(11) NOT NULL,
+ `pl_gid` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
+ `pl_file` int(11) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_places`
+--
+
+CREATE TABLE `wt_places` (
+ `p_id` int(11) NOT NULL,
+ `p_place` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `p_parent_id` int(11) DEFAULT NULL,
+ `p_file` int(11) NOT NULL,
+ `p_std_soundex` longtext COLLATE utf8_unicode_ci NOT NULL,
+ `p_dm_soundex` longtext COLLATE utf8_unicode_ci NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_session`
+--
+
+CREATE TABLE `wt_session` (
+ `session_id` char(128) COLLATE utf8_unicode_ci NOT NULL,
+ `session_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `user_id` int(11) NOT NULL,
+ `ip_address` varchar(45) COLLATE utf8_unicode_ci NOT NULL,
+ `session_data` longblob NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Dumping data for table `wt_session`
+--
+
+INSERT INTO `wt_session` (`session_id`, `session_time`, `user_id`, `ip_address`, `session_data`) VALUES
+('4bghb87q5rahrona5cvb5pj6o3', '2017-06-29 18:43:00', 0, '182.77.62.2', 0x696e697469617465647c623a313b6c6f63616c657c733a353a22656e2d5553223b61637469766974795f74696d657c693a313439383736313830383b7468656d655f69647c733a383a227765627472656573223b435352465f544f4b454e7c733a33323a224e4d4353736b536a496a6b674a664f6972505759687748316972746d5644716f223b);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_site_access_rule`
+--
+
+CREATE TABLE `wt_site_access_rule` (
+ `site_access_rule_id` int(11) NOT NULL,
+ `ip_address_start` int(10) UNSIGNED NOT NULL DEFAULT '0',
+ `ip_address_end` int(10) UNSIGNED NOT NULL DEFAULT '4294967295',
+ `user_agent_pattern` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+ `rule` enum('allow','deny','robot','unknown') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'unknown',
+ `comment` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+ `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Dumping data for table `wt_site_access_rule`
+--
+
+INSERT INTO `wt_site_access_rule` (`site_access_rule_id`, `ip_address_start`, `ip_address_end`, `user_agent_pattern`, `rule`, `comment`, `updated`) VALUES
+(1, 0, 4294967295, 'Mozilla/5.0 (%) Gecko/% %/%', 'allow', 'Gecko-based browsers', '2017-06-29 18:43:21'),
+(2, 0, 4294967295, 'Mozilla/5.0 (%) AppleWebKit/% (KHTML, like Gecko)%', 'allow', 'WebKit-based browsers', '2017-06-29 18:43:21'),
+(3, 0, 4294967295, 'Opera/% (%) Presto/% Version/%', 'allow', 'Presto-based browsers', '2017-06-29 18:43:21'),
+(4, 0, 4294967295, 'Mozilla/% (compatible; MSIE %', 'allow', 'Trident-based browsers', '2017-06-29 18:43:21'),
+(5, 0, 4294967295, 'Mozilla/5.0 (% Konqueror/%', 'allow', 'Konqueror browser', '2017-06-29 18:43:22'),
+(6, 0, 4294967295, 'Mozilla/% (Windows%; Trident%; rv:%) like Gecko', 'allow', 'Modern Internet Explorer', '2017-06-29 18:43:22'),
+(7, 0, 4294967295, 'Mozilla/5.0 (Mobile; Windows Phone 8.1; % Microsoft; %', 'allow', 'Windows Phone 8.1', '2017-06-29 18:43:22');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_site_setting`
+--
+
+CREATE TABLE `wt_site_setting` (
+ `setting_name` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
+ `setting_value` varchar(2000) COLLATE utf8_unicode_ci NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Dumping data for table `wt_site_setting`
+--
+
+INSERT INTO `wt_site_setting` (`setting_name`, `setting_value`) VALUES
+('ALLOW_CHANGE_GEDCOM', '1'),
+('ALLOW_USER_THEMES', '1'),
+('FV_SCHEMA_VERSION', '4'),
+('INDEX_DIRECTORY', 'data/'),
+('NB_SCHEMA_VERSION', '3'),
+('SESSION_TIME', '7200'),
+('SMTP_ACTIVE', 'internal'),
+('SMTP_AUTH', '1'),
+('SMTP_FROM_NAME', 'datamol.tk'),
+('SMTP_HELO', 'datamol.tk'),
+('SMTP_HOST', 'localhost'),
+('SMTP_PORT', '25'),
+('SMTP_SSL', 'none'),
+('USE_REGISTRATION_MODULE', '1'),
+('WT_SCHEMA_VERSION', '37');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_sources`
+--
+
+CREATE TABLE `wt_sources` (
+ `s_id` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
+ `s_file` int(11) NOT NULL,
+ `s_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+ `s_gedcom` longtext COLLATE utf8_unicode_ci NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_user`
+--
+
+CREATE TABLE `wt_user` (
+ `user_id` int(11) NOT NULL,
+ `user_name` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
+ `real_name` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
+ `email` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
+ `password` varchar(128) COLLATE utf8_unicode_ci NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Dumping data for table `wt_user`
+--
+
+INSERT INTO `wt_user` (`user_id`, `user_name`, `real_name`, `email`, `password`) VALUES
+(-1, 'DEFAULT_USER', 'DEFAULT_USER', 'DEFAULT_USER', 'DEFAULT_USER');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_user_gedcom_setting`
+--
+
+CREATE TABLE `wt_user_gedcom_setting` (
+ `user_id` int(11) NOT NULL,
+ `gedcom_id` int(11) NOT NULL,
+ `setting_name` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
+ `setting_value` varchar(255) COLLATE utf8_unicode_ci NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `wt_user_setting`
+--
+
+CREATE TABLE `wt_user_setting` (
+ `user_id` int(11) NOT NULL,
+ `setting_name` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
+ `setting_value` varchar(255) COLLATE utf8_unicode_ci NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Indexes for dumped tables
+--
+
+--
+-- Indexes for table `wt_block`
+--
+ALTER TABLE `wt_block`
+ ADD PRIMARY KEY (`block_id`),
+ ADD KEY `wt_block_fk1` (`gedcom_id`),
+ ADD KEY `wt_block_fk2` (`user_id`),
+ ADD KEY `wt_block_fk3` (`module_name`);
+
+--
+-- Indexes for table `wt_block_setting`
+--
+ALTER TABLE `wt_block_setting`
+ ADD PRIMARY KEY (`block_id`,`setting_name`);
+
+--
+-- Indexes for table `wt_change`
+--
+ALTER TABLE `wt_change`
+ ADD PRIMARY KEY (`change_id`),
+ ADD KEY `wt_change_ix1` (`gedcom_id`,`status`,`xref`),
+ ADD KEY `wt_change_fk1` (`user_id`);
+
+--
+-- Indexes for table `wt_dates`
+--
+ALTER TABLE `wt_dates`
+ ADD KEY `wt_dates_ix1` (`d_day`),
+ ADD KEY `wt_dates_ix2` (`d_month`),
+ ADD KEY `wt_dates_ix3` (`d_mon`),
+ ADD KEY `wt_dates_ix4` (`d_year`),
+ ADD KEY `wt_dates_ix5` (`d_julianday1`),
+ ADD KEY `wt_dates_ix6` (`d_julianday2`),
+ ADD KEY `wt_dates_ix7` (`d_gid`),
+ ADD KEY `wt_dates_ix8` (`d_file`),
+ ADD KEY `wt_dates_ix9` (`d_type`),
+ ADD KEY `wt_dates_ix10` (`d_fact`,`d_gid`);
+
+--
+-- Indexes for table `wt_default_resn`
+--
+ALTER TABLE `wt_default_resn`
+ ADD PRIMARY KEY (`default_resn_id`),
+ ADD UNIQUE KEY `wt_default_resn_ix1` (`gedcom_id`,`xref`,`tag_type`);
+
+--
+-- Indexes for table `wt_families`
+--
+ALTER TABLE `wt_families`
+ ADD PRIMARY KEY (`f_id`,`f_file`),
+ ADD UNIQUE KEY `wt_families_ix1` (`f_file`,`f_id`),
+ ADD KEY `wt_families_ix2` (`f_husb`),
+ ADD KEY `wt_families_ix3` (`f_wife`);
+
+--
+-- Indexes for table `wt_favorite`
+--
+ALTER TABLE `wt_favorite`
+ ADD PRIMARY KEY (`favorite_id`),
+ ADD KEY `news_ix1` (`gedcom_id`,`user_id`),
+ ADD KEY `wt_favorite_fk1` (`user_id`);
+
+--
+-- Indexes for table `wt_gedcom`
+--
+ALTER TABLE `wt_gedcom`
+ ADD PRIMARY KEY (`gedcom_id`),
+ ADD UNIQUE KEY `wt_gedcom_ix1` (`gedcom_name`),
+ ADD KEY `wt_gedcom_ix2` (`sort_order`),
+ ADD KEY `ix1` (`sort_order`);
+
+--
+-- Indexes for table `wt_gedcom_chunk`
+--
+ALTER TABLE `wt_gedcom_chunk`
+ ADD PRIMARY KEY (`gedcom_chunk_id`),
+ ADD KEY `ix1` (`gedcom_id`,`imported`);
+
+--
+-- Indexes for table `wt_gedcom_setting`
+--
+ALTER TABLE `wt_gedcom_setting`
+ ADD PRIMARY KEY (`gedcom_id`,`setting_name`);
+
+--
+-- Indexes for table `wt_hit_counter`
+--
+ALTER TABLE `wt_hit_counter`
+ ADD PRIMARY KEY (`gedcom_id`,`page_name`,`page_parameter`);
+
+--
+-- Indexes for table `wt_individuals`
+--
+ALTER TABLE `wt_individuals`
+ ADD PRIMARY KEY (`i_id`,`i_file`),
+ ADD UNIQUE KEY `wt_individuals_ix1` (`i_file`,`i_id`);
+
+--
+-- Indexes for table `wt_link`
+--
+ALTER TABLE `wt_link`
+ ADD PRIMARY KEY (`l_from`,`l_file`,`l_type`,`l_to`),
+ ADD UNIQUE KEY `wt_link_ix1` (`l_to`,`l_file`,`l_type`,`l_from`);
+
+--
+-- Indexes for table `wt_log`
+--
+ALTER TABLE `wt_log`
+ ADD PRIMARY KEY (`log_id`),
+ ADD KEY `wt_log_ix1` (`log_time`),
+ ADD KEY `wt_log_ix2` (`log_type`),
+ ADD KEY `wt_log_ix3` (`ip_address`),
+ ADD KEY `wt_log_fk1` (`user_id`),
+ ADD KEY `wt_log_fk2` (`gedcom_id`);
+
+--
+-- Indexes for table `wt_media`
+--
+ALTER TABLE `wt_media`
+ ADD PRIMARY KEY (`m_file`,`m_id`),
+ ADD UNIQUE KEY `wt_media_ix1` (`m_id`,`m_file`),
+ ADD KEY `wt_media_ix2` (`m_ext`,`m_type`),
+ ADD KEY `wt_media_ix3` (`m_titl`);
+
+--
+-- Indexes for table `wt_message`
+--
+ALTER TABLE `wt_message`
+ ADD PRIMARY KEY (`message_id`),
+ ADD KEY `wt_message_fk1` (`user_id`);
+
+--
+-- Indexes for table `wt_module`
+--
+ALTER TABLE `wt_module`
+ ADD PRIMARY KEY (`module_name`);
+
+--
+-- Indexes for table `wt_module_privacy`
+--
+ALTER TABLE `wt_module_privacy`
+ ADD PRIMARY KEY (`module_name`,`gedcom_id`,`component`),
+ ADD KEY `wt_module_privacy_fk2` (`gedcom_id`);
+
+--
+-- Indexes for table `wt_module_setting`
+--
+ALTER TABLE `wt_module_setting`
+ ADD PRIMARY KEY (`module_name`,`setting_name`);
+
+--
+-- Indexes for table `wt_name`
+--
+ALTER TABLE `wt_name`
+ ADD PRIMARY KEY (`n_id`,`n_file`,`n_num`),
+ ADD KEY `wt_name_ix1` (`n_full`,`n_id`,`n_file`),
+ ADD KEY `wt_name_ix2` (`n_surn`,`n_file`,`n_type`,`n_id`),
+ ADD KEY `wt_name_ix3` (`n_givn`,`n_file`,`n_type`,`n_id`);
+
+--
+-- Indexes for table `wt_news`
+--
+ALTER TABLE `wt_news`
+ ADD PRIMARY KEY (`news_id`),
+ ADD KEY `news_ix1` (`user_id`,`updated`),
+ ADD KEY `news_ix2` (`gedcom_id`,`updated`);
+
+--
+-- Indexes for table `wt_next_id`
+--
+ALTER TABLE `wt_next_id`
+ ADD PRIMARY KEY (`gedcom_id`,`record_type`);
+
+--
+-- Indexes for table `wt_other`
+--
+ALTER TABLE `wt_other`
+ ADD PRIMARY KEY (`o_id`,`o_file`),
+ ADD UNIQUE KEY `wt_other_ix1` (`o_file`,`o_id`);
+
+--
+-- Indexes for table `wt_placelinks`
+--
+ALTER TABLE `wt_placelinks`
+ ADD PRIMARY KEY (`pl_p_id`,`pl_gid`,`pl_file`),
+ ADD KEY `wt_placelinks_ix1` (`pl_p_id`),
+ ADD KEY `wt_placelinks_ix2` (`pl_gid`),
+ ADD KEY `wt_placelinks_ix3` (`pl_file`);
+
+--
+-- Indexes for table `wt_places`
+--
+ALTER TABLE `wt_places`
+ ADD PRIMARY KEY (`p_id`),
+ ADD UNIQUE KEY `wt_places_ix2` (`p_parent_id`,`p_file`,`p_place`),
+ ADD KEY `wt_places_ix1` (`p_file`,`p_place`);
+
+--
+-- Indexes for table `wt_session`
+--
+ALTER TABLE `wt_session`
+ ADD PRIMARY KEY (`session_id`),
+ ADD KEY `ix1` (`session_time`),
+ ADD KEY `ix2` (`user_id`,`ip_address`);
+
+--
+-- Indexes for table `wt_site_access_rule`
+--
+ALTER TABLE `wt_site_access_rule`
+ ADD PRIMARY KEY (`site_access_rule_id`),
+ ADD UNIQUE KEY `wt_site_access_rule_ix1` (`ip_address_end`,`ip_address_start`,`user_agent_pattern`,`rule`),
+ ADD KEY `wt_site_access_rule_ix2` (`rule`);
+
+--
+-- Indexes for table `wt_site_setting`
+--
+ALTER TABLE `wt_site_setting`
+ ADD PRIMARY KEY (`setting_name`);
+
+--
+-- Indexes for table `wt_sources`
+--
+ALTER TABLE `wt_sources`
+ ADD PRIMARY KEY (`s_id`,`s_file`),
+ ADD UNIQUE KEY `wt_sources_ix1` (`s_file`,`s_id`),
+ ADD KEY `wt_sources_ix2` (`s_name`);
+
+--
+-- Indexes for table `wt_user`
+--
+ALTER TABLE `wt_user`
+ ADD PRIMARY KEY (`user_id`),
+ ADD UNIQUE KEY `wt_user_ix1` (`user_name`),
+ ADD UNIQUE KEY `wt_user_ix2` (`email`);
+
+--
+-- Indexes for table `wt_user_gedcom_setting`
+--
+ALTER TABLE `wt_user_gedcom_setting`
+ ADD PRIMARY KEY (`user_id`,`gedcom_id`,`setting_name`),
+ ADD KEY `wt_user_gedcom_setting_fk2` (`gedcom_id`);
+
+--
+-- Indexes for table `wt_user_setting`
+--
+ALTER TABLE `wt_user_setting`
+ ADD PRIMARY KEY (`user_id`,`setting_name`);
+
+--
+-- AUTO_INCREMENT for dumped tables
+--
+
+--
+-- AUTO_INCREMENT for table `wt_block`
+--
+ALTER TABLE `wt_block`
+ MODIFY `block_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;
+--
+-- AUTO_INCREMENT for table `wt_change`
+--
+ALTER TABLE `wt_change`
+ MODIFY `change_id` int(11) NOT NULL AUTO_INCREMENT;
+--
+-- AUTO_INCREMENT for table `wt_default_resn`
+--
+ALTER TABLE `wt_default_resn`
+ MODIFY `default_resn_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
+--
+-- AUTO_INCREMENT for table `wt_favorite`
+--
+ALTER TABLE `wt_favorite`
+ MODIFY `favorite_id` int(11) NOT NULL AUTO_INCREMENT;
+--
+-- AUTO_INCREMENT for table `wt_gedcom`
+--
+ALTER TABLE `wt_gedcom`
+ MODIFY `gedcom_id` int(11) NOT NULL AUTO_INCREMENT;
+--
+-- AUTO_INCREMENT for table `wt_gedcom_chunk`
+--
+ALTER TABLE `wt_gedcom_chunk`
+ MODIFY `gedcom_chunk_id` int(11) NOT NULL AUTO_INCREMENT;
+--
+-- AUTO_INCREMENT for table `wt_log`
+--
+ALTER TABLE `wt_log`
+ MODIFY `log_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=57;
+--
+-- AUTO_INCREMENT for table `wt_message`
+--
+ALTER TABLE `wt_message`
+ MODIFY `message_id` int(11) NOT NULL AUTO_INCREMENT;
+--
+-- AUTO_INCREMENT for table `wt_news`
+--
+ALTER TABLE `wt_news`
+ MODIFY `news_id` int(11) NOT NULL AUTO_INCREMENT;
+--
+-- AUTO_INCREMENT for table `wt_places`
+--
+ALTER TABLE `wt_places`
+ MODIFY `p_id` int(11) NOT NULL AUTO_INCREMENT;
+--
+-- AUTO_INCREMENT for table `wt_site_access_rule`
+--
+ALTER TABLE `wt_site_access_rule`
+ MODIFY `site_access_rule_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
+--
+-- AUTO_INCREMENT for table `wt_user`
+--
+ALTER TABLE `wt_user`
+ MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT;
+--
+-- Constraints for dumped tables
+--
+
+--
+-- Constraints for table `wt_block`
+--
+ALTER TABLE `wt_block`
+ ADD CONSTRAINT `wt_block_fk1` FOREIGN KEY (`gedcom_id`) REFERENCES `wt_gedcom` (`gedcom_id`),
+ ADD CONSTRAINT `wt_block_fk2` FOREIGN KEY (`user_id`) REFERENCES `wt_user` (`user_id`),
+ ADD CONSTRAINT `wt_block_fk3` FOREIGN KEY (`module_name`) REFERENCES `wt_module` (`module_name`);
+
+--
+-- Constraints for table `wt_block_setting`
+--
+ALTER TABLE `wt_block_setting`
+ ADD CONSTRAINT `wt_block_setting_fk1` FOREIGN KEY (`block_id`) REFERENCES `wt_block` (`block_id`);
+
+--
+-- Constraints for table `wt_change`
+--
+ALTER TABLE `wt_change`
+ ADD CONSTRAINT `wt_change_fk1` FOREIGN KEY (`user_id`) REFERENCES `wt_user` (`user_id`),
+ ADD CONSTRAINT `wt_change_fk2` FOREIGN KEY (`gedcom_id`) REFERENCES `wt_gedcom` (`gedcom_id`);
+
+--
+-- Constraints for table `wt_default_resn`
+--
+ALTER TABLE `wt_default_resn`
+ ADD CONSTRAINT `wt_default_resn_fk1` FOREIGN KEY (`gedcom_id`) REFERENCES `wt_gedcom` (`gedcom_id`);
+
+--
+-- Constraints for table `wt_favorite`
+--
+ALTER TABLE `wt_favorite`
+ ADD CONSTRAINT `wt_favorite_fk1` FOREIGN KEY (`user_id`) REFERENCES `wt_user` (`user_id`) ON DELETE CASCADE,
+ ADD CONSTRAINT `wt_favorite_fk2` FOREIGN KEY (`gedcom_id`) REFERENCES `wt_gedcom` (`gedcom_id`) ON DELETE CASCADE;
+
+--
+-- Constraints for table `wt_gedcom_chunk`
+--
+ALTER TABLE `wt_gedcom_chunk`
+ ADD CONSTRAINT `wt_gedcom_chunk_fk1` FOREIGN KEY (`gedcom_id`) REFERENCES `wt_gedcom` (`gedcom_id`);
+
+--
+-- Constraints for table `wt_gedcom_setting`
+--
+ALTER TABLE `wt_gedcom_setting`
+ ADD CONSTRAINT `wt_gedcom_setting_fk1` FOREIGN KEY (`gedcom_id`) REFERENCES `wt_gedcom` (`gedcom_id`);
+
+--
+-- Constraints for table `wt_hit_counter`
+--
+ALTER TABLE `wt_hit_counter`
+ ADD CONSTRAINT `wt_hit_counter_fk1` FOREIGN KEY (`gedcom_id`) REFERENCES `wt_gedcom` (`gedcom_id`);
+
+--
+-- Constraints for table `wt_log`
+--
+ALTER TABLE `wt_log`
+ ADD CONSTRAINT `wt_log_fk1` FOREIGN KEY (`user_id`) REFERENCES `wt_user` (`user_id`),
+ ADD CONSTRAINT `wt_log_fk2` FOREIGN KEY (`gedcom_id`) REFERENCES `wt_gedcom` (`gedcom_id`);
+
+--
+-- Constraints for table `wt_message`
+--
+ALTER TABLE `wt_message`
+ ADD CONSTRAINT `wt_message_fk1` FOREIGN KEY (`user_id`) REFERENCES `wt_user` (`user_id`);
+
+--
+-- Constraints for table `wt_module_privacy`
+--
+ALTER TABLE `wt_module_privacy`
+ ADD CONSTRAINT `wt_module_privacy_fk1` FOREIGN KEY (`module_name`) REFERENCES `wt_module` (`module_name`),
+ ADD CONSTRAINT `wt_module_privacy_fk2` FOREIGN KEY (`gedcom_id`) REFERENCES `wt_gedcom` (`gedcom_id`);
+
+--
+-- Constraints for table `wt_module_setting`
+--
+ALTER TABLE `wt_module_setting`
+ ADD CONSTRAINT `wt_module_setting_fk1` FOREIGN KEY (`module_name`) REFERENCES `wt_module` (`module_name`);
+
+--
+-- Constraints for table `wt_news`
+--
+ALTER TABLE `wt_news`
+ ADD CONSTRAINT `wt_news_fk1` FOREIGN KEY (`user_id`) REFERENCES `wt_user` (`user_id`) ON DELETE CASCADE,
+ ADD CONSTRAINT `wt_news_fk2` FOREIGN KEY (`gedcom_id`) REFERENCES `wt_gedcom` (`gedcom_id`) ON DELETE CASCADE;
+
+--
+-- Constraints for table `wt_next_id`
+--
+ALTER TABLE `wt_next_id`
+ ADD CONSTRAINT `wt_next_id_fk1` FOREIGN KEY (`gedcom_id`) REFERENCES `wt_gedcom` (`gedcom_id`);
+
+--
+-- Constraints for table `wt_user_gedcom_setting`
+--
+ALTER TABLE `wt_user_gedcom_setting`
+ ADD CONSTRAINT `wt_user_gedcom_setting_fk1` FOREIGN KEY (`user_id`) REFERENCES `wt_user` (`user_id`),
+ ADD CONSTRAINT `wt_user_gedcom_setting_fk2` FOREIGN KEY (`gedcom_id`) REFERENCES `wt_gedcom` (`gedcom_id`);
+
+--
+-- Constraints for table `wt_user_setting`
+--
+ALTER TABLE `wt_user_setting`
+ ADD CONSTRAINT `wt_user_setting_fk1` FOREIGN KEY (`user_id`) REFERENCES `wt_user` (`user_id`);
+
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
diff --git a/manifest.json b/manifest.json
new file mode 100644
index 0000000..48dcd81
--- /dev/null
+++ b/manifest.json
@@ -0,0 +1,84 @@
+{
+ "name": "webtrees",
+ "id": "webtrees",
+ "packaging_format": 1,
+ "description": {
+ "en": "webtrees is a free open source web-based genealogy application.",
+ },
+ "url": "https://www.webtrees.net",
+ "maintainer": {
+ "name": "anmol Sharma",
+ "email": "anmol@datamol.in",
+ },
+ "requirements": {
+ "yunohost": ">> 2.4.0"
+ },
+ "multi_instance": false,
+ "services": [
+ "nginx",
+ "php5-fpm",
+ "mysql"
+ ],
+ "arguments": {
+ "install" : [
+ {
+ "name": "domain",
+ "type": "domain",
+ "ask": {
+ "en": "Choose a domain name for ynhexample",
+ },
+ "example": "example.com"
+ },
+ {
+ "name": "path",
+ "type": "path",
+ "ask": {
+ "en": "Choose a path for ynhexample",
+ },
+ "example": "/example",
+ "default": "/webtrees"
+ },
+ {
+ "name": "username",
+ "type": "username",
+ "ask": {
+ "en": "Choose an admin username (Not a LDAP User)",
+ },
+ "example": "john"
+ },
+ {
+ "name": "name",
+ "type": "name",
+ "ask": {
+ "en": "Name of the user (Not a LDAP User)",
+ },
+ "example": "john doe"
+ },
+ {
+ "name": "email",
+ "type": "email",
+ "ask": {
+ "en": "Admin email (All the new registration will be sent on this email)",
+ },
+ "example": "admin@example.com"
+ },
+ {
+ "name": "password",
+ "type": "password",
+ "ask": {
+ "en": "Password for the admin account (At least 6 characters long)",
+ },
+ "example": "admin@example.com"
+ },
+ {
+ "name": "is_public",
+ "type": "boolean",
+ "ask": {
+ "en": "Is it a public application?",
+ "fr": "Est-ce une application publique ?"
+ },
+ "default": true
+ }
+ ]
+ }
+}
diff --git a/script/install b/script/install
new file mode 100755
index 0000000..a7c8c6e
--- /dev/null
+++ b/script/install
@@ -0,0 +1,108 @@
+#!/bin/bash
+
+# Exit on command errors and treat unset variables as an error
+set -eu
+
+# This is a multi-instance app, meaning it can be installed several times independently
+# The id of the app as stated in the manifest is available as $YNH_APP_ID
+# The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...)
+# The app instance name is available as $YNH_APP_INSTANCE_NAME
+# - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample
+# - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2
+# - ynhexample__{N} for the subsequent installations, with N=3,4, ...
+# The app instance name is probably what you are interested the most, since this is
+# guaranteed to be unique. This is a good unique identifier to define installation path,
+# db names, ...
+app=$YNH_APP_INSTANCE_NAME
+
+# Retrieve arguments
+domain=$YNH_APP_ARG_DOMAIN
+path_url=$YNH_APP_ARG_PATH
+is_public=$YNH_APP_ARG_IS_PUBLIC
+admin_username=$YNH_APP_ARG_USERNAME
+admin_name=$YNH_APP_ARG_NAME
+admin_email=$YNH_APP_ARG_EMAIL
+admin_password=openssl passwd -1 -salt xyz $YNH_APP_ARG_PASSWORD
+
+# Source YunoHost helpers
+source /usr/share/yunohost/helpers
+
+# Save app settings
+ynh_app_setting_set "$app" is_public "$is_public"
+
+
+# Check domain/path availability
+sudo yunohost app checkurl "${domain}${path_url}" -a "$app" \
+ || ynh_die "Path not available: ${domain}${path_url}"
+
+# Check password strength
+[[ ${#admin_password} -gt 6 ]] || ynh_die \
+"The password is too weak, it must be longer than 6 characters"
+
+
+# Copy source files
+src_path=/var/www/$app
+sudo mkdir -p $src_path
+sudo cp -a ../sources/. $src_path
+
+# Set permissions to app files
+# you may need to make some file and/or directory writeable by www-data (nginx user)
+sudo chown -R root: $src_path
+
+### MySQL (can be removed if not used) ###
+# If your app use a MySQL database you can use these lines to bootstrap
+# a database, an associated user and save the password in app settings.
+#
+# # Generate MySQL password and create database
+ dbuser=$app
+ dbname=$app
+ dbpass=$(ynh_string_random 12)
+ ynh_app_setting_set "$app" mysqlpwd "$dbpass"
+ ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass"
+
+# Adding the details of the database to the config file
+sed -i "s@__dbuser__@$dbuser@g" ../conf/config.ini.php
+sed -i "s@__dbpass__@$dbpass@g" ../conf/config.ini.php
+sed -i "s@__dbname__@$dbname@g" ../conf/config.ini.php
+
+# Copy the config file to the src_path
+sudo cp ../conf/config.ini.php $src_path/data/.
+
+
+
+# # Load initial SQL into the new database
+ ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" \
+ < "../sources/sql/webtrees.sql"
+
+
+
+# Replace variables in sql scripts
+ynh_replace_string "__USER_NAME__" "$admin_username" ../conf/sql/admin.sql
+ynh_replace_string "__NAME__" "$admin_name" ../conf/sql/admin.sql
+ynh_replace_string "__USER_EMAIL__" "$admin_email" ../conf/sql/admin.sql
+ynh_replace_string "__PASSWORD__" "$admin_password" ../conf/sql/admin.sql
+
+ynh_mysql_connect_as $db_name $db_pwd $db_name < ../conf/sql/admin.sql
+
+### MySQL end ###
+
+# Modify Nginx configuration file and copy it to Nginx conf directory
+nginx_conf=../conf/nginx.conf
+sed -i "s@YNH_WWW_PATH@$path_url@g" $nginx_conf
+sed -i "s@YNH_WWW_ALIAS@$src_path/@g" $nginx_conf
+# If a dedicated php-fpm process is used:
+# Don't forget to modify ../conf/nginx.conf accordingly or your app will not work!
+# sed -i "s@YNH_WWW_APP@$app@g" $nginx_conf
+sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf
+
+
+# If app is public, add url to SSOWat conf as skipped_uris
+if [[ $is_public -eq 1 ]]; then
+ # unprotected_uris allows SSO credentials to be passed anyway.
+ ynh_app_setting_set "$app" unprotected_uris "/"
+fi
+
+sudo chmod -R 777 $src_path/data
+
+# Reload services
+sudo service nginx reload
diff --git a/script/remove b/script/remove
new file mode 100755
index 0000000..bc8bbd9
--- /dev/null
+++ b/script/remove
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# See comments in install script
+app=$YNH_APP_INSTANCE_NAME
+
+# Source YunoHost helpers
+source /usr/share/yunohost/helpers
+
+# Retrieve app settings
+domain=$(ynh_app_setting_get "$app" domain)
+
+# Remove sources
+sudo rm -rf /var/www/$app
+
+# Remove nginx configuration file
+sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
+
+### PHP (remove if not used) ###
+# If a dedicated php-fpm process is used:
+# sudo rm -f /etc/php5/fpm/pool.d/$app.conf
+# sudo service php5-fpm reload
+### PHP end ###
+
+### MySQL (remove if not used) ###
+# If a MySQL database is used:
+# # Drop MySQL database and user
+dbname=$app
+dbuser=$app
+ynh_mysql_drop_db "$dbname" || true
+ynh_mysql_drop_user "$dbuser" || true
+### MySQL end ###
+
+# Reload nginx service
+sudo service nginx reload
diff --git a/sources/README.md b/sources/README.md
new file mode 100644
index 0000000..afc517c
--- /dev/null
+++ b/sources/README.md
@@ -0,0 +1,429 @@
+[![Latest Stable Version](https://poser.pugx.org/fisharebest/webtrees/v/stable.svg)](https://packagist.org/packages/fisharebest/webtrees)
+[![Build Status](https://travis-ci.org/fisharebest/webtrees.svg?branch=master)](https://travis-ci.org/fisharebest/webtrees)
+[![Coverage Status](https://coveralls.io/repos/github/fisharebest/webtrees/badge.svg?branch=master)](https://coveralls.io/github/fisharebest/webtrees?branch=master)
+[![Translation status](https://translate.webtrees.net/widgets/webtrees/-/svg-badge.svg)](https://translate.webtrees.net/engage/webtrees/?utm_source=widget)
+[![SensioLabsInsight](https://insight.sensiolabs.com/projects/78a5ba19-7ddf-4a58-8262-1c8a149f38de/mini.png)](https://insight.sensiolabs.com/projects/78a5ba19-7ddf-4a58-8262-1c8a149f38de)
+[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/fisharebest/webtrees/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/fisharebest/webtrees/?branch=master)
+[![Code Climate](https://codeclimate.com/github/fisharebest/webtrees/badges/gpa.svg)](https://codeclimate.com/github/fisharebest/webtrees)
+
+# webtrees
+
+The project’s website is [www.webtrees.net](https://www.webtrees.net).
+Further documentation is available at [wiki.webtrees.net](https://wiki.webtrees.net).
+
+
+## Contents
+
+* [License](#license)
+* [Introduction](#introduction)
+* [System requirements](#system-requirements)
+* [Installation](#installation)
+* [Upgrading](#upgrading)
+* [Gedcom (family tree) files](#gedcom-family-tree-files)
+* [Security](#security)
+* [Backup](#backup)
+* [Converting from phpgedview](#converting-from-phpgedview)
+
+
+### License
+
+* **webtrees: online genealogy**
+* Copyright (C) 2016 webtrees 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 3 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, see .
+
+
+### Introduction
+
+**webtrees** is the web's leading online collaborative genealogy application.
+
+* It works from standard GEDCOM files, and is therefore compatible with every
+major desktop application.
+* It aims to to be efficient and effective by using the right combination of
+third-party tools, design techniques and open standards.
+
+**webtrees** allows you to view and edit your genealogy on your website. It has
+full editing capabilities, full privacy functions, and supports imedia such as
+photos and document images. As an online program, it fosters extended family
+participation and good ancestral recording habits, as it simplifies the process
+of collaborating with others working on your family lines. Your latest information
+is always on your web site and available for others to see, defined by viewing
+rules you set. For more information and to see working demos, visit
+[webtrees.net](https://webtrees.net/).
+
+**webtrees** is Open Source software that has been produced by people from many
+countries freely donating their time and talents to the project. All service,
+support, and future development is dependent on the time developers are willing
+to donate to the project, often at the expense of work, recreation, and family.
+Beyond the few donations received from users, developers receive no compensation
+for the time they spend working on the project. There is also no outside source
+of revenue to support the project. Please consider these circumstances when
+making support requests and consider volunteering your own time and skills to make
+the project even stronger and better.
+
+
+### System requirements
+
+To install **webtrees**, you need:
+
+* A webserver. Apache and IIS are the most common types. There are no requirements
+ to use a specific type or version.
+* Approximately 65MB of disk space for the application files, plus whatever is
+ needed for your media files, GEDCOM files and database.
+* PHP 5.3.2 or later. Note that many web hosts offer *both* PHP4 and PHP5,
+ typically with PHP4 as the default. If this is the case, you will be able to
+ switch between the two using a control panel or a configuration file. Refer
+ to your web host's support documentation for details.
+ * PHP should be configured with the PHP/PDO library for MySQL. This is a
+ server configuration option. It is enabled by default on most hosts.
+ See [http://php.net/pdo](http://php.net/pdo)
+ * PHP should be configured to allow sufficient server resources (memory and
+ execution time) for the size of your system. Typical requirements are:
+ * Small systems (500 individuals): 16–32 MB, 10–20 seconds
+ * Medium systems (5,000 individuals): 32–64 MB, 20–40 seconds
+ * Large systems (50,000 individuals): 64–128 MB, 40–80 seconds
+* MySQL 5.0.13 or later. Note that **webtrees** can share a single database
+ with other applications, by choosing a unique table prefix during configuration.
+ If the number of databases is not restricted, you can set up a database purely
+ for use by **webtrees** and create a separate user and password for only
+ your genealogy.
+* Internet browser compatibility. **webtrees** supports the use of most
+ current versions of open-source browsers such as Firefox, Chrome, and Safari.
+ We will do our best to support others such as Opera and Internet Explorer,
+ though not their earlier versions. Currently many things do not work well in
+ IE7, and some not in IE8 either. We strongly recommend anyone using these
+ obsolete browsers upgrade as soon as possible. We are also aware that IE
+ provides poor RTL language support generally, so cannot recommend it for
+ sites requiring RTL languages.
+* To view sites that contain both left-to-right and right-to-left text (e.g.
+ English data on Hebrew pages), you will need to use a browser that provides
+ support for the HTML5 **dir="auto"** attribute. At present, Internet Explorer
+ (11 and lower) do not support this.
+* HTML Frames. Note that **webtrees** uses cookies to track login sessions. Sites
+ that make **webtrees** pages available inside an HTML Frames will encounter
+ problems with login for versions 7, 8, and 9 of Internet Explorer. IE users
+ should review the ``Privacy settings Tools`` / ``Internet Options`` for more details.
+
+
+### Installation
+
+Installing **webtrees** is really easy. All you need is a webserver with PHP and
+MySQL. Almost every web hosting service provides these, but be sure to confirm
+that those supplied meet or exceed the minimum system requirements.
+
+1. Download latest stable version from [webtrees.net](https://webtrees.net/)
+2. Unzip the files and upload them to an empty directory on your web server.
+3. Open your web browser and type the URL for your **webtrees** site (for example,
+ [http://www.yourserver.com/webtrees](http://www.yourserver.com/webtrees)) into
+ the address bar.
+4. The **webtrees** setup wizard will start automatically. Simply follow the steps,
+ answering each question as you proceed. (See '''Step Six''' procedure below.)
+
+That's it!
+
+However, before you can use **webtrees**, you need one (or possibly more) GEDCOM
+(family tree) files. If you have been doing your research using a desktop program
+such as Family Tree Maker, you can use it's “save as GEDCOM” function to create
+a GEDCOM file. If you are starting from scratch, then **webtrees** can create a
+GEDCOM file for you. Alternatively, you can import data directly from PhpGedView.
+
+So, after installation, you'll be directed to the GEDCOM (family tree)
+administration page, where you'll need to select one of the following options:
+
+* On successful completion of all steps you will be taken to the GEDCOM (family tree)
+ administration page where you can:
+ * UPLOAD a GEDCOM file from your local machine
+ * ADD a GEDCOM file from your server, (if your GEDCOM file is too large to upload,
+ you can copy it to the webtrees/data folder, and load it from there)
+ * CREATE a new, empty GEDCOM file
+ * TRANSFER your existing PhpGedView data straight into **webtrees**, using the
+ PhpGedView-to-**webtrees** wizard described in section 9 below:
+ [Converting from phpgedview](#converting-from-phpgedview)
+
+There are *lots* of configuration options. You'll probably want to review the
+privacy settings first. Don't worry too much about all the other options - the
+defaults are good for most people. If you get stuck, there's lots of built-in
+help and you can get friendly advice from the [help](https://webtrees.net/forums)
+forum.
+
+
+### Upgrading
+
+Upgrading **webtrees** is quick and easy. It is strongly recommended that you
+upgrade your installation whenever a new version is made available. Even minor
+**webtrees** version updates usually contain a significant number of bug fixes
+as well as interface improvements and program enhancements. The Administration
+page of your **webtrees** installation will display a notification whenever a
+new version is available.
+
+1. Now would be a good time to make a [backup](#backup).
+2. Download the latest version of **webtrees** available from
+ [webtrees.net](https://webtrees.net/)
+3. While you are in the middle of uploading the new files,
+ a visitor to your site would encounter a mixture of new and old files. This
+ could cause unpredictable behaviour or errors. To prevent this, create the
+ file **data/offline.txt**. While this file exists, visitors will see a
+ “site unavailable - come back later” message.
+4. Unzip the .ZIP file, and upload the files to your web server, overwriting the existing files.
+5. Delete the file **data/offline.txt**
+
+
+#### Note for Macintosh users
+
+Step 4 assumes you are using a copy tool that **merges** directories rather than
+replaces them. (**Merge** is standard behaviour on Windows and Linux.) If you use
+the Macintosh Finder or other similar tool to perform step 3, it will **replace**
+your configuration, media and other directories with the empty/default ones from
+the installation. This would be very bad (but you did take a backup in step 1,
+didn't you!). Further details and recommendations for suitable tools can be found
+by searching [google.com](http://google.com).
+
+
+#### Note for anyone using custom code (modules, themes, etc.).
+
+It is **very likely** that your custom code will not work when you upgrade
+**webtrees**.
+
+**We recommend that you disable all custom code before you apply the upgrade.**
+
+Disable custom modules, switch over to a standard
+theme, and remove any code “hacks”. Once the upgrade is complete and you are satisfied
+your site is fully operational contact the source of those modules or themes for
+a new version.
+
+
+#### General note
+
+Depending on the changes in the new files, your browser configuration
+and possibly other factors, it is always wise to clear both the **webtrees** cache
+and your browser cache immediately after the upgrade is completed. The **webtrees**
+cache can be cleared simply by going to ``Administration`` ->
+``Cleanup data directory`` and deleting the cache.
+
+If you have any problems or questions, help is available on the
+[webtrees forum](https://webtrees.net/forums).
+
+
+### Gedcom (family tree) files
+
+When you ADD, IMPORT or UPLOAD a family tree (GEDCOM) file in **webtrees** the
+data from the file is all transferred to the database tables. The file itself is
+no longer used or required by **webtrees**
+
+* If you use ADD or IMPORT, your file remains in the webtrees/data folder you
+ first copied it to, and will not be changed by any subsequent editing of the
+ **webtrees** data.
+* If you use UPLOAD, the file is left in its original location, and again remains
+ untouched.
+
+When or if you change your genealogy data outside of **webtrees**, it is not
+necessary to delete your GEDCOM file or database from **webtrees** and start
+over. Follow these steps to update a GEDCOM that has already been imported:
+
+* Decide if you want to IMPORT or UPLOAD your new GEDCOM file.
+ * Use UPLOAD if your family tree file is smaller than your server's PHP file
+ upload limit (often 2MB).The new file can have any name you choose.
+ * Use IMPORT for larger files. In this case you need to use FTP to first copy
+ your file to the webtrees/data folder. Either copy over the existing file,
+ or use a different name.
+* From the Administration page, go to your **webtrees** Family trees (GEDCOM)
+ configuration page. On the line relating to this particular family tree (GEDCOM)
+ file (or a new one) click either IMPORT or UPLOAD.
+* Take careful note of the media items option (_“If you have created media objects
+ in **webtrees**, and have edited your data off-line using software that
+ deletes media objects, then tick this box to merge the current media objects
+ with the new GEDCOM.”_) In most cases you should leave this box **UNCHECKED**.
+* Click “SAVE”. **webtrees** will validate the GEDCOM again before importing.
+ During this process, **webtrees** copies your entire family tree (GEDCOM file)
+ to a 'chunk' table within your database. Depending on the coding of your file,
+ its file size and the capabilities of your server and the supporting software,
+ this may take some time. **No progress bar will show while the data is being
+ copied** and should you navigate away from this page, the process is suspended.
+ It will start again when you return to the Family Tree management page.
+
+
+#### FORMAT
+
+Every Family History program has its own method of creating GEDCOM files, and
+differing output format options to select from. **webtrees'** import routines
+can read many different formats, but not necessarily all. If your software has
+a “UTF8” option you should always use that. However, **webtrees** has been
+tested with these alternative formats:
+
+* ANSI
+ * imports OK, but is slow due to the translation into UTF8 as part
+ of the import process.
+* MAC
+ * imports OK, but is slow due to the translation into UTF8 as part
+ of the import process.
+* DOS
+ * imports OK, but is slow due to the translation into UTF8 as part
+ of the import process.
+* ANSEL
+ * currently will not import. Gives warning *Error: cannot convert
+ GEDCOM file from ANSEL encoding to UTF-8 encoding*. Later releases
+ of **webtrees** may include translation from ANSEL to UTF8, but this
+ is not a simple process.
+
+
+### Security
+
+**Security** in _webtrees_ means ensuring your site is safe from unwanted
+intrusions, hacking, or access to data and configuration files. The developers
+of _webtrees_ regard security as an extremely important part of its development
+and have made every attempt to ensure your data is safe.
+
+The area most at risk of intrusion would be the /data folder that contains your
+config.ini.php file, and various temporary files. If you are concerned there
+may be a risk there is a very simple test you can do: try to fetch **config.ini.php**
+by typing **http://_url to your site_/data/config.ini.php** in your web
+browser.
+
+The most likely result is an “access denied” message like this:
+
+ Forbidden
+
+ You don't have permission to access /data/xxxx.ged on this server.
+
+This indicates that the protection built into **webtrees** is working, and no
+further action is required.
+
+In the unlikely event you do fetch the file (you will just see a semicolon),
+then that protection is not working on your site and you should take some further
+action.
+
+If your server runs PHP in CGI mode, then change the permission of the /data
+directory to 700 instead of 777. This will block access to the httpd process,
+while still allowing access to PHP scripts.
+
+This will work for perhaps 99% of all users. Only the remaining 1% should consider
+the most complex solution, moving the /data/ directory out of accessible web
+space. (**_Note:_** In many shared hosting environments this is not an option anyway.)
+
+If you do find it necessary, following is an example of the process required:
+
+If your home directory is something like **/home/username**,
+and the root directory for your web site is **/home/username/public_html**,
+and you have installed **webtrees** in the **public_html/webtrees** directory,
+then you would create a new **data** folder in your home directory at the same
+level as your public_html directory, such as **/home/username/private/data**,
+and place your GEDCOM (family tree) file there.
+
+Then change the **Data file directory** setting on the ``Admin`` ->
+``Site Administration`` page from the default **data/** to the new
+location **/home/username/private/data**
+
+You will have **two** data directories:
+
+* [path to webtrees]/data - just needs to contain config.ini.php
+* /home/username/private/data - contains everything else
+
+
+#### Hypertext Transfer Protocol Secure (HTTPS)
+
+**webtrees** supports https access. If your website is configured with mandatory
+or optional https support **webtrees** will operate correctly in either mode.
+
+If your website is configured with optional https support, **webtrees** can be
+configured to switch to https at login. To enable https at login, set the Login
+URL setting on the ``Admin`` -> ``Site Administration`` ->
+``Configuration page`` to your https login URL, which is often in the form
+[https://example.com/admin.php](https://example.com/admin.php)
+(substitute your domain for example.com).
+
+**Warning:** Misconfiguration can disable your login links. If this occurs,
+access the login by typing the correct URL directly into your browser's address input.
+
+
+### Backup
+
+Backups are good. Whatever problem you have, it can always be fixed from a good
+backup.
+
+To make a backup of webtrees, you need to make a copy of the following
+
+1. The files in the *webtrees/data* directory.
+2. The files in the *webtrees/media* directory.
+3. The tables in the database. Freely available tools such as
+ [phpMyAdmin](http://www.phpmyadmin.net) allow you to do this in one click.
+
+Remember that most web hosting services do NOT backup your data, and this is
+your responsibility.
+
+
+### Converting from phpgedview
+
+If you are moving to **webtrees** from an existing PhpGedView setup, and
+your PhpGedView install meets certain requirements, **webtrees** has provided a “wizard”
+to help make the transfer of the majority of your data a relatively quick and
+painless operation. See exceptions noted below. Please note that we have designed
+this wizard so as to not disturb your existing PhpGedView installation, leaving all those
+settings, data and your website intact and fully functional.
+
+The requirements are:
+
+* The PhpGedView database and index directory must be on the same server as **webtrees**.
+* Your **webtrees** MySQL database username and password must either be the same
+ as your PhpGedView username and password, or if you created a new user for **webtrees**,
+ that new user must also have full privileges to access your PhpGedView database.
+* PhpGedView must be at least versions 4.2.3 or 4.2.4 (this corresponds to an internal
+ “PGV_SCHEMA_VERSION” of between 10 and 14). Newer versions, including the current
+ version 4.3 SVN work (as of JAN 2013) also currently, and later versions, should
+ they be released, will probably work, provided the data structures do not change;
+* All changes in PhpGedView must be accepted (as pending edits will not be transfered).
+* All existing PhpGedView users must have an email address, and it must be unique to that
+ user (PhpGedView allows users to delete their email address, or have the same email
+ address as other users; **webtrees** requires that all users have their own
+ unique email address).
+* The wizard transfer process overwrites the username and password you may have
+ entered in setting up the initial admin account. The main administration user
+ name and password in **webtrees** will be identical to the admin username and
+ password from PhpGedView after running the wizard. Once done, you can change it back
+ if desired.
+
+
+#### Warning
+
+Please read the [https://wiki.webtrees.net/en/Converting_from_PhpGedView](https://wiki.webtrees.net/en/Converting_from_PhpGedView)
+before doing a transfer as important pre-processing steps and known issues may
+be outlined there.
+
+
+#### Important Note
+
+This transfer wizard is not able to assist with moving media items. You will need
+to set up and move or copy your media configuration and objects separately after
+the transfer wizard is finished. If you use the media firewall in PhpGedView with a
+directory outside the PhpGedView root, then duplicating the media configuration in
+**webtrees** to use the same firewall directory should make your media available
+in **webtrees**.
+
+After the transfer is complete, you should check your family tree configuration
+and privacy settings. Due to differences in internal data formats, the following
+settings are not yet transfered: custom privacy restrictions, block configuration,
+FAQs, and HTML blocks. We hope to add these to the wizard in a future release.
+
+
+#### Custom privacy restrictions, block configuration, FAQs and HTML blocks
+
+We hope to add these to the wizard in a future release. Otherwise, read the
+[https://wiki.webtrees.net/en/Converting_from_PhpGedView](https://wiki.webtrees.net/en/Converting_from_PhpGedView)
+before reporting a problem in the forum.
+
+The transfer wizard is accessed in **webtrees** from the bottom of the
+“Manage family trees” page to which you will be automatically directed once you
+have completed the initial **webtrees** installation steps (section 4 above:
+[installation](#installation)). This option is only available on a new,
+empty **webtrees** installation; once you have created a GEDCOM (family tree)
+or added user accounts, it will no longer be available.
diff --git a/sources/action.php b/sources/action.php
new file mode 100644
index 0000000..d4927b3
--- /dev/null
+++ b/sources/action.php
@@ -0,0 +1,253 @@
+.
+ */
+namespace Fisharebest\Webtrees;
+
+/**
+ * Defined in session.php
+ *
+ * @global Tree $WT_TREE
+ */
+global $WT_TREE;
+
+use Fisharebest\Webtrees\Functions\FunctionsDb;
+use Fisharebest\Webtrees\Functions\FunctionsEdit;
+use Fisharebest\Webtrees\Functions\FunctionsImport;
+
+define('WT_SCRIPT_NAME', 'action.php');
+require './includes/session.php';
+
+header('Content-type: text/html; charset=UTF-8');
+
+if (!Filter::checkCsrf()) {
+ http_response_code(406);
+
+ return;
+}
+
+switch (Filter::post('action')) {
+case 'accept-changes':
+ // Accept all the pending changes for a record
+ $record = GedcomRecord::getInstance(Filter::post('xref', WT_REGEX_XREF), $WT_TREE);
+ if ($record && Auth::isModerator($record->getTree()) && $record->canShow() && $record->canEdit()) {
+ if ($record->isPendingDeletion()) {
+ FlashMessages::addMessage(/* I18N: %s is the name of a genealogy record */
+ I18N::translate('“%s” has been deleted.', $record->getFullName()));
+ } else {
+ FlashMessages::addMessage(/* I18N: %s is the name of a genealogy record */
+ I18N::translate('The changes to “%s” have been accepted.', $record->getFullName()));
+ }
+ FunctionsImport::acceptAllChanges($record->getXref(), $record->getTree()->getTreeId());
+ } else {
+ http_response_code(406);
+ }
+ break;
+
+case 'copy-fact':
+ // Copy a fact to the clipboard
+ $xref = Filter::post('xref', WT_REGEX_XREF);
+ $fact_id = Filter::post('fact_id');
+
+ $record = GedcomRecord::getInstance($xref, $WT_TREE);
+
+ if ($record && $record->canEdit()) {
+ foreach ($record->getFacts() as $fact) {
+ if ($fact->getFactId() == $fact_id) {
+ switch ($fact->getTag()) {
+ case 'NOTE':
+ case 'SOUR':
+ case 'OBJE':
+ $type = 'all'; // paste this anywhere
+ break;
+ default:
+ $type = $record::RECORD_TYPE; // paste only to the same record type
+ break;
+ }
+ $clipboard = Session::get('clipboard');
+ if (!is_array($clipboard)) {
+ $clipboard = array();
+ }
+ $clipboard[$fact_id] = array(
+ 'type' => $type,
+ 'factrec' => $fact->getGedcom(),
+ 'fact' => $fact->getTag(),
+ );
+ // The clipboard only holds 10 facts
+ while (count($clipboard) > 10) {
+ array_shift($clipboard);
+ }
+ Session::put('clipboard', $clipboard);
+ FlashMessages::addMessage(I18N::translate('The record has been copied to the clipboard.'));
+ break 2;
+ }
+ }
+ }
+ break;
+
+case 'paste-fact':
+ // Paste a fact from the clipboard
+ $xref = Filter::post('xref', WT_REGEX_XREF);
+ $fact_id = Filter::post('fact_id');
+ $record = GedcomRecord::getInstance($xref, $WT_TREE);
+ $clipboard = Session::get('clipboard');
+
+ if ($record && $record->canEdit() && isset($clipboard[$fact_id])) {
+ $record->createFact($clipboard[$fact_id]['factrec'], true);
+ }
+ break;
+
+case 'delete-fact':
+ $xref = Filter::post('xref', WT_REGEX_XREF);
+ $fact_id = Filter::post('fact_id');
+
+ $record = GedcomRecord::getInstance($xref, $WT_TREE);
+ if ($record && $record->canShow() && $record->canEdit()) {
+ foreach ($record->getFacts() as $fact) {
+ if ($fact->getFactId() == $fact_id && $fact->canShow() && $fact->canEdit()) {
+ $record->deleteFact($fact_id, true);
+ break 2;
+ }
+ }
+ }
+
+ // Can’t find the record/fact, or don’t have permission to delete it.
+ http_response_code(406);
+ break;
+
+case 'delete-record':
+ $record = GedcomRecord::getInstance(Filter::post('xref', WT_REGEX_XREF), $WT_TREE);
+ if ($record && Auth::isEditor($record->getTree()) && $record->canShow() && $record->canEdit()) {
+ // Delete links to this record
+ foreach (FunctionsDb::fetchAllLinks($record->getXref(), $record->getTree()->getTreeId()) as $xref) {
+ $linker = GedcomRecord::getInstance($xref, $WT_TREE);
+ $old_gedcom = $linker->getGedcom();
+ $new_gedcom = FunctionsEdit::removeLinks($old_gedcom, $record->getXref());
+ // FunctionsDb::fetch_all_links() does not take account of pending changes. The links (or even the
+ // record itself) may have already been deleted.
+ if ($old_gedcom !== $new_gedcom) {
+ // If we have removed a link from a family to an individual, and it has only one member
+ if (preg_match('/^0 @' . WT_REGEX_XREF . '@ FAM/', $new_gedcom) && preg_match_all('/\n1 (HUSB|WIFE|CHIL) @(' . WT_REGEX_XREF . ')@/', $new_gedcom, $match) == 1) {
+ // Delete the family
+ $family = GedcomRecord::getInstance($xref, $WT_TREE);
+ FlashMessages::addMessage(/* I18N: %s is the name of a family group, e.g. “Husband name + Wife name” */ I18N::translate('The family “%s” has been deleted because it only has one member.', $family->getFullName()));
+ $family->deleteRecord();
+ // Delete any remaining link to this family
+ if ($match) {
+ $relict = GedcomRecord::getInstance($match[2][0], $WT_TREE);
+ $new_gedcom = $relict->getGedcom();
+ $new_gedcom = FunctionsEdit::removeLinks($new_gedcom, $linker->getXref());
+ $relict->updateRecord($new_gedcom, false);
+ FlashMessages::addMessage(/* I18N: %s are names of records, such as sources, repositories or individuals */ I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $relict->getFullName(), $family->getFullName()));
+ }
+ } else {
+ // Remove links from $linker to $record
+ FlashMessages::addMessage(/* I18N: %s are names of records, such as sources, repositories or individuals */ I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $linker->getFullName(), $record->getFullName()));
+ $linker->updateRecord($new_gedcom, false);
+ }
+ }
+ }
+ // Delete the record itself
+ $record->deleteRecord();
+ } else {
+ http_response_code(406);
+ }
+ break;
+
+case 'delete-user':
+ $user = User::find(Filter::postInteger('user_id'));
+
+ if ($user && Auth::isAdmin() && Auth::user() !== $user) {
+ Log::addAuthenticationLog('Deleted user: ' . $user->getUserName());
+ $user->delete();
+ }
+ break;
+
+case 'language':
+ // Change the current language
+ $language = Filter::post('language');
+ try {
+ I18N::init($language);
+ Session::put('locale', $language);
+ // Remember our selection
+ Auth::user()->setPreference('language', $language);
+ } catch (\Exception $ex) {
+ // Request for a non-existant language.
+ http_response_code(406);
+ }
+ break;
+
+case 'masquerade':
+ $user = User::find(Filter::postInteger('user_id'));
+
+ if ($user && Auth::isAdmin() && Auth::user() !== $user) {
+ Log::addAuthenticationLog('Masquerade as user: ' . $user->getUserName());
+ Auth::login($user);
+ Session::put('masquerade', '1');
+ } else {
+ http_response_code(406);
+ }
+ break;
+
+case 'unlink-media':
+ // Remove links from an individual and their spouse-family records to a media object.
+ // Used by the "unlink" option on the album (lightbox) tab.
+ $source = Individual::getInstance(Filter::post('source', WT_REGEX_XREF), $WT_TREE);
+ $target = Filter::post('target', WT_REGEX_XREF);
+ if ($source && $source->canShow() && $source->canEdit() && $target) {
+ // Consider the individual and their spouse-family records
+ $sources = $source->getSpouseFamilies();
+ $sources[] = $source;
+ foreach ($sources as $source) {
+ foreach ($source->getFacts() as $fact) {
+ if (!$fact->isPendingDeletion()) {
+ if ($fact->getValue() == '@' . $target . '@') {
+ // Level 1 links
+ $source->deleteFact($fact->getFactId(), true);
+ } elseif (strpos($fact->getGedcom(), ' @' . $target . '@')) {
+ // Level 2-3 links
+ $source->updateFact($fact->getFactId(), preg_replace(array('/\n2 OBJE @' . $target . '@(\n[3-9].*)*/', '/\n3 OBJE @' . $target . '@(\n[4-9].*)*/'), '', $fact->getGedcom()), true);
+ }
+ }
+ }
+ }
+ } else {
+ http_response_code(406);
+ }
+ break;
+
+case 'reject-changes':
+ // Reject all the pending changes for a record
+ $record = GedcomRecord::getInstance(Filter::post('xref', WT_REGEX_XREF), $WT_TREE);
+ if ($record && $record->canEdit() && Auth::isModerator($record->getTree())) {
+ FlashMessages::addMessage(/* I18N: %s is the name of an individual, source or other record */ I18N::translate('The changes to “%s” have been rejected.', $record->getFullName()));
+ FunctionsImport::rejectAllChanges($record);
+ } else {
+ http_response_code(406);
+ }
+ break;
+
+case 'theme':
+ // Change the current theme
+ $theme = Filter::post('theme');
+ if (Site::getPreference('ALLOW_USER_THEMES') && array_key_exists($theme, Theme::themeNames())) {
+ Session::put('theme_id', $theme);
+ // Remember our selection
+ Auth::user()->setPreference('theme', $theme);
+ } else {
+ // Request for a non-existant theme.
+ http_response_code(406);
+ }
+ break;
+}
diff --git a/sources/addmedia.php b/sources/addmedia.php
new file mode 100644
index 0000000..574acc7
--- /dev/null
+++ b/sources/addmedia.php
@@ -0,0 +1,719 @@
+.
+ */
+namespace Fisharebest\Webtrees;
+
+/**
+ * Defined in session.php
+ *
+ * @global Tree $WT_TREE
+ */
+global $WT_TREE;
+
+use Fisharebest\Webtrees\Controller\SimpleController;
+use Fisharebest\Webtrees\Functions\Functions;
+use Fisharebest\Webtrees\Functions\FunctionsDb;
+use Fisharebest\Webtrees\Functions\FunctionsEdit;
+use Fisharebest\Webtrees\Functions\FunctionsImport;
+use Fisharebest\Webtrees\Functions\FunctionsPrint;
+use Fisharebest\Webtrees\Query\QueryMedia;
+
+define('WT_SCRIPT_NAME', 'addmedia.php');
+require './includes/session.php';
+
+$NO_UPDATE_CHAN = $WT_TREE->getPreference('NO_UPDATE_CHAN');
+$MEDIA_DIRECTORY = $WT_TREE->getPreference('MEDIA_DIRECTORY');
+
+$pid = Filter::get('pid', WT_REGEX_XREF, Filter::post('pid', WT_REGEX_XREF)); // edit this media object
+$linktoid = Filter::get('linktoid', WT_REGEX_XREF, Filter::post('linktoid', WT_REGEX_XREF)); // create a new media object, linked to this record
+$action = Filter::get('action', null, Filter::post('action'));
+$filename = Filter::get('filename', null, Filter::post('filename'));
+$text = Filter::postArray('text');
+$tag = Filter::postArray('tag', WT_REGEX_TAG);
+$islink = Filter::postArray('islink');
+$glevels = Filter::postArray('glevels', '[0-9]');
+$folder = Filter::post('folder');
+$update_CHAN = !Filter::postBool('preserve_last_changed');
+
+$controller = new SimpleController;
+$controller
+ ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)
+ ->addInlineJavascript('autocomplete();')
+ ->restrictAccess(Auth::isMember($WT_TREE));
+
+$disp = true;
+$media = Media::getInstance($pid, $WT_TREE);
+if ($media) {
+ $disp = $media->canShow();
+}
+if ($action == 'update' || $action == 'create') {
+ if ($linktoid) {
+ $disp = GedcomRecord::getInstance($linktoid, $WT_TREE)->canShow();
+ }
+}
+
+if (!Auth::isEditor($WT_TREE) || !$disp) {
+ $controller
+ ->pageHeader()
+ ->addInlineJavascript('closePopupAndReloadParent();');
+
+ return;
+}
+
+// There is a lot of common code in the create and update cases…
+// …and also in the admin_media_upload.php script
+
+switch ($action) {
+case 'create': // Save the information from the “showcreateform” action
+ $controller->setPageTitle(I18N::translate('Create a media object'));
+
+ // Validate the media folder
+ $folderName = str_replace('\\', '/', $folder);
+ $folderName = trim($folderName, '/');
+ if ($folderName == '.') {
+ $folderName = '';
+ }
+ if ($folderName) {
+ $folderName .= '/';
+ // Not allowed to use “../”
+ if (strpos('/' . $folderName, '/../') !== false) {
+ FlashMessages::addMessage('Folder names are not allowed to include “../”');
+ break;
+ }
+ }
+
+ // Make sure the media folder exists
+ if (!is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY)) {
+ if (File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY)) {
+ FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY)));
+ } else {
+ FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY)), 'danger');
+ break;
+ }
+ }
+
+ // Managers can create new media paths (subfolders). Users must use existing folders.
+ if ($folderName && !is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)) {
+ if (Auth::isManager($WT_TREE)) {
+ if (File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)) {
+ FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)));
+ } else {
+ FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)), 'danger');
+ break;
+ }
+ } else {
+ // Regular users should not have seen this option - so no need for an error message.
+ break;
+ }
+ }
+
+ // The media folder exists. Now create a thumbnail folder to match it.
+ if (!is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)) {
+ if (!File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)) {
+ FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)), 'danger');
+ break;
+ }
+ }
+
+ // A thumbnail file with no main image?
+ if (!empty($_FILES['thumbnail']['name']) && empty($_FILES['mediafile']['name'])) {
+ // Assume the user used the wrong field, and treat this as a main image
+ $_FILES['mediafile'] = $_FILES['thumbnail'];
+ unset($_FILES['thumbnail']);
+ }
+
+ // Thumbnail files must contain images.
+ if (!empty($_FILES['thumbnail']['name']) && !preg_match('/^image/', $_FILES['thumbnail']['type'])) {
+ FlashMessages::addMessage(I18N::translate('Thumbnail files must contain images.'));
+ break;
+ }
+
+ // User-specified filename?
+ if ($tag[0] == 'FILE' && $text[0]) {
+ $filename = $text[0];
+ }
+ // Use the name of the uploaded file?
+ // If no filename specified, use the name of the uploaded file?
+ if (!$filename && !empty($_FILES['mediafile']['name'])) {
+ $filename = $_FILES['mediafile']['name'];
+ }
+
+ // Validate the media path and filename
+ if (preg_match('/^https?:\/\//i', $text[0], $match)) {
+ // External media needs no further validation
+ $fileName = $filename;
+ $folderName = '';
+ unset($_FILES['mediafile'], $_FILES['thumbnail']);
+ } elseif (preg_match('/([\/\\\\<>])/', $filename, $match)) {
+ // Local media files cannot contain certain special characters
+ FlashMessages::addMessage(I18N::translate('Filenames are not allowed to contain the character “%s”.', $match[1]));
+ break;
+ } elseif (preg_match('/(\.(php|pl|cgi|bash|sh|bat|exe|com|htm|html|shtml))$/i', $filename, $match)) {
+ // Do not allow obvious script files.
+ FlashMessages::addMessage(I18N::translate('Filenames are not allowed to have the extension “%s”.', $match[1]));
+ break;
+ } elseif (!$filename) {
+ FlashMessages::addMessage(I18N::translate('No media file was provided.'));
+ break;
+ } else {
+ $fileName = $filename;
+ }
+
+ // Now copy the file to the correct location.
+ if (!empty($_FILES['mediafile']['name'])) {
+ $serverFileName = WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName . $fileName;
+ if (file_exists($serverFileName)) {
+ FlashMessages::addMessage(I18N::translate('The file %s already exists. Use another filename.', $folderName . $fileName));
+ break;
+ }
+ if (move_uploaded_file($_FILES['mediafile']['tmp_name'], $serverFileName)) {
+ Log::addMediaLog('Media file ' . $serverFileName . ' uploaded');
+ } else {
+ FlashMessages::addMessage(
+ I18N::translate('There was an error uploading your file.') .
+ ' ' .
+ Functions::fileUploadErrorText($_FILES['mediafile']['error'])
+ );
+ break;
+ }
+
+ // Now copy the (optional) thumbnail
+ if (!empty($_FILES['thumbnail']['name']) && preg_match('/^image\/(png|gif|jpeg)/', $_FILES['thumbnail']['type'], $match)) {
+ // Thumbnails have either
+ // (a) the same filename as the main image
+ // (b) the same filename as the main image - but with a .png extension
+ if ($match[1] == 'png' && !preg_match('/\.(png)$/i', $fileName)) {
+ $thumbFile = preg_replace('/\.[a-z0-9]{3,5}$/', '.png', $fileName);
+ } else {
+ $thumbFile = $fileName;
+ }
+ $serverFileName = WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName . $thumbFile;
+ if (move_uploaded_file($_FILES['thumbnail']['tmp_name'], $serverFileName)) {
+ Log::addMediaLog('Thumbnail file ' . $serverFileName . ' uploaded');
+ }
+ }
+ }
+
+ $controller->pageHeader();
+ // Build the gedcom record
+ $newged = "0 @new@ OBJE";
+ if ($tag[0] == 'FILE') {
+ // The admin has an edit field to change the filename
+ $text[0] = $folderName . $fileName;
+ } else {
+ // Users keep the original filename
+ $newged .= "\n1 FILE " . $folderName . $fileName;
+ }
+
+ $newged = FunctionsEdit::handleUpdates($newged);
+
+ $new_media = $WT_TREE->createRecord($newged);
+ if ($linktoid) {
+ $record = GedcomRecord::getInstance($linktoid, $WT_TREE);
+ $record->createFact('1 OBJE @' . $new_media->getXref() . '@', true);
+ Log::addEditLog('Media ID ' . $new_media->getXref() . " successfully added to $linktoid.");
+ $controller->addInlineJavascript('closePopupAndReloadParent();');
+ } else {
+ Log::addEditLog('Media ID ' . $new_media->getXref() . ' successfully added.');
+ $controller->addInlineJavascript('openerpasteid("' . $new_media->getXref() . '");');
+ }
+ echo '';
+
+ return;
+
+case 'update': // Save the information from the “editmedia” action
+ $controller->setPageTitle(I18N::translate('Edit the media object'));
+
+ // Validate the media folder
+ $folderName = str_replace('\\', '/', $folder);
+ $folderName = trim($folderName, '/');
+ if ($folderName == '.') {
+ $folderName = '';
+ }
+ if ($folderName) {
+ $folderName .= '/';
+ // Not allowed to use “../”
+ if (strpos('/' . $folderName, '/../') !== false) {
+ FlashMessages::addMessage('Folder names are not allowed to include “../”');
+ break;
+ }
+ }
+
+ // Make sure the media folder exists
+ if (!is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY)) {
+ if (File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY)) {
+ FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY)));
+ } else {
+ FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY)), 'danger');
+ break;
+ }
+ }
+
+ // Managers can create new media paths (subfolders). Users must use existing folders.
+ if ($folderName && !is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)) {
+ if (Auth::isManager($WT_TREE)) {
+ if (File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)) {
+ FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)));
+ } else {
+ FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)), 'danger');
+ break;
+ }
+ } else {
+ // Regular users should not have seen this option - so no need for an error message.
+ break;
+ }
+ }
+
+ // The media folder exists. Now create a thumbnail folder to match it.
+ if (!is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)) {
+ if (!File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)) {
+ FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)), 'danger');
+ break;
+ }
+ }
+
+ // Validate the media path and filename
+ if (preg_match('/^https?:\/\//i', $filename, $match)) {
+ // External media needs no further validation
+ $fileName = $filename;
+ $folderName = '';
+ unset($_FILES['mediafile'], $_FILES['thumbnail']);
+ } elseif (preg_match('/([\/\\\\<>])/', $filename, $match)) {
+ // Local media files cannot contain certain special characters
+ FlashMessages::addMessage(I18N::translate('Filenames are not allowed to contain the character “%s”.', $match[1]));
+ break;
+ } elseif (preg_match('/(\.(php|pl|cgi|bash|sh|bat|exe|com|htm|html|shtml))$/i', $filename, $match)) {
+ // Do not allow obvious script files.
+ FlashMessages::addMessage(I18N::translate('Filenames are not allowed to have the extension “%s”.', $match[1]));
+ break;
+ } elseif (!$filename) {
+ FlashMessages::addMessage(I18N::translate('No media file was provided.'));
+ break;
+ } else {
+ $fileName = $filename;
+ }
+
+ $oldFilename = $media->getFilename();
+ $newFilename = $folderName . $fileName;
+
+ // Cannot rename local to external or vice-versa
+ if (Functions::isFileExternal($oldFilename) != Functions::isFileExternal($filename)) {
+ FlashMessages::addMessage(I18N::translate('The media file %1$s could not be renamed to %2$s.', Html::filename($oldFilename), Html::filename($newFilename)));
+ break;
+ }
+
+ $messages = false;
+ $move_file = false;
+
+ // Move files on disk (if we can) to reflect the change to the GEDCOM data
+ if (!$media->isExternal()) {
+ $oldServerFile = $media->getServerFilename('main');
+ $oldServerThumb = $media->getServerFilename('thumb');
+
+ $newmedia = new Media("xxx", "0 @xxx@ OBJE\n1 FILE " . $newFilename, null, $WT_TREE);
+ $newServerFile = $newmedia->getServerFilename('main');
+ $newServerThumb = $newmedia->getServerFilename('thumb');
+
+ // We could be either renaming an existing file, or updating a record (with no valid file) to point to a new file
+ if ($oldServerFile !== $newServerFile) {
+ //-- check if the file is used in more than one gedcom
+ //-- do not allow it to be moved or renamed if it is
+ if (!$media->isExternal() && FunctionsDb::isMediaUsedInOtherTree($media->getFilename(), $WT_TREE->getTreeId())) {
+ FlashMessages::addMessage(I18N::translate('This file is linked to another family tree on this server. It cannot be deleted, moved, or renamed until these links have been removed.'));
+ break;
+ }
+
+ $move_file = true;
+ if (!file_exists($newServerFile) || md5_file($oldServerFile) === md5_file($newServerFile)) {
+ try {
+ rename($oldServerFile, $newServerFile);
+ FlashMessages::addMessage(I18N::translate('The media file %1$s has been renamed to %2$s.', Html::filename($oldFilename), Html::filename($newFilename)));
+ } catch (\ErrorException $ex) {
+ FlashMessages::addMessage(I18N::translate('The media file %1$s could not be renamed to %2$s.', Html::filename($oldFilename), Html::filename($newFilename)));
+ }
+ $messages = true;
+ }
+ if (!file_exists($newServerFile)) {
+ FlashMessages::addMessage(I18N::translate('The media file %s does not exist.', Html::filename($newFilename)));
+ $messages = true;
+ }
+ }
+ if ($oldServerThumb != $newServerThumb) {
+ $move_file = true;
+ if (!file_exists($newServerThumb) || md5_file($oldServerFile) == md5_file($newServerThumb)) {
+ try {
+ rename($oldServerThumb, $newServerThumb);
+ FlashMessages::addMessage(I18N::translate('The thumbnail file %1$s has been renamed to %2$s.', Html::filename($oldFilename), Html::filename($newFilename)));
+ } catch (\ErrorException $ex) {
+ FlashMessages::addMessage(I18N::translate('The thumbnail file %1$s could not be renamed to %2$s.', Html::filename($oldFilename), Html::filename($newFilename)));
+ }
+ $messages = true;
+ }
+ if (!file_exists($newServerThumb)) {
+ FlashMessages::addMessage(I18N::translate('The thumbnail file %s does not exist.', Html::filename($newFilename)));
+ $messages = true;
+ }
+ }
+ }
+
+ // Insert the 1 FILE xxx record into the arrays used by function FunctionsEdit::handle_updatesges()
+ $glevels = array_merge(array('1'), $glevels);
+ $tag = array_merge(array('FILE'), $tag);
+ $islink = array_merge(array(0), $islink);
+ $text = array_merge(array($newFilename), $text);
+
+ $record = GedcomRecord::getInstance($pid, $WT_TREE);
+ $newrec = "0 @$pid@ OBJE\n";
+ $newrec = FunctionsEdit::handleUpdates($newrec);
+ $record->updateRecord($newrec, $update_CHAN);
+
+ if ($move_file) {
+ // We've moved a file. Therefore we must approve the change, as rejecting
+ // the change will create broken references.
+ FunctionsImport::acceptAllChanges($record->getXref(), $record->getTree()->getTreeId());
+ }
+
+ if ($pid && $linktoid) {
+ $record = GedcomRecord::getInstance($linktoid, $WT_TREE);
+ $record->createFact('1 OBJE @' . $pid . '@', true);
+ Log::addEditLog('Media ID ' . $pid . " successfully added to $linktoid.");
+ }
+ $controller->pageHeader();
+ if ($messages) {
+ echo '';
+ } else {
+ $controller->addInlineJavascript('closePopupAndReloadParent();');
+ }
+
+ return;
+case 'showmediaform':
+ $controller->setPageTitle(I18N::translate('Create a media object'));
+ $action = 'create';
+ break;
+case 'editmedia':
+ $controller->setPageTitle(I18N::translate('Edit the media object'));
+ $action = 'update';
+ break;
+default:
+ throw new \Exception('Bad $action (' . $action . ') in addmedia.php');
+}
+
+$controller->pageHeader();
+
+echo '
';
+ echo I18N::translate('Media file to upload');
+ echo '
';
+ echo '
';
+ echo '';
+ echo '
';
+ echo '
';
+ echo I18N::translate('Thumbnail to upload');
+ echo '
';
+ echo '
';
+ echo '';
+ if ($i === 1) {
+ echo '
', I18N::translate('Choose the thumbnail image that you want to upload. Although thumbnails can be generated automatically for images, you may wish to generate your own thumbnail, especially for other media types. For example, you can provide a still image from a video, or a photograph of the individual who made an audio recording.'), '
';
+ }
+ echo '
';
+
+ if (Auth::isManager($WT_TREE)) {
+ echo '
';
+ echo I18N::translate('Filename on server');
+ echo '
';
+ echo '
';
+ echo '';
+ if ($i == 1) {
+ echo '
', I18N::translate('Do not change to keep original filename.'), "
";
+ echo '
', I18N::translate('The media file you are uploading can be, and probably should be, named differently on the server than it is on your local computer. This is so because often the local filename has meaning to you but is much less meaningful to others visiting this website. Consider also the possibility that you and someone else both try to upload different files called “granny.jpg“.
In this field, you specify the new name of the file you are uploading. The name you enter here will also be used to name the thumbnail, which can be uploaded separately or generated automatically. You do not need to enter the filename extension (jpg, gif, pdf, doc, etc.)
Leave this field blank to keep the original name of the file you have uploaded from your local computer.'), '
+
+
diff --git a/sources/admin_modules.php b/sources/admin_modules.php
new file mode 100644
index 0000000..b061ab4
--- /dev/null
+++ b/sources/admin_modules.php
@@ -0,0 +1,263 @@
+.
+ */
+namespace Fisharebest\Webtrees;
+
+use Fisharebest\Webtrees\Controller\PageController;
+use Fisharebest\Webtrees\Functions\FunctionsEdit;
+use Fisharebest\Webtrees\Module\AbstractModule;
+use Fisharebest\Webtrees\Module\ModuleBlockInterface;
+use Fisharebest\Webtrees\Module\ModuleChartInterface;
+use Fisharebest\Webtrees\Module\ModuleConfigInterface;
+use Fisharebest\Webtrees\Module\ModuleMenuInterface;
+use Fisharebest\Webtrees\Module\ModuleReportInterface;
+use Fisharebest\Webtrees\Module\ModuleSidebarInterface;
+use Fisharebest\Webtrees\Module\ModuleTabInterface;
+use Fisharebest\Webtrees\Module\ModuleThemeInterface;
+
+define('WT_SCRIPT_NAME', 'admin_modules.php');
+require 'includes/session.php';
+
+$controller = new PageController;
+$controller
+ ->restrictAccess(Auth::isAdmin())
+ ->setPageTitle(I18N::translate('Module administration'));
+
+$modules = Module::getInstalledModules('disabled');
+$module_status = Database::prepare("SELECT module_name, status FROM `##module`")->fetchAssoc();
+
+uasort($modules, function (AbstractModule $x, AbstractModule $y) {
+ return I18N::strcasecmp($x->getTitle(), $y->getTitle());
+});
+
+if (Filter::post('action') === 'update_mods' && Filter::checkCsrf()) {
+ foreach ($modules as $module) {
+ $new_status = Filter::post('status-' . $module->getName(), '[01]');
+ if ($new_status !== null) {
+ $new_status = $new_status ? 'enabled' : 'disabled';
+ $old_status = $module_status[$module->getName()];
+ if ($new_status !== $old_status) {
+ Database::prepare("UPDATE `##module` SET status=? WHERE module_name=?")->execute(array($new_status, $module->getName()));
+ if ($new_status === 'disabled') {
+ FlashMessages::addMessage(I18N::translate('The module “%s” has been disabled.', $module->getTitle()), 'success');
+ } else {
+ FlashMessages::addMessage(I18N::translate('The module “%s” has been enabled.', $module->getTitle()), 'success');
+ }
+ }
+ }
+ }
+
+ header('Location: ' . WT_BASE_URL . 'admin_modules.php');
+
+ return;
+}
+
+if (Filter::post('action') === 'delete' && Filter::checkCsrf()) {
+ $module_name = Filter::post('module_name');
+ Database::prepare(
+ "DELETE `##block_setting`" .
+ " FROM `##block_setting`" .
+ " JOIN `##block` USING (block_id)" .
+ " JOIN `##module` USING (module_name)" .
+ " WHERE module_name=?"
+ )->execute(array($module_name));
+ Database::prepare(
+ "DELETE `##block`" .
+ " FROM `##block`" .
+ " JOIN `##module` USING (module_name)" .
+ " WHERE module_name=?"
+ )->execute(array($module_name));
+ Database::prepare("DELETE FROM `##module_setting` WHERE module_name=?")->execute(array($module_name));
+ Database::prepare("DELETE FROM `##module_privacy` WHERE module_name=?")->execute(array($module_name));
+ Database::prepare("DELETE FROM `##module` WHERE module_name=?")->execute(array($module_name));
+
+ FlashMessages::addMessage(I18N::translate('The preferences for the module “%s” have been deleted.', $module_name), 'success');
+
+ header('Location: ' . WT_BASE_URL . 'admin_modules.php');
+
+ return;
+}
+
+// The module can’t be found on disk?
+// Don't delete it automatically. It may be temporarily missing, after a re-installation, etc.
+foreach ($module_status as $module_name => $status) {
+ if (!array_key_exists($module_name, $modules)) {
+ $html =
+ I18N::translate('Preferences exist for the module “%s”, but this module no longer exists.', '' . $module_name . '') .
+ '';
+ FlashMessages::addMessage($html, 'warning');
+ }
+}
+
+$controller
+ ->pageHeader()
+ ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
+ ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)
+ ->addInlineJavascript('
+ function reindexMods(id) {
+ jQuery("#" + id + " input").each(
+ function (index, value) {
+ value.value = index+1;
+ });
+ }
+ jQuery("#installed_table").dataTable( {
+ paging: false,
+ ' . I18N::datatablesI18N() . ',
+ sorting: [[ 1, "asc" ]],
+ columns : [
+ { sortable: false, class: "center" },
+ null,
+ null,
+ { class: "center" },
+ { class: "center" },
+ { class: "center" },
+ { class: "center" },
+ { class: "center" },
+ { class: "center" },
+ { class: "center", visible: false } // The Module system does not yet include themes
+ ]
+ });
+ ');
+
+?>
+
+
+
getPageTitle(); ?>
+
+
+
getPageTitle(); ?>
+
+
diff --git a/sources/admin_pgv_to_wt.php b/sources/admin_pgv_to_wt.php
new file mode 100644
index 0000000..452692c
--- /dev/null
+++ b/sources/admin_pgv_to_wt.php
@@ -0,0 +1,1154 @@
+.
+ */
+namespace Fisharebest\Webtrees;
+
+use Fisharebest\Webtrees\Controller\PageController;
+use PDO;
+use PDOException;
+
+/**
+ * Defined in session.php
+ *
+ * @global Tree $WT_TREE
+ */
+global $WT_TREE;
+
+define('WT_SCRIPT_NAME', 'admin_pgv_to_wt.php');
+require './includes/session.php';
+
+// We can only import into an empty system, so deny access if we have already created a gedcom or added users.
+if ($WT_TREE || count(User::all()) > 1) {
+ header('Location: ' . WT_BASE_URL);
+
+ return;
+}
+
+$controller = new PageController;
+$controller
+ ->restrictAccess(Auth::isAdmin())
+ ->setPageTitle(I18N::translate('PhpGedView to webtrees transfer wizard'));
+
+$error = false;
+$PGV_PATH = Filter::post('PGV_PATH');
+
+// We read these variables from PhpGedView's config.php, and set them here in case any are missing.
+$INDEX_DIRECTORY = '';
+$DBHOST = '';
+$DBNAME = '';
+$TBLPREFIX = '';
+$PGV_SCHEMA_VERSION = '';
+$USE_REGISTRATION_MODULE = '';
+$ALLOW_USER_THEMES = '';
+$ALLOW_CHANGE_GEDCOM = '';
+$PGV_SESSION_TIME = '';
+$PGV_SMTP_ACTIVE = '';
+$PGV_SMTP_HOST = '';
+$PGV_SMTP_HELO = '';
+$PGV_SMTP_PORT = '';
+$PGV_SMTP_AUTH = '';
+$PGV_SMTP_AUTH_USER = '';
+$PGV_SMTP_AUTH_PASS = '';
+$PGV_SMTP_SSL = '';
+$PGV_SMTP_FROM_NAME = '';
+
+if ($PGV_PATH) {
+ if (!is_dir($PGV_PATH) || !is_readable($PGV_PATH . '/config.php')) {
+ FlashMessages::addMessage('The specified folder does not contain an installation of PhpGedView.', 'danger');
+ $PGV_PATH = null;
+ } else {
+ // Load the configuration settings
+ $config_php = file_get_contents($PGV_PATH . '/config.php');
+ // The easiest way to do this is to exec() the file - but not lines containing require or PHP tags
+ $config_php = preg_replace(
+ array(
+ '/^\s*(include|require).*/m',
+ '/.*<\?php.*/',
+ '/.*\?>.*/',
+ ), '', $config_php
+ );
+ eval($config_php);
+ // $INDEX_DIRECTORY can be either absolute or relative to the PhpGedView root.
+ if (preg_match('/^(\/|\\|[A-Z]:)/', $INDEX_DIRECTORY)) {
+ $INDEX_DIRECTORY = realpath($INDEX_DIRECTORY) . DIRECTORY_SEPARATOR;
+ } else {
+ $INDEX_DIRECTORY = realpath($PGV_PATH . '/' . $INDEX_DIRECTORY) . DIRECTORY_SEPARATOR;
+ }
+ $wt_config = parse_ini_file(WT_ROOT . 'data/config.ini.php');
+ if ($DBHOST != $wt_config['dbhost']) {
+ FlashMessages::addMessage(I18N::translate('PhpGedView must use the same database as webtrees.', 'danger'));
+ $PGV_PATH = null;
+ unset($wt_config);
+ } else {
+ unset($wt_config);
+ try {
+ $PGV_SCHEMA_VERSION = Database::prepare(
+ "SELECT site_setting_value FROM `{$DBNAME}`.`{$TBLPREFIX}site_setting` WHERE site_setting_name='PGV_SCHEMA_VERSION'"
+ )->fetchOne();
+ if ($PGV_SCHEMA_VERSION < 10) {
+ FlashMessages::addMessage(I18N::translate('The version of %s is too old.', 'PhpGedView'), 'danger');
+ $PGV_PATH = null;
+ } elseif ($PGV_SCHEMA_VERSION > 14) {
+ FlashMessages::addMessage(I18N::translate('The version of %s is too new.', 'PhpGedView'), 'danger');
+ $PGV_PATH = null;
+ }
+ } catch (PDOException $ex) {
+ FlashMessages::addMessage(
+ /* I18N: %s is a database name/identifier */
+ I18N::translate('webtrees cannot connect to the PhpGedView database: %s.', $DBNAME . '@' . $DBHOST) .
+ ' ' .
+ /* I18N: %s is an error message */
+ I18N::translate('MySQL gave the error: %s', $ex->getMessage()), 'danger');
+ $PGV_PATH = null;
+ }
+ }
+ }
+}
+
+if ($PGV_PATH) {
+ // The account we are using is about to be deleted.
+ Session::forget('wt_user');
+}
+
+$controller->pageHeader();
+
+?>
+
+
+
+
getPageTitle(); ?>
+
+
+
getPageTitle(); ?>
+
+ 1) {
+ $html = I18N::translate('PhpGedView might be installed in one of these folders:');
+ foreach ($pgv_dirs as $pgv_dir) {
+ $html .= '
' . Filter::escapeHtml($pgv_dir) . '
';
+ }
+
+ echo Theme::theme()->htmlAlert($html, 'info', true);
+ }
+ ?>
+
+
+ 0 OR gedcom_id>0");
+Database::exec("DELETE FROM `##block` WHERE user_id>0 OR gedcom_id>0");
+Database::exec("DELETE FROM `##message`");
+Database::exec("DELETE FROM `##user_gedcom_setting` WHERE user_id>0");
+Database::exec("DELETE FROM `##user_setting` WHERE user_id>0");
+Database::exec("DELETE FROM `##user` WHERE user_id>0");
+
+////////////////////////////////////////////////////////////////////////////////
+
+echo '
';
+
+ Database::prepare(
+ "INSERT INTO `##gedcom_setting` (gedcom_id, setting_name, setting_value)" .
+ " SELECT gedcom_id, setting_name," .
+ " CASE setting_name" .
+ " WHEN 'THEME_DIR' THEN" .
+ " CASE setting_value" .
+ " WHEN '' THEN ''" .
+ " WHEN 'themes/cloudy/' THEN 'clouds'" .
+ " WHEN 'themes/minimal/' THEN 'minimal'" .
+ " WHEN 'themes/simplyblue/' THEN 'colors'" .
+ " WHEN 'themes/simplygreen/' THEN 'colors'" .
+ " WHEN 'themes/simplyred/' THEN 'colors'" .
+ " WHEN 'themes/xenea/' THEN 'xenea'" .
+ " ELSE 'themes/webtrees/'" . // ocean, simplyred/blue/green, standard, wood
+ " END" .
+ " WHEN 'LANGUAGE' THEN" .
+ " CASE setting_value" .
+ " WHEN 'arabic' THEN 'ar'" .
+ " WHEN 'catalan' THEN 'ca'" .
+ " WHEN 'chinese' THEN 'zh_CN'" .
+ " WHEN 'croatian' THEN 'hr'" .
+ " WHEN 'danish' THEN 'da'" .
+ " WHEN 'dutch' THEN 'nl'" .
+ " WHEN 'english' THEN 'en_US'" .
+ " WHEN 'english-uk' THEN 'en_GB'" . // PhpGedView once had the config for this, but no language files
+ " WHEN 'estonian' THEN 'et'" .
+ " WHEN 'finnish' THEN 'fi'" .
+ " WHEN 'french' THEN 'fr'" .
+ " WHEN 'german' THEN 'de'" .
+ " WHEN 'greek' THEN 'el'" .
+ " WHEN 'hebrew' THEN 'he'" .
+ " WHEN 'hungarian' THEN 'hu'" .
+ " WHEN 'indonesian' THEN 'id'" .
+ " WHEN 'italian' THEN 'it'" .
+ " WHEN 'lithuanian' THEN 'lt'" .
+ " WHEN 'norwegian' THEN 'nn'" .
+ " WHEN 'polish' THEN 'pl'" .
+ " WHEN 'portuguese' THEN 'pt'" .
+ " WHEN 'romainian' THEN 'ro'" .
+ " WHEN 'russian' THEN 'ru'" .
+ " WHEN 'serbian-la' THEN 'sr@Latn'" .
+ " WHEN 'slovak' THEN 'sk'" .
+ " WHEN 'slovenian' THEN 'sl'" .
+ " WHEN 'spanish' THEN 'es'" .
+ " WHEN 'spanish-ar' THEN 'es'" . // webtrees does not yet have this variant
+ " WHEN 'swedish' THEN 'sv'" .
+ " WHEN 'turkish' THEN 'tr'" .
+ " WHEN 'vietnamese' THEN 'vi'" .
+ " ELSE 'en_US'" .
+ " END" .
+ " ELSE setting_value" .
+ " END" .
+ " FROM `{$DBNAME}`.`{$TBLPREFIX}gedcom_setting`" .
+ " WHERE setting_name NOT IN ('HOME_SITE_TEXT', 'HOME_SITE_URL')"
+ )->execute();
+
+ echo '
pgv_user => wt_user…
';
+
+ try {
+ // "INSERT IGNORE" is needed to allow for PhpGedView users with duplicate emails. Only the first will be imported.
+ Database::prepare(
+ "INSERT IGNORE INTO `##user` (user_id, user_name, real_name, email, password)" .
+ " SELECT user_id, user_name, CONCAT_WS(' ', us1.setting_value, us2.setting_value), us3.setting_value, password FROM `{$DBNAME}`.`{$TBLPREFIX}user`" .
+ " LEFT JOIN `{$DBNAME}`.`{$TBLPREFIX}user_setting` us1 USING (user_id)" .
+ " LEFT JOIN `{$DBNAME}`.`{$TBLPREFIX}user_setting` us2 USING (user_id)" .
+ " JOIN `{$DBNAME}`.`{$TBLPREFIX}user_setting` us3 USING (user_id)" .
+ " WHERE us1.setting_name='firstname'" .
+ " AND us2.setting_name='lastname'" .
+ " AND us3.setting_name='email'"
+ )->execute();
+ } catch (PDOException $ex) {
+ // Ignore duplicates
+ }
+
+ echo '
pgv_user_setting => wt_user_setting…
';
+
+ Database::prepare(
+ "INSERT INTO `##user_setting` (user_id, setting_name, setting_value)" .
+ " SELECT user_id, setting_name," .
+ " CASE setting_name" .
+ " WHEN 'language' THEN " .
+ " CASE setting_value" .
+ " WHEN 'arabic' THEN 'ar'" .
+ " WHEN 'catalan' THEN 'ca'" .
+ " WHEN 'chinese' THEN 'zh_CN'" .
+ " WHEN 'croatian' THEN 'hr'" .
+ " WHEN 'danish' THEN 'da'" .
+ " WHEN 'dutch' THEN 'nl'" .
+ " WHEN 'english' THEN 'en_US'" .
+ " WHEN 'english-uk' THEN 'en_GB'" . // PhpGedView once had the config for this, but no language files
+ " WHEN 'estonian' THEN 'et'" .
+ " WHEN 'finnish' THEN 'fi'" .
+ " WHEN 'french' THEN 'fr'" .
+ " WHEN 'german' THEN 'de'" .
+ " WHEN 'greek' THEN 'el'" .
+ " WHEN 'hebrew' THEN 'he'" .
+ " WHEN 'hungarian' THEN 'hu'" .
+ " WHEN 'indonesian' THEN 'id'" .
+ " WHEN 'italian' THEN 'it'" .
+ " WHEN 'lithuanian' THEN 'lt'" .
+ " WHEN 'norwegian' THEN 'nn'" .
+ " WHEN 'polish' THEN 'pl'" .
+ " WHEN 'portuguese' THEN 'pt'" .
+ " WHEN 'romainian' THEN 'ro'" .
+ " WHEN 'russian' THEN 'ru'" .
+ " WHEN 'serbian-la' THEN 'sr@Latn'" .
+ " WHEN 'slovak' THEN 'sk'" .
+ " WHEN 'slovenian' THEN 'sl'" .
+ " WHEN 'spanish' THEN 'es'" .
+ " WHEN 'spanish-ar' THEN 'es'" . // webtrees does not yet have this variant
+ " WHEN 'swedish' THEN 'sv'" .
+ " WHEN 'turkish' THEN 'tr'" .
+ " WHEN 'vietnamese' THEN 'vi'" .
+ " ELSE 'en_US'" .
+ " END" .
+ " WHEN 'theme' THEN" .
+ " CASE setting_value" .
+ " WHEN '' THEN ''" .
+ " WHEN 'themes/cloudy/' THEN 'clouds'" .
+ " WHEN 'themes/minimal/' THEN 'minimal'" .
+ " WHEN 'themes/simplyblue/' THEN 'colors'" .
+ " WHEN 'themes/simplygreen/' THEN 'colors'" .
+ " WHEN 'themes/simplyred/' THEN 'colors'" .
+ " WHEN 'themes/xenea/' THEN 'xenea'" .
+ " ELSE 'themes/webtrees/'" . // ocean, simplyred/blue/green, standard, wood
+ " END" .
+ " ELSE" .
+ " CASE" .
+ " WHEN setting_value IN ('Y', 'yes') THEN 1 WHEN setting_value IN ('N', 'no') THEN 0 ELSE setting_value END" .
+ " END" .
+ " FROM `{$DBNAME}`.`{$TBLPREFIX}user_setting`" .
+ " JOIN `##user` USING (user_id)" .
+ " WHERE setting_name NOT IN ('email', 'firstname', 'lastname', 'loggedin')"
+ )->execute();
+
+ echo '
';
+
+ try {
+ // "INSERT IGNORE" is needed to allow for PhpGedView users with duplicate emails. Only the first will be imported.
+ Database::prepare(
+ "INSERT IGNORE INTO `##user` (user_name, real_name, email, password)" .
+ " SELECT u_username, CONCAT_WS(' ', u_firstname, u_lastname), u_email, u_password FROM `{$DBNAME}`.`{$TBLPREFIX}users`"
+ )->execute();
+ } catch (PDOException $ex) {
+ // This could only fail if;
+ // a) we've already done it (upgrade)
+ // b) it doesn't exist (new install)
+ }
+ echo '
pgv_users => wt_user_setting…
';
+
+ try {
+ Database::prepare(
+ "INSERT INTO `##user_setting` (user_id, setting_name, setting_value)" .
+ " SELECT user_id, 'canadmin', " .
+ " CASE WHEN u_canadmin IN ('Y', 'yes') THEN 1 WHEN u_canadmin IN ('N', 'no') THEN 0 ELSE u_canadmin END" .
+ " FROM `{$DBNAME}`.`{$TBLPREFIX}users`" .
+ " JOIN `##user` ON (user_name=CONVERT(u_username USING utf8) COLLATE utf8_unicode_ci)" .
+ " UNION ALL" .
+ " SELECT user_id, 'verified', " .
+ " CASE WHEN u_verified IN ('Y', 'yes') THEN 1 WHEN u_verified IN ('N', 'no') THEN 0 ELSE u_verified END" .
+ " FROM `{$DBNAME}`.`{$TBLPREFIX}users`" .
+ " JOIN `##user` ON (user_name=CONVERT(u_username USING utf8) COLLATE utf8_unicode_ci)" .
+ " UNION ALL" .
+ " SELECT user_id, 'verified_by_admin', " .
+ " CASE WHEN u_verified_by_admin IN ('Y', 'yes') THEN 1 WHEN u_verified_by_admin IN ('N', 'no') THEN 0 ELSE u_verified_by_admin END" .
+ " FROM `{$DBNAME}`.`{$TBLPREFIX}users`" .
+ " JOIN `##user` ON (user_name=CONVERT(u_username USING utf8) COLLATE utf8_unicode_ci)" .
+ " UNION ALL" .
+ " SELECT user_id, 'language', " .
+ " CASE u_language" .
+ " WHEN 'catalan' THEN 'ca'" .
+ " WHEN 'danish' THEN 'da'" .
+ " WHEN 'dutch' THEN 'nl'" .
+ " WHEN 'english' THEN 'en_US'" .
+ " WHEN 'english-uk' THEN 'en_GB'" . // PhpGedView had the config for en_GB, but no language files
+ " WHEN 'estonian' THEN 'et'" .
+ " WHEN 'finnish' THEN 'fi'" .
+ " WHEN 'french' THEN 'fr'" .
+ " WHEN 'german' THEN 'de'" .
+ " WHEN 'hebrew' THEN 'he'" .
+ " WHEN 'hungarian' THEN 'hu'" .
+ " WHEN 'italian' THEN 'it'" .
+ " WHEN 'norwegian' THEN 'nn'" .
+ " WHEN 'polish' THEN 'pl'" .
+ " WHEN 'portuguese' THEN 'pt'" .
+ " WHEN 'russian' THEN 'ru'" .
+ " WHEN 'slovak' THEN 'sk'" .
+ " WHEN 'slovenian' THEN 'sl'" .
+ " WHEN 'spanish' THEN 'es'" .
+ " WHEN 'swedish' THEN 'sv'" .
+ " WHEN 'turkish' THEN 'tr'" .
+ " ELSE 'en_US'" . // PhpGedView supports other languages that webtrees does not (yet)
+ " END" .
+ " FROM `{$DBNAME}`.`{$TBLPREFIX}users`" .
+ " JOIN `##user` ON (user_name=CONVERT(u_username USING utf8) COLLATE utf8_unicode_ci)" .
+ " UNION ALL" .
+ " SELECT user_id, 'reg_timestamp', u_reg_timestamp" .
+ " FROM `{$DBNAME}`.`{$TBLPREFIX}users`" .
+ " JOIN `##user` ON (user_name=CONVERT(u_username USING utf8) COLLATE utf8_unicode_ci)" .
+ " UNION ALL" .
+ " SELECT user_id, 'reg_hashcode', u_reg_hashcode" .
+ " FROM `{$DBNAME}`.`{$TBLPREFIX}users`" .
+ " JOIN `##user` ON (user_name=CONVERT(u_username USING utf8) COLLATE utf8_unicode_ci)" .
+ " UNION ALL" .
+ " SELECT user_id, 'theme', " .
+ " CASE u_theme" .
+ " WHEN '' THEN ''" .
+ " WHEN 'themes/cloudy/' THEN 'clouds'" .
+ " WHEN 'themes/minimal/' THEN 'minimal'" .
+ " WHEN 'themes/simplyblue/' THEN 'colors'" .
+ " WHEN 'themes/simplygreen/' THEN 'colors'" .
+ " WHEN 'themes/simplyred/' THEN 'colors'" .
+ " WHEN 'themes/xenea/' THEN 'xenea'" .
+ " ELSE 'themes/webtrees/'" . // ocean, simplyred/blue/green, standard, wood
+ " END" .
+ " FROM `{$DBNAME}`.`{$TBLPREFIX}users`" .
+ " JOIN `##user` ON (user_name=CONVERT(u_username USING utf8) COLLATE utf8_unicode_ci)" .
+ " UNION ALL" .
+ " SELECT user_id, 'sessiontime', u_sessiontime" .
+ " FROM `{$DBNAME}`.`{$TBLPREFIX}users`" .
+ " JOIN `##user` ON (user_name=CONVERT(u_username USING utf8) COLLATE utf8_unicode_ci)" .
+ " UNION ALL" .
+ " SELECT user_id, 'contactmethod', u_contactmethod" .
+ " FROM `{$DBNAME}`.`{$TBLPREFIX}users`" .
+ " JOIN `##user` ON (user_name=CONVERT(u_username USING utf8) COLLATE utf8_unicode_ci)" .
+ " UNION ALL" .
+ " SELECT user_id, 'visibleonline', " .
+ " CASE WHEN u_visibleonline IN ('Y', 'yes') THEN 1 WHEN u_visibleonline IN ('N', 'no') THEN 0 ELSE u_visibleonline END" .
+ " FROM `{$DBNAME}`.`{$TBLPREFIX}users`" .
+ " JOIN `##user` ON (user_name=CONVERT(u_username USING utf8) COLLATE utf8_unicode_ci)" .
+ " UNION ALL" .
+ " SELECT user_id, 'comment', u_comment" .
+ " FROM `{$DBNAME}`.`{$TBLPREFIX}users`" .
+ " JOIN `##user` ON (user_name=CONVERT(u_username USING utf8) COLLATE utf8_unicode_ci)" .
+ " UNION ALL" .
+ " SELECT user_id, 'relationship_privacy', " .
+ " CASE WHEN u_relationship_privacy IN ('Y', 'yes') THEN 1 WHEN u_relationship_privacy IN ('N', 'no') THEN 0 ELSE u_relationship_privacy END" .
+ " FROM `{$DBNAME}`.`{$TBLPREFIX}users`" .
+ " JOIN `##user` ON (user_name=CONVERT(u_username USING utf8) COLLATE utf8_unicode_ci)" .
+ " UNION ALL" .
+ " SELECT user_id, 'max_relation_path', u_max_relation_path" .
+ " FROM `{$DBNAME}`.`{$TBLPREFIX}users`" .
+ " JOIN `##user` ON (user_name=CONVERT(u_username USING utf8) COLLATE utf8_unicode_ci)" .
+ " UNION ALL" .
+ " SELECT user_id, 'auto_accept', " .
+ " CASE WHEN u_auto_accept IN ('Y', 'yes') THEN 1 WHEN u_auto_accept IN ('N', 'no') THEN 0 ELSE u_auto_accept END" .
+ " FROM `{$DBNAME}`.`{$TBLPREFIX}users`" .
+ " JOIN `##user` ON (user_name=CONVERT(u_username USING utf8) COLLATE utf8_unicode_ci)"
+ )->execute();
+ } catch (PDOException $ex) {
+ // This could only fail if;
+ // a) we've already done it (upgrade)
+ // b) it doesn't exist (new install)
+ }
+ // Some PhpGedView installations store the u_reg_timestamp in the format "2010-03-07 21:41:07"
+ Database::prepare(
+ "UPDATE `##user_setting` SET setting_value=UNIX_TIMESTAMP(setting_value) WHERE setting_name='reg_timestamp' AND setting_value LIKE '____-__-__ __:__:__'"
+ )->execute();
+ // Some PhpGedView installations have empty/invalid values for reg_timestamp
+ Database::prepare(
+ "UPDATE `##user_setting` SET setting_value=CAST(setting_value AS UNSIGNED) WHERE setting_name='reg_timestamp'"
+ )->execute();
+ echo '