diff --git a/inc/functions.php b/inc/functions.php index c176a481..a75ebb8a 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1983,10 +1983,10 @@ function undoImage(array $post) { if (!$post['has_file']) return; - if (isset($post['file'])) - file_unlink($post['file']); - if (isset($post['thumb'])) - file_unlink($post['thumb']); + if (isset($post['file_path'])) + file_unlink($post['file_path']); + if (isset($post['thumb_path'])) + file_unlink($post['thumb_path']); } function rDNS($ip_addr) { diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 8f2ce843..35713c27 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -2260,7 +2260,10 @@ function mod_theme_configure($theme_name) { $query = prepare("INSERT INTO ``theme_settings`` VALUES(:theme, :name, :value)"); $query->bindValue(':theme', $theme_name); $query->bindValue(':name', $conf['name']); - $query->bindValue(':value', $_POST[$conf['name']]); + if ($conf['type'] == 'checkbox') + $query->bindValue(':value', isset($_POST[$conf['name']]) ? 1 : 0); + else + $query->bindValue(':value', $_POST[$conf['name']]); $query->execute() or error(db_error($query)); } diff --git a/install.php b/install.php index e42bcc9c..1914434d 100644 --- a/install.php +++ b/install.php @@ -1,7 +1,7 @@ vichan-devel-4.0.9-gold'); +define('VERSION', 'v0.9.6-dev-12 + vichan-devel-4.0.10'); require 'inc/functions.php'; @@ -23,6 +23,15 @@ if (file_exists($config['has_installed'])) { if (empty($version)) $version = 'v0.9.1'; + function __query($sql) { + sql_open(); + + if (mysql_version() >= 50503) + return query($sql); + else + return query(str_replace('utf8mb4', 'utf8', $sql)); + } + $boards = listBoards(); switch ($version) { @@ -256,14 +265,6 @@ if (file_exists($config['has_installed'])) { case 'v0.9.6-dev-9 + vichan-devel-4.0.3': case 'v0.9.6-dev-9 + vichan-devel-4.0.4-gold': case 'v0.9.6-dev-9 + vichan-devel-4.0.5-gold': - sql_open(); - function __query($sql) { - if (mysql_version() >= 50503) - return query($sql); - else - return query(str_replace('utf8mb4', 'utf8', $sql)); - } - foreach ($boards as &$board) { __query(sprintf("ALTER TABLE `posts_%s` CHANGE `subject` `subject` VARCHAR(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, @@ -367,6 +368,14 @@ if (file_exists($config['has_installed'])) { case 'v0.9.6-dev-11 + vichan-devel-4.0.6': case 'v0.9.6-dev-11 + vichan-devel-4.0.7-gold': case 'v0.9.6-dev-11 + vichan-devel-4.0.8-gold': + case 'v0.9.6-dev-11 + vichan-devel-4.0.9-gold': + foreach ($boards as &$board) { + __query(sprintf("ALTER TABLE ``posts_%s`` + CHANGE `thumb` `thumb` VARCHAR( 255 ) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + CHANGE `file` `file` VARCHAR( 255 ) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ;", + $board['uri'])) or error(db_error()); + } + case 'v0.9.6-dev-12': case false: // Update version number file_write($config['has_installed'], VERSION); diff --git a/js/inline-expanding.js b/js/inline-expanding.js index 8710d632..2afb61bf 100644 --- a/js/inline-expanding.js +++ b/js/inline-expanding.js @@ -16,7 +16,7 @@ onready(function(){ var link = this.getElementsByTagName('a'); for (var i = 0; i < link.length; i++) { - if (typeof link[i] == "object" && link[i].childNodes && typeof link[i].childNodes[0] !== 'undefined' && link[i].childNodes[0].src && link[i].childNodes[0].className.match(/post-image/)) { + if (typeof link[i] == "object" && link[i].childNodes && typeof link[i].childNodes[0] !== 'undefined' && link[i].childNodes[0].src && link[i].childNodes[0].className.match(/post-image/) && !link[i].className.match(/file/)) { link[i].childNodes[0].style.maxWidth = '95%'; link[i].onclick = function(e) { if (this.childNodes[0].className == 'hidden') diff --git a/post.php b/post.php index 91ecbabe..f6c15c0c 100644 --- a/post.php +++ b/post.php @@ -595,8 +595,10 @@ if (isset($_POST['delete'])) { // not an image //copy($config['file_thumb'], $post['thumb']); $post['thumb'] = 'file'; - - $size = @getimagesize($config['file_thumb']); + + $size = @getimagesize(sprintf($config['file_thumb'], + isset($config['file_icons'][$post['extension']]) ? + $config['file_icons'][$post['extension']] : $config['file_icons']['default'])); $post['thumbwidth'] = $size[0]; $post['thumbheight'] = $size[1]; } @@ -605,7 +607,7 @@ if (isset($_POST['delete'])) { if (isset($post['file_tmp'])) { if (!@rename($upload, $post['file'])) error($config['error']['nomove']); - chmod($post['file'], 0755); + chmod($post['file'], 0644); } elseif (!@move_uploaded_file($upload, $post['file'])) error($config['error']['nomove']); } @@ -653,6 +655,7 @@ if (isset($_POST['delete'])) { // Remove board directories before inserting them into the database. if ($post['has_file']) { $post['file_path'] = $post['file']; + $post['thumb_path'] = $post['thumb']; $post['file'] = mb_substr($post['file'], mb_strlen($board['dir'] . $config['dir']['img'])); if ($is_an_image && $post['thumb'] != 'spoiler') $post['thumb'] = mb_substr($post['thumb'], mb_strlen($board['dir'] . $config['dir']['thumb'])); diff --git a/templates/mod/theme_config.html b/templates/mod/theme_config.html index 2dbb8397..d85b5df1 100644 --- a/templates/mod/theme_config.html +++ b/templates/mod/theme_config.html @@ -7,12 +7,21 @@ {{ conf.title }} - + {% else %} + {% endif %} - /> {% if conf.comment %} {{ conf.comment }} {% endif %} diff --git a/templates/post_reply.html b/templates/post_reply.html index 65fd576c..bc3d36cd 100644 --- a/templates/post_reply.html +++ b/templates/post_reply.html @@ -91,7 +91,7 @@ )

- + + 'Update on new posts', + 'name' => 'update_on_posts', + 'type' => 'checkbox', + 'default' => false, + 'comment' => 'Without this checked, the catalog only updates on new threads.' + ); + // Unique function name for building everything $theme['build_function'] = 'catalog_build'; diff --git a/templates/themes/catalog/theme.php b/templates/themes/catalog/theme.php index 4e2d40db..96550683 100644 --- a/templates/themes/catalog/theme.php +++ b/templates/themes/catalog/theme.php @@ -20,7 +20,7 @@ $b = new Catalog(); $b->build($settings, $board); } - } elseif ($action == 'post-thread' && in_array($board, $boards)) { + } elseif ($action == 'post-thread' || ($settings['update_on_posts'] && $action == 'post') && in_array($board, $boards)) { $b = new Catalog(); $b->build($settings, $board); }