Переглянути джерело

Updated edit extension, user accounts with optional user description

markseu 3 роки тому
батько
коміт
fd27fe91ca

+ 14 - 8
system/extensions/edit.php

@@ -2,7 +2,7 @@
 // Edit extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/edit
 
 class YellowEdit {
-    const VERSION = "0.8.57";
+    const VERSION = "0.8.58";
     public $yellow;         // access to API
     public $response;       // web response
     public $merge;          // text merge
@@ -23,8 +23,8 @@ class YellowEdit {
         $this->yellow->system->setDefault("editUserPasswordMinLength", "8");
         $this->yellow->system->setDefault("editUserHashAlgorithm", "bcrypt");
         $this->yellow->system->setDefault("editUserHashCost", "10");
-        $this->yellow->system->setDefault("editUserHome", "/");
         $this->yellow->system->setDefault("editUserAccess", "create, edit, delete, restore, upload");
+        $this->yellow->system->setDefault("editUserHome", "/");
         $this->yellow->system->setDefault("editLoginRestriction", "0");
         $this->yellow->system->setDefault("editLoginSessionTimeout", "2592000");
         $this->yellow->system->setDefault("editBruteForceProtection", "25");
@@ -164,12 +164,14 @@ class YellowEdit {
         }
         if ($status=="ok") {
             $name = $this->yellow->system->get("sitename");
+            $userLanguage = $this->yellow->system->get("language");
             $fileNameUser = $this->yellow->system->get("coreExtensionDirectory").$this->yellow->system->get("coreUserFile");
             $settings = array(
                 "name" => $name,
-                "language" => $this->yellow->system->get("language"),
-                "home" => $this->yellow->system->get("editUserHome"),
+                "description" => $this->yellow->language->getText("editUserDescription", $userLanguage),
+                "language" => $userLanguage,
                 "access" => $this->yellow->system->get("editUserAccess"),
+                "home" => $this->yellow->system->get("editUserHome"),
                 "hash" => $this->response->createHash($password),
                 "stamp" => $this->response->createStamp(),
                 "pending" => "none",
@@ -348,12 +350,14 @@ class YellowEdit {
         if ($this->response->status=="ok" && $this->response->isLoginRestriction()) $this->response->status = "next";
         if ($this->response->status=="ok" && $this->isUserAccountTaken($email)) $this->response->status = "next";
         if ($this->response->status=="ok") {
+            $userLanguage = $this->yellow->lookup->findContentLanguage($fileName, $this->yellow->system->get("language"));
             $fileNameUser = $this->yellow->system->get("coreExtensionDirectory").$this->yellow->system->get("coreUserFile");
             $settings = array(
                 "name" => $name,
-                "language" => $this->yellow->lookup->findContentLanguage($fileName, $this->yellow->system->get("language")),
-                "home" => $this->yellow->system->get("editUserHome"),
+                "description" => $this->yellow->language->getText("editUserDescription", $userLanguage),
+                "language" => $userLanguage,
                 "access" => $this->yellow->system->get("editUserAccess"),
+                "home" => $this->yellow->system->get("editUserHome"),
                 "hash" => $this->response->createHash($password),
                 "stamp" => $this->response->createStamp(),
                 "pending" => "none",
@@ -597,9 +601,10 @@ class YellowEdit {
                 $fileNameUser = $this->yellow->system->get("coreExtensionDirectory").$this->yellow->system->get("coreUserFile");
                 $settings = array(
                     "name" => $name,
+                    "description" => $this->yellow->user->getUser("description", $emailSource),
                     "language" => $language,
-                    "home" => $this->yellow->user->getUser("home", $emailSource),
                     "access" => $this->yellow->user->getUser("access", $emailSource),
+                    "home" => $this->yellow->user->getUser("home", $emailSource),
                     "hash" => $this->response->createHash("none"),
                     "stamp" => $this->response->createStamp(),
                     "pending" => $emailSource,
@@ -1257,10 +1262,11 @@ class YellowEditResponse {
         if ($this->isUser()) {
             $data["email"] = $this->userEmail;
             $data["name"] = $this->yellow->user->getUser("name", $this->userEmail);
+            $data["description"] = $this->yellow->user->getUser("description", $this->userEmail);
             $data["language"] = $this->yellow->user->getUser("language", $this->userEmail);
             $data["status"] = $this->yellow->user->getUser("status", $this->userEmail);
-            $data["home"] = $this->yellow->user->getUser("home", $this->userEmail);
             $data["access"] = $this->yellow->user->getUser("access", $this->userEmail);
+            $data["home"] = $this->yellow->user->getUser("home", $this->userEmail);
         }
         return $data;
     }

BIN
system/extensions/install-language.bin


+ 3 - 2
system/extensions/install.php

@@ -2,7 +2,7 @@
 // Install extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/install
 
 class YellowInstall {
-    const VERSION = "0.8.69";
+    const VERSION = "0.8.70";
     const PRIORITY = "1";
     public $yellow;                 // access to API
     
@@ -186,9 +186,10 @@ class YellowInstall {
             $fileNameUser = $this->yellow->system->get("coreExtensionDirectory").$this->yellow->system->get("coreUserFile");
             $settings = array(
                 "name" => $name,
+                "description" => $this->yellow->language->getText("editUserDescription", $language),
                 "language" => $language,
-                "home" => "/",
                 "access" => "create, edit, delete, restore, upload, configure, update",
+                "home" => "/",
                 "hash" => $this->yellow->extension->get("edit")->response->createHash($password),
                 "stamp" => $this->yellow->extension->get("edit")->response->createStamp(),
                 "pending" => "none",

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

@@ -37,11 +37,11 @@ system/layouts/navigation.html: navigation.html, create, update, careful
 system/layouts/pagination.html: pagination.html, create, update, careful
 
 Extension: Edit
-Version: 0.8.57
+Version: 0.8.58
 Description: Edit your website in a web browser.
 DocumentationUrl: https://github.com/datenstrom/yellow-extensions/tree/master/source/edit
 DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/master/zip/edit.zip
-Published: 2022-04-18 23:11:04
+Published: 2022-04-19 22:33:56
 Developer: Datenstrom
 Tag: feature
 system/extensions/edit.php: edit.php, create, update
@@ -64,11 +64,11 @@ media/images/photo.jpg: photo.jpg, create, optional
 media/thumbnails/photo-100x40.jpg: photo-100x40.jpg, create, optional
 
 Extension: Install
-Version: 0.8.69
+Version: 0.8.70
 Description: Install a brand new, shiny website.
 DocumentationUrl: https://github.com/datenstrom/yellow-extensions/tree/master/source/install
 DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/master/zip/install.zip
-Published: 2022-04-18 23:25:29
+Published: 2022-04-19 22:49:34
 Developer: Datenstrom
 Status: unlisted
 system/extensions/install.php: install.php, create