Conflicts:
	install.php
This commit is contained in:
czaks 2013-08-18 13:16:31 -04:00
commit da1b7d087e
11 changed files with 60 additions and 28 deletions

View File

@ -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) {

View File

@ -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));
}

View File

@ -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);

View File

@ -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')

View File

@ -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']));

View File

@ -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 %}

View File

@ -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 }}

View File

@ -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 }}

View File

@ -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,

View File

@ -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';

View File

@ -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);
}