Пример #1
0
                    /** @var array $data */
                    $data = \Main::parseFile($_FILES["fileToUpload"]["tmp_name"]);
                    $build = \Main::buildImages($data);
                    // Отправляем ответ
                    \Main::jsonMessage(['status' => true, 'data' => $build]);
                } else {
                    throw new Exception("Файл имеет длину 0 байт!");
                }
            } else {
                throw new Exception("Вы ничего не загрузили!");
            }
        }
    } else {
        if ($Request === 'GET') {
            if (isset($_GET["list"]) && intval($_GET["list"]) == 1) {
                $result = \Main::loadList();
                if (count($result) > 0) {
                    // Отправляем ответ
                    \Main::JsonMessage(['status' => true, 'data' => $result]);
                } else {
                    throw new Exception("Галерея пуста, пожайлуста загрузите файл загрузок!");
                }
            }
            if (isset($_GET["lang"]) && is_string($_GET["lang"])) {
                // Отправляем ответ
                \Main::JsonMessage(['status' => true, 'data' => \Main::getLangs(trim($_GET["lang"]))], true);
            }
            throw new Exception("error");
        }
    }
} catch (Exception $e) {