diff options
| author | czaks <marcin@6irc.net> | 2015-03-10 14:22:47 +0100 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2015-03-10 14:22:47 +0100 |
| commit | bf1b6103cf6d3cf7f83e85453aad2d03e03e62da (patch) | |
| tree | 9460a02b2e7629059349fb88cacb1ad54bab1814 /templates | |
| parent | 6c4d3941fa729558f4a5313081c85b0a06202e54 (diff) | |
| parent | 4bf525599e7c596e7aec7f483664a091ef0db57b (diff) | |
Merge branch 'master' of github.com:vichan-devel/Tinyboard
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/main.js | 1 | ||||
| -rw-r--r-- | templates/mod/debug/recent_posts.html | 2 | ||||
| -rw-r--r-- | templates/mod/search_results.html | 4 | ||||
| -rw-r--r-- | templates/post_reply.html | 4 | ||||
| -rw-r--r-- | templates/post_thread.html | 10 | ||||
| -rw-r--r-- | templates/posts.sql | 1 | ||||
| -rw-r--r-- | templates/themes/catalog/theme.php | 2 | ||||
| -rw-r--r-- | templates/themes/recent/theme.php | 4 | ||||
| -rw-r--r-- | templates/themes/sitemap/sitemap.xml | 4 | ||||
| -rw-r--r-- | templates/themes/sitemap/theme.php | 2 |
10 files changed, 18 insertions, 16 deletions
diff --git a/templates/main.js b/templates/main.js index ead852fe..e948fd82 100644 --- a/templates/main.js +++ b/templates/main.js @@ -146,6 +146,7 @@ function changeStyle(styleName, link) { {% endraw %} {% if config.stylesheets_board %} {# This is such an unacceptable mess. There needs to be an easier way. #} + {# Needs fix for slugify #} var matches = document.URL.match(/\/(\w+)\/($|{{ config.dir.res|replace({'/': '\\/'}) }}{{ config.file_page|replace({'%d': '\\d+', '.': '\\.'}) }}|{{ config.file_index|replace({'.': '\\.'}) }}|{{ config.file_page|replace({'%d': '\\d+', '.': '\\.'}) }})/); {% raw %} if (matches) { diff --git a/templates/mod/debug/recent_posts.html b/templates/mod/debug/recent_posts.html index e4eb4f3a..ce4cffc4 100644 --- a/templates/mod/debug/recent_posts.html +++ b/templates/mod/debug/recent_posts.html @@ -63,7 +63,7 @@ {% else %} {% set thread = post.id %} {% endif %} - <a href="?/{{ post.board ~ '/' ~ config.dir.res}}{{ config.file_page|sprintf(thread) }}#{{ post.id }}"> + <a href="?/{{ post.board ~ '/' ~ config.dir.res}}{{ link_for(post) }}#{{ post.id }}"> {{ post.id }} </a> </td> diff --git a/templates/mod/search_results.html b/templates/mod/search_results.html index 0d3c2a10..186ee5db 100644 --- a/templates/mod/search_results.html +++ b/templates/mod/search_results.html @@ -195,7 +195,7 @@ {% else %} {% set thread = post.id %} {% endif %} - <a href="?/{{ post.board ~ '/' ~ config.dir.res}}{{ config.file_page|sprintf(thread) }}#{{ post.id }}"> + <a href="?/{{ post.board ~ '/' ~ config.dir.res}}{{ link_for(post) }}#{{ post.id }}"> {{ post.id }} </a> </td> @@ -265,4 +265,4 @@ <a href="?/search/{{ search_type }}/{{ search_query_escaped }}/{{ i + 1 }}">[{{ i + 1 }}]</a> {% endfor %} </p> -{% endif %}
\ No newline at end of file +{% endif %} diff --git a/templates/post_reply.html b/templates/post_reply.html index e7343230..451ff1b9 100644 --- a/templates/post_reply.html +++ b/templates/post_reply.html @@ -12,8 +12,8 @@ {% include 'post/time.html' %} </label> {% include 'post/poster_id.html' %} - <a class="post_no" id="post_no_{{ post.id }}" onclick="highlightReply({{ post.id }})" href="{% if isnoko50 %}{{ post.link('', config.file_page50) }}{% else %}{{ post.link }}{% endif %}">No.</a> - <a class="post_no" onclick="citeReply({{ post.id }})" href="{% if isnoko50 %}{{ post.link('q', config.file_page50) }}{% else %}{{ post.link('q') }}{% endif %}">{{ post.id }}</a> + <a class="post_no" id="post_no_{{ post.id }}" onclick="highlightReply({{ post.id }})" href="{% if isnoko50 %}{{ post.link('', '50') }}{% else %}{{ post.link }}{% endif %}">No.</a> + <a class="post_no" onclick="citeReply({{ post.id }})" href="{% if isnoko50 %}{{ post.link('q', '50') }}{% else %}{{ post.link('q') }}{% endif %}">{{ post.id }}</a> </p> {% include 'post/fileinfo.html' %} {% include 'post/post_controls.html' %} diff --git a/templates/post_thread.html b/templates/post_thread.html index 08b4c4c1..61146491 100644 --- a/templates/post_thread.html +++ b/templates/post_thread.html @@ -15,8 +15,8 @@ {% include 'post/time.html' %} </label> {% include 'post/poster_id.html' %} - <a class="post_no" id="post_no_{{ post.id }}" onclick="highlightReply({{ post.id }})" href="{% if isnoko50 %}{{ post.link('', config.file_page50) }}{% else %}{{ post.link }}{% endif %}">No.</a> - <a class="post_no" onclick="citeReply({{ post.id }})" href="{% if isnoko50 %}{{ post.link('q', config.file_page50) }}{% else %}{{ post.link('q') }}{% endif %}">{{ post.id }}</a> + <a class="post_no" id="post_no_{{ post.id }}" onclick="highlightReply({{ post.id }})" href="{% if isnoko50 %}{{ post.link('', '50') }}{% else %}{{ post.link }}{% endif %}">No.</a> + <a class="post_no" onclick="citeReply({{ post.id }})" href="{% if isnoko50 %}{{ post.link('q', '50') }}{% else %}{{ post.link('q') }}{% endif %}">{{ post.id }}</a> {% if post.sticky %} {% if config.font_awesome %} <i class="fa fa-thumb-tack"></i> @@ -39,14 +39,14 @@ {% endif %} {% endif %} {% if index %} - <a href="{{ post.root }}{{ board.dir }}{{ config.dir.res }}{{ config.file_page|sprintf(post.id) }}">[{% trans %}Reply{% endtrans %}]</a> + <a href="{{ post.root }}{{ board.dir }}{{ config.dir.res }}{{ link_for(post) }}">[{% trans %}Reply{% endtrans %}]</a> {% endif %} {% if isnoko50 %} - <a href="{{ post.root }}{{ board.dir }}{{ config.dir.res }}{{ config.file_page|sprintf(post.id) }}">[{% trans %}View All{% endtrans %}]</a> + <a href="{{ post.root }}{{ board.dir }}{{ config.dir.res }}{{ link_for(post) }}">[{% trans %}View All{% endtrans %}]</a> {% endif %} {% if hasnoko50 and not isnoko50 %} {% set lastcount = config.noko50_count %} - <a href="{{ post.root }}{{ board.dir }}{{ config.dir.res }}{{ config.file_page50|sprintf(post.id) }}">[{% trans %}Last 1 Post{% plural lastcount %}Last {{ count }} Posts{% endtrans %}]</a> + <a href="{{ post.root }}{{ board.dir }}{{ config.dir.res }}{{ link_for(post, true) }}">[{% trans %}Last 1 Post{% plural lastcount %}Last {{ count }} Posts{% endtrans %}]</a> {% endif %} {% include 'post/post_controls.html' %} </p> diff --git a/templates/posts.sql b/templates/posts.sql index 9a47c6ad..6b2249ef 100644 --- a/templates/posts.sql +++ b/templates/posts.sql @@ -19,6 +19,7 @@ CREATE TABLE IF NOT EXISTS ``posts_{{ board }}`` ( `locked` int(1) NOT NULL, `sage` int(1) NOT NULL, `embed` text, + `slug` varchar(256) DEFAULT NULL, UNIQUE KEY `id` (`id`), KEY `thread_id` (`thread`,`id`), KEY `filehash` (`filehash`(40)), diff --git a/templates/themes/catalog/theme.php b/templates/themes/catalog/theme.php index 9ba2d27a..f8f1146e 100644 --- a/templates/themes/catalog/theme.php +++ b/templates/themes/catalog/theme.php @@ -42,7 +42,7 @@ $board_name, $board_name, $board_name, $board_name, $board_name)) or error(db_error()); while ($post = $query->fetch(PDO::FETCH_ASSOC)) { - $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id'])); + $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . link_for($post); $post['board_name'] = $board['name']; if ($post['embed'] && preg_match('/^https?:\/\/(\w+\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9\-_]{10,11})(&.+)?$/i', $post['embed'], $matches)) { diff --git a/templates/themes/recent/theme.php b/templates/themes/recent/theme.php index b1153477..2ea6a7b9 100644 --- a/templates/themes/recent/theme.php +++ b/templates/themes/recent/theme.php @@ -62,7 +62,7 @@ // board settings won't be available in the template file, so generate links now $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] - . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id'])) . '#' . $post['id']; + . link_for($post) . '#' . $post['id']; if ($files) { if ($files[0]->thumb == 'spoiler') { @@ -92,7 +92,7 @@ while ($post = $query->fetch(PDO::FETCH_ASSOC)) { openBoard($post['board']); - $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id'])) . '#' . $post['id']; + $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . link_for($post) . '#' . $post['id']; if ($post['body'] != "") $post['snippet'] = pm_snippet($post['body'], 30); else diff --git a/templates/themes/sitemap/sitemap.xml b/templates/themes/sitemap/sitemap.xml index 733da607..95dfdd26 100644 --- a/templates/themes/sitemap/sitemap.xml +++ b/templates/themes/sitemap/sitemap.xml @@ -9,11 +9,11 @@ {% for board, thread_list in threads %} {% for thread in thread_list %} <url> - <loc>{{ settings.url ~ (config.board_path | format(board)) ~ config.dir.res ~ (config.file_page | format(thread.thread_id)) }}</loc> + <loc>{{ settings.url ~ (config.board_path | format(board)) ~ config.dir.res ~ link_for(thread) }}</loc> <lastmod>{{ thread.lastmod | date('%Y-%m-%dT%H:%M:%S') }}{{ timezone() }}</lastmod> <changefreq>{{ settings.changefreq }}</changefreq> </url> {% endfor %} {% endfor %} </urlset> -{% endfilter %}
\ No newline at end of file +{% endfilter %} diff --git a/templates/themes/sitemap/theme.php b/templates/themes/sitemap/theme.php index 3e048dd5..41a7f304 100644 --- a/templates/themes/sitemap/theme.php +++ b/templates/themes/sitemap/theme.php @@ -26,7 +26,7 @@ $threads = array(); foreach ($boards as $board) { - $query = query(sprintf("SELECT `id` AS `thread_id`, (SELECT `time` FROM ``posts_%s`` WHERE `thread` = `thread_id` OR `id` = `thread_id` ORDER BY `time` DESC LIMIT 1) AS `lastmod` FROM ``posts_%s`` WHERE `thread` IS NULL", $board, $board)) or error(db_error()); + $query = query(sprintf("SELECT `id`, `id` AS `thread_id`, `slug`, (SELECT `time` FROM ``posts_%s`` WHERE `thread` = `thread_id` OR `id` = `thread_id` ORDER BY `time` DESC LIMIT 1) AS `lastmod` FROM ``posts_%s`` WHERE `thread` IS NULL", $board, $board)) or error(db_error()); $threads[$board] = $query->fetchAll(PDO::FETCH_ASSOC); } |
