From ea3b619fcd72db3e3c43806926a64580f0e8267c Mon Sep 17 00:00:00 2001 From: Banana Date: Tue, 27 Dec 2022 14:41:33 +0100 Subject: [PATCH] fixed import and export from xml --- ChangeLog | 1 + webroot/lib/management.class.php | 21 ++++++++++++++++----- webroot/view/editlink.inc.php | 3 +-- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 34e7b2c..4cb8f6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ version 2.x - Deathwind Chapel () + Fixed/Updated the creation of the webpage thumbnail using google pagespeed insights api + Fixed search index update + Fixed missing lang property + + Fixed xml ex- and import version 2.8 - Wastelands (2022-12-10) diff --git a/webroot/lib/management.class.php b/webroot/lib/management.class.php index 38098ad..74c9ab5 100644 --- a/webroot/lib/management.class.php +++ b/webroot/lib/management.class.php @@ -733,15 +733,21 @@ class Management { * * @param string $hash * @param Link|null $linkObj Use already existing link obj - * @return bool + * @return string */ - public function exportLinkData(string $hash, Link $linkObj=null): bool { - $ret = false; + public function exportLinkData(string $hash, Link $linkObj=null): string { + $ret = ''; + + if(DEBUG) { + error_log("DEBUG Start to export link with hash $hash"); + } if (!empty($hash)) { $linkData = $this->loadLink($hash, true, true); if (!empty($linkData)) { $data = $linkData; + } elseif(DEBUG) { + error_log("ERROR Could not load link with $hash"); } } elseif(!empty($linkObj) && is_a($linkObj,'Link')) { @@ -749,9 +755,14 @@ class Management { } if(!empty($data) && isset($data['link'])) { + if(DEBUG) { + error_log("DEBUG Using data: ".var_export($data, true)); + } require_once 'lib/import-export.class.php'; $ImEx = new ImportExport(); $ret = $ImEx->createSingleLinkExportXML($data); + } elseif(DEBUG) { + error_log("ERROR Missing link data for hash $hash"); } return $ret; @@ -935,8 +946,8 @@ class Management { $ret = false; if(!empty($id)) { - $queryStr = "SELECT `id` - FROM `" . DB_PREFIX . "_link` + $queryStr = "SELECT `id` + FROM `" . DB_PREFIX . "_link` WHERE `id` = '" . $this->DB->real_escape_string($id) . "'"; $query = $this->DB->query($queryStr); if(!empty($query) && $query->num_rows > 0) { diff --git a/webroot/view/editlink.inc.php b/webroot/view/editlink.inc.php index 75cc19e..48453c7 100644 --- a/webroot/view/editlink.inc.php +++ b/webroot/view/editlink.inc.php @@ -65,7 +65,7 @@ if($_isAwm === true) { $submitFeedback['status'] = 'success'; } -if($_requestMode && $_requestMode == "export") { +if($_requestMode == "export") { $linkObj->load($_id); $_i = $linkObj->getData('id'); @@ -90,7 +90,6 @@ if($_requestMode && $_requestMode == "export") { $submitFeedback['message'] = $T->t('edit.link.export.data.fail'); $submitFeedback['status'] = 'error'; } - } if(isset($_POST['data']) && !empty($_POST['data']) && isset($_POST['editlink'])) { -- 2.39.5