2020-11-15 21:51:28 +01:00
|
|
|
<?php
|
2020-11-23 11:01:37 +01:00
|
|
|
include('init.php');
|
2020-11-15 21:51:28 +01:00
|
|
|
include('templates/header.php');
|
2020-11-16 21:31:59 +01:00
|
|
|
|
|
|
|
if (empty($_POST)) {
|
|
|
|
?>
|
|
|
|
<div id="cloud_create">
|
|
|
|
<form method="post" action="create.php">
|
2020-11-22 16:05:54 +01:00
|
|
|
<div class="cloud_create_element">
|
2020-11-23 11:01:37 +01:00
|
|
|
<label id="ftext_l" for="ftext"><?php echo L::cloud_description ?></label>
|
|
|
|
<textarea id="ftext" name="ftext" rows="3" cols="50" placeholder="<?php echo L::cloud_description_message ?>"></textarea>
|
2020-11-22 16:05:54 +01:00
|
|
|
</div>
|
|
|
|
<div class="cloud_create_element">
|
2020-11-23 11:01:37 +01:00
|
|
|
<label for="fduration"><span title="<?php echo L::cloud_duration_tooltip ?>"><?php echo L::cloud_duration ?></span></label>
|
2020-11-22 16:05:54 +01:00
|
|
|
<select id="fduration" name="fduration">
|
2020-11-16 21:31:59 +01:00
|
|
|
<?php
|
|
|
|
foreach (DataBase::OPTIONS_DURATION as $name => $duration) {
|
2020-11-23 11:01:37 +01:00
|
|
|
echo sprintf('<option value="%s">%s</option>', $name, constant('L::duration_' . $name));
|
2020-11-16 21:31:59 +01:00
|
|
|
}
|
|
|
|
?>
|
2020-11-22 16:05:54 +01:00
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<div class="cloud_create_element">
|
2020-11-23 11:01:37 +01:00
|
|
|
<label for="fsize"><?php echo L::cloud_size ?></label>
|
|
|
|
<input type="number" id="fsize" name="fsize" min="1" max="9" value=<?php echo DataBase::DEFAULT_SIZE ?>>
|
2020-11-22 16:05:54 +01:00
|
|
|
</div>
|
2020-11-26 16:59:44 +01:00
|
|
|
<input type="submit" id="cloud_create_submit" value="<?php echo L::create_button ?>">
|
2020-11-16 21:31:59 +01:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
} else {
|
2020-11-23 11:01:37 +01:00
|
|
|
if (isset($_POST['fsize']) && is_numeric($_POST['fsize'])) {
|
|
|
|
$size = $_POST['fsize'];
|
|
|
|
} else {
|
|
|
|
$size = 3;
|
|
|
|
}
|
|
|
|
if (isset($_POST['ftext'])) {
|
|
|
|
$text = $_POST['ftext'];
|
|
|
|
} else {
|
|
|
|
$text = '';
|
|
|
|
}
|
2020-11-25 22:35:28 +01:00
|
|
|
if (isset($_POST['fduration']) && key_exists($_POST['fduration'], DataBase::OPTIONS_DURATION)) {
|
2020-11-23 11:01:37 +01:00
|
|
|
$duration = $_POST['fduration'];
|
|
|
|
} else {
|
|
|
|
$duration = DataBase::DEFAULT_DURATION;
|
|
|
|
}
|
2020-11-26 16:59:44 +01:00
|
|
|
|
2020-11-25 23:15:38 +01:00
|
|
|
if ($cloud = $db->createCloud($text, $size, $duration)) {
|
|
|
|
$viewUrl = 'result.php?id=' . $cloud['code'];
|
2021-01-11 18:05:46 +01:00
|
|
|
header('Location: ' . $viewUrl);
|
|
|
|
die();
|
2020-11-25 23:15:38 +01:00
|
|
|
} else {
|
|
|
|
?>
|
|
|
|
<h2><?php echo L::create_errorCode ?></h2>
|
|
|
|
<?php
|
|
|
|
}
|
2020-11-16 21:31:59 +01:00
|
|
|
}
|
2020-11-15 21:51:28 +01:00
|
|
|
include('templates/footer.php');
|