mirror of
https://github.com/Neetpone/ponepaste.git
synced 2025-03-12 06:30:07 +01:00
feat: ability to blank paste contents
This commit is contained in:
parent
776a0ba636
commit
36abc1725e
2 changed files with 30 additions and 5 deletions
|
@ -118,7 +118,24 @@ if (isset($_POST['hide'])) {
|
||||||
$paste->save();
|
$paste->save();
|
||||||
$redis->del('ajax_pastes'); /* Expire from Redis so it doesn't show up anymore */
|
$redis->del('ajax_pastes'); /* Expire from Redis so it doesn't show up anymore */
|
||||||
flashSuccess('Paste ' . ($is_hidden ? 'hidden' : 'unhidden') . '.');
|
flashSuccess('Paste ' . ($is_hidden ? 'hidden' : 'unhidden') . '.');
|
||||||
header('Location: /');
|
header('Location: ' . urlForPaste($paste));
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['blank'])) {
|
||||||
|
if (!can('blank', $paste)) {
|
||||||
|
$error = 'You do not have permission to blank this paste.';
|
||||||
|
goto Not_Valid_Paste;
|
||||||
|
}
|
||||||
|
|
||||||
|
$paste->content = '';
|
||||||
|
$paste->title = 'Removed by moderator';
|
||||||
|
$paste->tags()->detach();
|
||||||
|
|
||||||
|
$paste->save();
|
||||||
|
$redis->del('ajax_pastes'); /* Expire from Redis so it doesn't show up anymore */
|
||||||
|
flashSuccess('Paste contents blanked.');
|
||||||
|
header('Location: ' . urlForPaste($paste));
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,11 +153,19 @@
|
||||||
<?php if (isset($csrf_token)): ?>
|
<?php if (isset($csrf_token)): ?>
|
||||||
<input type="hidden" name="csrf_token" value="<?= $csrf_token ?>"/>
|
<input type="hidden" name="csrf_token" value="<?= $csrf_token ?>"/>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<div class="field">
|
<div class="field is-grouped">
|
||||||
|
<div class="control">
|
||||||
<input class="button is-small <?= $paste->is_hidden ? 'is-success' : 'is-danger' ?>"
|
<input class="button is-small <?= $paste->is_hidden ? 'is-success' : 'is-danger' ?>"
|
||||||
type="submit" name="hide" id="hide"
|
type="submit" name="hide" id="hide"
|
||||||
value="<?= $paste->is_hidden ? 'Unhide' : 'Hide' ?> Paste" />
|
value="<?= $paste->is_hidden ? 'Unhide' : 'Hide' ?> Paste" />
|
||||||
</div>
|
</div>
|
||||||
|
<?php if (can('blank', $paste)): ?>
|
||||||
|
<div class="control">
|
||||||
|
<input class="button is-small is-danger" type="submit" name="blank" id="blank" value="Blank Paste Contents (No Undo)" />
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
Loading…
Add table
Reference in a new issue