forked from rDrama/rDrama
fds
parent
6a2b57155c
commit
449f483502
|
@ -516,7 +516,6 @@ class User(Base):
|
||||||
if days > 0:
|
if days > 0:
|
||||||
ban_time = int(time.time()) + (days * 86400)
|
ban_time = int(time.time()) + (days * 86400)
|
||||||
self.unban_utc = ban_time
|
self.unban_utc = ban_time
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.bannerurl = None
|
self.bannerurl = None
|
||||||
self.profileurl = None
|
self.profileurl = None
|
||||||
|
|
|
@ -861,17 +861,15 @@ def ban_user(user_id, v):
|
||||||
|
|
||||||
# check for number of days for suspension
|
# check for number of days for suspension
|
||||||
if 'form' in request.values:
|
if 'form' in request.values:
|
||||||
days = int(request.values.get("days")) if request.values.get('days') else 0
|
days = request.values.get("days", 0)
|
||||||
reason = sanitize(request.values.get("reason", ""))
|
reason = sanitize(request.values.get("reason", ""))
|
||||||
message = request.values.get("reason", "")
|
message = request.values.get("reason", "")
|
||||||
else:
|
else:
|
||||||
days = int(request.values.get("days")) if request.values.get('days') else 0
|
days = request.values.get("days", 0)
|
||||||
reason = sanitize(request.values.get("reason", ""))
|
reason = sanitize(request.values.get("reason", ""))
|
||||||
message = request.values.get("reason", "")
|
message = request.values.get("reason", "")
|
||||||
|
|
||||||
if not user: abort(400)
|
if not user: abort(400)
|
||||||
|
|
||||||
#if user.admin_level > 0: abort(403)
|
|
||||||
|
|
||||||
if days > 0:
|
if days > 0:
|
||||||
if message:
|
if message:
|
||||||
|
|
|
@ -114,8 +114,10 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
|
||||||
|
|
||||||
posts = g.db.query(Submission).options(lazyload('*'))
|
posts = g.db.query(Submission).options(lazyload('*'))
|
||||||
|
|
||||||
if t != 'all':
|
if t != 'day' and sort in ["hot","controversial"]:
|
||||||
cutoff = 0
|
cutoff = int(time.time()) - 86400
|
||||||
|
posts = posts.filter(Submission.created_utc >= cutoff)
|
||||||
|
elif t != 'all':
|
||||||
now = int(time.time())
|
now = int(time.time())
|
||||||
if t == 'hour':
|
if t == 'hour':
|
||||||
cutoff = now - 3600
|
cutoff = now - 3600
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<textarea name="reason" form="banModalForm" class="form-control" id="ban-modal-link" aria-label="With textarea" placeholder="Enter reason"></textarea>
|
<textarea name="reason" form="banModalForm" class="form-control" id="ban-modal-link" aria-label="With textarea" placeholder="Enter reason"></textarea>
|
||||||
|
|
||||||
<label for="days" class="mt-3">Duration days</label>
|
<label for="days" class="mt-3">Duration days</label>
|
||||||
<input type="number" name="days" id="days" class="form-control" placeholder="leave blank for permanent" />
|
<input type="number" step="any" name="days" id="days" class="form-control" placeholder="leave blank for permanent" />
|
||||||
|
|
||||||
<div class="custom-control custom-switch mt-3">
|
<div class="custom-control custom-switch mt-3">
|
||||||
<input type="checkbox" class="custom-control-input" id="alts" name="alts">
|
<input type="checkbox" class="custom-control-input" id="alts" name="alts">
|
||||||
|
|
|
@ -14,6 +14,26 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var clipboard = new ClipboardJS('.copy-link');
|
||||||
|
clipboard.on('success', function(e) {
|
||||||
|
|
||||||
|
jQuery(function($) {
|
||||||
|
$('#toast-success').toast('show');
|
||||||
|
})
|
||||||
|
console.log(e);
|
||||||
|
});
|
||||||
|
clipboard.on('error', function(e) {
|
||||||
|
|
||||||
|
jQuery(function($) {
|
||||||
|
$('#toast-error').toast('show');
|
||||||
|
})
|
||||||
|
console.log(e);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<div class="row justify-content-around">
|
<div class="row justify-content-around">
|
||||||
|
|
||||||
<div class="col h-100">
|
<div class="col h-100">
|
||||||
|
|
|
@ -299,7 +299,7 @@
|
||||||
<form action="/ban_user/{{u.id}}" method="post" action="">
|
<form action="/ban_user/{{u.id}}" method="post" action="">
|
||||||
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
||||||
<input style="font-size:11px;" type="text" class="form-control" name="reason" placeholder="Ban Reason" onchange="document.getElementById('user-ban-submit').disabled=false">
|
<input style="font-size:11px;" type="text" class="form-control" name="reason" placeholder="Ban Reason" onchange="document.getElementById('user-ban-submit').disabled=false">
|
||||||
<input style="font-size:11px;" type="number" class="form-control" name="days" placeholder="Days (blank = permanent)">
|
<input style="font-size:11px;" type="number" step="any" class="form-control" name="days" placeholder="Days (blank = permanent)">
|
||||||
<div class="custom-control custom-checkbox">
|
<div class="custom-control custom-checkbox">
|
||||||
<input type="checkbox" id="alts-2-desktop" class="custom-control-input" name="alts" value="1">
|
<input type="checkbox" id="alts-2-desktop" class="custom-control-input" name="alts" value="1">
|
||||||
<label class="custom-control-label" for="alts-2-desktop">Include alts</label>
|
<label class="custom-control-label" for="alts-2-desktop">Include alts</label>
|
||||||
|
@ -312,7 +312,7 @@
|
||||||
|
|
||||||
<form id="agendaposter" class="{% if u.agendaposter %}d-none{% endif %}" action="/agendaposter/{{u.id}}" method="post">
|
<form id="agendaposter" class="{% if u.agendaposter %}d-none{% endif %}" action="/agendaposter/{{u.id}}" method="post">
|
||||||
<input type="hidden" name="formkey", value="{{v.formkey}}">
|
<input type="hidden" name="formkey", value="{{v.formkey}}">
|
||||||
<input type="number" name="days" class="form-control" placeholder="Days (0 or blank = permanent)" />
|
<input type="number" step="any" name="days" class="form-control" placeholder="Days (0 or blank = permanent)" />
|
||||||
<input type="submit" class="btn btn-danger" value="Lock Agendaposter Theme" />
|
<input type="submit" class="btn btn-danger" value="Lock Agendaposter Theme" />
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
@ -574,7 +574,7 @@
|
||||||
<form action="/ban_user/{{u.id}}/" method="post">
|
<form action="/ban_user/{{u.id}}/" method="post">
|
||||||
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
||||||
<input style="font-size:11px;" type="text" class="form-control" name="reason" placeholder="Ban Reason" onchange="document.getElementById('user-ban-submit2').disabled=false">
|
<input style="font-size:11px;" type="text" class="form-control" name="reason" placeholder="Ban Reason" onchange="document.getElementById('user-ban-submit2').disabled=false">
|
||||||
<input style="font-size:11px;" type="number" class="form-control" name="days" placeholder="Days (blank = permanent)">
|
<input style="font-size:11px;" type="number" step="any" class="form-control" name="days" placeholder="Days (blank = permanent)">
|
||||||
<br />
|
<br />
|
||||||
<div class="custom-control custom-checkbox">
|
<div class="custom-control custom-checkbox">
|
||||||
<input type="checkbox" id="alts-2-mobile" class="custom-control-input" name="alts" value="1">
|
<input type="checkbox" id="alts-2-mobile" class="custom-control-input" name="alts" value="1">
|
||||||
|
@ -589,7 +589,7 @@
|
||||||
|
|
||||||
<form id="agendaposter2" class="{% if u.agendaposter %}d-none{% endif %}" action="/agendaposter/{{u.id}}" method="post">
|
<form id="agendaposter2" class="{% if u.agendaposter %}d-none{% endif %}" action="/agendaposter/{{u.id}}" method="post">
|
||||||
<input type="hidden" name="formkey", value="{{v.formkey}}">
|
<input type="hidden" name="formkey", value="{{v.formkey}}">
|
||||||
<input type="number" name="days" class="form-control" placeholder="Days (0 or blank = permanent)" />
|
<input type="number" step="any" name="days" class="form-control" placeholder="Days (0 or blank = permanent)" />
|
||||||
<input type="submit" class="btn btn-danger" value="Lock Agendaposter Theme" />
|
<input type="submit" class="btn btn-danger" value="Lock Agendaposter Theme" />
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue