]> 91.132.146.200 Git - insipid.git/commitdiff
fixed import and export from xml
authorBanana <mail@bananas-playground.net>
Tue, 27 Dec 2022 13:41:33 +0000 (14:41 +0100)
committerBanana <mail@bananas-playground.net>
Tue, 27 Dec 2022 13:41:33 +0000 (14:41 +0100)
ChangeLog
webroot/lib/management.class.php
webroot/view/editlink.inc.php

index 34e7b2ca6d0a4d0bc97774ab40a29c455b962d1c..4cb8f6cb8f2d70d2c5e5d3b2ff734525b4ad4144 100644 (file)
--- 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)
 
index 38098ad6b1fb24f608d932fe8dde9e7aba64f387..74c9ab52def27980b90ec41b7ee539063fea525b 100644 (file)
@@ -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) {
index 75cc19e30da0e4819cbbe3b0dae3366d88d3c213..48453c7ec31d238b590c0b62d2f84e41d7e7a454 100644 (file)
@@ -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'])) {