From b02442ff2261325c17c936641c04ce0ce432da1e Mon Sep 17 00:00:00 2001 From: 8chan Date: Tue, 5 May 2015 22:40:35 -0700 Subject: [PATCH 01/23] URL encode filename in API due to new file boards which allow filenames that are not just numbers. --- inc/api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/api.php b/inc/api.php index b278da96..9972deb6 100644 --- a/inc/api.php +++ b/inc/api.php @@ -92,7 +92,7 @@ class Api { $apiPost['filename'] = @substr($file->name, 0, strrpos($file->name, '.')); $dotPos = strrpos($file->file, '.'); $apiPost['ext'] = substr($file->file, $dotPos); - $apiPost['tim'] = substr($file->file, 0, $dotPos); + $apiPost['tim'] = urlencode(substr($file->file, 0, $dotPos)); if (isset($file->hash)) $apiPost['md5'] = base64_encode(hex2bin($file->hash)); } From 6b7311fad263e461f3e78b3226c15057a5ff4797 Mon Sep 17 00:00:00 2001 From: 8chan Date: Tue, 5 May 2015 22:40:51 -0700 Subject: [PATCH 02/23] h1-5 in allowed_html by default --- inc/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/config.php b/inc/config.php index 8536ab44..604e146d 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1783,4 +1783,4 @@ $config['report_captcha'] = false; // Allowed HTML tags in ?/edit_pages. - $config['allowed_html'] = 'a[href|title],p,br,li,ol,ul,strong,em,u,h2,b,i,tt,div,img[src|alt|title],hr'; + $config['allowed_html'] = 'a[href|title],p,br,li,ol,ul,strong,em,u,h2,b,i,tt,div,img[src|alt|title],hr,h1,h2,h3,h4,h5'; From 8dd8f9390e9b2390cb359ec524c0e9afb1ec61bf Mon Sep 17 00:00:00 2001 From: 8chan Date: Tue, 5 May 2015 22:41:21 -0700 Subject: [PATCH 03/23] Prevent bug in enumerating bans when post json is empty --- inc/bans.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/inc/bans.php b/inc/bans.php index 3e9eb9cf..b4f45149 100644 --- a/inc/bans.php +++ b/inc/bans.php @@ -187,7 +187,9 @@ class Bans { if ($ban['post']) { $post = json_decode($ban['post']); - $ban['message'] = $post->body; + if ($post) { + $ban['message'] = $post->body; + } } unset($ban['ipstart'], $ban['ipend'], $ban['post'], $ban['creator']); From 31b9efd51d5baf17e4100831c34c111aca16e412 Mon Sep 17 00:00:00 2001 From: 8chan Date: Tue, 5 May 2015 22:42:05 -0700 Subject: [PATCH 04/23] Fix bad UTF8 handling on boards page, it's already stored escaped in the DB... --- inc/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/functions.php b/inc/functions.php index 045cf81b..a9b7e373 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -986,7 +986,7 @@ function fetchBoardTags( $uris ) { $boardTags[ $tagRow['uri'] ] = array(); } - $boardTags[ $tagRow['uri'] ][] = htmlentities( utf8_encode( $tag ) ); + $boardTags[ $tagRow['uri'] ][] = $tag; } } From b84b22c2869775d806c7397b311f8a8bbee5ad7d Mon Sep 17 00:00:00 2001 From: 8chan Date: Tue, 5 May 2015 22:42:53 -0700 Subject: [PATCH 05/23] SECURITY: New fileboards feature requires thumbnail to be escaped or passes raw strings to shell... --- inc/lib/webm/ffmpeg.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/inc/lib/webm/ffmpeg.php b/inc/lib/webm/ffmpeg.php index bf14f7d9..fab60099 100644 --- a/inc/lib/webm/ffmpeg.php +++ b/inc/lib/webm/ffmpeg.php @@ -57,17 +57,17 @@ function make_webm_thumbnail($filename, $thumbnail, $width, $height, $duration) global $board, $config; $filename = escapeshellarg($filename); - //$thumbnail = escapeshellarg($thumbnail); // Should be safe by default but you + $thumbnailfc = escapeshellarg($thumbnail); // Should be safe by default but you // can never be too safe. $ffmpeg = $config['webm']['ffmpeg_path']; $ret = 0; $ffmpeg_out = array(); - exec("$ffmpeg -strict -2 -ss " . floor($duration / 2) . " -i $filename -v quiet -an -vframes 1 -f mjpeg -vf scale=$width:$height $thumbnail 2>&1", $ffmpeg_out, $ret); + exec("$ffmpeg -strict -2 -ss " . floor($duration / 2) . " -i $filename -v quiet -an -vframes 1 -f mjpeg -vf scale=$width:$height $thumbnailfc 2>&1", $ffmpeg_out, $ret); // Work around for https://trac.ffmpeg.org/ticket/4362 if (filesize($thumbnail) === 0) { // try again with first frame - exec("$ffmpeg -y -strict -2 -ss 0 -i $filename -v quiet -an -vframes 1 -f mjpeg -vf scale=$width:$height $thumbnail 2>&1", $ffmpeg_out, $ret); + exec("$ffmpeg -y -strict -2 -ss 0 -i $filename -v quiet -an -vframes 1 -f mjpeg -vf scale=$width:$height $thumbnailfc 2>&1", $ffmpeg_out, $ret); clearstatcache(); // failed if no thumbnail size even if ret code 0, ffmpeg is buggy if (filesize($thumbnail) === 0) { From 25c5ccd2db1781e4af57d29d7faf9f2da27480a0 Mon Sep 17 00:00:00 2001 From: 8chan Date: Tue, 5 May 2015 22:43:16 -0700 Subject: [PATCH 06/23] Fileboards: Open link in new tab --- templates/post_thread_fileboard.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/post_thread_fileboard.html b/templates/post_thread_fileboard.html index 3f17907d..079b5086 100644 --- a/templates/post_thread_fileboard.html +++ b/templates/post_thread_fileboard.html @@ -8,7 +8,7 @@ {{ post.id }} {% include 'post/name.html' %} {% include 'post/flag.html' %} -[{{ post.files[0].filename|e|bidi_cleanup }}] +[{{ post.files[0].filename|e|bidi_cleanup }}] {% if post.modifiers['tag'] %}[{{ post.modifiers['tag']|e }}]{% endif %} {% include 'post/subject.html' %} {% if post.sticky %} From cbc49e2a165f315fafa39e7dcba43ccb299cf120 Mon Sep 17 00:00:00 2001 From: 8chan Date: Tue, 5 May 2015 22:43:39 -0700 Subject: [PATCH 07/23] Handle paperclip icon as OP image --- templates/themes/catalog/theme.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/templates/themes/catalog/theme.php b/templates/themes/catalog/theme.php index 42fad1ea..9354b251 100644 --- a/templates/themes/catalog/theme.php +++ b/templates/themes/catalog/theme.php @@ -82,7 +82,11 @@ $post['file'] = '/' . $config['spoiler_image']; } else { - $post['file'] = $config['uri_thumb'] . $files[0]->thumb; + if ($files[0]->thumb == 'file') { + $post['file'] = $config['root'] . sprintf($config['file_thumb'], 'file.png'); + } else { + $post['file'] = $config['uri_thumb'] . $files[0]->thumb; + } $post['fullimage'] = $config['uri_img'] . $files[0]->file; } } From a9d0ee1f421e2440b9b40757b9abc81b2ba4902d Mon Sep 17 00:00:00 2001 From: 8chan Date: Tue, 5 May 2015 22:44:12 -0700 Subject: [PATCH 08/23] Bugfix: Allow blank tag in fileboards, do not show empty tinyboard markups --- post.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/post.php b/post.php index 7d8a0bc7..576a17bd 100644 --- a/post.php +++ b/post.php @@ -664,7 +664,7 @@ elseif (isset($_POST['post'])) { } } - if ($config['allowed_tags'] && $post['op'] && isset($_POST['tag']) && isset($config['allowed_tags'][$_POST['tag']])) { + if ($config['allowed_tags'] && $post['op'] && isset($_POST['tag']) && $_POST['tag'] && isset($config['allowed_tags'][$_POST['tag']])) { $post['body'] .= "\n" . $_POST['tag'] . ""; } From 52cfcb6d7cdf7d0193a5277d58ed84bb46c889e3 Mon Sep 17 00:00:00 2001 From: Fredrick Brennan Date: Wed, 6 May 2015 13:57:55 +0800 Subject: [PATCH 09/23] Fix stretched table stylesheet --- stylesheets/style.css | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/stylesheets/style.css b/stylesheets/style.css index a2f69cb8..f5e58238 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -24,13 +24,10 @@ main { } /* Tables */ -table { - margin: auto; - width: 100%; -} - table { margin: auto; +} +table.board-list-table { width: 100%; } table tbody td { From 92168dd21e40642dfea96d9ea79262dc0334991b Mon Sep 17 00:00:00 2001 From: Fredrick Brennan Date: Wed, 6 May 2015 19:27:27 +0800 Subject: [PATCH 10/23] Board owners can now change their usernames and set recovery email during creation process and while logged in. --- create.php | 6 ++- inc/config.php | 2 +- inc/mod/pages.php | 76 ++++++++++++++++++++++++++---------- install.sql | 1 + templates/8chan/create.html | 1 + templates/mod/dashboard.html | 2 +- templates/mod/user.html | 18 +++++++-- templates/mod/users.html | 4 ++ 8 files changed, 83 insertions(+), 27 deletions(-) diff --git a/create.php b/create.php index f220157b..eefe099f 100644 --- a/create.php +++ b/create.php @@ -21,6 +21,7 @@ $title = $_POST['title']; $subtitle = $_POST['subtitle']; $username = $_POST['username']; $password = $_POST['password']; +$email = $_POST['email']; $resp = file_get_contents($config['captcha']['provider_check'] . "?" . http_build_query([ 'mode' => 'check', @@ -39,6 +40,8 @@ if (!preg_match('/^[a-zA-Z0-9._]{1,30}$/', $username)) error(_('Invalid username')); if ($resp !== '1') error($config['error']['captcha']); +if (!filter_var($email, FILTER_VALIDATE_EMAIL)) + $email = ''; foreach (listBoards() as $i => $board) { if ($board['uri'] == $uri) @@ -66,12 +69,13 @@ error(_('The username you\'ve tried to enter already exists!')); $salt = generate_salt(); $password = hash('sha256', $salt . sha1($password)); -$query = prepare('INSERT INTO ``mods`` VALUES (NULL, :username, :password, :salt, :type, :boards)'); +$query = prepare('INSERT INTO ``mods`` VALUES (NULL, :username, :password, :salt, :type, :boards, :email)'); $query->bindValue(':username', $username); $query->bindValue(':password', $password); $query->bindValue(':salt', $salt); $query->bindValue(':type', 20); $query->bindValue(':boards', $uri); +$query->bindValue(':email', $email); $query->execute() or error(db_error($query)); $query = prepare('INSERT INTO ``boards`` (`uri`, `title`, `subtitle`) VALUES (:uri, :title, :subtitle)'); diff --git a/inc/config.php b/inc/config.php index 604e146d..da569b3d 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1530,7 +1530,7 @@ // Edit any users' login information $config['mod']['editusers'] = ADMIN; // Change user's own password - $config['mod']['change_password'] = JANITOR; + $config['mod']['edit_profile'] = JANITOR; // Delete a user $config['mod']['deleteusers'] = ADMIN; // Create a user diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 3d78fb31..c24312f8 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -1914,11 +1914,11 @@ function mod_deletebyip($boardName, $post, $global = false) { function mod_user($uid) { global $config, $mod; - if (!hasPermission($config['mod']['editusers']) && !(hasPermission($config['mod']['change_password']) && $uid == $mod['id'])) + if (!hasPermission($config['mod']['editusers']) && !(hasPermission($config['mod']['edit_profile']) && $uid == $mod['id'])) error($config['error']['noaccess']); if (in_array($mod['boards'][0], array('infinity', 'z'))) - error('This board has password changing disabled.'); + error('This board has profile changing disabled.'); $query = prepare('SELECT * FROM ``mods`` WHERE `id` = :id'); $query->bindValue(':id', $uid); @@ -1997,8 +1997,8 @@ function mod_user($uid) { return; } - if (hasPermission($config['mod']['change_password']) && $uid == $mod['id'] && isset($_POST['password'])) { - if ($_POST['password'] != '') { + if (hasPermission($config['mod']['edit_profile']) && $uid == $mod['id']) { + if (isset($_POST['password']) && $_POST['password'] != '') { $salt = generate_salt(); $password = hash('sha256', $salt . sha1($_POST['password'])); @@ -2013,13 +2013,50 @@ function mod_user($uid) { login($user['username'], $_POST['password']); setCookies(); } + + if (isset($_POST['username']) && $user['username'] !== $_POST['username']) { + if ($_POST['username'] == '') + error(sprintf($config['error']['required'], 'username')); + + if (!preg_match('/^[a-zA-Z0-9._]{1,30}$/', $_POST['username'])) + error(_('Invalid username')); + + $query = prepare('SELECT `username` FROM ``mods``'); + $query->execute() or error(db_error($query)); + $users = $query->fetchAll(PDO::FETCH_ASSOC); + + foreach ($users as $i => $v) { + if (strtolower($_POST['username']) == strtolower($v['username'])) { + error(_('Refusing to change your username because another user is already using it.')); + } + } + + $query = prepare('UPDATE ``mods`` SET `username` = :username WHERE `id` = :id'); + $query->bindValue(':id', $uid); + $query->bindValue(':username', $_POST['username']); + $query->execute() or error(db_error($query)); - if (hasPermission($config['mod']['manageusers'])) - header('Location: ?/users', true, $config['redirect_http']); - else - header('Location: ?/', true, $config['redirect_http']); + modLog('Renamed user "' . utf8tohtml($user['username']) . '" (#' . $user['id'] . ') to "' . utf8tohtml($_POST['username']) . '"'); + } + + if (isset($_POST['email']) && $user['email'] !== $_POST['email'] && (empty($_POST['email']) || filter_var($_POST['email'], FILTER_VALIDATE_EMAIL))) { + // account was renamed + $query = prepare('UPDATE ``mods`` SET `email` = :email WHERE `id` = :id'); + $query->bindValue(':id', $uid); + $query->bindValue(':email', $_POST['email']); + $query->execute() or error(db_error($query)); - return; + modLog('Changed user\'s email "' . utf8tohtml($user['email']) . '" (#' . $user['id'] . ') to "' . utf8tohtml($_POST['email']) . '"'); + } + + if ($_SERVER['REQUEST_METHOD'] === 'POST') { + if (hasPermission($config['mod']['manageusers'])) + header('Location: ?/users', true, $config['redirect_http']); + else + header('Location: ?/', true, $config['redirect_http']); + + return; + } } if (hasPermission($config['mod']['modlog'])) { @@ -2032,21 +2069,18 @@ function mod_user($uid) { } if ($mod['type'] >= ADMIN){ - $boards = listBoards(); + $boards = listBoards(); } else { - $boards2 = explode(',', $user['boards']); - - foreach($boards2 as $string){ - - $boards[] = array("uri"=>$string, "title"=>"MY BOARD"); - - } - + $boards2 = explode(',', $user['boards']); + foreach ($boards2 as $string){ + $boards[] = array("uri"=>$string, "title" => _("My board")); + } } + $user['boards'] = explode(',', $user['boards']); - mod_page(_('Edit user'), 'mod/user.html', array( + mod_page(_('Edit user profile'), 'mod/user.html', array( 'user' => $user, 'logs' => $log, 'boards' => $boards, @@ -2114,7 +2148,7 @@ function mod_users() { if (!hasPermission($config['mod']['manageusers'])) error($config['error']['noaccess']); - $query = query("SELECT ``m``.`id`, ``m``.`username`, ``m``.`boards`, ``m``.`type`, + $query = query("SELECT ``m``.`id`, ``m``.`username`, ``m``.`boards`, ``m``.`type`, ``m``.`email`, ``ml``.`time` last, ``ml``.`text` action FROM ``mods`` AS m LEFT JOIN ( @@ -2125,7 +2159,7 @@ function mod_users() { FROM ``modlogs`` GROUP BY `mod` ) AS ml2 USING (`mod`, time) - ) AS ml ON m.id = ml.`mod` ORDER BY ``m``.`type` DESC;") or error(db_error()); + ) AS ml ON m.id = ml.`mod` GROUP BY ``m``.`id` ORDER BY ``m``.`type` DESC;") or error(db_error()); $users = $query->fetchAll(PDO::FETCH_ASSOC); foreach ($users as &$user) { diff --git a/install.sql b/install.sql index 7990c0a8..86527a11 100644 --- a/install.sql +++ b/install.sql @@ -138,6 +138,7 @@ CREATE TABLE IF NOT EXISTS `mods` ( `salt` char(32) CHARACTER SET ascii NOT NULL, `type` smallint(2) NOT NULL, `boards` text CHARACTER SET utf8 NOT NULL, + `email` varchar(1024) DEFAULT '', PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`,`username`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ; diff --git a/templates/8chan/create.html b/templates/8chan/create.html index be0cf4b7..6f8af2f7 100644 --- a/templates/8chan/create.html +++ b/templates/8chan/create.html @@ -7,6 +7,7 @@ Subtitle {% trans %}(must be < 200 chars){% endtrans %} {% trans %}Username{% endtrans %} {% trans %}(must contain only alphanumeric, periods and underscores){% endtrans %} {% trans %}Password{% endtrans %} {% trans %}(write this down){% endtrans %} +{% trans %}Email{% endtrans %} {% trans %}(optional, for board recovery){% endtrans %} {% trans %}CAPTCHA{% endtrans %}{{ captcha['html'] }}

diff --git a/templates/mod/dashboard.html b/templates/mod/dashboard.html index a97f0480..c7a516dc 100644 --- a/templates/mod/dashboard.html +++ b/templates/mod/dashboard.html @@ -66,7 +66,7 @@ {% if mod|hasPermission(config.mod.manageusers) %}
  • {% trans 'Manage users' %}
  • {% elseif mod|hasPermission(config.mod.change_password) %} -
  • {% trans 'Change password' %}
  • +
  • {% trans 'Edit profile' %} (username, email, password)
  • {% endif %} {% if mod|hasPermission(config.mod.themes) %}
  • {% trans 'Manage themes' %}
  • diff --git a/templates/mod/user.html b/templates/mod/user.html index 08598fe5..100f56e6 100644 --- a/templates/mod/user.html +++ b/templates/mod/user.html @@ -8,9 +8,9 @@ - + + + + + {% if new %} @@ -42,6 +52,7 @@ {% endif %} + {% if mod|hasPermission(config.mod.editusers) %} + {% endif %}
    {% trans 'Username' %}{% trans 'Username' %}
    {% if not mod|hasPermission(config.mod.editusers) %}({% trans 'warning: changing your username
    will log you out and change all occurrences
    of your old username to the new one in
    your board\'s logs' %}){% endif %}
    - {% if new or mod|hasPermission(config.mod.editusers) %} + {% if new or mod|hasPermission(config.mod.edit_profile) %} {% else %} {{ user.username|e }} @@ -20,13 +20,23 @@
    {% trans 'Password' %}{% if not new %} ({% trans 'new; optional' %}){% endif %} - {% if new or (mod|hasPermission(config.mod.editusers) or (mod|hasPermission(config.mod.change_password) and user.id == mod.id)) %} + {% if new or (mod|hasPermission(config.mod.editusers) or (mod|hasPermission(config.mod.edit_profile) and user.id == mod.id)) %} {% else %} - {% endif %}
    {% trans 'Email' %}
    ({% trans 'if you forget your board password
    email admin@8chan.co from this
    address to request a reset; optional' %})
    + {% if new or (mod|hasPermission(config.mod.editusers) or (mod|hasPermission(config.mod.edit_profile) and user.id == mod.id)) %} + + {% else %} + - + {% endif %} +
    {% trans 'Group' %}
    {% trans 'Boards' %} @@ -73,6 +84,7 @@
      diff --git a/templates/mod/users.html b/templates/mod/users.html index bed3863f..910dda8d 100644 --- a/templates/mod/users.html +++ b/templates/mod/users.html @@ -3,6 +3,7 @@ {% trans 'ID' %} {% trans 'Username' %} {% trans 'Type' %} + {% trans 'Email' %} {% trans 'Boards' %} {% if mod|hasPermission(config.mod.modlog) %} {% trans 'Last action' %} @@ -27,6 +28,9 @@ {% trans 'Unknown' %} ({{ user.type }}) {% endif %} + + {{ user.email|e }} + {% if user.boards == '' %} {% trans 'none' %} From 8068099bd54ec332e2ade23eace90a2e9b44cfec Mon Sep 17 00:00:00 2001 From: Fredrick Brennan Date: Wed, 6 May 2015 20:37:50 +0800 Subject: [PATCH 11/23] Only fileboards should be able to have anal_filenames due to 8archive... --- inc/8chan-mod-pages.php | 2 +- templates/mod/settings.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/8chan-mod-pages.php b/inc/8chan-mod-pages.php index f080c70f..3f16e16c 100644 --- a/inc/8chan-mod-pages.php +++ b/inc/8chan-mod-pages.php @@ -475,7 +475,7 @@ FLAGS; } } - $anal_filenames = ($imgboard || $fileboard) && isset($_POST['anal_filenames']) ? "\$config['filename_func'] = 'filename_func';\n" : ''; + $anal_filenames = ($fileboard) && isset($_POST['anal_filenames']) ? "\$config['filename_func'] = 'filename_func';\n" : ''; $anonymous = base64_encode($_POST['anonymous']); $blotter = base64_encode(purify_html(html_entity_decode($_POST['blotter']))); diff --git a/templates/mod/settings.html b/templates/mod/settings.html index 7dae373f..d559c96e 100644 --- a/templates/mod/settings.html +++ b/templates/mod/settings.html @@ -75,7 +75,7 @@ {% trans %}Disable OP image upload{% endtrans %} - {% trans %}Keep original filename{% endtrans %} + {% trans %}Keep original filename{% endtrans %} {% trans %}Max images per post{% endtrans %} From ca066b0ca8293bbe6eeaf3810f40a914b1ebd7c8 Mon Sep 17 00:00:00 2001 From: Fredrick Brennan Date: Wed, 6 May 2015 20:40:11 +0800 Subject: [PATCH 12/23] New feature: custom board assets --- inc/8chan-mod-config.php | 2 + inc/8chan-mod-pages.php | 128 ++++++++++++++++++++++++++++- inc/config.php | 5 +- templates/mod/settings.html | 3 +- templates/themes/catalog/theme.php | 4 +- 5 files changed, 137 insertions(+), 5 deletions(-) diff --git a/inc/8chan-mod-config.php b/inc/8chan-mod-config.php index 1c2ed2ac..962b5a51 100644 --- a/inc/8chan-mod-config.php +++ b/inc/8chan-mod-config.php @@ -15,6 +15,7 @@ $config['mod']['mod_board_log'] = MOD; $config['mod']['editpost'] = BOARDVOLUNTEER; $config['mod']['edit_banners'] = MOD; + $config['mod']['edit_assets'] = MOD; $config['mod']['edit_flags'] = MOD; $config['mod']['edit_settings'] = MOD; $config['mod']['edit_volunteers'] = MOD; @@ -51,3 +52,4 @@ $config['mod']['custom_pages']['/flags/(\%b)'] = '8_flags'; $config['mod']['custom_pages']['/banners/(\%b)'] = '8_banners'; $config['mod']['custom_pages']['/settings/(\%b)'] = '8_settings'; + $config['mod']['custom_pages']['/assets/(\%b)'] = '8_assets'; diff --git a/inc/8chan-mod-pages.php b/inc/8chan-mod-pages.php index 3f16e16c..67495517 100644 --- a/inc/8chan-mod-pages.php +++ b/inc/8chan-mod-pages.php @@ -303,6 +303,121 @@ FLAGS; mod_page(_('Edit flags'), 'mod/flags.html', array('board'=>$board,'banners'=>$banners,'token'=>make_secure_link_token('banners/'.$board['uri']))); } + function mod_8_assets($b) { + global $config, $mod, $board; + require_once 'inc/image.php'; + + if (!hasPermission($config['mod']['edit_assets'], $b)) + error($config['error']['noaccess']); + + if (!openBoard($b)) + error("Could not open board!"); + + $dir = 'static/assets/'.$b; + + if (!is_dir($dir)){ + mkdir($dir, 0777, true); + + symlink(getcwd() . '/' . $config['image_deleted'], "$dir/deleted.png"); + symlink(getcwd() . '/' . $config['spoiler_image'], "$dir/spoiler.png"); + symlink(getcwd() . '/' . $config['no_file_image'], "$dir/no-file.png"); + } + + // "File deleted" + if (isset($_FILES['deleted_file']) && !empty($_FILES['deleted_file']['tmp_name'])){ + $upload = $_FILES['deleted_file']['tmp_name']; + $extension = strtolower(mb_substr($_FILES['deleted_file']['name'], mb_strrpos($_FILES['deleted_file']['name'], '.') + 1)); + var_dump($_FILES); + + if (!is_readable($upload)) { + error($config['error']['nomove']); + } + + if (filesize($upload) > 512000){ + error('File too large!'); + } + + if (!in_array($extension, array('png', 'gif'))) { + error('File must be PNG or GIF format.'); + } + + if (!$size = @getimagesize($upload)) { + error($config['error']['invalidimg']); + } + + if ($size[0] != 140 or $size[1] != 50){ + error('Image wrong size!'); + } + + unlink("$dir/deleted.png"); + copy($upload, "$dir/deleted.png"); + purge("$dir/deleted.png"); + } + + // Spoiler file + if (isset($_FILES['spoiler_file']) && !empty($_FILES['spoiler_file']['tmp_name'])){ + $upload = $_FILES['spoiler_file']['tmp_name']; + $extension = strtolower(mb_substr($_FILES['spoiler_file']['name'], mb_strrpos($_FILES['spoiler_file']['name'], '.') + 1)); + + if (!is_readable($upload)) { + error($config['error']['nomove']); + } + + if (filesize($upload) > 512000){ + error('File too large!'); + } + + + if (!in_array($extension, array('png', 'gif'))) { + error('File must be PNG or GIF format.'); + } + + if (!$size = @getimagesize($upload)) { + error($config['error']['invalidimg']); + } + + if ($size[0] != 128 or $size[1] != 128){ + error('Image wrong size!'); + } + + unlink("$dir/spoiler.png"); + copy($upload, "$dir/spoiler.png"); + purge("$dir/spoiler.png"); + } + + // No file + if (isset($_FILES['nofile_file']) && !empty($_FILES['nofile_file']['tmp_name'])){ + $upload = $_FILES['nofile_file']['tmp_name']; + $extension = strtolower(mb_substr($_FILES['nofile_file']['name'], mb_strrpos($_FILES['nofile_file']['name'], '.') + 1)); + + if (!is_readable($upload)) { + error($config['error']['nomove']); + } + + if (filesize($upload) > 512000){ + error('File too large!'); + } + + if (!in_array($extension, array('png', 'gif'))) { + error('File must be PNG or GIF format.'); + } + + if (!$size = @getimagesize($upload)) { + error($config['error']['invalidimg']); + } + + if ($size[0] != 500 or $size[1] != 500){ + error('Image wrong size!'); + } + + unlink("$dir/no-file.png"); + copy($upload, "$dir/no-file.png"); + purge("$dir/no-file.png"); + } + + mod_page(_('Edit board assets'), 'mod/assets.html', array('board'=>$board,'token'=>make_secure_link_token('assets/'.$board['uri']))); + } + function mod_8_banners($b) { global $config, $mod, $board; require_once 'inc/image.php'; @@ -431,6 +546,16 @@ FLAGS; $multiimage = ''; } + if (isset($_POST['custom_assets'])) { + $assets = "\$config['custom_assets'] = true; + \$config['spoiler_image'] = 'static/assets/$b/spoiler.png'; + \$config['image_deleted'] = 'static/assets/$b/deleted.png'; + \$config['no_file_image'] = 'static/assets/$b/no-file.png'; + "; + } else { + $assets = ''; + } + $file_board = ''; if ($fileboard) { $force_image_op = true; @@ -588,7 +713,8 @@ FLAGS; \$config['max_pages'] = $max_pages; \$config['max_newlines'] = $max_newlines; \$config['oekaki'] = $oekaki; -$code_tags $katex $replace $multiimage $allow_flash $allow_pdf $user_flags +$code_tags $katex $replace $multiimage $allow_flash $allow_pdf $user_flags +$assets $locale $anal_filenames $file_board diff --git a/inc/config.php b/inc/config.php index da569b3d..fb749ae4 100644 --- a/inc/config.php +++ b/inc/config.php @@ -839,7 +839,7 @@ // Location of thumbnail to use for spoiler images. $config['spoiler_image'] = 'static/spoiler.png'; // Location of thumbnail to use for deleted images. - // $config['image_deleted'] = 'static/deleted.png'; + $config['image_deleted'] = 'static/deleted.png'; // Location of placeholder image for fileless posts in catalog. $config['no_file_image'] = 'static/no-file.png'; @@ -1784,3 +1784,6 @@ // Allowed HTML tags in ?/edit_pages. $config['allowed_html'] = 'a[href|title],p,br,li,ol,ul,strong,em,u,h2,b,i,tt,div,img[src|alt|title],hr,h1,h2,h3,h4,h5'; + + // Use custom assets? (spoiler file, etc; this is used by ?/settings and ?/assets) + $config['custom_assets'] = false; diff --git a/templates/mod/settings.html b/templates/mod/settings.html index d559c96e..c6b98be0 100644 --- a/templates/mod/settings.html +++ b/templates/mod/settings.html @@ -30,7 +30,8 @@ {% trans %}Country flags{% endtrans %} - {% trans %}/pol/-style user flags{% endtrans %}
      Enabling this disables country flags
      Make sure to actually upload some first!
      + {% trans %}/pol/-style user flags{% endtrans %}
      Enabling this disables country flags
      Make sure to actually upload some first on the flags page!
      + {% trans %}Custom board assets{% endtrans %}
      Enabling this uses your custom spoiler/deleted/no file images.
      Make sure to actually upload some first on the assets page or they will 404!
      {% trans %}Forced anonymous{% endtrans %} {% trans %}YouTube/Voocaroo embedding{% endtrans %} {% trans %}Require image for OP{% endtrans %} diff --git a/templates/themes/catalog/theme.php b/templates/themes/catalog/theme.php index 9354b251..69db0119 100644 --- a/templates/themes/catalog/theme.php +++ b/templates/themes/catalog/theme.php @@ -76,10 +76,10 @@ if ($files[0]) { if ($files[0]->file == 'deleted') { - $post['file'] = $config['image_deleted']; + $post['file'] = $config['root'] . $config['image_deleted']; } else if($files[0]->thumb == 'spoiler') { - $post['file'] = '/' . $config['spoiler_image']; + $post['file'] = $config['root'] . $config['spoiler_image']; } else { if ($files[0]->thumb == 'file') { From 8e52335f7ca0894733cffe333ea7ab9bf7c53612 Mon Sep 17 00:00:00 2001 From: Fredrick Brennan Date: Wed, 6 May 2015 20:57:59 +0800 Subject: [PATCH 13/23] Forgot assets template --- templates/mod/assets.html | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 templates/mod/assets.html diff --git a/templates/mod/assets.html b/templates/mod/assets.html new file mode 100644 index 00000000..649c6753 --- /dev/null +++ b/templates/mod/assets.html @@ -0,0 +1,32 @@ +
      +
      + +

      All board assets must be less than 500KB and either PNG or GIF format. Please be aware that files may be cached by your browser, so make sure to clear your cache if you change one.

      + +

      Upload new spoiler file

      + +

      + +

      Spoiler file must be 128 x 128.

      + +

      Current spoiler file:

      +
      +

      Upload new "file deleted" file

      + +

      + +

      "File deleted" file must be 140 x 50.

      + +

      Current "file deleted" file:

      +
      +

      Upload new "no file" file

      + +

      + +

      "No file" file must be 500 x 500.

      + +

      Current "no file" file:

      + +

      +
      +
      From e8a1b23e1064d09d54c086432b7cf230cd86b5d8 Mon Sep 17 00:00:00 2001 From: Fredrick Brennan Date: Wed, 6 May 2015 20:58:37 +0800 Subject: [PATCH 14/23] Forgot to add assets link in ?/settings --- templates/mod/settings.html | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/mod/settings.html b/templates/mod/settings.html index c6b98be0..2bfc680a 100644 --- a/templates/mod/settings.html +++ b/templates/mod/settings.html @@ -89,6 +89,7 @@

      {% trans %}Edit board banners{% endtrans %}

      +

      {% trans %}Edit board assets{% endtrans %}

      {% trans %}Edit board flags{% endtrans %}

      {% trans %}Edit board volunteers{% endtrans %}

      {% trans %}Edit board tags{% endtrans %}

      From d45852c3ddf26ea807b30c6b8b15b0269ed84c95 Mon Sep 17 00:00:00 2001 From: Fredrick Brennan Date: Wed, 6 May 2015 21:37:18 +0800 Subject: [PATCH 15/23] Give purge() the ability to clear CloudFlare cache, fixes caching issues in ?/flags and ?/assets --- inc/8chan-mod-pages.php | 9 ++++----- inc/config.php | 7 +++++++ inc/functions.php | 35 ++++++++++++++++++++++++++++++++++- 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/inc/8chan-mod-pages.php b/inc/8chan-mod-pages.php index 67495517..8d4acb7d 100644 --- a/inc/8chan-mod-pages.php +++ b/inc/8chan-mod-pages.php @@ -224,7 +224,7 @@ } copy($upload, "$dir/$id.$extension"); - purge("$dir/$id.$extension"); + purge("$dir/$id.$extension", true); $config['user_flags'][$id] = utf8tohtml($description); file_write($b.'/flags.ser', serialize($config['user_flags'])); } @@ -327,7 +327,6 @@ FLAGS; if (isset($_FILES['deleted_file']) && !empty($_FILES['deleted_file']['tmp_name'])){ $upload = $_FILES['deleted_file']['tmp_name']; $extension = strtolower(mb_substr($_FILES['deleted_file']['name'], mb_strrpos($_FILES['deleted_file']['name'], '.') + 1)); - var_dump($_FILES); if (!is_readable($upload)) { error($config['error']['nomove']); @@ -351,7 +350,7 @@ FLAGS; unlink("$dir/deleted.png"); copy($upload, "$dir/deleted.png"); - purge("$dir/deleted.png"); + purge("$dir/deleted.png", true); } // Spoiler file @@ -382,7 +381,7 @@ FLAGS; unlink("$dir/spoiler.png"); copy($upload, "$dir/spoiler.png"); - purge("$dir/spoiler.png"); + purge("$dir/spoiler.png", true); } // No file @@ -412,7 +411,7 @@ FLAGS; unlink("$dir/no-file.png"); copy($upload, "$dir/no-file.png"); - purge("$dir/no-file.png"); + purge("$dir/no-file.png", true); } mod_page(_('Edit board assets'), 'mod/assets.html', array('board'=>$board,'token'=>make_secure_link_token('assets/'.$board['uri']))); diff --git a/inc/config.php b/inc/config.php index fb749ae4..1d85a544 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1787,3 +1787,10 @@ // Use custom assets? (spoiler file, etc; this is used by ?/settings and ?/assets) $config['custom_assets'] = false; + + // If you use CloudFlare set these for some features to work correctly. + $config['cloudflare'] = array(); + $config['cloudflare']['enabled'] = false; + $config['cloudflare']['token'] = 'token'; + $config['cloudflare']['email'] = 'email'; + $config['cloudflare']['domain'] = 'example.com'; diff --git a/inc/functions.php b/inc/functions.php index ec32f1e7..3c8b2366 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -589,9 +589,42 @@ function boardTitle($uri) { return false; } -function purge($uri) { +function cloudflare_purge($uri) { + global $config; + + if (!$config['cloudflare']['enabled']) return; + + $fields = array( + 'a' => 'zone_file_purge', + 'tkn' => $config['cloudflare']['token'], + 'email' => $config['cloudflare']['email'], + 'z' => $config['cloudflare']['domain'], + 'url' => 'https://' . $config['cloudflare']['domain'] . '/' . $uri + ); + + $fields_string = http_build_query($fields); + + $ch = curl_init(); + + curl_setopt($ch, CURLOPT_URL, 'https://www.cloudflare.com/api_json.html'); + curl_setopt($ch, CURLOPT_POST, count($fields)); + curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + + $result = curl_exec($ch); + + curl_close($ch); + + return $result; +} + +function purge($uri, $cloudflare = false) { global $config, $debug; + if ($cloudflare) { + cloudflare_purge($uri); + } + if (!isset($config['purge'])) return; // Fix for Unicode From 7cdd67068d41d9ef51b50ea2230abb88f1c40c68 Mon Sep 17 00:00:00 2001 From: 8chan Date: Sat, 9 May 2015 21:15:14 -0700 Subject: [PATCH 16/23] Fix some user adding errors --- inc/8chan-mod-pages.php | 2 +- inc/mod/pages.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/inc/8chan-mod-pages.php b/inc/8chan-mod-pages.php index 8d4acb7d..7569b986 100644 --- a/inc/8chan-mod-pages.php +++ b/inc/8chan-mod-pages.php @@ -118,7 +118,7 @@ $salt = generate_salt(); $password = hash('sha256', $salt . sha1($_POST['password'])); - $query = prepare('INSERT INTO ``mods`` VALUES (NULL, :username, :password, :salt, 19, :board)'); + $query = prepare('INSERT INTO ``mods`` VALUES (NULL, :username, :password, :salt, 19, :board, "")'); $query->bindValue(':username', $_POST['username']); $query->bindValue(':password', $password); $query->bindValue(':salt', $salt); diff --git a/inc/mod/pages.php b/inc/mod/pages.php index c24312f8..54356489 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -2122,12 +2122,13 @@ function mod_user_new() { $salt = generate_salt(); $password = hash('sha256', $salt . sha1($_POST['password'])); - $query = prepare('INSERT INTO ``mods`` VALUES (NULL, :username, :password, :salt, :type, :boards)'); + $query = prepare('INSERT INTO ``mods`` VALUES (NULL, :username, :password, :salt, :type, :boards, :email)'); $query->bindValue(':username', $_POST['username']); $query->bindValue(':password', $password); $query->bindValue(':salt', $salt); $query->bindValue(':type', $type); $query->bindValue(':boards', implode(',', $boards)); + $query->bindValue(':email', (isset($_POST['email']) ? $_POST['email'] : '')); $query->execute() or error(db_error($query)); $userID = $pdo->lastInsertId(); From 60eef68e4428f6182887b0adb7722e04640c67bd Mon Sep 17 00:00:00 2001 From: 8chan Date: Sat, 9 May 2015 21:15:27 -0700 Subject: [PATCH 17/23] Fix create.php error --- create.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create.php b/create.php index eefe099f..37dfb2f5 100644 --- a/create.php +++ b/create.php @@ -21,7 +21,7 @@ $title = $_POST['title']; $subtitle = $_POST['subtitle']; $username = $_POST['username']; $password = $_POST['password']; -$email = $_POST['email']; +$email = (isset($_POST['email']) ? $_POST['email'] : ''); $resp = file_get_contents($config['captcha']['provider_check'] . "?" . http_build_query([ 'mode' => 'check', From 45f0ee1afcb420e1f7a59941eebf81ffe2a3da1c Mon Sep 17 00:00:00 2001 From: 8chan Date: Sat, 9 May 2015 21:15:45 -0700 Subject: [PATCH 18/23] Make tomorrow theme work with static pages --- stylesheets/tomorrow.css | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/stylesheets/tomorrow.css b/stylesheets/tomorrow.css index c8a4427e..d942ada3 100644 --- a/stylesheets/tomorrow.css +++ b/stylesheets/tomorrow.css @@ -69,14 +69,15 @@ form table tr th { color:#C5C8C6 } div.ban h2 { - background:#FCA; + background:#282A2E; color:inherit } div.ban { - border-color:#800 + border-color:#282A2E; } -div.ban p { - color:#000 +div.ban { + color:#C5C8C6; + background-color: inherit; } div.pages { background:#1d1f21; @@ -191,4 +192,4 @@ table.board-list-table .board-tags .board-cell:hover { } table.board-list-table tr:nth-of-type( even ) .board-tags .board-cell { background: #282a2e; -} \ No newline at end of file +} From 1ab39952af83ebb268a661abf9f324fe5901015c Mon Sep 17 00:00:00 2001 From: 8chan Date: Sat, 9 May 2015 21:18:51 -0700 Subject: [PATCH 19/23] No more password field, stop annoying "Do you want to save this PW?" errors --- templates/post_form.html | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/templates/post_form.html b/templates/post_form.html index 028de0f3..16db8413 100644 --- a/templates/post_form.html +++ b/templates/post_form.html @@ -229,12 +229,9 @@ {% if not config.field_disable_password or (mod and post.mod|hasPermission(config.mod.bypass_field_disable, board.uri)) %} {% trans %}Password{% endtrans %} - - - - + {% trans %}(For file and post deletion.){% endtrans %} {% endif %} From 7e4a0c9fe47042bd2fef2b1a2883248fd46f193a Mon Sep 17 00:00:00 2001 From: 8chan Date: Sat, 9 May 2015 21:19:18 -0700 Subject: [PATCH 20/23] Add config.root before image_deleted to solve custom asset 404 --- templates/post/fileinfo.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/post/fileinfo.html b/templates/post/fileinfo.html index 4a3300a4..80ddd2a6 100644 --- a/templates/post/fileinfo.html +++ b/templates/post/fileinfo.html @@ -5,7 +5,7 @@ {% for file in post.files %}
      {% if file.file == 'deleted' %} - + {% else %}

      File: {{ file.file }} ( From 22b5d3f1cc674f7019eee3d6e28783545b0621b2 Mon Sep 17 00:00:00 2001 From: Fredrick Brennan Date: Sun, 10 May 2015 12:39:04 +0800 Subject: [PATCH 21/23] Catalog update: Show icons for sticky/lock/cycle, show page number. --- stylesheets/style.css | 2 +- templates/post/mod_attributes.html | 28 ++++++++++++++++++++++++++ templates/post_thread.html | 29 +-------------------------- templates/themes/catalog/catalog.html | 3 ++- 4 files changed, 32 insertions(+), 30 deletions(-) create mode 100644 templates/post/mod_attributes.html diff --git a/stylesheets/style.css b/stylesheets/style.css index f5e58238..ac9281a5 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -314,7 +314,7 @@ div.post img.icon { padding: 0; } -div.post i.fa { +div.post i.fa, div.thread i.fa { margin: 0 4px; font-size: 16px; } diff --git a/templates/post/mod_attributes.html b/templates/post/mod_attributes.html new file mode 100644 index 00000000..0eb89747 --- /dev/null +++ b/templates/post/mod_attributes.html @@ -0,0 +1,28 @@ +{% if post.sticky %} + {% if config.font_awesome %} + + {% else %} + Sticky + {% endif %} +{% endif %} +{% if post.locked %} + {% if config.font_awesome %} + + {% else %} + 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 config.font_awesome %} + + {% else %} + Bumplocked + {% endif %} +{% endif %} +{% if post.cycle %} + {% if config.font_awesome %} + + {% else %} + Cyclical + {% endif %} +{% endif %} diff --git a/templates/post_thread.html b/templates/post_thread.html index 77462bd5..ff693e22 100644 --- a/templates/post_thread.html +++ b/templates/post_thread.html @@ -17,34 +17,7 @@ {% include 'post/poster_id.html' %}  No. {{ post.id }} - {% if post.sticky %} - {% if config.font_awesome %} - - {% else %} - Sticky - {% endif %} - {% endif %} - {% if post.locked %} - {% if config.font_awesome %} - - {% else %} - 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 config.font_awesome %} - - {% else %} - Bumplocked - {% endif %} - {% endif %} - {% if post.cycle %} - {% if config.font_awesome %} - - {% else %} - Cyclical - {% endif %} - {% endif %} + {% include 'post/mod_attributes.html' %} {% if index %} [{% trans %}Reply{% endtrans %}] {% endif %} diff --git a/templates/themes/catalog/catalog.html b/templates/themes/catalog/catalog.html index 7060c4cd..903bd619 100644 --- a/templates/themes/catalog/catalog.html +++ b/templates/themes/catalog/catalog.html @@ -44,6 +44,7 @@ data-id="{{ post.id }}" data-sticky="{% if post.sticky %}true{% else %}false{% endif %}" data-locked="{% if post.locked %}true{% else %}false{% endif %}" + data-cycle="{% if post.cycle %}true{% else %}false{% endif %}" >

      @@ -55,7 +56,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')}}">
      - R: {{ post.reply_count }} / I: {{ post.image_count }}{% if post.sticky %} (sticky){% endif %} + R: {{ post.reply_count }} / I: {{ post.image_count }} / P: {{ (loop.index // config.threads_per_page) + 1 }} {% include 'post/mod_attributes.html' %} {% if post.subject %}

      From 7fa876099e200d8691dd7acb5e73963341c91af2 Mon Sep 17 00:00:00 2001 From: Fredrick Brennan Date: Sun, 10 May 2015 12:45:39 +0800 Subject: [PATCH 22/23] Add medium size to catalog thumbnaisl because why not? --- js/catalog.js | 1 + stylesheets/style.css | 10 ++++++++++ templates/themes/catalog/catalog.html | 1 + 3 files changed, 12 insertions(+) diff --git a/js/catalog.js b/js/catalog.js index 065fba7b..59b57f6c 100644 --- a/js/catalog.js +++ b/js/catalog.js @@ -17,6 +17,7 @@ if (active_page == 'catalog') $(function(){ var value = this.value, old; $(".grid-li").removeClass("grid-size-vsmall"); $(".grid-li").removeClass("grid-size-small"); + $(".grid-li").removeClass("grid-size-medium"); $(".grid-li").removeClass("grid-size-large"); $(".grid-li").addClass("grid-size-"+value); catalog.image_size = value; diff --git a/stylesheets/style.css b/stylesheets/style.css index ac9281a5..af8a3d8b 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -778,6 +778,16 @@ pre { max-height: 192px; } +.theme-catalog div.grid-size-medium img { + max-height: 33%; + max-width: 95% +} + +.theme-catalog div.grid-size-medium { + min-width:200px; max-width: 200px; + max-height: 274px; +} + .theme-catalog div.grid-size-large img { max-height: 40%; max-width: 95% diff --git a/templates/themes/catalog/catalog.html b/templates/themes/catalog/catalog.html index 903bd619..ea89e188 100644 --- a/templates/themes/catalog/catalog.html +++ b/templates/themes/catalog/catalog.html @@ -32,6 +32,7 @@

      From dc0553bc47fd74d06b69460b2b6b2a2f1890468f Mon Sep 17 00:00:00 2001 From: Fredrick Brennan Date: Sun, 10 May 2015 12:51:35 +0800 Subject: [PATCH 23/23] Catalog: click to scroll thread --- js/catalog.js | 10 ++++++++++ stylesheets/style.css | 3 --- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/js/catalog.js b/js/catalog.js index 59b57f6c..3ded2141 100644 --- a/js/catalog.js +++ b/js/catalog.js @@ -36,4 +36,14 @@ if (active_page == 'catalog') $(function(){ if (catalog.image_size !== undefined) { $('#image_size').val(catalog.image_size).trigger('change'); } + + $('div.thread').on('click', function(e) { + if ($(this).css('overflow-y') === 'hidden') { + $(this).css('overflow-y', 'auto'); + $(this).css('width', '100%'); + } else { + $(this).css('overflow-y', 'hidden'); + $(this).css('width', 'auto'); + } + }); }); diff --git a/stylesheets/style.css b/stylesheets/style.css index af8a3d8b..1c33f5d0 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -1244,9 +1244,6 @@ div.boardlist a { div.mix { display: inline-block; } -.theme-catalog div.thread:hover { - overflow-y: auto; width: 100% -} /* Mona Font */ .aa {