Browse Source

Updated extensions for Giovanni

markseu 1 year ago
parent
commit
c77e73c4e7

+ 23 - 2
system/extensions/core.php

@@ -2,7 +2,7 @@
 // Core extension, https://github.com/annaesvensson/yellow-core
 
 class YellowCore {
-    const VERSION = "0.8.131";
+    const VERSION = "0.8.132";
     const RELEASE = "0.8.23";
     public $content;        // content files
     public $media;          // media files
@@ -1456,6 +1456,27 @@ class YellowLookup {
         return $output;
     }
     
+    // Normalise name and email for a single address
+    public function normaliseAddress($input, $type = "mail", $filterStrict = true) {
+        $output = "";
+        if ($type=="mail") {
+            if (preg_match("/^(.*?)(\s*)<(.*?)>$/", $input, $matches)) {
+                $name = $matches[1];
+                $email = $matches[3];
+            } else {
+                $name = "";
+                $email = $input;
+            }
+            $name = preg_replace("/[^\pL\d\-\. ]/u", "", $name);
+            $name = preg_replace("/\s+/s", " ", $name);
+            if ($filterStrict && !preg_match("/^[\w\+\-\.\@]+$/", $email)) {
+                $email = "error-mail-filter";
+            }
+            $output = is_string_empty($name) ? "<$email>" : "$name <$email>";
+        }
+        return $output;
+    }
+    
     // Normalise fields in MIME headers
     public function normaliseHeaders($input, $type = "mime", $filterStrict = true) {
         $output = "";
@@ -1470,7 +1491,7 @@ class YellowLookup {
                             $matches[1] = $matches[2] = "";
                             $matches[3] = $email;
                         }
-                        if ($filterStrict && !preg_match("/[\w\+\-\.\@]+/", $matches[3])) {
+                        if ($filterStrict && !preg_match("/^[\w\+\-\.\@]+$/", $matches[3])) {
                             $matches[3] = "error-mail-filter";
                         }
                         if (substru($text, -2, 2)!=": ") $text .= ",\r\n ";

+ 3 - 3
system/extensions/edit.php

@@ -2,7 +2,7 @@
 // Edit extension, https://github.com/annaesvensson/yellow-edit
 
 class YellowEdit {
-    const VERSION = "0.8.78";
+    const VERSION = "0.8.79";
     public $yellow;         // access to API
     public $response;       // web response
     public $merge;          // text merge
@@ -1605,8 +1605,8 @@ class YellowEditResponse {
         $footer = str_replace("\\n", "\r\n", $footer);
         $footer = preg_replace("/@sitename/i", $sitename, $footer);
         $mailHeaders = array(
-            "To" => "$userName <$userEmail>",
-            "From" => "$sitename <$siteEmail>",
+            "To" => $this->yellow->lookup->normaliseAddress("$userName <$userEmail>"),
+            "From" => $this->yellow->lookup->normaliseAddress("$sitename <$siteEmail>"),
             "Subject" => $subject,
             "Date" => date(DATE_RFC2822),
             "Mime-Version" => "1.0",

+ 6 - 6
system/extensions/update-available.ini

@@ -120,14 +120,14 @@ Status: available
 system/extensions/chinese.php: chinese.php, create, update
 
 Extension: Contact
-Version: 0.8.24
+Version: 0.8.25
 Description: Email contact page.
 Developer: Anna Svensson
 Tag: feature
 DownloadUrl: https://github.com/annaesvensson/yellow-contact/archive/refs/heads/main.zip
 DocumentationUrl: https://github.com/annaesvensson/yellow-contact
 DocumentationLanguage: en, de, sv
-Published: 2024-04-01 19:29:34
+Published: 2024-04-03 18:33:18
 Status: available
 system/extensions/contact.php: contact.php, create, update
 system/layouts/contact.html: contact.html, create, update, careful
@@ -148,14 +148,14 @@ system/themes/copenhagen.css: copenhagen.css, create, update, careful
 system/themes/copenhagen.png: copenhagen.png, create
 
 Extension: Core
-Version: 0.8.131
+Version: 0.8.132
 Description: Core functionality of your website.
 Developer: Anna Svensson
 Tag: feature
 DownloadUrl: https://github.com/annaesvensson/yellow-core/archive/refs/heads/main.zip
 DocumentationUrl: https://github.com/annaesvensson/yellow-core
 DocumentationLanguage: en, de, sv
-Published: 2024-04-02 20:52:39
+Published: 2024-04-03 21:03:27
 Status: available
 system/extensions/core.php: core.php, create, update
 system/layouts/default.html: default.html, create, update, careful
@@ -211,14 +211,14 @@ Status: available
 system/extensions/dutch.php: dutch.php, create, update
 
 Extension: Edit
-Version: 0.8.78
+Version: 0.8.79
 Description: Edit your website in a web browser.
 Developer: Anna Svensson
 Tag: feature
 DownloadUrl: https://github.com/annaesvensson/yellow-edit/archive/refs/heads/main.zip
 DocumentationUrl: https://github.com/annaesvensson/yellow-edit
 DocumentationLanguage: en, de, sv
-Published: 2024-04-01 18:48:05
+Published: 2024-04-03 19:54:42
 Status: available
 system/extensions/edit.php: edit.php, create, update
 system/extensions/edit.css: edit.css, create, update

+ 4 - 4
system/extensions/update-current.ini

@@ -1,14 +1,14 @@
 # Datenstrom Yellow update settings for installed extensions
 
 Extension: Core
-Version: 0.8.131
+Version: 0.8.132
 Description: Core functionality of your website.
 Developer: Anna Svensson
 Tag: feature
 DownloadUrl: https://github.com/annaesvensson/yellow-core/archive/refs/heads/main.zip
 DocumentationUrl: https://github.com/annaesvensson/yellow-core
 DocumentationLanguage: en, de, sv
-Published: 2024-04-02 20:52:39
+Published: 2024-04-03 21:03:27
 Status: available
 system/extensions/core.php: core.php, create, update
 system/layouts/default.html: default.html, create, update, careful
@@ -19,14 +19,14 @@ system/layouts/navigation.html: navigation.html, create, update, careful
 system/layouts/pagination.html: pagination.html, create, update, careful
 
 Extension: Edit
-Version: 0.8.78
+Version: 0.8.79
 Description: Edit your website in a web browser.
 Developer: Anna Svensson
 Tag: feature
 DownloadUrl: https://github.com/annaesvensson/yellow-edit/archive/refs/heads/main.zip
 DocumentationUrl: https://github.com/annaesvensson/yellow-edit
 DocumentationLanguage: en, de, sv
-Published: 2024-04-01 18:48:05
+Published: 2024-04-03 19:54:42
 Status: available
 system/extensions/edit.php: edit.php, create, update
 system/extensions/edit.css: edit.css, create, update