Browse Source

Merge remote-tracking branch 'upstream/config' into frontpage

pull/40/head
Comatoast 3 years ago
parent
commit
c67d914549
  1. 3
      inc/config.php
  2. 3
      inc/instance-config.php
  3. 12
      inc/mod/pages.php
  4. 2
      post.php
  5. 3
      robots.txt
  6. 4
      stylesheets/dark.css
  7. 10
      templates/post_thread.html
  8. 2
      templates/themes/catalog/catalog.html
  9. 30
      templates/themes/semirand/theme.php

3
inc/config.php

@ -1223,7 +1223,8 @@
// $config['font_awesome'] is false (default).
// $config['image_sticky'] = 'static/sticky.png';
// $config['image_locked'] = 'static/locked.gif';
// $config['image_bumplocked'] = 'static/sage.png'.
// $config['image_bumplocked'] = 'static/sage.png';
// $config['image_cycled'] = 'static/cycled.png';
// If you want to put images and other dynamic-static stuff on another (preferably cookieless) domain.
// This will override $config['root'] and $config['dir']['...'] directives. "%s" will get replaced with

3
inc/instance-config.php

@ -122,6 +122,9 @@ $config['mod']['rawhtml'] = MOD;
$config['mod']['mod_board_log'] = MOD;
$config['mod']['ip_recentposts'] = 350;
// Allow everyone to see bumplocks
$config['mod']['view_bumplock'] = -1;
$config['allow_thread_deletion'] = false;
// Max attachments per post

12
inc/mod/pages.php

@ -2020,18 +2020,18 @@ function mod_edit_post($board, $edit_raw_html, $postID) {
header('Location: ?/' . sprintf($config['board_path'], $board) . $config['dir']['res'] . link_for($post) . '#' . $postID, true, $config['redirect_http']);
} else {
// Remove modifiers
//$post['body_nomarkup'] = remove_modifiers($post['body_nomarkup']);
$post['body_nomarkup'] = remove_modifiers($post['body_nomarkup']);
//$post['body_nomarkup'] = utf8tohtml($post['body_nomarkup']);
//$post['body'] = utf8tohtml($post['body']);
/*if ($config['minify_html']) {
$post['body_nomarkup'] = utf8tohtml($post['body_nomarkup']);
$post['body'] = utf8tohtml($post['body']);
if ($config['minify_html']) {
$post['body_nomarkup'] = str_replace("\n", '
', $post['body_nomarkup']);
$post['body'] = str_replace("\n", '
', $post['body']);
$post['body_nomarkup'] = str_replace("\r", '', $post['body_nomarkup']);
$post['body'] = str_replace("\r", '', $post['body']);
$post['body_nomarkup'] = str_replace("\t", '	', $post['body_nomarkup']);
$post['body'] = str_replace("\t", '	', $post['body']);
}*/
}
mod_page(_('Edit post'), 'mod/edit_post_form.html', array('token' => $security_token, 'board' => $board, 'raw' => $edit_raw_html, 'post' => $post));
}
@ -3219,7 +3219,7 @@ function mod_theme_uninstall($theme_name) {
// Clean cache
Cache::delete("themes");
Cache::delete("theme_settings_".$theme);
Cache::delete("theme_settings_".$theme_name);
header('Location: ?/themes', true, $config['redirect_http']);
}

2
post.php

@ -1374,7 +1374,7 @@ function handle_post(){
query('INSERT INTO ``cites`` VALUES ' . implode(', ', $insert_rows)) or error(db_error());
}
if (!$post['op'] && strtolower($post['email']) != 'sage' && !$thread['sage'] && ($config['reply_limit'] == 0 || $numposts['replies']+1 < $config['reply_limit'])) {
if (!$post['op'] && strtolower($post['email']) != 'sage' && !$thread['sage'] && ($config['reply_limit'] == 0 || $numposts['replies'] < $config['reply_limit'])) {
bumpThread($post['thread']);
}

3
robots.txt

@ -1,2 +1,3 @@
User-agent: *
Disallow: /
Disallow: /templates/
Allow: /

4
stylesheets/dark.css

@ -5,8 +5,8 @@
body {
background: #1E1E1E;
color: #999999;
font-family: sans-serif;
font-size: 12px;
font-family: Verdana, sans-serif;
font-size: 14px;
}
.quote {
color:#B8D962;

10
templates/post_thread.html

@ -21,28 +21,28 @@
{% if config.font_awesome %}
<i class="fa fa-thumb-tack" title="Sticky"></i>
{% else %}
<img class="icon" title="Sticky" src="{{ config.image_sticky }}" alt="Sticky" />
<img class="icon" title="Sticky" src="{{ config.root }}{{ config.image_sticky }}" alt="Sticky" />
{% endif %}
{% endif %}
{% if post.locked %}
{% if config.font_awesome %}
<i class="fa fa-lock" title="Locked"></i>
{% else %}
<img class="icon" title="Locked" src="{{ config.image_locked }}" alt="Locked" />
<img class="icon" title="Locked" src="{{ config.root }}{{ config.image_locked }}" alt="Locked" />
{% endif %}
{% endif %}
{% if post.bumplocked and (config.mod.view_bumplock < 0 or (post.mod and post.mod|hasPermission(config.mod.view_bumplock, board.uri))) %}
{% if post.sage and (config.mod.view_bumplock < 0 or (post.mod and post.mod|hasPermission(config.mod.view_bumplock, board.uri))) %}
{% if config.font_awesome %}
<i class="fa fa-anchor" title="Bumplocked"></i>
{% else %}
<img class="icon" title="Bumplocked" src="{{ config.image_bumplocked }}" alt="Bumplocked" />
<img class="icon" title="Bumplocked" src="{{ config.root }}{{ config.image_bumplocked }}" alt="Bumplocked" />
{% endif %}
{% endif %}
{% if post.cycle %}
{% if config.font_awesome %}
<i class="fa fa-refresh" title="Cyclical"></i>
{% else %}
<img class="icon" title="Cyclical" src="{{ config.image_sticky }}" alt="Cyclical" />
<img class="icon" title="Cyclical" src="{{ config.root }}{{ config.image_cycled }}" alt="Cyclical" />
{% endif %}
{% endif %}
{% if index %}

2
templates/themes/catalog/catalog.html

@ -70,7 +70,7 @@
id="img-{{ post.id }}" data-subject="{% if post.subject %}{{ post.subject|e }}{% endif %}" data-name="{{ post.name|e }}" data-muhdifference="{{ post.muhdifference }}" class="{{post.board}} thread-image" title="{{post.bump|date('%b %d %H:%M')}}">
</a>
<div class="replies">
<strong>R: {{ post.replies }} / I: {{ post.images }}{% if post.sticky %} (sticky){% endif %}{% if post.locked %} <span class="fa fa-lock">&nbsp;</span>{% endif %}</strong>
<strong>R: {{ post.replies }} / I: {{ post.images }}{% if post.sticky %} (sticky){% endif %}{% if post.sage %} (sage){% endif %}{% if (config.reply_limit > 0) and (post.replies >= config.reply_limit) %} (full){% endif %}{% if post.locked %} <span class="fa fa-lock">&nbsp;</span>{% endif %}</strong>
{% if post.subject %}
<p class="intro">
<span class="subject">

30
templates/themes/semirand/theme.php

@ -97,6 +97,18 @@
return $query->fetchAll(PDO::FETCH_ASSOC);
}
/**
* Retrieve count of images and posts in a thread
*/
private function fetchThreadCount($board, $thread_id, $preview_count) {
$query = prepare("SELECT SUM(t.num_files) as file_count, COUNT(t.id) as post_count FROM (SELECT * FROM ``posts_$board`` WHERE `thread` = :id ORDER BY `time` DESC LIMIT :offset , 18446744073709551615) as t;");
$query->bindValue(':id', $thread_id, PDO::PARAM_INT);
$query->bindValue(':offset', $preview_count, PDO::PARAM_INT);
$query->execute() or error(db_error($query));
return $query->fetch(PDO::FETCH_ASSOC);
}
/**
* Intersperse random threads between those in bump order
*/
@ -138,27 +150,15 @@
$config['threads_preview'];
$replies = $this->fetchReplies($post['board'], $post['id'], $preview_count);
// Chomp the last few replies
$disp_replies = $replies;
$disp_img_count = 0;
foreach ($disp_replies as $reply) {
if ($reply['files'] !== '')
++$disp_img_count;
// Append the reply to the thread as it's being built
$thread->add(new Post($reply, $mod ? '?/' : $config['root'], $mod));
}
// Count the number of omitted image replies
$omitted_img_count = count(array_filter($replies, function($p) {
return $p['files'] !== '';
}));
// Set the corresponding omitted numbers on the thread
if (!empty($replies)) {
$thread->omitted = count($replies);
$thread->omitted_images = $omitted_img_count;
}
$threadCount = $this->fetchThreadCount($post['board'], $post['id'], $preview_count);
$thread->omitted = $threadCount['post_count'];
$thread->omitted_images = $threadCount['file_count'];
// Board name and link
$html = '<h2><a href="' . $config['root'] . $post['board'] . '/">/' .

Loading…
Cancel
Save