diff --git a/.env b/.env new file mode 100644 index 0000000..19eee41 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +TEST='This is a test string' \ No newline at end of file diff --git a/Gallery/GetEnv.php b/Gallery/GetEnv.php new file mode 100644 index 0000000..f24d528 --- /dev/null +++ b/Gallery/GetEnv.php @@ -0,0 +1,79 @@ +path = $path; + } + + public function load() :void + { + if (!is_readable($this->path)) { + throw new \RuntimeException(sprintf('%s file is not readable', $this->path)); + } + + $lines = file($this->path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); + foreach ($lines as $line) { + + if (strpos(trim($line), '#') === 0) { + continue; + } + + list($name, $value) = explode('=', $line, 2); + $name = trim($name); + $value = trim($value); + + if (!array_key_exists($name, $_SERVER) && !array_key_exists($name, $_ENV)) { + putenv(sprintf('%s=%s', $name, $value)); + $_ENV[$name] = $value; + $_SERVER[$name] = $value; + } + } + } +} + +namespace Aaa; + +class GetEnv { + protected $path; + + public function __construct(string $path) + { + if(!file_exists($path)) { + throw new \InvalidArgumentException(sprintf('%s does not exist', $path)); + } + $this->path = $path; + } + + public function load() :void + { + if (!is_readable($this->path)) { + throw new \RuntimeException(sprintf('%s file is not readable', $this->path)); + } + + $lines = file($this->path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); + foreach ($lines as $line) { + + if (strpos(trim($line), '#') === 0) { + continue; + } + + list($name, $value) = explode('=', $line, 2); + $name = trim($name); + $value = trim($value); + + if (!array_key_exists($name, $_SERVER) && !array_key_exists($name, $_ENV)) { + putenv(sprintf('%s=%s', $name, $value)); + $_ENV[$name] = $value; + $_SERVER[$name] = $value; + } + } + } +} \ No newline at end of file diff --git a/app/image/delete_image.php b/app/image/delete_image.php deleted file mode 100644 index c15c0cf..0000000 --- a/app/image/delete_image.php +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + , - submit: deleteSubmit + submit_delete: deleteSubmit }); }); }); @@ -285,10 +285,10 @@ event.preventDefault(); var descriptionInput = $("#descriptionInput").val(); var descriptionSubmit = $("#descriptionSubmit").val(); - $("#sniffle").load("app/image/edit_description.php", { + $("#sniffle").load("app/image/image.php", { id: , input: descriptionInput, - submit: descriptionSubmit + submit_description: descriptionSubmit }); }); }); @@ -321,10 +321,10 @@ event.preventDefault(); var tagsInput = $("#tagsInput").val(); var tagsSubmit = $("#tagsSubmit").val(); - $("#sniffle").load("app/image/edit_tags.php", { + $("#sniffle").load("app/image/image.php", { id: , input: tagsInput, - submit: tagsSubmit + submit_tags: tagsSubmit }); }); }); @@ -355,10 +355,10 @@ event.preventDefault(); var authorInput = $("#authorInput").val(); var authorSubmit = $("#authorSubmit").val(); - $("#sniffle").load("app/image/edit_author.php", { + $("#sniffle").load("app/image/image.php", { id: , input: authorInput, - submit: authorSubmit + submit_author: authorSubmit }); }); }); diff --git a/upload.php b/upload.php index d372182..8b7c5f5 100644 --- a/upload.php +++ b/upload.php @@ -22,6 +22,9 @@ var alt = $("#alt").val(); formData.append("alt", alt); // Get ALT + var tags = $("#tags").val(); + formData.append("tags", tags); + // Submit data var submit = $("#submit").val(); formData.append("submit", submit); @@ -71,6 +74,7 @@
+