diff --git a/Zephir/aes-loader/hydraterbootloader/hydraterbootloader/licenseverifier.zep b/Zephir/aes-loader/hydraterbootloader/hydraterbootloader/licenseverifier.zep
index 09862bc..945dccd 100644
--- a/Zephir/aes-loader/hydraterbootloader/hydraterbootloader/licenseverifier.zep
+++ b/Zephir/aes-loader/hydraterbootloader/hydraterbootloader/licenseverifier.zep
@@ -4,47 +4,73 @@ use HydraterBootloader\Loader;
class LicenseVerifier
{
- public function tryEnabledItem(string licenseFile, string keyFile, string featureName, string publicKeyPem, bool useInclude = true, bool forceRefresh = false) {
+ public function tryEnabledItem(string licenseFile, string keyFile, string featureName, string publicKeyPem, bool useInclude = true, bool forceRefresh = false) -> array {
var l, f, found, password, filePath, r, aesKey, aesIV, data;
+ var ran_okay, enabled, status, name, details = [];
if featureName == "" || licenseFile == "" || publicKeyPem == "" {
- return false;
+ throw new \Exception("Missing input Data!");
}
if ! this->verifySignature(licenseFile, publicKeyPem) {
- return false;
+ throw new \Exception("Invalid Signatures!");
}
let l = new Loader();
if ! file_exists(keyFile) {
- return false;
+ throw new \Exception("No Key File found!");
}
require keyFile;
let r = rnd_q();
if r === false {
- return false;
+ throw new \Exception("Invalid Keys!");
}
let aesKey = r[0];
let aesIV = r[1];
let data = this->getEnabledFeatures(licenseFile, aesKey, aesIV);
let found = false;
+ let enabled = false;
+ let name = false;
for f in data {
if ! isset f["feature"] || f["feature"] != featureName {
continue;
}
- let filePath = f["file"];
+ let name = true;
if isset f["enabled"] && f["enabled"] == true {
+ let filePath = f["file"];
if isset f["password"] {
let password = f["password"];
let found = true;
+ let enabled = true;
+ if isset f["status"] {
+ let status = f["status"];
+ } else {
+ let status = "Invalid License!";
+ }
break;
}
- }
+ } else {
+ let filePath = "";
+ if isset f["status"] {
+ let status = f["status"];
+ } else {
+ let status = "Invalid License!";
+ }
+ }
}
if found {
- return l->run(filePath, password, useInclude, forceRefresh);
- }
+ let ran_okay = l->run(filePath, password, useInclude, forceRefresh);
+ } else {
+ let ran_okay = false;
+ }
+ let details = [
+ "feature_name_found": name,
+ "enabled": enabled,
+ "status": status,
+ "ran_okay": ran_okay
+ ];
+ return details;
}
/**
@@ -137,6 +163,14 @@ class LicenseVerifier
"status": "License valid"
];
}
+ } else {
+ if isset feature["feature"] {
+ let result[] = [
+ "feature": feature["feature"],
+ "enabled": false,
+ "status": "No License!"
+ ];
+ }
}
}
diff --git a/docs/CodeHydrater.md b/docs/CodeHydrater.md
index 8b14088..67fbb77 100644
--- a/docs/CodeHydrater.md
+++ b/docs/CodeHydrater.md
@@ -194,6 +194,8 @@ protedcted/src
├── models
├── outputs
├── routes
+│ └── app
+│ └── home_routes.php
│ └── routes.php
├── secret_php_files
│ ├── config.php
@@ -231,8 +233,7 @@ protedcted/src
public/assets/...
Testing website Code:
-$ cd /var/www/ProjectCodeHydrater/public
-$ php -S 127.0.0.1:8080
+$ php -S 127.0.0.1:8080 -t /var/www/ProjectCodeHydrater/public/
```
# Open web browser to [http://localhost:8080](http://127.0.0.1:8080)
diff --git a/src/classes/common.php b/src/classes/common.php
index b1749a2..a4fd694 100644
--- a/src/classes/common.php
+++ b/src/classes/common.php
@@ -252,7 +252,7 @@ final class common {
}
echo '
';
- if ($end === true) {
+ if ($end === endDump::exit_and_stop) {
exit;
}
}
diff --git a/src/classes/extras_booter.php b/src/classes/extras_booter.php
index 06dcdf7..e2df43b 100644
--- a/src/classes/extras_booter.php
+++ b/src/classes/extras_booter.php
@@ -17,18 +17,56 @@ const RND_Q = BaseDir."/protected/keydata/rnd_q.php";
const LicenseFile = BaseDir."/protected/keydata/license.json";
class extras_booter {
- public static function tryToEnableFeature(string $featureName, bool $include = true, $refresh = false) {
-
- if (! class_exists("HydraterBootloader\LicenseVerifier")) {
- return false;
- }
-
- $verifier = new LicenseVerifier();
+ public static function tryToEnableFeature(string $featureName, bool $include = true, $refresh = false): object {
+ $errors = "";
+ $success = false;
+ $named = false;
+ $fault = false;
try {
- return $verifier->tryEnabledItem(LicenseFile, RND_Q, $featureName, PublicPEM, $include, $refresh);
+ if (! class_exists("HydraterBootloader\LicenseVerifier")) {
+ throw new \Exception("License Verifier class not found!");
+ }
+
+ $verifier = new LicenseVerifier();
+
+ $a_details = $verifier->tryEnabledItem(LicenseFile, RND_Q, $featureName, PublicPEM, $include, $refresh);
} catch (\Exception $e) {
- return false;
+ $errors = $e->getMessage();
+ $fault = true;
}
+ if ($fault === true) {
+ if (!isset($a_details)) {
+ $loaded = false;
+ $status = "Error: Unknown License state";
+ $enabled = false;
+ }
+ } else if (! isset($a_details['feature_name_found']) || $a_details['feature_name_found'] === false) {
+ $loaded = false;
+ $status = "Invalid License!";
+ $enabled = false;
+ } else {
+ $named = true;
+ $loaded = $a_details['ran_okay'] ?? false;
+ $status = $a_details['status'] ?? "Invalid License!";
+ $enabled = $a_details['enabled'] ?? false;
+ }
+
+ $content = match($loaded) {
+ false => "Unable to load Feature [$featureName]...",
+ 1 => "Loaded the Feature [$featureName]",
+ default => "Error on Feature [$featureName]",
+ };
+
+ $success = (empty($errors) && $loaded === 1 && $enabled === true) ? true : false;
+
+ $obj = new \stdClass();
+ $obj->named = $named;
+ $obj->success = $success;
+ $obj->enabled = $enabled;
+ $obj->errors = $errors;
+ $obj->status_message = $content;
+ $obj->license_status = $status;
+ return $obj;
}
}
// tryToEnableFeature("testing");
\ No newline at end of file
diff --git a/src/classes/view.php b/src/classes/view.php
index 4b34387..ad38408 100644
--- a/src/classes/view.php
+++ b/src/classes/view.php
@@ -39,14 +39,14 @@ final class view {
* Alias to set_view
*/
public function include(string $file, ViewType $type = ViewType::PHP): void {
- $this->set_view($file);
+ $this->set_view($file, $type);
}
/**
* Alias to set_view
*/
public function add_view(string $file, ViewType $type = ViewType::PHP): void {
- $this->set_view($file);
+ $this->set_view($file, $type);
}
/**