diff options
| author | czaks <marcin@6irc.net> | 2013-08-18 13:16:31 -0400 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2013-08-18 13:16:31 -0400 |
| commit | da1b7d087e55019b064e4dff0498ae0aa8a64418 (patch) | |
| tree | cf92758fac657dee32485d34353653953b05b9a6 | |
| parent | f6c25382b9708eff88a575ba199a645fc3dac420 (diff) | |
| parent | f8837ad60cac5aa7ec1457819986822d14661681 (diff) | |
Merge branch 'master' of https://github.com/savetheinternet/Tinyboard
Conflicts:
install.php
| -rw-r--r-- | inc/functions.php | 8 | ||||
| -rw-r--r-- | inc/mod/pages.php | 5 | ||||
| -rw-r--r-- | install.php | 27 | ||||
| -rw-r--r-- | js/inline-expanding.js | 2 | ||||
| -rw-r--r-- | post.php | 9 | ||||
| -rw-r--r-- | templates/mod/theme_config.html | 19 | ||||
| -rw-r--r-- | templates/post_reply.html | 2 | ||||
| -rw-r--r-- | templates/post_thread.html | 2 | ||||
| -rw-r--r-- | templates/posts.sql | 4 | ||||
| -rw-r--r-- | templates/themes/catalog/info.php | 8 | ||||
| -rw-r--r-- | templates/themes/catalog/theme.php | 2 |
11 files changed, 60 insertions, 28 deletions
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 @@ <?php // Installation/upgrade file -define('VERSION', 'v0.9.6-dev-11 + <a href="https://int.vichan.net/devel/">vichan-devel-4.0.9-gold</a>'); +define('VERSION', 'v0.9.6-dev-12 + <a href="https://int.vichan.net/devel/">vichan-devel-4.0.10</a>'); 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 + <a href="https://github.com/vichan-devel/Tinyboard/">vichan-devel-4.0.3</a>': case 'v0.9.6-dev-9 + <a href="https://github.com/vichan-devel/Tinyboard/">vichan-devel-4.0.4-gold</a>': case 'v0.9.6-dev-9 + <a href="https://github.com/vichan-devel/Tinyboard/">vichan-devel-4.0.5-gold</a>': - 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 + <a href="https://int.vichan.net/devel/">vichan-devel-4.0.6</a>': case 'v0.9.6-dev-11 + <a href="https://int.vichan.net/devel/">vichan-devel-4.0.7-gold</a>': case 'v0.9.6-dev-11 + <a href="https://int.vichan.net/devel/">vichan-devel-4.0.8-gold</a>': + case 'v0.9.6-dev-11 + <a href="https://int.vichan.net/devel/">vichan-devel-4.0.9-gold</a>': + 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') @@ -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 @@ <tr> <th>{{ conf.title }}</th> <td> - <input type="text" name="{{ conf.name }}" - {% if settings[conf.name] %}value="{{ settings[conf.name] }}"{% else %}{% if conf.default %}value="{{ conf.default }}"{% endif %}{% endif %} - {% if conf.size %} - size="{{ conf.size }}" + {% if conf.type == 'checkbox' %} + <input type="checkbox" name="{{ conf.name }}" + {% if settings[conf.name] or (not settings[conf.name] is defined and conf.default) %} + checked + {% endif %}> + {% else %} + <input type="text" name="{{ conf.name }}" + {% if settings[conf.name] %} + value="{{ settings[conf.name] }}" + {% else %} + {% if conf.default %}value="{{ conf.default }}"{% endif %}{% endif %} + {% if conf.size %} + size="{{ conf.size }}" + {% endif %}> {% endif %} - /> {% if conf.comment %} <span class="unimportant">{{ conf.comment }}</span> {% 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 @@ ) </span> </p> - <a href="{{ config.uri_img }}{{ post.file }}" target="_blank"{% if post.thumb == 'file' %} class="file"{% endif %}> + <a href="{{ config.uri_img }}{{ post.file }}" target="_blank"{% if post.thumb == 'file' or post.modifiers['is_file'] == '1' %} class="file"{% endif %}> <img class="post-image" src=" {% if post.thumb == 'file' %} {{ config.root }} diff --git a/templates/post_thread.html b/templates/post_thread.html index adc3b64e..ddbb0b2e 100644 --- a/templates/post_thread.html +++ b/templates/post_thread.html @@ -41,7 +41,7 @@ {% endif %} ) </span></p> -<a href="{{ config.uri_img }}{{ post.file }}" target="_blank"{% if post.thumb == 'file' %} class="file"{% endif %}> +<a href="{{ config.uri_img }}{{ post.file }}" target="_blank"{% if post.thumb == 'file' or post.modifiers['is_file'] == '1' %} class="file"{% endif %}> <img class="post-image" src=" {% if post.thumb == 'file' %} {{ config.root }} diff --git a/templates/posts.sql b/templates/posts.sql index ca2ec304..4eef3a0d 100644 --- a/templates/posts.sql +++ b/templates/posts.sql @@ -10,10 +10,10 @@ CREATE TABLE IF NOT EXISTS ``posts_{{ board }}`` ( `body_nomarkup` text, `time` int(11) NOT NULL, `bump` int(11) DEFAULT NULL, - `thumb` varchar(50) DEFAULT NULL, + `thumb` varchar(255) DEFAULT NULL, `thumbwidth` int(11) DEFAULT NULL, `thumbheight` int(11) DEFAULT NULL, - `file` varchar(50) DEFAULT NULL, + `file` varchar(255) DEFAULT NULL, `filewidth` int(11) DEFAULT NULL, `fileheight` int(11) DEFAULT NULL, `filesize` int(11) DEFAULT NULL, diff --git a/templates/themes/catalog/info.php b/templates/themes/catalog/info.php index 1b9831ae..c68c9e09 100644 --- a/templates/themes/catalog/info.php +++ b/templates/themes/catalog/info.php @@ -38,5 +38,13 @@ 'comment' => '(eg. "catalog.css")' ); + $theme['config'][] = Array( + 'title' => '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); } |
