summaryrefslogtreecommitdiff
path: root/templates/mod
diff options
context:
space:
mode:
authorczaks <marcin@6irc.net>2013-09-17 10:43:44 -0400
committerczaks <marcin@6irc.net>2013-09-17 10:43:44 -0400
commit6cb7eb939e549f978ca6dd7d2afe2dabc0f18025 (patch)
tree8b2342bbf5c15847717db733ecf4f2f46718dacb /templates/mod
parent069f1def9bf8c8d769afdc5740e9ff13271065bd (diff)
parent803f0c8ce1487ea791824197de9d1ee140127838 (diff)
Merge branch 'master' of https://github.com/savetheinternet/Tinyboard into vichan-devel-4.5
Conflicts: inc/config.php inc/display.php inc/mod/pages.php install.php js/quick-reply.js post.php templates/index.html
Diffstat (limited to 'templates/mod')
-rw-r--r--templates/mod/ban_list.html14
-rw-r--r--templates/mod/config-editor.html9
-rw-r--r--templates/mod/debug/antispam.html26
-rw-r--r--templates/mod/debug/recent_posts.html43
-rw-r--r--templates/mod/debug/sql.html8
-rw-r--r--templates/mod/search_results.html14
-rw-r--r--templates/mod/user.html20
-rw-r--r--templates/mod/users.html13
-rw-r--r--templates/mod/view_ip.html4
9 files changed, 103 insertions, 48 deletions
diff --git a/templates/mod/ban_list.html b/templates/mod/ban_list.html
index f8826ade..b41cef28 100644
--- a/templates/mod/ban_list.html
+++ b/templates/mod/ban_list.html
@@ -17,10 +17,10 @@
<tr{% if ban.expires != 0 and ban.expires < time() %} style="text-decoration:line-through"{% endif %}>
<td style="white-space: nowrap">
<input type="checkbox" name="ban_{{ ban.id }}">
- {% if ban.real_ip %}
- <a href="?/IP/{{ ban.ip }}">{{ ban.ip }}</a>
+ {% if ban.single_addr %}
+ <a href="?/IP/{{ ban.mask }}">{{ ban.mask }}</a>
{% else %}
- {{ ban.ip|e }}
+ {{ ban.mask }}
{% endif %}
</td>
<td>
@@ -38,15 +38,15 @@
{% endif %}
</td>
<td style="white-space: nowrap">
- <span title="{{ ban.set|date(config.post_date) }}">
- {{ ban.set|ago }} ago
+ <span title="{{ ban.created|date(config.post_date) }}">
+ {{ ban.created|ago }} ago
</span>
</td>
<td style="white-space: nowrap">
{% if ban.expires == 0 %}
-
{% else %}
- {{ (ban.expires - ban.set + time()) | until }}
+ {{ (ban.expires - ban.created + time()) | until }}
{% endif %}
</td>
<td style="white-space: nowrap">
@@ -77,7 +77,7 @@
{% endif %}
{% endif %}
- {% elseif ban.mod == -1 %}
+ {% elseif ban.creator == -1 %}
<em>system</em>
{% else %}
<em>{% trans 'deleted?' %}</em>
diff --git a/templates/mod/config-editor.html b/templates/mod/config-editor.html
index a43f8cf7..4f4cba93 100644
--- a/templates/mod/config-editor.html
+++ b/templates/mod/config-editor.html
@@ -42,10 +42,11 @@
<input name="{{ name }}" type="text" value="{{ var.value|e }}">
{% elseif var.permissions %}
<select name="{{ name }}">
- <option value="{{ constant('JANITOR') }}"{% if var.value == constant('JANITOR')%} selected{% endif %}>JANITOR</option>
- <option value="{{ constant('MOD') }}"{% if var.value == constant('MOD')%} selected{% endif %}>MOD</option>
- <option value="{{ constant('ADMIN') }}"{% if var.value == constant('ADMIN')%} selected{% endif %}>ADMIN</option>
- <option value="{{ constant('DISABLED') }}"{% if var.value == constant('DISABLED')%} selected{% endif %}>DISABLED</option>
+ {% for group_value, group_name in config.mod.groups %}
+ <option value="{{ group_value }}"{% if var.value == group_value %} selected{% endif %}>
+ {{ group_name }}
+ </option>
+ {% endfor %}
</select>
{% elseif var.type == 'integer' %}
<input name="{{ name }}" type="number" value="{{ var.value|e }}">
diff --git a/templates/mod/debug/antispam.html b/templates/mod/debug/antispam.html
index 95aa61a6..9979a093 100644
--- a/templates/mod/debug/antispam.html
+++ b/templates/mod/debug/antispam.html
@@ -14,11 +14,14 @@
<tr>
<td>{{ config.board_abbreviation|sprintf(hash.board) }}</td>
<td>
- {% if hash.thread %}
+ {% if hash.thread > 0 %}
{{ hash.thread }}
+ {% elseif hash.thread < 0 %}
+ Index (page {{ - hash.thread }})
{% else %}
-
- {% endif %}</td>
+ {% endif %}
+ </td>
<td>
<small><code>{{ hash.hash }}</code></small>
</td>
@@ -28,7 +31,11 @@
<td>
{% if hash.expires %}
<span title="{{ hash.expires|date(config.post_date) }}">
- {{ hash.expires|until }}
+ {% if hash.expires < time() %}
+ {{ hash.expires|ago }} ago
+ {% else %}
+ {{ hash.expires|until }}
+ {% endif %}
</span>
{% else %}
-
@@ -55,11 +62,14 @@
<tr>
<td>{{ config.board_abbreviation|sprintf(hash.board) }}</td>
<td>
- {% if hash.thread %}
+ {% if hash.thread > 0 %}
{{ hash.thread }}
+ {% elseif hash.thread < 0 %}
+ Index (page {{ - hash.thread }})
{% else %}
-
- {% endif %}</td>
+ {% endif %}
+ </td>
<td>
<small><code>{{ hash.hash }}</code></small>
</td>
@@ -69,7 +79,11 @@
<td>
{% if hash.expires %}
<span title="{{ hash.expires|date(config.post_date) }}">
- {{ hash.expires|until }}
+ {% if hash.expires < time() %}
+ {{ hash.expires|ago }} ago
+ {% else %}
+ {{ hash.expires|until }}
+ {% endif %}
</span>
{% else %}
-
diff --git a/templates/mod/debug/recent_posts.html b/templates/mod/debug/recent_posts.html
index b84d24ab..e4eb4f3a 100644
--- a/templates/mod/debug/recent_posts.html
+++ b/templates/mod/debug/recent_posts.html
@@ -1,3 +1,40 @@
+<p style="text-align:center">
+ Flood prevention cache:
+</p>
+<table class="modlog" style="width:1%;">
+ <tr>
+ <th>#</th>
+ <th>Time</th>
+ <th>Board</th>
+ <th>Post hash</th>
+ <th>File hash</th>
+ </tr>
+ {% for post in flood_posts %}
+ <tr>
+ <td class="minimal">{{ post.id }}</td>
+ <td class="minimal"{% if post.in_flood_table %} style="color:red" title="Still in flood prevention cache."{% endif %}>
+ <small>{{ post.time | ago }} ago</small>
+ </td>
+ <td class="minimal">
+ <a href="?/{{ config.board_path|sprintf(post.board) }}{{ config.file_index }}">
+ {{ config.board_abbreviation|sprintf(post.board) }}
+ </a>
+ </td>
+ <td><code>{{ post.posthash }}</code></td>
+ <td>
+ {% if post.filehash %}
+ <code>{{ post.filehash }}</code>
+ {% else %}
+ <em>No file</em>
+ {% endif %}
+ </td>
+ </tr>
+ {% endfor %}
+</table>
+
+<p style="text-align:center">
+ Most recent {{ posts|count }} posts:
+</p>
<table class="modlog" style="word-wrap: break-word;">
<tr>
<th>Time</th>
@@ -12,11 +49,13 @@
</tr>
{% for post in posts %}
<tr>
- <td class="minimal">
+ <td class="minimal"{% if post.in_flood_table %} style="color:red" title="Still in flood prevention cache."{% endif %}>
<small>{{ post.time | ago }} ago</small>
</td>
<td class="minimal">
- <a href="?/{{ config.board_path|sprintf(post.board) }}{{ config.file_index }}">{{ config.board_abbreviation|sprintf(post.board) }}</a>
+ <a href="?/{{ config.board_path|sprintf(post.board) }}{{ config.file_index }}">
+ {{ config.board_abbreviation|sprintf(post.board) }}
+ </a>
</td>
<td class="minimal" >
{% if post.thread %}
diff --git a/templates/mod/debug/sql.html b/templates/mod/debug/sql.html
index 755995f9..249d05e3 100644
--- a/templates/mod/debug/sql.html
+++ b/templates/mod/debug/sql.html
@@ -16,7 +16,13 @@
{% for row in result %}
<tr>
{% for col in row %}
- <td>{{ col | e }}</td>
+ <td>
+ {% if col != null %}
+ {{ col | e }}
+ {% else %}
+ <em>NULL</em>
+ {% endif %}
+ </td>
{% endfor %}
</tr>
{% endfor %}
diff --git a/templates/mod/search_results.html b/templates/mod/search_results.html
index 0c87f75f..0d3c2a10 100644
--- a/templates/mod/search_results.html
+++ b/templates/mod/search_results.html
@@ -56,10 +56,10 @@
{% for ban in results %}
<tr{% if ban.expires != 0 and ban.expires < time() %} style="text-decoration:line-through"{% endif %}>
<td style="white-space: nowrap">
- {% if ban.real_ip %}
- <a href="?/IP/{{ ban.ip }}#bans">{{ ban.ip }}</a>
+ {% if ban.single_addr %}
+ <a href="?/IP/{{ ban.mask }}#bans">{{ ban.mask }}</a>
{% else %}
- {{ ban.ip|e }}
+ {{ ban.mask|e }}
{% endif %}
</td>
<td>
@@ -77,15 +77,15 @@
{% endif %}
</td>
<td style="white-space: nowrap">
- <span title="{{ ban.set|date(config.post_date) }}">
- {{ ban.set|ago }} ago
+ <span title="{{ ban.created|date(config.post_date) }}">
+ {{ ban.created|ago }} ago
</span>
</td>
<td style="white-space: nowrap">
{% if ban.expires == 0 %}
-
{% else %}
- {{ (ban.expires - ban.set + time()) | until }}
+ {{ (ban.expires - ban.created + time()) | until }}
{% endif %}
</td>
<td style="white-space: nowrap">
@@ -116,7 +116,7 @@
{% endif %}
{% endif %}
- {% elseif ban.mod == -1 %}
+ {% elseif ban.creator == -1 %}
<em>system</em>
{% else %}
<em>{% trans 'deleted?' %}</em>
diff --git a/templates/mod/user.html b/templates/mod/user.html
index 1bb297af..89240824 100644
--- a/templates/mod/user.html
+++ b/templates/mod/user.html
@@ -28,21 +28,15 @@
</tr>
{% if new %}
<tr>
- <th>{% trans 'Class' %}</th>
+ <th>{% trans 'Group' %}</th>
<td>
<ul style="padding:5px 8px;list-style:none">
- <li>
- <input type="radio" name="type" id="janitor" value="{{ constant('JANITOR') }}">
- <label for="janitor">{% trans 'Janitor' %}</label>
- </li>
- <li>
- <input type="radio" name="type" id="mod" value="{{ constant('MOD') }}" checked>
- <label for="mod">{% trans 'Mod' %}</label>
- </li>
- <li>
- <input type="radio" name="type" id="admin" value="{{ constant('Admin') }}">
- <label for="admin">{% trans 'Admin' %}</label>
- </li>
+ {% for group_value, group_name in config.mod.groups if group_name != 'Disabled' %}
+ <li>
+ <input type="radio" name="type" id="group_{{ group_name }}" value="{{ group_value }}">
+ <label for="group_{{ group_name }}">{% trans group_name %}</label>
+ </li>
+ {% endfor %}
</ul>
</td>
</tr>
diff --git a/templates/mod/users.html b/templates/mod/users.html
index fbd43b32..b4c666e1 100644
--- a/templates/mod/users.html
+++ b/templates/mod/users.html
@@ -15,9 +15,10 @@
<td><small>{{ user.id }}</small></td>
<td>{{ user.username|e }}</td>
<td>
- {% if user.type == constant('JANITOR') %}{% trans 'Janitor' %}
- {% elseif user.type == constant('MOD') %}{% trans 'Mod' %}
- {% elseif user.type == constant('ADMIN') %}{% trans 'Admin' %}
+ {% if config.mod.groups[user.type] %}
+ {{ config.mod.groups[user.type] }}
+ {% else %}
+ <em>{% trans 'Unknown' %}</em> ({{ user.type }})
{% endif %}
</td>
<td>
@@ -46,11 +47,11 @@
</td>
{% endif %}
<td>
- {% if mod|hasPermission(config.mod.promoteusers) and user.type < constant('ADMIN') %}
+ {% if mod|hasPermission(config.mod.promoteusers) and user.type < constant(config.mod.groups[0:-1]|last) %}
<a style="float:left;text-decoration:none" href="?/users/{{ user.id }}/promote" title="{% trans 'Promote' %}">&#9650;</a>
{% endif %}
- {% if mod|hasPermission(config.mod.promoteusers) and user.type > constant('JANITOR') %}
- <a style="float:left;text-decoration:none" href="?/users/{{ user.id }}/demote" title="{% trans 'Demote' %}">&#9660;</a>
+ {% if mod|hasPermission(config.mod.promoteusers) and user.type > constant(config.mod.groups|first) %}
+ <a style="float:left;text-decoration:none" href="?/users/{{ user.id }}/demote" title="{% trans 'Demote' %}"{% if mod.id == user.id %} onclick="return confirm('{% trans 'Are you sure you want to demote yourself?' %}')"{% endif %}>&#9660;</a>
{% endif %}
{% if mod|hasPermission(config.mod.modlog) %}
<a class="unimportant" style="margin-left:5px;float:right" href="?/log:{{ user.username|e }}">[{% trans 'log' %}]</a>
diff --git a/templates/mod/view_ip.html b/templates/mod/view_ip.html
index e2dad7af..f73c5d5a 100644
--- a/templates/mod/view_ip.html
+++ b/templates/mod/view_ip.html
@@ -100,7 +100,7 @@
</tr>
<tr>
<th>{% trans 'IP' %}</th>
- <td>{{ ban.ip }}</td>
+ <td>{{ ban.mask }}</td>
</tr>
<tr>
<th>{% trans 'Reason' %}</th>
@@ -124,7 +124,7 @@
</tr>
<tr>
<th>{% trans 'Set' %}</th>
- <td>{{ ban.set|date(config.post_date) }}</td>
+ <td>{{ ban.created|date(config.post_date) }}</td>
</tr>
<tr>
<th>{% trans 'Expires' %}</th>