diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..016f8066 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/tests/ diff --git a/.htaccess b/.htaccess index 92933b52..a3ed8893 100644 --- a/.htaccess +++ b/.htaccess @@ -5,4 +5,25 @@ RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l -RewriteRule ^ index.php [QSA,L] \ No newline at end of file +RewriteRule ^ index.php [QSA,L] + +# # Enable these lines when website is slow because of search engine indexation +# BrowserMatchNoCase "claudebot" bad_bot +# BrowserMatchNoCase "facebookexternalhit/1.1" bad_bot +# BrowserMatchNoCase "Python/3.10 aiohttp/3.9.3" bad_bot +# Order Deny,Allow +# Deny from env=bad_bot + +# # Blocking Bot traffic except search bots +# RewriteEngine On +# RewriteCond %{HTTP_USER_AGENT} ^$ [OR] +# RewriteCond %{HTTP_USER_AGENT} (bot|crawl|robot|facebook|spider) +# RewriteCond %{HTTP_USER_AGENT} !(Bing|Google|msn|MSR|Twitter|Yandex|Slurp|DuckDuck|Baidu|Exa) [NC] +# RewriteRule ^ - [F] +# # END Blocking Bot traffic except search bots + +# Explanation of RewriteCond lines: +# Line 1 stops unidentified bots. +# Line 2 stops bots including text: bot, crawl of robot zit. +# Line 3 enables access to robots including text: Bing, Google, etc. +# Line 4 block all useless bots including an acces denied message. \ No newline at end of file diff --git a/admin/admin.css b/admin/admin.css index 695b96da..74c6c587 100644 --- a/admin/admin.css +++ b/admin/admin.css @@ -1,15 +1,4 @@ /* Basic page styles */ -/* dec. 2023 test */ - -/* -html { - height: 100%; - max-height: 100%; - padding: 0; - margin: 0; - border: 0; -} -*/ body.humo { background-color: white; @@ -17,14 +6,6 @@ body.humo { background-repeat: no-repeat; font: 15px Verdana, tahoma, arial, sans-serif; - - /* - height: 100%; - max-height: 100%; - padding: 0; - margin: 0; - border: 0; - */ } #top_website_name { @@ -232,7 +213,7 @@ div.rtlsddm #sub_2 ul { } /* Order boxes (children) */ - +/* TODO it's possible to use bootstrap layout */ .sortable { width: 750px; user-select: none; diff --git a/admin/admin_print.css b/admin/admin_print.css index 692cb17d..05c793bb 100644 --- a/admin/admin_print.css +++ b/admin/admin_print.css @@ -1,28 +1,8 @@ /* TODO: check these items. Probably remove admin_print file */ -/* -html { - padding: 0; - margin: 0; - border: 0; - overflow: visible; -} -*/ - body { background-color: white; background-image: none; - /* - font-family: Trebuchet MS, Arial, sans-serif; - font-size: 14px; - height: auto; - max-height: auto; - overflow: visible; - padding: 0; - margin: 0; - border: 0; - float: none; - */ } .button { diff --git a/admin/controller/edit_addressController.php b/admin/controller/adminAddressController.php similarity index 58% rename from admin/controller/edit_addressController.php rename to admin/controller/adminAddressController.php index 77f4488e..8a60601b 100644 --- a/admin/controller/edit_addressController.php +++ b/admin/controller/adminAddressController.php @@ -1,21 +1,16 @@ editor_cls = new editor_cls; + $this->editor_cls = new Editor_cls; } public function detail($dbh, $tree_id, $db_functions) { - $editAddressModel = new EditAddressModel($dbh); + $editAddressModel = new AdminAddressModel($dbh); $editAddressModel->set_address_id(); $editAddressModel->update_address($dbh, $tree_id, $db_functions, $this->editor_cls); $editAddress['address_id'] = $editAddressModel->get_address_id(); diff --git a/admin/controller/adminCmsPagesController.php b/admin/controller/adminCmsPagesController.php new file mode 100644 index 00000000..879fa0ce --- /dev/null +++ b/admin/controller/adminCmsPagesController.php @@ -0,0 +1,25 @@ +menu_tab(); + + $CMS_pagesModel->add_change_page($dbh); + + $edit_cms_pages['select_page'] = $CMS_pagesModel->get_select_page(); + + $CMS_pagesModel->update_pages($dbh); + + if ($edit_cms_pages['menu_tab'] === 'pages') { + $edit_cms_pages['pages_in_category'] = $CMS_pagesModel->get_pages_in_category($dbh); + + $get_page = $CMS_pagesModel->get_page($dbh); + $edit_cms_pages = array_merge($edit_cms_pages, $get_page); + } + + return $edit_cms_pages; + } +} diff --git a/admin/controller/adminIndexController.php b/admin/controller/adminIndexController.php new file mode 100644 index 00000000..600e0a93 --- /dev/null +++ b/admin/controller/adminIndexController.php @@ -0,0 +1,44 @@ +get_php_version(); + + $index_array1 = $indexModel->database_settings($database_check); + $index_array2 = $indexModel->get_mysql_version($dbh); + $index = array_merge($index, $index_array1, $index_array2); + + // TODO: move to model. + // *** Check if database and tables are ok *** + $index['install_status'] = true; + + if (!$index['database_check']) { + $index['install_status'] = true; + + $index['db_host'] = 'localhost'; + if (isset($_POST['db_host'])) { + $index['db_host'] = $_POST['db_host']; + } + + $index['db_username'] = 'root'; + if (isset($_POST['db_username'])) { + $index['db_username'] = $_POST['db_username']; + } + + $index['db_password'] = ''; + if (isset($_POST['db_password'])) { + $index['db_password'] = $_POST['db_password']; + } + + $index['db_name'] = 'humo-gen'; + if (isset($_POST['db_name'])) { + $index['db_name'] = $_POST['db_name']; + } + } + + return $index; + } +} diff --git a/admin/controller/edit_repositoryController.php b/admin/controller/adminRepositoryController.php similarity index 58% rename from admin/controller/edit_repositoryController.php rename to admin/controller/adminRepositoryController.php index 7977df72..0f0a2a8d 100644 --- a/admin/controller/edit_repositoryController.php +++ b/admin/controller/adminRepositoryController.php @@ -1,21 +1,16 @@ editor_cls = new editor_cls; + $this->editor_cls = new Editor_cls; } public function detail($dbh, $tree_id, $db_functions) { - $editRepositoryModel = new EditorRepositoryModel($dbh); + $editRepositoryModel = new AdminRepositoryModel($dbh); $editRepositoryModel->set_repo_id(); $editRepositoryModel->update_repository($dbh, $tree_id, $db_functions, $this->editor_cls); $editRepository['repo_id'] = $editRepositoryModel->get_repo_id(); diff --git a/admin/controller/adminSettingsController.php b/admin/controller/adminSettingsController.php new file mode 100644 index 00000000..cb0d7fa9 --- /dev/null +++ b/admin/controller/adminSettingsController.php @@ -0,0 +1,23 @@ +get_menu_tab(); + $settings['time_lang'] = $settingsModel->get_timeline_language($humo_option); + $settingsModel->save_settings($dbh, $db_functions, $humo_option, $settings); + + // *** Use a seperate controller for each tab *** + if ($settings['menu_tab'] == 'settings_homepage') { + $settings_homepageModel = new SettingsHomepageModel($dbh); + $settings_homepageModel -> reset_modules($dbh); + $settings_homepageModel -> save_settings_modules($dbh); + $settings_homepageModel -> order_modules($dbh); + + $settings_homepageModel -> save_settings_favorites($dbh); + } + + return $settings; + } +} diff --git a/admin/controller/edit_sourceController.php b/admin/controller/adminSourceController.php similarity index 59% rename from admin/controller/edit_sourceController.php rename to admin/controller/adminSourceController.php index bdad8ce9..56b2f6fc 100644 --- a/admin/controller/edit_sourceController.php +++ b/admin/controller/adminSourceController.php @@ -1,21 +1,16 @@ editor_cls = new editor_cls; + $this->editor_cls = new Editor_cls; } public function detail($dbh, $tree_id, $db_functions) { - $editSourceModel = new EditSourceModel($dbh); + $editSourceModel = new AdminSourceModel($dbh); $editSourceModel->set_source_id($dbh, $tree_id); $editSourceModel->update_source($dbh, $tree_id, $db_functions, $this->editor_cls); $editSource['source_id'] = $editSourceModel->get_source_id(); diff --git a/admin/controller/adminStatisticsController.php b/admin/controller/adminStatisticsController.php new file mode 100644 index 00000000..a509dda1 --- /dev/null +++ b/admin/controller/adminStatisticsController.php @@ -0,0 +1,15 @@ +get_tab(); + + $data = $statisticsModel->get_data($dbh); + $statistics = array_merge($statistics, $data); + + return $statistics; + } +} diff --git a/admin/controller/backupController.php b/admin/controller/backupController.php new file mode 100644 index 00000000..ed5a020c --- /dev/null +++ b/admin/controller/backupController.php @@ -0,0 +1,14 @@ +process_old_files(); + + $backup['upload_status'] = $backupModel->upload_backup_file(); + + return $backup; + } +} diff --git a/admin/controller/edit_cms_pagesController.php b/admin/controller/edit_cms_pagesController.php deleted file mode 100644 index 96f65430..00000000 --- a/admin/controller/edit_cms_pagesController.php +++ /dev/null @@ -1,29 +0,0 @@ -editor_cls = new editor_cls; - } - */ - - public function detail($dbh) - { - $CMS_pagesModel = new CMS_pagesModel($dbh); - - $cms_pages['menu_tab'] = $CMS_pagesModel->menu_tab(); - - $CMS_pagesModel->add_change_page($dbh); - - $cms_pages['select_page'] = $CMS_pagesModel->get_select_page(); - - $CMS_pagesModel->update_pages($dbh); - - return $cms_pages; - } -} diff --git a/admin/controller/editorController.php b/admin/controller/editorController.php index f2705158..0c4fd338 100644 --- a/admin/controller/editorController.php +++ b/admin/controller/editorController.php @@ -1,30 +1,11 @@ set_tree_id($tree_id); -} - - class EditorController { private $editor_cls; public function __construct() { - $this->editor_cls = new editor_cls; + $this->editor_cls = new Editor_cls; } public function detail($dbh, $tree_id, $tree_prefix, $db_functions, $humo_option) diff --git a/admin/controller/extensionsController.php b/admin/controller/extensionsController.php new file mode 100644 index 00000000..0a2b96b4 --- /dev/null +++ b/admin/controller/extensionsController.php @@ -0,0 +1,21 @@ +get_theme_folders(); + + $extensionsModel->save_settings($db_functions, $humo_option, $language_file, $extensions); + + + // *** Re-read variables after changing them *** + // *** Don't use include_once! Otherwise the old value will be shown *** + include(__DIR__ . "/../../include/settings_global.php"); //variables + $extensions['hide_languages'] = explode(";", $humo_option["hide_languages"]); + $extensions['hide_themes'] = explode(";", $humo_option["hide_themes"]); + + + return $extensions; + } +} diff --git a/admin/controller/gedcom_exportController.php b/admin/controller/gedcomExportController.php similarity index 88% rename from admin/controller/gedcom_exportController.php rename to admin/controller/gedcomExportController.php index 00955688..094f273d 100644 --- a/admin/controller/gedcom_exportController.php +++ b/admin/controller/gedcomExportController.php @@ -1,7 +1,5 @@ db_functions = $db_functions; - } - */ - public function detail($dbh) { $groupsModel = new GroupsModel($dbh); diff --git a/admin/controller/index_adminController.php b/admin/controller/index_adminController.php deleted file mode 100644 index ff639908..00000000 --- a/admin/controller/index_adminController.php +++ /dev/null @@ -1,31 +0,0 @@ -editor_cls = new editor_cls; - } - */ - - public function detail($database_check, $dbh) - { - $indexModel = new IndexModel(); - - $index['php_version'] = $indexModel->get_php_version(); - - $index_array1 = $indexModel->database_settings($database_check); - //$index = array_merge($index, $index_array); - - $index_array2 = $indexModel->get_mysql_version($dbh); - //$index = array_merge($index, $index_array); - - $index = array_merge($index, $index_array1, $index_array2); - - return $index; - } -} diff --git a/admin/controller/installController.php b/admin/controller/installController.php new file mode 100644 index 00000000..a2734044 --- /dev/null +++ b/admin/controller/installController.php @@ -0,0 +1,11 @@ +check_tables($dbh); + + return $install; + } +} diff --git a/admin/controller/language_editorController.php b/admin/controller/languageEditorController.php similarity index 71% rename from admin/controller/language_editorController.php rename to admin/controller/languageEditorController.php index d94c422d..99194b6b 100644 --- a/admin/controller/language_editorController.php +++ b/admin/controller/languageEditorController.php @@ -1,17 +1,6 @@ editor_cls = new editor_cls; - } - */ - public function detail($dbh, $humo_option) { $language_model = new LanguageEditorModel($dbh, $humo_option); diff --git a/admin/controller/logController.php b/admin/controller/logController.php index ff77271b..d9ad6a7e 100644 --- a/admin/controller/logController.php +++ b/admin/controller/logController.php @@ -1,17 +1,6 @@ editor_cls = new editor_cls; - } - */ - public function detail($dbh) { $logModel = new LogModel(); diff --git a/admin/controller/main_adminController.php b/admin/controller/main_adminController.php new file mode 100644 index 00000000..0694c828 --- /dev/null +++ b/admin/controller/main_adminController.php @@ -0,0 +1,11 @@ +get_abc(); + + //return $main_admin; + } +} diff --git a/admin/controller/mapsController.php b/admin/controller/mapsController.php index 7a6fcf36..ea3f06d7 100644 --- a/admin/controller/mapsController.php +++ b/admin/controller/mapsController.php @@ -1,17 +1,6 @@ editor_cls = new editor_cls; - } - */ - public function detail($dbh, $db_functions) { $mapsModel = new MapsModel(); diff --git a/admin/controller/notesController.php b/admin/controller/notesController.php index 348d0454..30b78491 100644 --- a/admin/controller/notesController.php +++ b/admin/controller/notesController.php @@ -1,17 +1,6 @@ editor_cls = new editor_cls; - } - */ - public function detail($dbh) { $notesModel = new NotesModel($dbh); diff --git a/admin/controller/edit_rename_placeController.php b/admin/controller/renamePlaceController.php similarity index 62% rename from admin/controller/edit_rename_placeController.php rename to admin/controller/renamePlaceController.php index 9c676949..7936cc79 100644 --- a/admin/controller/edit_rename_placeController.php +++ b/admin/controller/renamePlaceController.php @@ -1,16 +1,11 @@ editor_cls = new editor_cls; + $this->editor_cls = new Editor_cls; } public function detail($dbh, $tree_id) diff --git a/admin/controller/settings_adminController.php b/admin/controller/settings_adminController.php deleted file mode 100644 index 198d5d75..00000000 --- a/admin/controller/settings_adminController.php +++ /dev/null @@ -1,18 +0,0 @@ -get_menu_tab(); - - $settings['time_lang'] = $settingsModel->get_timeline_language($humo_option); - - $settingsModel->save_settings($dbh, $db_functions, $humo_option, $settings); - - return $settings; - } -} diff --git a/admin/controller/thumbsController.php b/admin/controller/thumbsController.php index e0df27ca..6ed41414 100644 --- a/admin/controller/thumbsController.php +++ b/admin/controller/thumbsController.php @@ -1,6 +1,4 @@ editor_cls = new editor_cls; - } - */ - public function detail($dbh, $tree_id, $db_functions, $selected_language) { $treesModel = new TreesModel($dbh); @@ -28,10 +16,12 @@ public function detail($dbh, $tree_id, $db_functions, $selected_language) if ($trees['menu_tab'] == 'tree_main') { include_once(__DIR__ . "/../../include/show_tree_date.php"); include_once(__DIR__ . "/../../views/partial/select_language.php"); - include(__DIR__ . '/../../languages/' . $trees['language2'] . '/language_data.php'); - //require_once __DIR__ . "/../models/tree_admin.php"; + $tree_adminModel = new TreeAdminModel($dbh); + $trees['count_trees'] = $tree_adminModel->count_trees($dbh); + $trees['collation'] = $tree_adminModel->get_collation($dbh); + $trees['language_path'] = 'index.php?page=tree&tree_id=' . $trees['tree_id'] . '&'; } elseif ($trees['menu_tab'] == 'tree_gedcom') { include_once(__DIR__ . "/../include/gedcom_asciihtml.php"); @@ -46,7 +36,6 @@ public function detail($dbh, $tree_id, $db_functions, $selected_language) // Because of processing very large GEDCOM files. @set_time_limit(4000); - require_once __DIR__ . "/../models/gedcom.php"; $gedcomModel = new GedcomModel($dbh); $trees['step'] = $gedcomModel->get_step(); @@ -57,9 +46,20 @@ public function detail($dbh, $tree_id, $db_functions, $selected_language) $trees['gedcom_directory'] = $gedcomModel->get_gedcom_directory(); } } elseif ($trees['menu_tab'] == 'tree_data') { + $trees['tree_pict_path'] = $treesModel->get_tree_pict_path($dbh, $tree_id); + + // *** Check for default path *** + if (substr($trees['tree_pict_path'], 0, 1) === '|') { + $trees['tree_pict_path'] = substr($trees['tree_pict_path'], 1); + $trees['default_path'] = true; + } else { + $trees['default_path'] = false; + } + //require_once __DIR__ . "/../models/tree_data.php"; + //$tree_dataModel = new TreeDataModel($dbh); + //$trees['count_trees'] = $tree_dataModel->count_trees($dbh); } elseif ($trees['menu_tab'] == 'tree_text') { - require_once __DIR__ . "/../models/tree_text.php"; $tree_textModel = new TreeTextModel($dbh); // *** Select language for texts at page *** @@ -68,7 +68,6 @@ public function detail($dbh, $tree_id, $db_functions, $selected_language) $tree_texts = $tree_textModel->get_tree_texts($dbh, $trees['tree_id'], $trees['language']); $trees = array_merge($trees, $tree_texts); } elseif ($trees['menu_tab'] == 'tree_merge') { - require_once __DIR__ . "/../models/tree_merge.php"; $treeMergeModel = new TreeMergeModel($dbh); $trees['relatives_merge'] = $treeMergeModel->get_relatives_merge($dbh, $trees['tree_id']); $treeMergeModel->update_settings($db_functions); // *** Store and reset tree merge settings *** diff --git a/admin/controller/usersController.php b/admin/controller/usersController.php index a610abc1..61930414 100644 --- a/admin/controller/usersController.php +++ b/admin/controller/usersController.php @@ -1,17 +1,6 @@ editor_cls = new editor_cls; - } - */ - public function detail($dbh) { $usersModel = new UsersModel($dbh); diff --git a/admin/images/play_button.png b/admin/images/play_button.png new file mode 100644 index 00000000..6a21c766 Binary files /dev/null and b/admin/images/play_button.png differ diff --git a/admin/include/drag.php b/admin/include/drag.php index 746f6872..b66eed59 100644 --- a/admin/include/drag.php +++ b/admin/include/drag.php @@ -15,10 +15,9 @@ $drag_kind = safe_text_db($_GET["drag_kind"]); - if ($drag_kind == "children") { + if ($drag_kind == "children" && is_numeric($_GET["family_id"])) { $chldstring = safe_text_db($_GET['chldstring']); - $sql = "UPDATE humo_families SET fam_children='" . $chldstring . "' WHERE fam_id='" . safe_text_db($_GET["family_id"]) . "'"; - $result = $dbh->query($sql); + $result = $dbh->query("UPDATE humo_families SET fam_children='" . $chldstring . "' WHERE fam_id='" . $_GET["family_id"] . "'"); } if ($drag_kind == "media") { @@ -26,8 +25,9 @@ $media_arr = explode(";", $mediastring); $counter = count($media_arr); for ($x = 0; $x < $counter; $x++) { - $sql = "UPDATE humo_events SET event_order='" . ($x + 1) . "' WHERE event_id='" . $media_arr[$x] . "'"; - $result = $dbh->query($sql); + if (is_numeric($media_arr[$x])) { + $result = $dbh->query("UPDATE humo_events SET event_order='" . ($x + 1) . "' WHERE event_id='" . $media_arr[$x] . "'"); + } } } @@ -36,8 +36,20 @@ $media_arr = explode(";", $mediastring); $counter = count($media_arr); for ($x = 0; $x < $counter; $x++) { - $sql = "UPDATE humo_connections SET connect_order='" . ($x + 1) . "' WHERE connect_id='" . $media_arr[$x] . "'"; - $result = $dbh->query($sql); + if (is_numeric($media_arr[$x])) { + $result = $dbh->query("UPDATE humo_connections SET connect_order='" . ($x + 1) . "' WHERE connect_id='" . $media_arr[$x] . "'"); + } + } + } + + if ($drag_kind == "trees") { + $mediastring = safe_text_db($_GET['order']); + $media_arr = explode(";", $mediastring); + $counter = count($media_arr); + for ($x = 0; $x < $counter; $x++) { + if (is_numeric($media_arr[$x])) { + $result = $dbh->query("UPDATE humo_trees SET tree_order='" . ($x + 1) . "' WHERE tree_id='" . $media_arr[$x] . "'"); + } } } } diff --git a/admin/include/editor_event_cls.php b/admin/include/editorEvent.php similarity index 89% rename from admin/include/editor_event_cls.php rename to admin/include/editorEvent.php index 0feba65c..3f633250 100644 --- a/admin/include/editor_event_cls.php +++ b/admin/include/editorEvent.php @@ -1,5 +1,5 @@ event_kind == 'baptism_witness' || $data_listDb->event_kind == 'birth_decl_witness' || $data_listDb->event_kind == 'death_decl_witness' || $data_listDb->event_kind == 'burial_witness' || $data_listDb->event_kind == 'marriage_witness' || $data_listDb->event_kind == 'marriage_witness_rel' - //) { - //if ( - // $data_listDb->event_kind == 'baptism_witness' || $data_listDb->event_connect_kind == 'birth_declaration' || $data_listDb->event_connect_kind == 'death_declaration' || $data_listDb->event_kind == 'burial_witness' || $data_listDb->event_kind == 'marriage_witness' || $data_listDb->event_kind == 'marriage_witness_rel' - //) { if ( $data_listDb->event_kind == 'ASSO' || $data_listDb->event_connect_kind == 'birth_declaration' || $data_listDb->event_connect_kind == 'death_declaration' ) { @@ -1070,96 +1031,12 @@ function myFunction() { } } - $extensions_check = substr($path_prefix . $tree_pict_path3 . $data_listDb->event_event, -3, 3); - if (strtolower($extensions_check) === "pdf") { - echo ''; - } elseif (strtolower($extensions_check) === "doc" || strtolower(substr($path_prefix . $tree_pict_path3 . $data_listDb->event_event, -4, 4)) === "docx") { - echo ''; - } - // *** Show AVI Video file *** - elseif ($extensions_check === "avi") { - echo ''; - } - // *** Show WMV Video file *** - elseif ($extensions_check === "wmv") { - echo ''; - } - // *** Show MPG Video file *** - elseif (strtolower($extensions_check) === "mpg") { - echo ''; - } - // *** Show MP4 Video file *** - elseif (strtolower($extensions_check) === "mp4") { - echo ''; - } - // *** Show MOV Video file *** - elseif (strtolower($extensions_check) === "mov") { - echo ''; - } - // *** Show WMA Audio file *** - elseif (strtolower($extensions_check) === "wma") { - echo ''; - } - // *** Show WAV Audio file *** - elseif (strtolower($extensions_check) === "wav") { - echo ''; - } - // *** Show MP3 Audio file *** - elseif (strtolower($extensions_check) === "mp3") { - echo ''; - } - // *** Show MID Audio file *** - elseif (strtolower($extensions_check) === "mid") { - echo ''; - } - // *** Show RAM Audio file *** - elseif (strtolower($extensions_check) === "ram") { - echo ''; - } - // *** Show RA Audio file *** - elseif (strtolower($extensions_check) === ".ra") { - echo ''; - } else { - $show_image = ''; - - // *** No subdirectory: show picture/ thumbnail *** - $thumb_prefix = ''; - if (file_exists($path_prefix . $tree_pict_path3 . 'thumb_' . $data_listDb->event_event)) { - $thumb_prefix = 'thumb_'; - } - $picture = $path_prefix . $tree_pict_path3 . $thumb_prefix . $data_listDb->event_event; - //$tree_pic_path3 is missing for family picture - // echo $path_prefix .'-'. $tree_pict_path3.'-'.$data_listDb->event_event; - // *** Check if picture is in subdirectory *** - // Example: subdir1_test/xy/2022_02_12 Scheveningen.jpg - if ($thumb_prefix === '') { - $dirname = dirname($data_listDb->event_event); // subdir1_test/xy/2022_02_12 - $basename = basename($data_listDb->event_event); // 2022_02_12 Scheveningen.jpg - if (file_exists($path_prefix . $tree_pict_path3 . $dirname . '/thumb_' . $basename)) { - $thumb_prefix = 'thumb_'; - } - $picture = $path_prefix . $tree_pict_path3 . $dirname . '/' . $thumb_prefix . $basename; - } - - if ($data_listDb->event_event && file_exists($picture)) { - // *** Get size of original picture *** - list($width, $height) = getimagesize($picture); - $size = ' style="width:100px"'; - if ($height > $width) { - $size = ' style="height:80px"'; - } - //$show_image= ''; - $show_image = ''; - } else { - $show_image = ''; - } - //Check line above. If thumb if missing, missing picture is shown... + include_once(__DIR__ . '/../../include/give_media_path.php'); - if (!$data_listDb->event_event) { - $show_image = ''; - } - echo $show_image; - } + // echo '' . + // print_thumbnail($path_prefix . $tree_pict_path3, $data_listDb->event_event) . ''; + echo '' . + print_thumbnail($path_prefix . $tree_pict_path3, $data_listDb->event_event) . ''; ?> @@ -1563,8 +1440,6 @@ function myFunction() { @@ -1587,8 +1462,6 @@ function myFunction() { } ?> @@ -1609,18 +1482,19 @@ function myFunction() { if ($data_listDb->event_text && preg_match('/\R/', $data_listDb->event_text)) { $field_text_selected = $field_text_medium; } + ?> + +
+ +
+ +
+
- //$witness_array = array("birth_decl_witness", "baptism_witness", "death_decl_witness", "burial_witness", "marriage_witness", "marriage_witness_rel"); + -
- -
- -
-
-
@@ -1725,15 +1599,59 @@ function myFunction() { } } - if ($event_kind == 'picture' || $event_kind == 'marriage_picture') { + if ($event_kind == 'picture' || $event_kind == 'marriage_picture' || $event_kind == 'source_picture') { + // get subfolders of media dir + $subfolders = glob($path_prefix . $tree_pict_path . '[^.]*', GLOB_ONLYDIR); + $ignore = array('cms', 'slideshow', 'thumbs'); // *** Upload image *** ?> - - - + +
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
set_tree_id($tree_id); if ($gedcomnumber) { diff --git a/admin/include/editor_cls.php b/admin/include/editor_cls.php index 43f483f3..07882039 100644 --- a/admin/include/editor_cls.php +++ b/admin/include/editor_cls.php @@ -1,5 +1,5 @@ query("SELECT * FROM humo_trees WHERE tree_prefix='" . $tree_prefix . "'"); $dataDb = $datasql->fetch(PDO::FETCH_OBJ); @@ -246,161 +250,56 @@ $tree_pict_path = 'media/'; } $dir = $path_prefix . $tree_pict_path; - - // check if this is a category file (file with existing category prefix) and if a subfolder for this category exists, place it there. - $temp = $dbh->query("SHOW TABLES LIKE 'humo_photocat'"); - if ($temp->rowCount()) { // there is a category table - $catgry = $dbh->query("SELECT photocat_prefix FROM humo_photocat WHERE photocat_prefix != 'none' GROUP BY photocat_prefix"); - if ($catgry->rowCount()) { - while ($catDb = $catgry->fetch(PDO::FETCH_OBJ)) { - if ( - is_dir($dir . substr($_FILES['photo_upload']['name'], 0, 2)) && substr($_FILES['photo_upload']['name'], 0, 3) == $catDb->photocat_prefix - ) { // there is a subfolder of this prefix - $dir = $dir . substr($_FILES['photo_upload']['name'], 0, 2) . '/'; // place uploaded file in that subfolder - } - } - } + + $safepath = ''; + $selected_subdir = preg_replace("/[\/\\\\]/", '', $_POST['select_media_folder']); // remove all / and \ + if (array_key_exists(substr($_FILES['photo_upload']['name'], 0, 3), $pcat_dirs)) { // old suffix style categories + $dir .= substr($_FILES['photo_upload']['name'], 0, 2) . '/'; + } elseif (!empty($selected_subdir) && // new user selected dirs/cats + is_dir($dir . $selected_subdir) ) { + $dir .= $selected_subdir . '/'; + $safepath = $selected_subdir . '/'; } - - if ($_FILES['photo_upload']['type'] == "image/pjpeg" || $_FILES['photo_upload']['type'] == "image/jpeg") { - $fault = ""; - - // *** feb. 2023: removed limits *** - // 100000=100kb. - //if($_FILES['photo_upload']['size']>2000000){ $fault=__('Photo too large'); } - - if ($fault === '') { - $picture_original = $dir . $_FILES['photo_upload']['name']; - $picture_original_tmp = $dir . '0_temp.jpg'; - $picture_thumb = $dir . 'thumb_' . $_FILES['photo_upload']['name']; - if (!move_uploaded_file($_FILES['photo_upload']['tmp_name'], $picture_original)) { - echo __('Photo upload failed, check folder rights'); - } else { - // *** Resize uploaded picture and create thumbnail *** - if (strtolower(substr($picture_original, -3)) === "jpg") { - // *** Get width and height of original file *** - list($width, $height) = getimagesize($picture_original); - - // *** If filesize > 2MB: resize image to: height 720px/ width 1280px or: width 1920px/ height 1080px *** - if ($_FILES['photo_upload']['size'] > 2000000 && $height > 1080) { - // *** First rename original file to temp. file name *** - rename($picture_original, $picture_original_tmp); - $newheight = 1080; - $factor = $height / $newheight; - $newwidth = $width / $factor; - $resize_media = imagecreatetruecolor($newwidth, $newheight); - $source = imagecreatefromjpeg($picture_original_tmp); - // *** Resize *** - imagecopyresized($resize_media, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); - @imagejpeg($resize_media, $picture_original); - // *** Remove temp. file *** - unlink($picture_original_tmp); - // *** Recalculate width and height of file, needed for thumbnail *** - list($width, $height) = getimagesize($picture_original); - } - - $create_thumb_height = 120; - $newheight = $create_thumb_height; - $factor = $height / $newheight; - $newwidth = $width / $factor; - - $create_thumb = imagecreatetruecolor($newwidth, $newheight); - $source = imagecreatefromjpeg($picture_original); - - // Resize - imagecopyresized($create_thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); - @imagejpeg($create_thumb, $picture_thumb); - } - - // *** Add picture to array *** - $picture_array[] = $_FILES['photo_upload']['name']; - - // *** Re-order pictures by alphabet *** - @sort($picture_array); - $nr_pictures = count($picture_array); - - // *** Directly connect new media to person or relation *** - if (isset($_POST['person_add_media'])) { - $event_connect_kind = 'person'; - $event_connect_id = $pers_gedcomnumber; - $event_kind = 'picture'; - $event_event = $_FILES['photo_upload']['name']; - $event_gedcom = ''; - } - if (isset($_POST['relation_add_media'])) { - $event_connect_kind = 'family'; - $event_connect_id = $marriage; - $event_kind = 'picture'; - $event_event = $_FILES['photo_upload']['name']; - $event_gedcom = ''; - } - // *** Add event. If event is new, use: $new_event=true. *** - // *** true/false, $event_connect_kind,$event_connect_id,$event_kind,$event_event,$event_gedcom,$event_date,$event_place,$event_text *** - add_event(false, $event_connect_kind, $event_connect_id, $event_kind, $event_event, $event_gedcom, '', '', ''); - } - } else { - print "$fault"; + $picture_original = $dir . $_FILES['photo_upload']['name']; + if (!move_uploaded_file($_FILES['photo_upload']['tmp_name'], $picture_original)) { + echo __('Photo upload failed, check folder rights'); + } elseif (check_media_type($dir, $_FILES['photo_upload']['name'])) { + resize_picture($dir, $_FILES['photo_upload']['name']); // resize only big image files to H=1080px + create_thumbnail($dir, $_FILES['photo_upload']['name']); + // *** Add picture to array *** + $picture_array[] = $_FILES['photo_upload']['name']; + + // *** Re-order pictures by alphabet *** + @sort($picture_array); + $nr_pictures = count($picture_array); + + // *** Directly connect new media to person or relation *** + if (isset($_POST['person_add_media'])) { + $event_connect_kind = 'person'; + $event_connect_id = $pers_gedcomnumber; + $event_kind = 'picture'; + $event_event = $safepath . $_FILES['photo_upload']['name']; + $event_gedcom = ''; } - } elseif ( - $_FILES['photo_upload']['type'] == "audio/mpeg" || $_FILES['photo_upload']['type'] == "audio/mpeg3" || - $_FILES['photo_upload']['type'] == "audio/x-mpeg" || $_FILES['photo_upload']['type'] == "audio/x-mpeg3" || - $_FILES['photo_upload']['type'] == "audio/mpg" || $_FILES['photo_upload']['type'] == "audio/mp3" || - $_FILES['photo_upload']['type'] == "audio/mid" || $_FILES['photo_upload']['type'] == "audio/midi" || - $_FILES['photo_upload']['type'] == "audio/x-midi" || $_FILES['photo_upload']['type'] == "audio/x-ms-wma" || - $_FILES['photo_upload']['type'] == "audio/wav" || $_FILES['photo_upload']['type'] == "audio/x-wav" || - $_FILES['photo_upload']['type'] == "audio/x-pn-realaudio" || $_FILES['photo_upload']['type'] == "audio/x-realaudio" || - $_FILES['photo_upload']['type'] == "application/pdf" || $_FILES['photo_upload']['type'] == "application/msword" || - $_FILES['photo_upload']['type'] == "application/vnd.openxmlformats-officedocument.wordprocessingml.document" || - $_FILES['photo_upload']['type'] == "video/quicktime" || $_FILES['photo_upload']['type'] == "video/x-ms-wmv" || - $_FILES['photo_upload']['type'] == "video/avi" || $_FILES['photo_upload']['type'] == "video/x-msvideo" || - $_FILES['photo_upload']['type'] == "video/msvideo" || $_FILES['photo_upload']['type'] == "video/mpeg" || - $_FILES['photo_upload']['type'] == "video/msvideo" || $_FILES['photo_upload']['type'] == "video/mp4" - - || $_FILES['photo_upload']['type'] == "image/png" // Added in sept. 2023. TODO resize png - ) { - $fault = ""; - - // *** feb. 2023: removed limits *** - // *** Limit to 49MB *** - //if($_FILES['photo_upload']['size']>49000000){ $fault=__('Media too large'); } - - if (!$fault) { - $picture_original = $dir . $_FILES['photo_upload']['name']; - if (!move_uploaded_file($_FILES['photo_upload']['tmp_name'], $picture_original)) { - echo __('Media upload failed, check folder rights'); - } else { - // *** Add picture to array *** - $picture_array[] = $_FILES['photo_upload']['name']; - - // *** Re-order pictures by alphabet *** - @sort($picture_array); - $nr_pictures = count($picture_array); - - // Added in sept. 2023 - // *** Directly connect new media to person or relation *** - if (isset($_POST['person_add_media'])) { - $event_connect_kind = 'person'; - $event_connect_id = $pers_gedcomnumber; - $event_kind = 'picture'; - $event_event = $_FILES['photo_upload']['name']; - $event_gedcom = ''; - } - if (isset($_POST['relation_add_media'])) { - $event_connect_kind = 'family'; - $event_connect_id = $marriage; - $event_kind = 'picture'; - $event_event = $_FILES['photo_upload']['name']; - $event_gedcom = ''; - } - // *** Add event. If event is new, use: $new_event=true. *** - // *** true/false, $event_connect_kind,$event_connect_id,$event_kind,$event_event,$event_gedcom,$event_date,$event_place,$event_text *** - add_event(false, $event_connect_kind, $event_connect_id, $event_kind, $event_event, $event_gedcom, '', '', ''); - } - } else { - echo '' . $fault . ''; + if (isset($_POST['relation_add_media'])) { + $event_connect_kind = 'family'; + $event_connect_id = $marriage; + $event_kind = 'picture'; + $event_event = $safepath . $_FILES['photo_upload']['name']; + $event_gedcom = ''; } + if (isset($_POST['source_add_media'])) { + $event_connect_kind = 'source'; + $event_connect_id = $_POST['source_gedcomnr']; + $event_kind = 'picture'; + $event_event = $safepath . $_FILES['photo_upload']['name']; + $event_gedcom = ''; + } + // *** Add event. If event is new, use: $new_event=true. *** + // *** true/false, $event_connect_kind,$event_connect_id,$event_kind,$event_event,$event_gedcom,$event_date,$event_place,$event_text *** + add_event(false, $event_connect_kind, $event_connect_id, $event_kind, $event_event, $event_gedcom, '', '', ''); } else { - echo '' . __('No valid picture, media or document file') . ''; + echo '' . __('No valid picture, media or document file') . ''; } } @@ -858,6 +757,8 @@ } elseif ($event_connect_kind == 'MARR_REL') { $event_connect_kind = 'MARR_REL'; $event_connect_id = $marriage; + } elseif ($event_connect_kind == 'family') { + $event_connect_id = $marriage; } $sql = "UPDATE humo_events SET event_order='99' WHERE event_tree_id='" . $tree_id . "' @@ -914,6 +815,8 @@ } elseif ($event_connect_kind == 'MARR_REL') { $event_connect_kind = 'MARR_REL'; $event_connect_id = $marriage; + } elseif ($event_connect_kind == 'family') { + $event_connect_id = $marriage; } // TEST @@ -1356,7 +1259,7 @@ $save_source_data = true; } // *** Also save source data if media is added *** -if (isset($_POST['add_source_picture'])) { + if (isset($_POST['source_add_media'])) { $save_source_data = true; } if ($save_source_data) { diff --git a/admin/include/editor_media_select.php b/admin/include/editor_media_select.php index c06d172a..8056dffb 100644 --- a/admin/include/editor_media_select.php +++ b/admin/include/editor_media_select.php @@ -4,6 +4,8 @@ exit; } +include_once(__DIR__ . "/../include/media_inc.php"); + echo '

' . __('Select media') . '

'; $place_item = ''; @@ -91,11 +93,14 @@ function get_dirs($prefx, $path) echo '

' . $selected_picture_folder . '

'; $dh = opendir($selected_picture_folder); - $gd = gd_info(); // certain versions of GD don't handle gifs while (false !== ($filename = readdir($dh))) { if (is_dir($selected_picture_folder . $filename)) { // - } elseif (!in_array($filename, $ignore) && substr($filename, 0, 6) !== 'thumb_') { + } elseif ( + !in_array($filename, $ignore) && + substr($filename, 0, 6) !== 'thumb_' && + substr($filename, 0, 1) !== '.' + ) { // skip hidden files (unix style) // *** stripos = case-insensitive search *** if ($search_quicksearch == '' || $search_quicksearch != '' && stripos($filename, $search_quicksearch) !== false) { $sub_dir = substr($selected_picture_folder, $dirname_start); @@ -111,13 +116,8 @@ function get_dirs($prefx, $path) if (isset($list_filename)) { array_multisort($list_filename_order, $list_filename); foreach ($list_filename as $selected_filename) { - $thumb = ''; - if (is_file($selected_picture_folder . 'thumb_' . $selected_filename)) { - $thumb = 'thumb_'; - } - echo '
'; - echo ''; + echo print_thumbnail($selected_picture_folder, $selected_filename); // *** Replace ' by ′ otherwise a place including a ' character can't be selected *** echo '
' . $sub_dir . $selected_filename . '
'; echo '
'; diff --git a/admin/include/editor_person_select.php b/admin/include/editor_person_select.php index 8f0490f7..c993f1f6 100644 --- a/admin/include/editor_person_select.php +++ b/admin/include/editor_person_select.php @@ -158,8 +158,7 @@ function select_item2(pgn,ppf,pln,pfn,pbdp,pbd,pbp,pddp,pdd,pdp,psx){ //$person = $db_functions->get_person($man_gedcomnumber); } -include(__DIR__ . '/editor_cls.php'); -$editor_cls = new editor_cls; +$editor_cls = new Editor_cls; if ($_GET['person_item'] != 'add_partner' && substr($_GET['person_item'], 0, 10) !== 'add_child_') { while ($person = $person_result->fetch(PDO::FETCH_OBJ)) { diff --git a/admin/include/editor_relation_select.php b/admin/include/editor_relation_select.php index 18dccfcd..e6144ec7 100644 --- a/admin/include/editor_relation_select.php +++ b/admin/include/editor_relation_select.php @@ -20,8 +20,7 @@ $form = 'form1'; } -include(__DIR__ . '/editor_cls.php'); -$editor_cls = new editor_cls; +$editor_cls = new Editor_cls; echo ' '; + } + } + + public function save_settings_modules($dbh) + { + // *** Change Module *** + if (isset($_POST['change_module'])) { + $datasql = $dbh->query("SELECT * FROM humo_settings WHERE setting_variable='template_homepage'"); + while ($dataDb = $datasql->fetch(PDO::FETCH_OBJ)) { + $setting_value = $_POST[$dataDb->setting_id . 'module_status'] . '|' . $_POST[$dataDb->setting_id . 'module_column'] . '|' . $_POST[$dataDb->setting_id . 'module_item']; + if (isset($_POST[$dataDb->setting_id . 'module_option_1'])) { + $setting_value .= '|' . $_POST[$dataDb->setting_id . 'module_option_1']; + } + if (isset($_POST[$dataDb->setting_id . 'module_option_2'])) { + $setting_value .= '|' . $_POST[$dataDb->setting_id . 'module_option_2']; + } + $sql = "UPDATE humo_settings SET setting_value='" . safe_text_db($setting_value) . "' WHERE setting_id=" . safe_text_db($_POST[$dataDb->setting_id . 'id']); + $dbh->query($sql); + } + } + + // *** Remove module *** + if (isset($_GET['remove_module']) && is_numeric($_GET['remove_module'])) { + $datasql = $dbh->query("SELECT * FROM humo_settings WHERE setting_variable='template_homepage' AND setting_id='" . $_GET['remove_module'] . "'"); + $dataDb = $datasql->fetch(PDO::FETCH_OBJ); + $sql = "DELETE FROM humo_settings WHERE setting_id='" . $dataDb->setting_id . "'"; + $dbh->query($sql); + + // *** Re-order links *** + $repair_order = $dataDb->setting_order; + $item = $dbh->query("SELECT * FROM humo_settings WHERE setting_variable='template_homepage' AND setting_order>" . $repair_order); + while ($itemDb = $item->fetch(PDO::FETCH_OBJ)) { + $sql = "UPDATE humo_settings SET setting_order='" . ($itemDb->setting_order - 1) . "' WHERE setting_id=" . $itemDb->setting_id; + $dbh->query($sql); + } + } + + // *** Add module *** + if (isset($_POST['add_module']) && is_numeric($_POST['module_order'])) { + $setting_value = $_POST['module_status'] . "|" . $_POST['module_column'] . "|" . $_POST['module_item']; + $sql = "INSERT INTO humo_settings SET setting_variable='template_homepage', setting_value='" . safe_text_db($setting_value) . "', setting_order='" . $_POST['module_order'] . "'"; + $dbh->query($sql); + } + + if (isset($_GET['mod_up']) && is_numeric($_GET['module_order']) && is_numeric($_GET['id'])) { + // *** Search previous module *** + $item = $dbh->query("SELECT * FROM humo_settings WHERE setting_variable='template_homepage' AND setting_order=" . ($_GET['module_order'] - 1)); + $itemDb = $item->fetch(PDO::FETCH_OBJ); + + // *** Raise previous module *** + $sql = "UPDATE humo_settings SET setting_order='" . $_GET['module_order'] . "' WHERE setting_id='" . $itemDb->setting_id . "'"; + $dbh->query($sql); + + // *** Lower module order *** + $sql = "UPDATE humo_settings SET setting_order='" . ($_GET['module_order'] - 1) . "' WHERE setting_id=" . $_GET['id']; + $dbh->query($sql); + } + + if (isset($_GET['mod_down']) && is_numeric($_GET['module_order']) && is_numeric($_GET['id'])) { + // *** Search next link *** + $item = $dbh->query("SELECT * FROM humo_settings WHERE setting_variable='template_homepage' AND setting_order=" . ($_GET['module_order'] + 1)); + $itemDb = $item->fetch(PDO::FETCH_OBJ); + + // *** Lower previous link *** + $sql = "UPDATE humo_settings SET setting_order='" . $_GET['module_order'] . "' WHERE setting_id='" . $itemDb->setting_id . "'"; + $dbh->query($sql); + + // *** Raise link order *** + $sql = "UPDATE humo_settings SET setting_order='" . ($_GET['module_order'] + 1) . "' WHERE setting_id=" . $_GET['id']; + $dbh->query($sql); + } + } + + public function order_modules($dbh) + { + // *** Automatic group all items: left, center and right items. So it's easier to move items *** + $datasql = $dbh->query("SELECT * FROM humo_settings WHERE setting_variable='template_homepage' ORDER BY setting_order"); + $left = 0; + $center = 0; + $right = 0; + if ($datasql) { + $teller = 0; + // *** Read all items *** + while ($dataDb = $datasql->fetch(PDO::FETCH_OBJ)) { + $dataDb->setting_value .= '|'; // In some cases the last | is missing. TODO: improve saving of settings. + $lijst = explode("|", $dataDb->setting_value); + if ($lijst[1] === 'left') { + $left++; + } + if ($lijst[1] === 'center') { + $center++; + } + if ($lijst[1] === 'right') { + $right++; + } + $item_array[$teller]['id'] = $dataDb->setting_id; + $item_array[$teller]['column'] = $lijst[1]; + $item_array[$teller]['order'] = $dataDb->setting_order; + $teller++; + } + } + + $count_left = 0; + $count_center = $left; + $count_right = $left + $center; + // *** Reorder all items (if new item is added) *** + $counter = count($item_array); + // *** Reorder all items (if new item is added) *** + for ($i = 0; $i < $counter; $i++) { + if ($item_array[$i]['column'] == 'left') { + $count_left++; + if ($item_array[$i]['order'] != $count_left) { + $sql = "UPDATE humo_settings SET setting_order='" . $count_left . "' WHERE setting_id='" . $item_array[$i]['id'] . "'"; + $dbh->query($sql); + } + } + + if ($item_array[$i]['column'] == 'center') { + $count_center++; + if ($item_array[$i]['order'] != $count_center) { + $sql = "UPDATE humo_settings SET setting_order='" . $count_center . "' WHERE setting_id='" . $item_array[$i]['id'] . "'"; + $dbh->query($sql); + } + } + + if ($item_array[$i]['column'] == 'right') { + $count_right++; + if ($item_array[$i]['order'] != $count_right) { + $sql = "UPDATE humo_settings SET setting_order='" . $count_right . "' WHERE setting_id='" . $item_array[$i]['id'] . "'"; + $dbh->query($sql); + } + } + } + } + + public function save_settings_favorites($dbh) + { + // *** Change link *** + if (isset($_POST['change_link'])) { + $datasql = $dbh->query("SELECT * FROM humo_settings WHERE setting_variable='link'"); + while ($dataDb = $datasql->fetch(PDO::FETCH_OBJ)) { + $setting_value = $_POST[$dataDb->setting_id . 'own_code'] . "|" . $_POST[$dataDb->setting_id . 'link_text']; + $sql = "UPDATE humo_settings SET setting_value='" . safe_text_db($setting_value) . "' WHERE setting_id=" . safe_text_db($_POST[$dataDb->setting_id . 'id']); + $dbh->query($sql); + } + } + + // *** Remove link *** + if (isset($_GET['remove_link']) && is_numeric($_GET['remove_link'])) { + $datasql = $dbh->query("SELECT * FROM humo_settings WHERE setting_variable='link' AND setting_id='" . $_GET['remove_link'] . "'"); + $dataDb = $datasql->fetch(PDO::FETCH_OBJ); + $sql = "DELETE FROM humo_settings WHERE setting_id='" . $dataDb->setting_id . "'"; + $dbh->query($sql); + + // *** Re-order links *** + $repair_order = $dataDb->setting_order; + $item = $dbh->query("SELECT * FROM humo_settings WHERE setting_variable='link' AND setting_order>" . $repair_order); + while ($itemDb = $item->fetch(PDO::FETCH_OBJ)) { + $sql = "UPDATE humo_settings SET setting_order='" . ($itemDb->setting_order - 1) . "' WHERE setting_id=" . $itemDb->setting_id; + $dbh->query($sql); + } + } + + // *** Add link *** + if (isset($_POST['add_link']) && is_numeric($_POST['link_order'])) { + $setting_value = $_POST['own_code'] . "|" . $_POST['link_text']; + $sql = "INSERT INTO humo_settings SET setting_variable='link', setting_value='" . safe_text_db($setting_value) . "', setting_order='" . $_POST['link_order'] . "'"; + $dbh->query($sql); + } + + if (isset($_GET['up']) && is_numeric($_GET['link_order']) && is_numeric($_GET['id'])) { + // *** Search previous link *** + $item = $dbh->query("SELECT * FROM humo_settings WHERE setting_variable='link' AND setting_order=" . ($_GET['link_order'] - 1)); + $itemDb = $item->fetch(PDO::FETCH_OBJ); + + // *** Raise previous link *** + $sql = "UPDATE humo_settings SET setting_order='" . $_GET['link_order'] . "' WHERE setting_id='" . $itemDb->setting_id . "'"; + + $dbh->query($sql); + // *** Lower link order *** + $sql = "UPDATE humo_settings SET setting_order='" . ($_GET['link_order'] - 1) . "' WHERE setting_id=" . $_GET['id']; + + $dbh->query($sql); + } + + if (isset($_GET['down']) && is_numeric($_GET['link_order']) && is_numeric($_GET['id'])) { + // *** Search next link *** + $item = $dbh->query("SELECT * FROM humo_settings WHERE setting_variable='link' AND setting_order=" . ($_GET['link_order'] + 1)); + $itemDb = $item->fetch(PDO::FETCH_OBJ); + + // *** Lower previous link *** + $sql = "UPDATE humo_settings SET setting_order='" . safe_text_db($_GET['link_order']) . "' WHERE setting_id='" . $itemDb->setting_id . "'"; + + $dbh->query($sql); + // *** Raise link order *** + $sql = "UPDATE humo_settings SET setting_order='" . ($_GET['link_order'] + 1) . "' WHERE setting_id=" . $_GET['id']; + + $dbh->query($sql); + } + } +} diff --git a/admin/models/thumbs.php b/admin/models/thumbsModel.php similarity index 100% rename from admin/models/thumbs.php rename to admin/models/thumbsModel.php diff --git a/admin/models/treeAdminModel.php b/admin/models/treeAdminModel.php new file mode 100644 index 00000000..ba7231d3 --- /dev/null +++ b/admin/models/treeAdminModel.php @@ -0,0 +1,18 @@ +query("SELECT * FROM humo_trees WHERE tree_prefix!='EMPTY' ORDER BY tree_order"); + return $datasql->rowCount(); + } + + public function get_collation($dbh) + { + // ** Collation of family tree (needed for Swedish etc.) *** + $collation_sql = $dbh->query("SHOW FULL COLUMNS FROM humo_persons WHERE Field = 'pers_firstname'"); + $collationDb = $collation_sql->fetch(PDO::FETCH_OBJ); + return $collationDb->Collation; + } +} diff --git a/admin/models/tree_check.php b/admin/models/treeCheckModel.php similarity index 100% rename from admin/models/tree_check.php rename to admin/models/treeCheckModel.php diff --git a/admin/models/tree_merge.php b/admin/models/treeMergeModel.php similarity index 100% rename from admin/models/tree_merge.php rename to admin/models/treeMergeModel.php diff --git a/admin/models/tree_text.php b/admin/models/treeTextModel.php similarity index 100% rename from admin/models/tree_text.php rename to admin/models/treeTextModel.php diff --git a/admin/models/trees.php b/admin/models/treesModel.php similarity index 89% rename from admin/models/trees.php rename to admin/models/treesModel.php index 877b085d..76368dc6 100644 --- a/admin/models/trees.php +++ b/admin/models/treesModel.php @@ -49,6 +49,17 @@ public function get_menu_tab() return $menu_tab; } + public function get_tree_pict_path($dbh, $tree_id) + { + $data2sql = $dbh->query("SELECT tree_pict_path FROM humo_trees WHERE tree_id=" . $tree_id); + $data2Db = $data2sql->fetch(PDO::FETCH_OBJ); + $tree_pict_path = $data2Db->tree_pict_path; + //if (substr($data2Db->tree_pict_path, 0, 1) === '|') { + // $tree_pict_path = substr($trees['tree_pict_path'], 1); + //} + return $tree_pict_path; + } + public function update_tree($dbh, $db_functions): void { // *** Add family tree *** @@ -216,30 +227,6 @@ public function update_tree($dbh, $db_functions): void } } - if (isset($_GET['up']) && is_numeric($_GET['tree_order']) && is_numeric($_GET['id'])) { - // *** Search previous family tree *** - $item = $dbh->query("SELECT * FROM humo_trees WHERE tree_order=" . ($_GET['tree_order'] - 1)); - $itemDb = $item->fetch(PDO::FETCH_OBJ); - // *** Raise previous family trees *** - $sql = "UPDATE humo_trees SET tree_order='" . safe_text_db($_GET['tree_order']) . "' WHERE tree_id=" . $itemDb->tree_id; - $dbh->query($sql); - // *** Lower tree order *** - $sql = "UPDATE humo_trees SET tree_order='" . safe_text_db($_GET['tree_order'] - 1) . "' WHERE tree_id=" . safe_text_db($_GET['id']); - $dbh->query($sql); - } - - if (isset($_GET['down']) && is_numeric($_GET['tree_order']) && is_numeric($_GET['id'])) { - // *** Search next family tree *** - $item = $dbh->query("SELECT * FROM humo_trees WHERE tree_order=" . ($_GET['tree_order'] + 1)); - $itemDb = $item->fetch(PDO::FETCH_OBJ); - // *** Lower previous family tree *** - $sql = "UPDATE humo_trees SET tree_order='" . safe_text_db($_GET['tree_order']) . "' WHERE tree_id=" . $itemDb->tree_id; - $dbh->query($sql); - // *** Raise tree order *** - $sql = "UPDATE humo_trees SET tree_order='" . safe_text_db($_GET['tree_order'] + 1) . "' WHERE tree_id=" . safe_text_db($_GET['id']); - $dbh->query($sql); - } - if (isset($_POST['add_tree_text'])) { $sql = "INSERT INTO humo_tree_texts SET treetext_tree_id='" . $this->tree_id . "', diff --git a/admin/models/users.php b/admin/models/usersModel.php similarity index 100% rename from admin/models/users.php rename to admin/models/usersModel.php diff --git a/admin/update/install_update.php b/admin/update/install_update.php index 50a857ad..0c02e525 100644 --- a/admin/update/install_update.php +++ b/admin/update/install_update.php @@ -24,8 +24,11 @@ } if (isset($update['up_to_date']) && $update['up_to_date'] == 'yes') { - // *** Show HuMo-genealogy version number *** - echo '

HuMo-genealogy

'; +?> + +

+

HuMo-genealogy

+

'; printf(__('Enable/ disable %s update check.'), 'HuMo-genealogy'); echo '

'; -?> + ?>
onChange="this.form.submit();"> @@ -78,18 +81,20 @@ echo '

'; printf(__('Debug %s update'), 'HuMo-genealogy'); echo '

'; - echo ''; - echo ''; - echo '
'; - echo '

'; + ?> +
+ +


+ ' . __('Automatic update') . ''; - - echo __('Every step can take some time, please be patient and wait till the step is completed!') . '

'; + ?> +

+

+
-*/ + */ printf(__('Step 1) Download and unzip new %s version'), 'HuMo-genealogy'); @@ -135,12 +140,12 @@ echo '">'; printf(__('Download and unzip new %s version'), 'HuMo-genealogy'); echo '
'; + ?> - echo '

'; - printf(__('%s version history'), 'HuMo-genealogy'); - echo '

'; +

- echo '

'; +

+ ' . __('Step 2) Compare existing and update files (no installation yet)...') . '
'; + ?> +

- if ($_GET['step'] == '3') { - echo '
' . __('Step 3) Installation of new files...') . '
'; - } + ' . __('Step 3) Installation of new files...') . '
'; + } - function listFolderFiles($dir, $exclude, $file_array) - { - global $existing_dir_files, $existing_dir, $existing_files; - global $update_dir_files, $update_dir, $update_files; - $ffs = scandir($dir); - foreach ($ffs as $ff) { - if (is_array($exclude) and !in_array($ff, $exclude)) { - if ($ff != '.' && $ff != '..') { - // *** Skip all media files in folders ../media/, ../media/cms/ etc. - if (substr($dir, 0, 8) == '../media' and !is_dir($dir . '/' . $ff) and $ff != 'readme.txt') { - // skip media files - } - // *** Skip all backup files in folder backup_files/ - // ../admin/backup_files/2023_02_11_09_56_humo-genealogy_backup.sql.zip - elseif (substr($dir, 0, 21) == '../admin/backup_files' and !is_dir($dir . '/' . $ff) and $ff != 'readme.txt') { - // skip backup files - } else { - if ($file_array == 'existing_files') { - $existing_dir[] = $dir; - $existing_files[] = $ff; - $existing_dir_files[] = substr($dir . '/' . $ff, 3); + function listFolderFiles($dir, $exclude, $file_array) + { + global $existing_dir_files, $existing_dir, $existing_files; + global $update_dir_files, $update_dir, $update_files; + $ffs = scandir($dir); + foreach ($ffs as $ff) { + if (is_array($exclude) and !in_array($ff, $exclude)) { + if ($ff != '.' && $ff != '..') { + // *** Skip all media files in folders ../media/, ../media/cms/ etc. + if (substr($dir, 0, 8) == '../media' and !is_dir($dir . '/' . $ff) and $ff != 'readme.txt') { + // skip media files + } + // *** Skip all backup files in folder backup_files/ + // ../admin/backup_files/2023_02_11_09_56_humo-genealogy_backup.sql.zip + elseif (substr($dir, 0, 21) == '../admin/backup_files' and !is_dir($dir . '/' . $ff) and $ff != 'readme.txt') { + // skip backup files } else { - $update_dir[] = $dir; - $update_files[] = $ff; - $update_dir_files[] = substr($dir . '/' . $ff, 25); + if ($file_array == 'existing_files') { + $existing_dir[] = $dir; + $existing_files[] = $ff; + $existing_dir_files[] = substr($dir . '/' . $ff, 3); + } else { + $update_dir[] = $dir; + $update_files[] = $ff; + $update_dir_files[] = substr($dir . '/' . $ff, 25); + } + if (is_dir($dir . '/' . $ff)) listFolderFiles($dir . '/' . $ff, $exclude, $file_array); } - if (is_dir($dir . '/' . $ff)) listFolderFiles($dir . '/' . $ff, $exclude, $file_array); } } } } - } - // *** Find all existing HuMo-genealogy files, skip humo-gen_update.zip, humo-gen_update folder and ip_files folders. *** - listFolderFiles('..', array('humo-gen_update.zip', 'humo-gen_update', 'ip_files'), 'existing_files'); + // *** Find all existing HuMo-genealogy files, skip humo-gen_update.zip, humo-gen_update folder and ip_files folders. *** + listFolderFiles('..', array('humo-gen_update.zip', 'humo-gen_update', 'ip_files'), 'existing_files'); - // *** Find all update HuMo-genealogy files, a__ is just some random text (skip items)... *** - listFolderFiles('./update/humo-gen_update', array('a__', 'a__'), 'update_files'); + // *** Find all update HuMo-genealogy files, a__ is just some random text (skip items)... *** + listFolderFiles('./update/humo-gen_update', array('a__', 'a__'), 'update_files'); - echo '

'; - echo ''; - ?> + // TODO
is missing? + echo '
'; + echo ''; + ?>
-' . __('Update new db_login.php file...') . '
'; + +

+ + *** ' . __('The configuration file is not writable! Please change the include/db_login.php file manually.') . ' ***'; @@ -523,10 +532,9 @@ function listFolderFiles($dir, $exclude, $file_array) } if ($_GET['step'] == '2') { - //echo '

'.__('Step 3)').' '.__('Install files!').'
'; - echo '


'; + ?> +


+ query("UPDATE humo_settings SET setting_value='2012-01-01' WHERE setting_variable='update_last_check'"); @@ -558,16 +566,16 @@ function listFolderFiles($dir, $exclude, $file_array) } echo __('There are 2 update methods: automatic and manually.'); + ?> - echo '

'; - printf(__('1) Automatic update of %s'), 'HuMo-genealogy'); - echo '

'; +

+ ' . __('backup page') . '.
'; echo __('b)') . ' ' . __('Start automatic update') . '.
'; + ?> - echo '

'; - printf(__('1) Manual update of %s'), 'HuMo-genealogy'); - echo '

'; +

+ ' . __('backup page') . '.
'; echo __('b) Download the new version: ') . ' '; @@ -581,15 +589,16 @@ function listFolderFiles($dir, $exclude, $file_array) echo ''; } } else { - echo __('Online version check unavailable.'); - // *** Semi-automatic update *** // *** REMARK: to test this, just disable two lines "$content_array" in index.php *** - echo '

' . __('Semi-automatic update') . '

'; - echo __('In some cases the automatic update doesn\'t work. Then use this semi-automatic update method.') . '
'; - printf(__('1. Download a new version of %s.'), 'HuMo-genealogy'); - echo '
' . __('2. Rename the zip file into: humo-gen_update.zip') . '
'; + ?> + +

+
+
+
+ '; - echo __('3. Upload humo-gen_update.zip:') . ' '; - echo ''; - echo '

'; - echo '    ' . __('OR: manually upload the file to folder: admin/update/') . '
'; + ?> +
+ + +

+     
+ '; printf(__('start update of %s.'), 'HuMo-genealogy'); echo '
'; + ?> - // *** Show version *** - echo '

'; - printf(__('%s version history'), 'HuMo-genealogy'); - echo '

'; - printf(__('%s version'), 'HuMo-genealogy'); - echo ' ' . $humo_option["version"]; - echo '

'; + +

+ - // *** Check for HuMo-genealogy beta version SAME CODE AS CODE ABOVE *** - $check = ' checked'; - if ($humo_option['update_last_check'] == 'DISABLED') { - $check = ''; - } - echo '

'; - printf(__('Enable/ disable %s update check.'), 'HuMo-genealogy'); - echo '

'; +

- echo '

'; - echo ' '; - printf(__('Check regularly for %s updates.'), 'HuMo-genealogy'); - echo '
'; +

- //print ''; - print ''; - echo '
'; +
+ + onChange="this.form.submit();"> +
+
+ + +

+ + + + +
+ +
+ - + @@ -75,10 +117,11 @@ function calender($month, $year, $thismonth) $week_number"; // If neccesary skip days at start of month - $First_Day_Of_Month = date("w", mktime(0, 0, 0, $month, 1, $year)); if ($First_Day_Of_Month > "1") { echo '
'; } @@ -87,7 +130,6 @@ function calender($month, $year, $thismonth) echo '
'; } - // Show days $Days_In_Month = cal_days_in_month(CAL_GREGORIAN, $month, $year); $day = 1; $row = 1; @@ -106,14 +148,12 @@ function calender($month, $year, $thismonth) $yesterday = strtotime($date); $today = $yesterday + 86400; - if ($tab == 'visitors') { + if ($statistics['tab'] == 'visitors') { // *** Show visitors *** - $datasql = $dbh->query("SELECT stat_ip_address FROM humo_stat_date - WHERE stat_date_linux > " . $yesterday . " AND stat_date_linux < " . $today . ' GROUP BY stat_ip_address'); + $datasql = $dbh->query("SELECT stat_ip_address FROM humo_stat_date WHERE stat_date_linux > " . $yesterday . " AND stat_date_linux < " . $today . ' GROUP BY stat_ip_address'); } else { // *** Show families *** - $datasql = $dbh->query("SELECT * FROM humo_stat_date - WHERE stat_date_linux > " . $yesterday . " AND stat_date_linux < " . $today); + $datasql = $dbh->query("SELECT * FROM humo_stat_date WHERE stat_date_linux > " . $yesterday . " AND stat_date_linux < " . $today); } if ($datasql) { @@ -123,10 +163,11 @@ function calender($month, $year, $thismonth) // *** Use another colour for present day *** $color = ''; if ($date === $present_day) { - $color = ' bgcolor="#00FFFF"'; + $color = 'bgcolor="#00FFFF"'; } - echo "$day $nr_statistics"; + echo "$day $nr_statistics"; + $day++; if ($day <= $Days_In_Month) { $field++; @@ -151,12 +192,15 @@ function calender($month, $year, $thismonth) // *** Always make 6 rows *** if ($row == 5) { - echo "
"; - } ?> + + +
+ +
-query("SELECT stat_ip_address FROM humo_stat_date - WHERE stat_date_linux > " . $first_day . " AND stat_date_linux < " . $latest_day . " - GROUP BY stat_ip_address"); + WHERE stat_date_linux > " . $first_day . " AND stat_date_linux < " . $latest_day . " GROUP BY stat_ip_address"); } else { // *** Show visited families *** - $datasql = $dbh->query("SELECT * FROM humo_stat_date - WHERE stat_date_linux > " . $first_day . " AND stat_date_linux < " . $latest_day); + $datasql = $dbh->query("SELECT * FROM humo_stat_date WHERE stat_date_linux > " . $first_day . " AND stat_date_linux < " . $latest_day); } if ($datasql) { @@ -243,77 +285,10 @@ function year_graphics($month, $year) $mc = new maxChart($twelve_months); $this_month = date("n"); - if ($tab == 'visitors') { + if ($statistics['tab'] == 'visitors') { $mc->displayChart(__('Visitors'), 1, 700, 200, false, $this_month); } else { $mc->displayChart(__('Visited families in the past 12 months'), 1, 700, 200, false, $this_month); } } -// End statistics - -$tab = 'general_statistics'; -// TODO check these variables (partly from old tab menu) -if (isset($_POST['tab']) && $_POST['tab'] == 'date_statistics') { - $tab = 'date_statistics'; -} -if (isset($_POST['tab']) && $_POST['tab'] == 'visitors') { - $tab = 'visitors'; -} -if (isset($_POST['tab']) && $_POST['tab'] == 'statistics_old') { - $tab = 'statistics_old'; -} -if (isset($_POST['tab']) && $_POST['tab'] == 'remove') { - $tab = 'remove'; -} -if (isset($_GET['tree_id'])) { - $tab = 'statistics_old'; -} - -// *** Bootstrap tab *** -if (isset($_GET['tab'])) { - $tab = $_GET['tab']; -} - -$phpself = 'index.php'; -?> - -

- - - - -
- -
\ No newline at end of file +?> \ No newline at end of file diff --git a/admin/views/backup.php b/admin/views/backup.php index 0a6d2426..d5d1762e 100644 --- a/admin/views/backup.php +++ b/admin/views/backup.php @@ -7,38 +7,21 @@ if (!defined('ADMIN_PAGE')) { exit; } +?> -// *** Move and remove files from previous backup procedure *** -if (file_exists('humo_backup.sql.zip')) { - $new_file_name = 'backup_files/' . date("Y_m_d_H_i", filemtime('humo_backup.sql.zip')) . '_humo-genealogy_backup.sql.zip'; - rename('humo_backup.sql.zip', $new_file_name); - - if (file_exists('downloadbk.php')) { - unlink('downloadbk.php'); - } -} -if (file_exists('backup_tmp/readme.txt')) { - unlink('backup_tmp/readme.txt'); - rmdir('backup_tmp'); -} +

-echo '

'; -printf(__('%s backup'), 'HuMo-genealogy'); -echo '

'; + + + -// *** Upload backup file *** -if (isset($_POST['upload_the_file'])) { - if (substr($_FILES['upload_file']['name'], -4) === ".sql" || substr($_FILES['upload_file']['name'], -8) === ".sql.zip") { - if (move_uploaded_file($_FILES['upload_file']['tmp_name'], './backup_files/' . $_FILES['upload_file']['name'])) { - // file was successfully uploaded... - } else { - echo '' . __('Upload has failed (you may wish to try again or choose to place the file in the admin/backup_files folder yourself with an ftp program or the control panel of your webhost)') . '
'; - } - } else { - echo '' . __('Invalid backup file: has to be file with extension ".sql" or ".sql.zip"') . '
'; - } -} -?> + + +

@@ -103,15 +86,15 @@
-
- +
+

- 0) { @@ -119,41 +102,43 @@ $restore_file = 'backup_files/' . $_POST['select_file']; if (is_file($restore_file)) { // *** restore from backup on server made by HuMo-genealogy backup *** - echo '
' . __('Starting to restore database. This may take some time. Please wait...') . '
'; + ?> +

+ + ?>

- - +
+
+ +
+
+ +
+
-    " . __('No backup file found!') . ''; - } - ?> + +     +

query('SELECT * FROM ' . $table); - $count_text = $result->rowCount(); - if (isset($count_text) and is_numeric($count_text)) { - $total_rows += $count_text; - } - */ - $result = $dbh->query('SELECT COUNT(*) as counter FROM ' . $table); $resultDb = $result->fetch(PDO::FETCH_OBJ); $count_text = $resultDb->counter; if (isset($count_text) and is_numeric($count_text)) { $total_rows += $count_text; } - - //echo $count_text . '!' . $total_rows . '
'; } } $devider = floor($total_rows / 100); @@ -199,7 +174,7 @@ function backup_tables()
-query('SELECT [pers_id/fam_id etc] FROM '.$table); // - In loop get all items. $result = $dbh->query('SELECT * FROM ' . $table); - //$result = $dbh->query('SELECT * FROM `'.$table.'`'); - //$num_fields = $result->columnCount(); $row_result = $dbh->query('SHOW CREATE TABLE ' . $table); - //$row_result = $dbh->query('SHOW CREATE TABLE `'.$table.'`'); $row2 = $row_result->fetch(PDO::FETCH_NUM); $return = "\n\n" . $row2[1] . ";\n\n"; fwrite($handle, $return); @@ -302,12 +274,14 @@ function backup_tables() $zip->addFile($name); $zip->close(); unlink($name); - $name .= '.zip'; // last backup file is always stored in /admin as: humo_backup.sql.zip + $name .= '.zip'; } - echo '
' . __('A backup file was saved to the server. We strongly suggest you download a copy to your computer in case you might need it later.') . '
'; + ?> +
+ query("show tables"); // run the query and assign the result to $result - while ($table = $result->fetch()) { // go through each row that was returned in $result + // wipe contents of database. We don't do this until we know we've got a proper backup file to work with. + $result = $dbh->query("show tables"); + while ($table = $result->fetch()) { $dbh->query("DROP TABLE " . $table[0]); } - //$lines = file($filename); - // Loop through each line // *** Show processed lines *** $line_nr = 0; @@ -348,9 +320,7 @@ function restore_tables($filename) $commit_data = 0; $dbh->beginTransaction(); - //foreach ($lines as $line) { $handle = fopen($filename, "r"); - while (!feof($handle)) { $line = fgets($handle); @@ -362,13 +332,11 @@ function restore_tables($filename) $templine .= $line; // If it has a semicolon at the end, it's the end of the query if (substr(trim($line), -1, 1) === ';') { - // Perform the query try { $dbh->query($templine); } catch (PDOException $e) { print('Error performing query \'' . $templine . '\': ' . $e->getMessage() . '

'); } - // Reset temp variable to empty $templine = ''; } @@ -394,18 +362,15 @@ function restore_tables($filename) } fclose($handle); - //if($original_name != 'humo_backup.sql.zip') { - // // if a file was uploaded to backup_tmp in order to restore, delete it now. - // // if however the restore was made from the last backup (humo_backup.sql.zip) it should always stay in /admin, until replaced by next backup - // unlink($original_name); - //} - // *** The original was a zip file, so we delete the unzipped file *** if ($original_name != $filename) { unlink($filename); } - echo '' . __('Database has been restored successfully!') . '
'; + ?> +
+"; } diff --git a/admin/views/cal_date.php b/admin/views/cal_date.php index 1415361a..26be6c85 100644 --- a/admin/views/cal_date.php +++ b/admin/views/cal_date.php @@ -5,6 +5,25 @@ } $tree_result = $db_functions->get_trees(); + +$db_functions->set_tree_id($tree_id); + +function calculate_person($db_functions, $gedcomnumber) +{ + $pers_cal_date = ''; + $person2_db = $db_functions->get_person($gedcomnumber); + if ($person2_db) { + if ($person2_db->pers_cal_date) { + $pers_cal_date = $person2_db->pers_cal_date; + } elseif ($person2_db->pers_birth_date) { + $pers_cal_date = $person2_db->pers_birth_date; + } elseif ($person2_db->pers_bapt_date) { + $pers_cal_date = $person2_db->pers_bapt_date; + } + $pers_cal_date = substr($pers_cal_date, -4); + } + return $pers_cal_date; +} ?>

@@ -13,9 +32,7 @@ These calculated dates will be used for persons where all dates are missing (no birth, baptise, death or burial dates).
Calculation will be done using birth, baptise, death, burial and marriage dates of persons and these dates of parents and children.'); ?>

-
- - +
@@ -38,32 +55,10 @@

-set_tree_id($tree_id); - - function calculate_person($gedcomnumber) - { - global $db_functions; - $pers_cal_date = ''; - $person2_db = $db_functions->get_person($gedcomnumber); - if ($person2_db) { - if ($person2_db->pers_cal_date) { - $pers_cal_date = $person2_db->pers_cal_date; - } elseif ($person2_db->pers_birth_date) { - $pers_cal_date = $person2_db->pers_birth_date; - } elseif ($person2_db->pers_bapt_date) { - $pers_cal_date = $person2_db->pers_bapt_date; - } - $pers_cal_date = substr($pers_cal_date, -4); - } - return $pers_cal_date; - } -?> - + - diff --git a/admin/views/edit_address.php b/admin/views/edit_address.php index 7686aae4..689fab50 100644 --- a/admin/views/edit_address.php +++ b/admin/views/edit_address.php @@ -11,8 +11,7 @@ $field_text_large = 'style="height: 100px; width:550px"'; -include(__DIR__ . '/../include/editor_event_cls.php'); -$event_cls = new editor_event_cls; +$EditorEvent = new EditorEvent; // *** Editor icon for admin and editor: select family tree *** if (isset($tree_id) && $tree_id) { @@ -28,8 +27,7 @@
-
- + @@ -44,8 +42,7 @@
- - +
+ pers_gedcomnumber == $fam_db->fam_man) { $gedcomnumber = $fam_db->fam_woman; } - $pers_cal_date = calculate_person($gedcomnumber); + $pers_cal_date = calculate_person($db_functions, $gedcomnumber); // *** Check date of children *** if ($pers_cal_date == '' && $fam_db->fam_children) { $children_array = explode(";", $fam_db->fam_children); - $pers_cal_date = calculate_person($children_array[0]); + $pers_cal_date = calculate_person($db_functions, $children_array[0]); if ($pers_cal_date) { $pers_cal_date -= 25; } @@ -131,14 +126,14 @@ function calculate_person($gedcomnumber) // *** Check date of father *** if ($pers_cal_date == '' && $fam_db->fam_man) { - $pers_cal_date = calculate_person($fam_db->fam_man); + $pers_cal_date = calculate_person($db_functions, $fam_db->fam_man); if ($pers_cal_date) { $pers_cal_date += 25; } } // *** Check date of mother *** if ($pers_cal_date == '' && $fam_db->fam_woman) { - $pers_cal_date = calculate_person($fam_db->fam_woman); + $pers_cal_date = calculate_person($db_functions, $fam_db->fam_woman); if ($pers_cal_date) { $pers_cal_date += 25; } @@ -151,22 +146,15 @@ function calculate_person($gedcomnumber) $pers_cal_date -= 60; } } - ?> + pers_gedcomnumber; ?> + pers_firstname; ?> pers_prefix)); ?>pers_lastname; ?> + ' . __('No dates') . '' : ''; ?>
pers_firstname . ' ' . strtolower(str_replace("_", " ", $person_db->pers_prefix)) . $person_db->pers_lastname; - echo ' ' . $pers_cal_date; - if ($pers_cal_date == '') { - echo '' . __('No dates') . ''; - } - echo '
'; - - $sql = "UPDATE humo_persons SET pers_cal_date='" . $pers_cal_date . "' WHERE pers_tree_id='" . $tree_id . "' AND pers_id='" . $person_db->pers_id . "'"; - $dbh->query($sql); + $dbh->query("UPDATE humo_persons SET pers_cal_date='" . $pers_cal_date . "' WHERE pers_tree_id='" . $tree_id . "' AND pers_id='" . $person_db->pers_id . "'"); } - ?> + ?>
- - - + + + query($sql); - $cms_pagesDb = $qry->fetch(PDO::FETCH_OBJ); - //if ($memosoort2Db->website_id==$memosoortDb->menu_website_id){ - // echo ''.$cms_pagesDb->page_title.'
'; - $page_id = $cms_pagesDb->page_id; - $page_text = $cms_pagesDb->page_text; - $page_status = $cms_pagesDb->page_status; - $page_title = $cms_pagesDb->page_title; - $page_menu_id = $cms_pagesDb->page_menu_id; - $page_counter = $cms_pagesDb->page_counter; - $page_edit = 'change'; - } else { - // *** Add new page *** - $page_id = ''; - $page_text = ''; - $page_status = '1'; - $page_title = __('Page title'); - $page_menu_id = ''; - $page_counter = ''; - $page_edit = 'add'; + $previous_page = $cms_pagesDb->page_id; } ?> - -
- '; - echo '' . $path_tmp . '/index.php?page=cms_pages&select_page=', $page_id . '&menu=1
'; - // TODO link below shows menu and footer. Use menu=1 option. - if ($humo_option["url_rewrite"] == "j") { - echo ' ' . __('or') . ': ' . $path_tmp . '/cms_pages/' . $page_id . '?menu=1
'; - } +
- - - fetch(PDO::FETCH_OBJ)) { - // ** Show name of menu/ category *** - if ($cms_pagesDb->page_menu_id == '9999') { - echo ''; - $page_nr = 0; - } elseif ($cms_pagesDb->page_menu_id > 0 && $page_menu_id != $cms_pagesDb->page_menu_id) { - $qry_menu = $dbh->query("SELECT * FROM humo_cms_menu WHERE menu_id='" . $cms_pagesDb->page_menu_id . "'"); - $cmsDb = $qry_menu->fetch(PDO::FETCH_OBJ); - echo ''; - $page_nr = 0; - $page_menu_id = $cms_pagesDb->page_menu_id; - } - $page_nr++; +
+
+ +
* ' . __('Hide page in menu') . ' *
' . $cmsDb->menu_name . '
+ fetch(PDO::FETCH_OBJ)) { + // ** Show name of menu/ category *** + if ($cms_pagesDb->page_menu_id == '9999') { + ?> + + + + page_menu_id > 0 && $edit_cms_pages['page_menu_id'] != $cms_pagesDb->page_menu_id) { + $qry_menu = $dbh->query("SELECT * FROM humo_cms_menu WHERE menu_id='" . $cms_pagesDb->page_menu_id . "'"); + $cmsDb = $qry_menu->fetch(PDO::FETCH_OBJ); ?> - - + page_id; + $page_nr = 0; + $edit_cms_pages['page_menu_id'] = $cms_pagesDb->page_menu_id; } - ?> -
* *
- - <?= __('Remove page'); ?> - - page_id . '">up'; - } - if ($page_nr != $pages_in_category[$cms_pagesDb->page_menu_id]) { - echo ' down'; - } - ?> - - page_title) { - $page_title = $cms_pagesDb->page_title; - } - ?> -
-
menu_name; ?>

- -
+ $page_nr++; + ?> +
+ + <?= __('Remove page'); ?> + + + up + page_menu_id]) { + ?> + down + + + + page_title ? $cms_pagesDb->page_title : '[' . __('No page title') . ']'; ?> + +

+ +
+ +
+
+ +
+ /index.php?page=cms_pages&select_page=&menu=1
+ + : /cms_pages/?menu=1
+ - ?> - - - - - - - - - > - + + + + + + + '; - } + $qry = $dbh->query("SELECT * FROM humo_cms_menu ORDER BY menu_order"); + while ($menuDb = $qry->fetch(PDO::FETCH_OBJ)) { ?> - :
- - - - - + + + + + > + + + + + + + + :
+ + +
+ @@ -240,7 +189,7 @@ } // *** Show and edit menu's *** - if ($cms_pages['menu_tab'] === 'menu') { + if ($edit_cms_pages['menu_tab'] === 'menu') { $qry = $dbh->query("SELECT * FROM humo_cms_menu ORDER BY menu_order"); $count_menu = $qry->rowCount(); ?> @@ -296,11 +245,10 @@ query($sql); + $dbh->query("INSERT INTO humo_settings SET setting_variable='cms_images_path', setting_value='|'"); $cms_images_path = '|'; } else { $cms_images_path = $humo_option["cms_images_path"]; @@ -308,8 +256,7 @@ // *** Automatic installation or update *** if (!isset($humo_option["main_page_cms_id"])) { - $sql = "INSERT INTO humo_settings SET setting_variable='main_page_cms_id', setting_value=''"; - @$dbh->query($sql); + $dbh->query("INSERT INTO humo_settings SET setting_variable='main_page_cms_id', setting_value=''"); $main_page_cms_id = ''; } else { $main_page_cms_id = $humo_option["main_page_cms_id"]; @@ -387,11 +334,12 @@ if (substr($cms_images_path, 0, 1) === '|') { $checked1 = ' checked'; $checked2 = ''; + //$edit_cms_pages['default_path'] = true; } else { $checked1 = ''; $checked2 = ' checked'; + //$edit_cms_pages['default_path'] = false; } - //$tree_pict_path=$data2Db->tree_pict_path; if (substr($cms_images_path, 0, 1) === '|') { $cms_images_path = substr($cms_images_path, 1); } diff --git a/admin/views/edit_repository.php b/admin/views/edit_repository.php index 9a6ec7ab..4f66c23e 100644 --- a/admin/views/edit_repository.php +++ b/admin/views/edit_repository.php @@ -25,8 +25,7 @@
-
- + @@ -53,8 +52,7 @@
- - + +
@@ -117,8 +114,7 @@ } ?> -
- +