From b72ca8ca8650f160f145f187ddff8f8dc4bdd0a5 Mon Sep 17 00:00:00 2001
From: Stein Magne Bjorklund <steinmb@smbjorklund.com>
Date: Mon, 20 Sep 2021 20:49:00 +0200
Subject: [PATCH] Importer class, getting rid of warnings

---
 classes/Importer.php | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/classes/Importer.php b/classes/Importer.php
index dae575b2..99d45934 100644
--- a/classes/Importer.php
+++ b/classes/Importer.php
@@ -53,7 +53,7 @@ final class Importer
         } elseif (isset($_POST['importtext'])) {
             $parser->parse(RDF, $_POST['importtext']);
         } else {
-            HTTPStatus::send500();
+            HTTPStatus::send500('');
         }
 
         $triples = $parser->getTriples();
@@ -154,7 +154,7 @@ final class Importer
         $content .= "?>\n";
 
         try {
-            $fh = fopen(FILE, 'a');
+            $fh = fopen(FILE, 'ab');
             fwrite($fh, $content);
             fclose($fh);
         } catch (Exception $e) {
@@ -235,7 +235,7 @@ final class Importer
                     chdir($path[$i]);
                 }
 
-                $fh = fopen(end($path), 'w');
+                $fh = fopen(end($path), 'wb');
                 fwrite($fh, $v);
                 fclose($fh);
 
@@ -273,7 +273,7 @@ final class Importer
                     chdir($path[$i]);
                 }
 
-                $fh = fopen(end($path), 'w');
+                $fh = fopen(end($path), 'wb');
                 fwrite($fh, $v);
                 fclose($fh);
 
@@ -311,7 +311,7 @@ final class Importer
                     chdir($path[$i]);
                 }
 
-                $fh = fopen(end($path), 'w');
+                $fh = fopen(end($path), 'wb');
                 fwrite($fh, $v);
                 fclose($fh);
 
@@ -376,7 +376,7 @@ final class Importer
     private function showInterface(): void
     {
         echo <<<HTML
-<html>
+<html lang="eng">
   	<head>
         <title>Importing options</title>
   	</head>
@@ -385,7 +385,7 @@ final class Importer
         You can paste the data obtained from another LODSPeaKr instance here in the box.
         You can also automatize this import by adding a parameter '?import=URL' to this page.
         Usually, the URL will be of the for <pre>https://example.com/export</pre>
-        <form action='import' method='post'>
+        <form action='" . $this->basedir . "/import' method='post'>
             <textarea cols='100' rows='25' name='importtext'></textarea>
             <input type='submit' value='Import'/>
         </form>
-- 
GitLab