aboutsummaryrefslogtreecommitdiff
path: root/Neutron-trunk/cms-special/gallery
diff options
context:
space:
mode:
Diffstat (limited to 'Neutron-trunk/cms-special/gallery')
-rw-r--r--Neutron-trunk/cms-special/gallery/index.php61
-rw-r--r--Neutron-trunk/cms-special/gallery/preview/index.php129
2 files changed, 190 insertions, 0 deletions
diff --git a/Neutron-trunk/cms-special/gallery/index.php b/Neutron-trunk/cms-special/gallery/index.php
new file mode 100644
index 0000000..3fe2fad
--- /dev/null
+++ b/Neutron-trunk/cms-special/gallery/index.php
@@ -0,0 +1,61 @@
+<?php require_once "../../resources/private/relative.php"; getRelativeDetails("cms-special"); ?>
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/renderer/render.php";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/lang/processor.php";
+$buffer = ""; // Initialiser un nouveau tampon vide
+
+function buffer(string $value) {
+ global $buffer;
+ $buffer = $buffer . $value;
+}
+
+if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/pictures") && count(scandir($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/pictures")) > 2) {
+ $categories = scandir($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/categories");
+ array_push($categories, "unclassed");
+ foreach ($categories as $category) {
+ if ($category != "." && $category != "..") {
+ $shown = false;
+ if ($category == "unclassed") {
+ buffer("<h2>" . $lang["gallery"]["unclassed"] . "</h2>");
+ } else {
+ buffer("<h2>" . file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/categories/" . $category) . "</h2>");
+ }
+ buffer("<div style=\"text-align: center;\">");
+ $photos = scandir($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/pictures");
+ foreach ($photos as $photo) {
+ if ($photo == "." || $photo == "..") {} else {
+ $praw = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/pictures/" . $photo);
+ $pcat = explode("|", $praw)[1];
+ $ppath = explode("|", $praw)[0];
+ if ($pcat == $category) {
+ $shown = true;
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . $ppath)) {
+ buffer("<div class=\"photo\">");
+ buffer("<a href=\"{$GLOBALS["SYSTEM_ROOT"]}/cms-special/gallery/preview/?url={$GLOBALS["SYSTEM_ROOT"]}" . $ppath . "&return={$GLOBALS["SYSTEM_ROOT"]}/cms-special/gallery\"><img class=\"photo_image\" src=\"{$GLOBALS["SYSTEM_ROOT"]}" . $ppath . "\" /></a>");
+ if (isset(explode("|", $praw)[2])) {
+ buffer("<br><div class=\"photo_label\">" . explode("|", $praw)[2] . "</div>");
+ }
+ buffer("</div>");
+ } else {
+ buffer("<div class=\"photo\">");
+ buffer('<p><table class="message_error message_black"><tbody><tr><td><img src="' . $GLOBALS["SYSTEM_ROOT"] .'/resources/image/message_error.svg" class="message_img"></td><td style="width:100%;">' . $lang["gallery"]["error"] . '</td></tr></tbody></table></p>');
+ buffer("</div>");
+ }
+ }
+ }
+ }
+ if (!$shown) {
+ buffer("<p><div style=\"text-align: center;\"><i>" . $lang["gallery"]["nothing"] . "</i></div></p>");
+ }
+ buffer("</center></div></center>");
+ }
+ }
+} else {
+ buffer("<div style=\"text-align: center;\"><i>" . $lang["gallery"]["disabled"][0] . "<b>" . $lang["gallery"]["disabled"][1] . "</b>" . $lang["gallery"]["disabled"][2] . "</i></div>");
+}
+buffer("<script>window.onload = () => {setTimeout(() => {Array.from(document.getElementsByClassName('photo_image')).forEach((el) => {el.classList.add('loaded')});}, 1000)}</script>");
+
+renderSpecial($buffer, $lang["gallery"]["title"]);
+
+?> \ No newline at end of file
diff --git a/Neutron-trunk/cms-special/gallery/preview/index.php b/Neutron-trunk/cms-special/gallery/preview/index.php
new file mode 100644
index 0000000..e033cc0
--- /dev/null
+++ b/Neutron-trunk/cms-special/gallery/preview/index.php
@@ -0,0 +1,129 @@
+<?php require_once "../../../resources/private/relative.php"; getRelativeDetails("cms-special"); ?>
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/lang/processor.php";
+
+if (isset($_GET['return'])) {
+ $callback = $_GET['return'];
+}
+
+?>
+<!DOCTYPE html>
+<html lang="en" style="height:100%;overflow:hidden;">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
+ <link rel="stylesheet" href="<?= $GLOBALS['SYSTEM_ROOT'] ?>/resources/css/preview.css">
+ <script src="<?= $GLOBALS['SYSTEM_ROOT'] ?>/resources/js/jquery.js"></script>
+ <title><?= $lang["gallery"]["preview"]['title'] ?></title>
+</head>
+<?php
+
+ if (isset($_GET['url'])) {
+ if (strpos($_GET['url'], '..') !== false) {
+ require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["gallery"]["preview"]['invalid']);
+ } else {
+ if (file_exists($GLOBALS['ORIGINAL_DOCUMENT_ROOT'] . "/" . $_GET['url'])) {
+ $ext1 = explode(".", $_GET['url']);
+ $ext2 = end($ext1);
+ $ext = strtoupper($ext2);
+ } else {
+ require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["gallery"]["preview"]['notfound']);
+ }
+ }
+ } else {
+ require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["gallery"]["preview"]['none']);
+ }
+
+?>
+<body style="background-size:contain;background-position:center;height: 100%;margin: 0;background-repeat: no-repeat;background-color: #222;">
+ <div class="container">
+ <img class="image" id="scroll" src="<?= $_GET['url'] ?>" draggable="false" onmouseup="clearTimeout(mdt);--mousedown;" onclick="return false;">
+ <script>
+ document.getElementsByClassName('image')[0].style.transform = "scale(1)";
+ </script>
+ </div>
+ <?php if (isset($callback)): ?><a class="close" title="<?= $lang["gallery"]["preview"]['close'] ?>"><img class="icon" src="<?= $GLOBALS['SYSTEM_ROOT'] ?>/resources/image/close.svg" onclick="location.href = &quot;<?= $callback ?>&quot;"></a><?php endif ?>
+ <a class="download" href="<?= $_GET['url'] ?>" title="<?= $lang["gallery"]["preview"]['placeholder'][0] ?> <?= $ext ?> <?= $lang["gallery"]["preview"]['placeholder'][1] ?>" download><?= $lang["gallery"]["preview"]['download'] ?> (<?= $ext ?>)</a>
+ <span class="zoom">
+ <a class="zoomin" onclick="zoomin();"></a>
+ <a class="zoomout" onclick="zoomout();"></a>
+ </span>
+</body>
+<script>
+
+function zoomin() {
+ tf = document.getElementsByClassName("image")[0].style.transform.split("(")[1].split(")")[0] - 1 + 1;
+ if (tf < 8) {
+ tf++;
+ document.getElementsByClassName('image')[0].style.transform = `scale(${tf})`;
+ document.getElementsByClassName('image')[0].style['margin-top'] = (((1055 / 6) * (window.innerHeight / 480)) * tf) + 'px';
+ document.getElementsByClassName('image')[0].style['margin-left'] = (((1055 / 6) * (window.innerWidth / 480)) * tf) + 'px';
+ }
+}
+
+function zoomout() {
+ tf = document.getElementsByClassName("image")[0].style.transform.split("(")[1].split(")")[0] - 1 + 1;
+ if (tf > 1) {
+ tf--;
+ if (tf > 1) {
+ document.getElementsByClassName('image')[0].style.transform = `scale(${tf})`;
+ document.getElementsByClassName('image')[0].style['margin-top'] = (((1055 / 6) * (window.innerHeight / 480)) * tf) + 'px';
+ document.getElementsByClassName('image')[0].style['margin-left'] = (((1055 / 6) * (window.innerWidth / 480)) * tf) + 'px';
+ } else {
+ document.getElementsByClassName('image')[0].style.transform = `scale(${tf})`;
+ document.getElementsByClassName('image')[0].style['margin-top'] = (((1055 / 6) / 422) * tf) + 'px';
+ document.getElementsByClassName('image')[0].style['margin-left'] = (((1055 / 6) / 422) * tf) + 'px';
+ }
+ }
+}
+
+window.onload = () => {setTimeout(() => {Array.from(document.getElementsByClassName('ppreview')).forEach((el) => {el.classList.add('loaded')});}, 1000)}
+
+(function($) {
+ $.dragScroll = function(options) {
+ var settings = $.extend({
+ scrollVertical: true,
+ scrollHorizontal: true,
+ cursor: null
+ }, options);
+
+ var clicked = false,
+ clickY, clickX;
+
+ var getCursor = function() {
+ if (settings.cursor) return settings.cursor;
+ if (settings.scrollVertical && settings.scrollHorizontal) return 'move';
+ if (settings.scrollVertical) return 'row-resize';
+ if (settings.scrollHorizontal) return 'col-resize';
+ }
+
+ var updateScrollPos = function(e, el) {
+ $('html').css('cursor', getCursor());
+ var $el = $(el);
+ settings.scrollVertical && $el.scrollTop($el.scrollTop() + (clickY - e.pageY));
+ settings.scrollHorizontal && $el.scrollLeft($el.scrollLeft() + (clickX - e.pageX));
+ }
+
+ $(document).on({
+ 'mousemove': function(e) {
+ clicked && updateScrollPos(e, this);
+ },
+ 'mousedown': function(e) {
+ clicked = true;
+ clickY = e.pageY;
+ clickX = e.pageX;
+ },
+ 'mouseup': function() {
+ clicked = false;
+ $('html').css('cursor', 'auto');
+ }
+ });
+ }
+}(jQuery))
+
+$.dragScroll();
+
+</script>
+</html> \ No newline at end of file