mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-01-18 09:04:44 +01:00
Merge branch 'master' of https://github.com/savetheinternet/Tinyboard
Conflicts: install.php
This commit is contained in:
commit
311c18b34d
@ -1983,10 +1983,10 @@ function undoImage(array $post) {
|
|||||||
if (!$post['has_file'])
|
if (!$post['has_file'])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (isset($post['file']))
|
if (isset($post['file_path']))
|
||||||
file_unlink($post['file']);
|
file_unlink($post['file_path']);
|
||||||
if (isset($post['thumb']))
|
if (isset($post['thumb_path']))
|
||||||
file_unlink($post['thumb']);
|
file_unlink($post['thumb_path']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function rDNS($ip_addr) {
|
function rDNS($ip_addr) {
|
||||||
|
@ -2260,7 +2260,10 @@ function mod_theme_configure($theme_name) {
|
|||||||
$query = prepare("INSERT INTO ``theme_settings`` VALUES(:theme, :name, :value)");
|
$query = prepare("INSERT INTO ``theme_settings`` VALUES(:theme, :name, :value)");
|
||||||
$query->bindValue(':theme', $theme_name);
|
$query->bindValue(':theme', $theme_name);
|
||||||
$query->bindValue(':name', $conf['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));
|
$query->execute() or error(db_error($query));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
27
install.php
27
install.php
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Installation/upgrade file
|
// 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';
|
require 'inc/functions.php';
|
||||||
|
|
||||||
@ -23,6 +23,15 @@ if (file_exists($config['has_installed'])) {
|
|||||||
if (empty($version))
|
if (empty($version))
|
||||||
$version = 'v0.9.1';
|
$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();
|
$boards = listBoards();
|
||||||
|
|
||||||
switch ($version) {
|
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.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.4-gold</a>':
|
||||||
case 'v0.9.6-dev-9 + <a href="https://github.com/vichan-devel/Tinyboard/">vichan-devel-4.0.5-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) {
|
foreach ($boards as &$board) {
|
||||||
__query(sprintf("ALTER TABLE `posts_%s`
|
__query(sprintf("ALTER TABLE `posts_%s`
|
||||||
CHANGE `subject` `subject` VARCHAR(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
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.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.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.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:
|
case false:
|
||||||
// Update version number
|
// Update version number
|
||||||
file_write($config['has_installed'], VERSION);
|
file_write($config['has_installed'], VERSION);
|
||||||
|
@ -16,7 +16,7 @@ onready(function(){
|
|||||||
var link = this.getElementsByTagName('a');
|
var link = this.getElementsByTagName('a');
|
||||||
|
|
||||||
for (var i = 0; i < link.length; i++) {
|
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].childNodes[0].style.maxWidth = '95%';
|
||||||
link[i].onclick = function(e) {
|
link[i].onclick = function(e) {
|
||||||
if (this.childNodes[0].className == 'hidden')
|
if (this.childNodes[0].className == 'hidden')
|
||||||
|
9
post.php
9
post.php
@ -595,8 +595,10 @@ if (isset($_POST['delete'])) {
|
|||||||
// not an image
|
// not an image
|
||||||
//copy($config['file_thumb'], $post['thumb']);
|
//copy($config['file_thumb'], $post['thumb']);
|
||||||
$post['thumb'] = 'file';
|
$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['thumbwidth'] = $size[0];
|
||||||
$post['thumbheight'] = $size[1];
|
$post['thumbheight'] = $size[1];
|
||||||
}
|
}
|
||||||
@ -605,7 +607,7 @@ if (isset($_POST['delete'])) {
|
|||||||
if (isset($post['file_tmp'])) {
|
if (isset($post['file_tmp'])) {
|
||||||
if (!@rename($upload, $post['file']))
|
if (!@rename($upload, $post['file']))
|
||||||
error($config['error']['nomove']);
|
error($config['error']['nomove']);
|
||||||
chmod($post['file'], 0755);
|
chmod($post['file'], 0644);
|
||||||
} elseif (!@move_uploaded_file($upload, $post['file']))
|
} elseif (!@move_uploaded_file($upload, $post['file']))
|
||||||
error($config['error']['nomove']);
|
error($config['error']['nomove']);
|
||||||
}
|
}
|
||||||
@ -653,6 +655,7 @@ if (isset($_POST['delete'])) {
|
|||||||
// Remove board directories before inserting them into the database.
|
// Remove board directories before inserting them into the database.
|
||||||
if ($post['has_file']) {
|
if ($post['has_file']) {
|
||||||
$post['file_path'] = $post['file'];
|
$post['file_path'] = $post['file'];
|
||||||
|
$post['thumb_path'] = $post['thumb'];
|
||||||
$post['file'] = mb_substr($post['file'], mb_strlen($board['dir'] . $config['dir']['img']));
|
$post['file'] = mb_substr($post['file'], mb_strlen($board['dir'] . $config['dir']['img']));
|
||||||
if ($is_an_image && $post['thumb'] != 'spoiler')
|
if ($is_an_image && $post['thumb'] != 'spoiler')
|
||||||
$post['thumb'] = mb_substr($post['thumb'], mb_strlen($board['dir'] . $config['dir']['thumb']));
|
$post['thumb'] = mb_substr($post['thumb'], mb_strlen($board['dir'] . $config['dir']['thumb']));
|
||||||
|
@ -7,12 +7,21 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>{{ conf.title }}</th>
|
<th>{{ conf.title }}</th>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="{{ conf.name }}"
|
{% if conf.type == 'checkbox' %}
|
||||||
{% if settings[conf.name] %}value="{{ settings[conf.name] }}"{% else %}{% if conf.default %}value="{{ conf.default }}"{% endif %}{% endif %}
|
<input type="checkbox" name="{{ conf.name }}"
|
||||||
{% if conf.size %}
|
{% if settings[conf.name] or (not settings[conf.name] is defined and conf.default) %}
|
||||||
size="{{ conf.size }}"
|
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 %}
|
{% endif %}
|
||||||
/>
|
|
||||||
{% if conf.comment %}
|
{% if conf.comment %}
|
||||||
<span class="unimportant">{{ conf.comment }}</span>
|
<span class="unimportant">{{ conf.comment }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -91,7 +91,7 @@
|
|||||||
)
|
)
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</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="
|
<img class="post-image" src="
|
||||||
{% if post.thumb == 'file' %}
|
{% if post.thumb == 'file' %}
|
||||||
{{ config.root }}
|
{{ config.root }}
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
)
|
)
|
||||||
</span></p>
|
</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="
|
<img class="post-image" src="
|
||||||
{% if post.thumb == 'file' %}
|
{% if post.thumb == 'file' %}
|
||||||
{{ config.root }}
|
{{ config.root }}
|
||||||
|
@ -10,10 +10,10 @@ CREATE TABLE IF NOT EXISTS ``posts_{{ board }}`` (
|
|||||||
`body_nomarkup` text,
|
`body_nomarkup` text,
|
||||||
`time` int(11) NOT NULL,
|
`time` int(11) NOT NULL,
|
||||||
`bump` int(11) DEFAULT NULL,
|
`bump` int(11) DEFAULT NULL,
|
||||||
`thumb` varchar(50) DEFAULT NULL,
|
`thumb` varchar(255) DEFAULT NULL,
|
||||||
`thumbwidth` int(11) DEFAULT NULL,
|
`thumbwidth` int(11) DEFAULT NULL,
|
||||||
`thumbheight` int(11) DEFAULT NULL,
|
`thumbheight` int(11) DEFAULT NULL,
|
||||||
`file` varchar(50) DEFAULT NULL,
|
`file` varchar(255) DEFAULT NULL,
|
||||||
`filewidth` int(11) DEFAULT NULL,
|
`filewidth` int(11) DEFAULT NULL,
|
||||||
`fileheight` int(11) DEFAULT NULL,
|
`fileheight` int(11) DEFAULT NULL,
|
||||||
`filesize` int(11) DEFAULT NULL,
|
`filesize` int(11) DEFAULT NULL,
|
||||||
|
@ -38,5 +38,13 @@
|
|||||||
'comment' => '(eg. "catalog.css")'
|
'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
|
// Unique function name for building everything
|
||||||
$theme['build_function'] = 'catalog_build';
|
$theme['build_function'] = 'catalog_build';
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
$b = new Catalog();
|
$b = new Catalog();
|
||||||
$b->build($settings, $board);
|
$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 = new Catalog();
|
||||||
$b->build($settings, $board);
|
$b->build($settings, $board);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user