summaryrefslogtreecommitdiff
path: root/templates/themes
diff options
context:
space:
mode:
authorczaks <marcin@6irc.net>2015-03-10 12:48:59 +0100
committerczaks <marcin@6irc.net>2015-03-10 12:48:59 +0100
commitbdb6001f3f7e93e0b9655c0491bbef6f1df8a5fa (patch)
tree4f4007d1b090694746fc6d36a19dd8accfd3f8ca /templates/themes
parenteb245c2970062620f349024922f8c48379ffea88 (diff)
support for slugified links; may introduce a few bugs
Diffstat (limited to 'templates/themes')
-rw-r--r--templates/themes/catalog/theme.php2
-rw-r--r--templates/themes/recent/theme.php4
-rw-r--r--templates/themes/sitemap/sitemap.xml4
-rw-r--r--templates/themes/sitemap/theme.php2
4 files changed, 6 insertions, 6 deletions
diff --git a/templates/themes/catalog/theme.php b/templates/themes/catalog/theme.php
index 9ba2d27a..b3b7caf7 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..1cebcdb6 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`, `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);
}