summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorczaks <marcin@6irc.net>2013-07-20 17:28:34 -0400
committerczaks <marcin@6irc.net>2013-07-20 17:28:34 -0400
commit9f323ae65fb9370a93d1aaa869ab5edfbaca49cf (patch)
tree926a464440df8a37509ae54165edefac4a89d874 /templates
parentf04566f6d30553560d5a69e25e38de72a60f297c (diff)
parente8b693b0447e5a61f740b27c5f3a57f68d544342 (diff)
Merge branch 'master' of https://github.com/savetheinternet/Tinyboard
Conflicts: templates/themes/sitemap/info.php
Diffstat (limited to 'templates')
-rw-r--r--templates/mod/dashboard.html11
-rw-r--r--templates/mod/search_form.html18
-rw-r--r--templates/mod/search_results.html177
-rw-r--r--templates/themes/sitemap/info.php2
4 files changed, 199 insertions, 9 deletions
diff --git a/templates/mod/dashboard.html b/templates/mod/dashboard.html
index e54b3cd3..619663f5 100644
--- a/templates/mod/dashboard.html
+++ b/templates/mod/dashboard.html
@@ -101,22 +101,17 @@
</ul>
</fieldset>
-{#
+{% if mod|hasPermission(config.mod.search) %}
<fieldset>
<legend>{% trans 'Search' %}</legend>
<ul>
<li>
- <form style="display:inline" action="?/search" method="post">
- <label style="display:inline" for="search">{% trans 'Phrase:' %}</label>
- <input id="search" name="search" type="text" size="35">
- <input type="submit" value="{% trans 'Search' %}">
- </form>
- <p class="unimportant">{% trans '(Search is case-insensitive, and based on keywords. To match exact phrases, use "quotes". Use an asterisk (*) for wildcard.)' %}</p>
+ {% include 'mod/search_form.html' %}
</li>
</ul>
</fieldset>
-#}
+{% endif %}
{% if config.debug %}
<fieldset>
diff --git a/templates/mod/search_form.html b/templates/mod/search_form.html
new file mode 100644
index 00000000..d8a2fed4
--- /dev/null
+++ b/templates/mod/search_form.html
@@ -0,0 +1,18 @@
+<form style="display:inline" action="?/search" method="post">
+ <label style="display:inline" for="search">{% trans 'Phrase:' %}</label>
+ <input id="search" name="query" type="text" size="60" value="{{ search_query|e }}">
+ <select name="type">
+ <option value="posts"{% if search_type == 'posts'%} selected{% endif %}>{% trans 'Posts' %}</option>
+ {% if mod|hasPermission(config.mod.view_notes) and mod|hasPermission(config.mod.show_ip) %}
+ <option value="IP_notes"{% if search_type == 'IP_notes'%} selected{% endif %}>{% trans 'IP address notes' %}</option>
+ {% endif %}
+ {% if mod|hasPermission(config.mod.view_banlist) %}
+ <option value="bans"{% if search_type == 'bans'%} selected{% endif %}>{% trans 'Bans' %}</option>
+ {% endif %}
+ {% if mod|hasPermission(config.mod.modlog) %}
+ <option value="log"{% if search_type == 'log'%} selected{% endif %}>{% trans 'Moderation log' %}</option>
+ {% endif %}
+ </select>
+ <input type="submit" value="{% trans 'Search' %}">
+</form>
+<p class="unimportant">{% trans '(Search is case-insensitive and based on keywords. To match exact phrases, use "quotes". Use an asterisk (*) for wildcard.)' %}</p> \ No newline at end of file
diff --git a/templates/mod/search_results.html b/templates/mod/search_results.html
new file mode 100644
index 00000000..b441a28f
--- /dev/null
+++ b/templates/mod/search_results.html
@@ -0,0 +1,177 @@
+<fieldset style="margin-bottom:20px">
+ <legend>{% trans 'Search' %}</legend>
+
+ <ul>
+ <li>
+ {% include 'mod/search_form.html' %}
+ </li>
+ </ul>
+</fieldset>
+
+<p style="text-align:center">Showing {{ result_count }} result{% if result_count != 1 %}s{% endif %}.</p>
+
+{% if search_type == 'IP_notes' %}
+ <table class="modlog">
+ <tr>
+ <th>{% trans 'IP address' %}</th>
+ <th>{% trans 'Staff' %}</th>
+ <th>{% trans 'Note' %}</th>
+ <th>{% trans 'Date' %}</th>
+ </tr>
+ {% for note in results %}
+ <tr>
+ <td class="minimal">
+ <a href="?/IP/{{ note.ip }}#notes">{{ note.ip }}</a>
+ </td>
+ <td class="minimal">
+ {% if note.username %}
+ <a href="?/new_PM/{{ note.username|e }}">{{ note.username|e }}</a>
+ {% else %}
+ <em>{% trans 'deleted?' %}</em>
+ {% endif %}
+ </td>
+ <td>
+ {{ note.body }}
+ </td>
+ <td class="minimal">
+ {{ note.time|date(config.post_date) }}
+ </td>
+ </tr>
+ {% endfor %}
+ </table>
+{% endif %}
+
+{% if search_type == 'bans' %}
+ <table class="modlog" style="width:100%">
+ <tr>
+ <th>{% trans 'IP address/mask' %}</th>
+ <th>{% trans 'Reason' %}</th>
+ <th>{% trans 'Board' %}</th>
+ <th>{% trans 'Set' %}</th>
+ <th>{% trans 'Duration' %}</th>
+ <th>{% trans 'Expires' %}</th>
+ <th>{% trans 'Seen' %}</th>
+ <th>{% trans 'Staff' %}</th>
+ </tr>
+ {% 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>
+ {% else %}
+ {{ ban.ip|e }}
+ {% endif %}
+ </td>
+ <td>
+ {% if ban.reason %}
+ {{ ban.reason }}
+ {% else %}
+ -
+ {% endif %}
+ </td>
+ <td style="white-space: nowrap">
+ {% if ban.board %}
+ {{ config.board_abbreviation|sprintf(ban.board) }}
+ {% else %}
+ <em>{% trans 'all boards' %}</em>
+ {% endif %}
+ </td>
+ <td style="white-space: nowrap">
+ <span title="{{ ban.set|date(config.post_date) }}">
+ {{ ban.set|ago }} ago
+ </span>
+ </td>
+ <td style="white-space: nowrap">
+ {% if ban.expires == 0 %}
+ -
+ {% else %}
+ {{ (ban.expires - ban.set + time()) | until }}
+ {% endif %}
+ </td>
+ <td style="white-space: nowrap">
+ {% if ban.expires == 0 %}
+ <em>{% trans 'never' %}</em>
+ {% else %}
+ {{ ban.expires|date(config.post_date) }}
+ {% if ban.expires > time() %}
+ <small>(in {{ ban.expires|until }})</small>
+ {% endif %}
+ {% endif %}
+ </td>
+ <td>
+ {% if ban.seen %}
+ {% trans 'Yes' %}
+ {% else %}
+ {% trans 'No' %}
+ {% endif %}
+ </td>
+ <td>
+ {% if ban.username %}
+ {% if mod|hasPermission(config.mod.view_banstaff) %}
+ <a href="?/new_PM/{{ ban.username|e }}">{{ ban.username|e }}</a>
+ {% else %}
+ {% if mod|hasPermission(config.mod.view_banquestionmark) %}
+ <em>?</em>
+ {% else %}
+
+ {% endif %}
+ {% endif %}
+ {% elseif ban.mod == -1 %}
+ <em>system</em>
+ {% else %}
+ <em>{% trans 'deleted?' %}</em>
+ {% endif %}
+ </td>
+ </tr>
+ {% endfor %}
+ </table>
+{% endif %}
+
+{% if search_type == 'log' %}
+ <table class="modlog">
+ <tr>
+ <th>{% trans 'Staff' %}</th>
+ <th>{% trans 'IP address' %}</th>
+ <th>{% trans 'Time' %}</th>
+ <th>{% trans 'Board' %}</th>
+ <th>{% trans 'Action' %}</th>
+ </tr>
+ {% for log in results %}
+ <tr>
+ <td class="minimal">
+ {% if log.username %}
+ <a href="?/log:{{ log.username|e }}">{{ log.username|e }}</a>
+ {% elseif log.mod == -1 %}
+ <em>system</em>
+ {% else %}
+ <em>{% trans 'deleted?' %}</em>
+ {% endif %}
+ </td>
+ <td class="minimal">
+ <a href="?/IP/{{ log.ip }}">{{ log.ip }}</a>
+ </td>
+ <td class="minimal">
+ <span title="{{ log.time|date(config.post_date) }}">{{ log.time|ago }}</span>
+ </td>
+ <td class="minimal">
+ {% if log.board %}
+ <a href="?/{{ config.board_path|sprintf(log.board) }}{{ config.file_index }}">{{ config.board_abbreviation|sprintf(log.board) }}</a>
+ {% else %}
+ -
+ {% endif %}
+ </td>
+ <td>
+ {{ log.text }}
+ </td>
+ </tr>
+ {% endfor %}
+ </table>
+{% endif %}
+
+{% if result_count > results|count %}
+ <p class="unimportant" style="text-align:center;word-wrap:break-word">
+ {% for i in range(0, (result_count - 1) / config.mod.search_page) %}
+ <a href="?/search/{{ search_type }}/{{ search_query_escaped }}/{{ i + 1 }}">[{{ i + 1 }}]</a>
+ {% endfor %}
+ </p>
+{% endif %} \ No newline at end of file
diff --git a/templates/themes/sitemap/info.php b/templates/themes/sitemap/info.php
index 1198c2e3..43b529fa 100644
--- a/templates/themes/sitemap/info.php
+++ b/templates/themes/sitemap/info.php
@@ -23,7 +23,7 @@
'name' => 'url',
'type' => 'text',
'comment' => '(with trailing slash)',
- 'default' => 'http://' . (isset ($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : "localhost") . $config['root'],
+ 'default' => (isset($_SERVER['HTTP_HOST']) ? 'http://' . $_SERVER['HTTP_HOST'] . $config['root'] : ''),
'size' => '20'
);