mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-23 23:20:57 +01:00
Merge branch 'master' of https://github.com/savetheinternet/Tinyboard
Conflicts: inc/config.php inc/functions.php install.php stylesheets/dark_roach.css
This commit is contained in:
commit
8503e65858
@ -178,11 +178,14 @@ class AntiBot {
|
||||
}
|
||||
|
||||
function _create_antibot($board, $thread) {
|
||||
global $config;
|
||||
global $config, $purged_old_antispam;
|
||||
|
||||
$antibot = new AntiBot(array($board, $thread));
|
||||
|
||||
query('DELETE FROM ``antispam`` WHERE `expires` < UNIX_TIMESTAMP()') or error(db_error());
|
||||
if (!isset($purged_old_antispam)) {
|
||||
$purged_old_antispam = true;
|
||||
query('DELETE FROM ``antispam`` WHERE `expires` < UNIX_TIMESTAMP()') or error(db_error());
|
||||
}
|
||||
|
||||
if ($thread)
|
||||
$query = prepare('UPDATE ``antispam`` SET `expires` = UNIX_TIMESTAMP() + :expires WHERE `board` = :board AND `thread` = :thread AND `expires` IS NULL');
|
||||
|
@ -77,16 +77,18 @@
|
||||
// Database driver (http://www.php.net/manual/en/pdo.drivers.php)
|
||||
// Only MySQL is supported by Tinyboard at the moment, sorry.
|
||||
$config['db']['type'] = 'mysql';
|
||||
// Hostname or IP address
|
||||
// Hostname, IP address or Unix socket (prefixed with ":")
|
||||
$config['db']['server'] = 'localhost';
|
||||
// Example: Unix socket
|
||||
// $config['db']['server'] = ':/tmp/mysql.sock';
|
||||
// Login
|
||||
$config['db']['user'] = '';
|
||||
$config['db']['password'] = '';
|
||||
// Tinyboard database
|
||||
$config['db']['database'] = '';
|
||||
// Table prefix
|
||||
// Table prefix (optional)
|
||||
$config['db']['prefix'] = '';
|
||||
// Use a persistent connection (experimental)
|
||||
// Use a persistent connection (experimental; benefits unknown)
|
||||
$config['db']['persistent'] = false;
|
||||
// Anything more to add to the DSN string (eg. port=xxx;foo=bar)
|
||||
$config['db']['dsn'] = '';
|
||||
@ -1350,14 +1352,14 @@
|
||||
* =============
|
||||
*/
|
||||
|
||||
// Whether or not to use the API, disabled by default.
|
||||
// Whether or not to enable the 4chan-compatible API, disabled by default. See
|
||||
// https://github.com/4chan/4chan-API for API specification.
|
||||
$config['api']['enabled'] = false;
|
||||
|
||||
// Extra fields in to be shown in the array that are not 4chan API compatible.
|
||||
// You canget these by taking a look at the schema for posts_ tables. The array should be formatted as $db_name => $translated_name.
|
||||
// For example:
|
||||
|
||||
// $config['api']['extra_fields'] = array('body_nomarkup'=>'com_nomarkup');
|
||||
// Extra fields in to be shown in the array that are not in the 4chan-API. You can get these by taking a
|
||||
// look at the schema for posts_ tables. The array should be formatted as $db_column => $translated_name.
|
||||
// Example: Adding the pre-markup post body to the API as "com_nomarkup".
|
||||
// $config['api']['extra_fields'] = array('body_nomarkup' => 'com_nomarkup');
|
||||
|
||||
/*
|
||||
* ====================
|
||||
|
@ -43,9 +43,17 @@ class PreparedQueryDebug {
|
||||
|
||||
function sql_open() {
|
||||
global $pdo, $config;
|
||||
if ($pdo) return true;
|
||||
if ($pdo)
|
||||
return true;
|
||||
|
||||
$dsn = $config['db']['type'] . ':host=' . $config['db']['server'] . ';dbname=' . $config['db']['database'];
|
||||
if (isset($config['db']['server'][0]) && $config['db']['server'][0] == ':')
|
||||
$unix_socket = substr($config['db']['server'], 1);
|
||||
else
|
||||
$unix_socket = false;
|
||||
|
||||
$dsn = $config['db']['type'] . ':' .
|
||||
($unix_socket ? 'unix_socket=' . $unix_socket : 'host=' . $config['db']['server']) .
|
||||
';dbname=' . $config['db']['database'];
|
||||
if (!empty($config['db']['dsn']))
|
||||
$dsn .= ';' . $config['db']['dsn'];
|
||||
try {
|
||||
|
@ -35,6 +35,7 @@ function loadConfig() {
|
||||
|
||||
$arrays = array(
|
||||
'db',
|
||||
'api',
|
||||
'cache',
|
||||
'cookies',
|
||||
'error',
|
||||
@ -1001,9 +1002,8 @@ function deletePost($id, $error_if_doesnt_exist=true, $rebuild_after=true) {
|
||||
if (isset($tmp_board))
|
||||
openBoard($tmp_board);
|
||||
|
||||
$query = prepare("DELETE FROM ``cites`` WHERE (`target_board` = :board AND `target` = :id) OR (`board` = :board AND `post` = :id)");
|
||||
$query = prepare("DELETE FROM ``cites`` WHERE (`target_board` = :board AND `target` = (" . implode(' OR `target` = ', $ids) . ")) OR (`board` = :board AND (`post` = " . implode(' OR `post` = ', $ids) . "))");
|
||||
$query->bindValue(':board', $board['uri']);
|
||||
$query->bindValue(':id', $id, PDO::PARAM_INT);
|
||||
$query->execute() or error(db_error($query));
|
||||
|
||||
if (isset($rebuild) && $rebuild_after) {
|
||||
@ -1056,7 +1056,7 @@ function index($page, $mod=false) {
|
||||
return false;
|
||||
|
||||
$threads = array();
|
||||
|
||||
|
||||
while ($th = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
$thread = new Thread($th, $mod ? '?/' : $config['root'], $mod);
|
||||
|
||||
@ -1097,7 +1097,7 @@ function index($page, $mod=false) {
|
||||
$thread->omitted = $omitted['post_count'] - ($th['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview']);
|
||||
$thread->omitted_images = $omitted['image_count'] - $num_images;
|
||||
}
|
||||
|
||||
|
||||
$threads[] = $thread;
|
||||
$body .= $thread->build(true);
|
||||
}
|
||||
@ -1309,7 +1309,8 @@ function buildIndex() {
|
||||
for ($page = 1; $page <= $config['max_pages']; $page++) {
|
||||
$filename = $board['dir'] . ($page == 1 ? $config['file_index'] : sprintf($config['file_page'], $page));
|
||||
|
||||
if ($config['try_smarter'] && isset($build_pages) && count($build_pages) && !in_array($page, $build_pages) && is_file($filename))
|
||||
if ($config['try_smarter'] && isset($build_pages) && count($build_pages)
|
||||
&& !in_array($page, $build_pages) && is_file($filename))
|
||||
continue;
|
||||
$content = index($page);
|
||||
if (!$content)
|
||||
@ -1326,24 +1327,25 @@ function buildIndex() {
|
||||
$content['antibot'] = $antibot;
|
||||
|
||||
file_write($filename, Element('index.html', $content));
|
||||
|
||||
|
||||
// json api
|
||||
if ($config['api']['enabled']) {
|
||||
$threads = $content['threads'];
|
||||
$json = json_encode($api->translatePage($threads));
|
||||
$jsonFilename = $board['dir'] . ($page-1) . ".json"; // pages should start from 0
|
||||
$jsonFilename = $board['dir'] . ($page - 1) . '.json'; // pages should start from 0
|
||||
file_write($jsonFilename, $json);
|
||||
|
||||
$catalog[$page-1] = $threads;
|
||||
$catalog[$page-1] = $threads;
|
||||
}
|
||||
}
|
||||
|
||||
if ($page < $config['max_pages']) {
|
||||
for (;$page<=$config['max_pages'];$page++) {
|
||||
$filename = $board['dir'] . ($page==1 ? $config['file_index'] : sprintf($config['file_page'], $page));
|
||||
file_unlink($filename);
|
||||
|
||||
|
||||
if ($config['api']['enabled']) {
|
||||
$jsonFilename = $board['dir'] . ($page-1) . ".json";
|
||||
$jsonFilename = $board['dir'] . ($page - 1) . '.json';
|
||||
file_unlink($jsonFilename);
|
||||
}
|
||||
}
|
||||
@ -1352,7 +1354,7 @@ function buildIndex() {
|
||||
// json api catalog
|
||||
if ($config['api']['enabled']) {
|
||||
$json = json_encode($api->translateCatalog($catalog));
|
||||
$jsonFilename = $board['dir'] . "catalog.json";
|
||||
$jsonFilename = $board['dir'] . 'catalog.json';
|
||||
file_write($jsonFilename, $json);
|
||||
}
|
||||
}
|
||||
@ -1779,7 +1781,7 @@ function buildThread($id, $return = false, $mod = false) {
|
||||
if ($config['api']['enabled']) {
|
||||
$api = new Api();
|
||||
$json = json_encode($api->translateThread($thread));
|
||||
$jsonFilename = $board['dir'] . $config['dir']['res'] . $id . ".json";
|
||||
$jsonFilename = $board['dir'] . $config['dir']['res'] . $id . '.json';
|
||||
file_write($jsonFilename, $json);
|
||||
}
|
||||
|
||||
@ -1874,7 +1876,7 @@ function buildThread50($id, $return = false, $mod = false, $thread = null, $anti
|
||||
}
|
||||
}
|
||||
|
||||
function rrmdir($dir) {
|
||||
function rrmdir($dir) {
|
||||
if (is_dir($dir)) {
|
||||
$objects = scandir($dir);
|
||||
foreach ($objects as $object) {
|
||||
@ -2029,7 +2031,7 @@ function DNS($host) {
|
||||
global $config;
|
||||
|
||||
if ($config['cache']['enabled'] && ($ip_addr = cache::get('dns_' . $host))) {
|
||||
return $ip_addr;
|
||||
return $ip_addr != '?' ? $ip_addr : false;
|
||||
}
|
||||
|
||||
if (!$config['dns_system']) {
|
||||
@ -2045,7 +2047,7 @@ function DNS($host) {
|
||||
}
|
||||
|
||||
if ($config['cache']['enabled'])
|
||||
cache::set('dns_' . $host, $ip_addr, 3600);
|
||||
cache::set('dns_' . $host, $ip_addr !== false ? $ip_addr : '?', 3600);
|
||||
|
||||
return $ip_addr;
|
||||
}
|
||||
|
@ -314,16 +314,18 @@ class ImageConvert extends ImageBase {
|
||||
$this->destroy();
|
||||
}
|
||||
|
||||
$this->temp = tempnam($config['tmp'], 'imagick');
|
||||
$this->temp = tempnam($config['tmp'], 'convert');
|
||||
|
||||
$config['thumb_keep_animation_frames'] = (int)$config['thumb_keep_animation_frames'];
|
||||
|
||||
if ($this->format == 'gif' && ($config['thumb_ext'] == 'gif' || $config['thumb_ext'] == '') && $config['thumb_keep_animation_frames'] > 1) {
|
||||
if ($this->gifsicle) {
|
||||
if (($error = shell_exec("gifsicle -w --unoptimize -O2 --resize {$this->width}x{$this->height} < " .
|
||||
escapeshellarg($this->src . '') . " \"#0-{$config['thumb_keep_animation_frames']}\" -o " .
|
||||
escapeshellarg($this->temp))) || !file_exists($this->temp))
|
||||
escapeshellarg($this->src . '') . " \"#0-{$config['thumb_keep_animation_frames']}\" -o " .
|
||||
escapeshellarg($this->temp))) || !file_exists($this->temp)) {
|
||||
$this->destroy();
|
||||
error('Failed to resize image!', null, $error);
|
||||
}
|
||||
} else {
|
||||
if ($config['convert_manual_orient'] && ($this->format == 'jpg' || $this->format == 'jpeg'))
|
||||
$convert_args = str_replace('-auto-orient', ImageConvert::jpeg_exif_orientation($this->src), $config['convert_args']);
|
||||
@ -338,8 +340,10 @@ class ImageConvert extends ImageBase {
|
||||
escapeshellarg($this->src),
|
||||
$this->width,
|
||||
$this->height,
|
||||
escapeshellarg($this->temp)))) || !file_exists($this->temp))
|
||||
escapeshellarg($this->temp)))) || !file_exists($this->temp)) {
|
||||
$this->destroy();
|
||||
error('Failed to resize image!', null, $error);
|
||||
}
|
||||
if ($size = $this->get_size($this->temp)) {
|
||||
$this->width = $size[0];
|
||||
$this->height = $size[1];
|
||||
@ -359,8 +363,10 @@ class ImageConvert extends ImageBase {
|
||||
escapeshellarg($this->src . '[0]'),
|
||||
$this->width,
|
||||
$this->height,
|
||||
escapeshellarg($this->temp)))) || !file_exists($this->temp))
|
||||
escapeshellarg($this->temp)))) || !file_exists($this->temp)) {
|
||||
$this->destroy();
|
||||
error('Failed to resize image!', null, $error);
|
||||
}
|
||||
if ($size = $this->get_size($this->temp)) {
|
||||
$this->width = $size[0];
|
||||
$this->height = $size[1];
|
||||
|
@ -379,7 +379,7 @@ function mod_edit_board($boardName) {
|
||||
$query->bindValue(':uri', $board['uri'], PDO::PARAM_INT);
|
||||
$query->execute() or error(db_error($query));
|
||||
|
||||
$query = prepare("SELECT `board`, `post` FROM ``cites`` WHERE `target_board` = :board");
|
||||
$query = prepare("SELECT `board`, `post` FROM ``cites`` WHERE `target_board` = :board ORDER BY `board`");
|
||||
$query->bindValue(':board', $board['uri']);
|
||||
$query->execute() or error(db_error($query));
|
||||
while ($cite = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
@ -391,6 +391,9 @@ function mod_edit_board($boardName) {
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($tmp_board))
|
||||
$board = $tmp_board;
|
||||
|
||||
$query = prepare('DELETE FROM ``cites`` WHERE `board` = :board OR `target_board` = :board');
|
||||
$query->bindValue(':board', $board['uri']);
|
||||
$query->execute() or error(db_error($query));
|
||||
@ -1156,7 +1159,7 @@ function mod_move($originBoard, $postID) {
|
||||
if ($post['has_file']) {
|
||||
// copy image
|
||||
$clone($file_src, sprintf($config['board_path'], $board['uri']) . $config['dir']['img'] . $post['file']);
|
||||
if (!in_array($post['thumb'], array('spoiler', 'deleted')))
|
||||
if (!in_array($post['thumb'], array('spoiler', 'deleted', 'file')))
|
||||
$clone($file_thumb, sprintf($config['board_path'], $board['uri']) . $config['dir']['thumb'] . $post['thumb']);
|
||||
}
|
||||
|
||||
@ -1346,6 +1349,8 @@ function mod_ban_post($board, $delete, $post, $token = false) {
|
||||
modLog("Deleted post #{$post}");
|
||||
// Rebuild board
|
||||
buildIndex();
|
||||
// Rebuild themes
|
||||
rebuildThemes('post-delete', $board['uri']);
|
||||
}
|
||||
|
||||
header('Location: ?/' . sprintf($config['board_path'], $board) . $config['file_index'], true, $config['redirect_http']);
|
||||
@ -1409,6 +1414,8 @@ function mod_edit_post($board, $edit_raw_html, $postID) {
|
||||
}
|
||||
|
||||
buildIndex();
|
||||
|
||||
rebuildThemes('post', $board);
|
||||
|
||||
header('Location: ?/' . sprintf($config['board_path'], $board) . $config['dir']['res'] . sprintf($config['file_page'], $post['thread'] ? $post['thread'] : $postID) . '#' . $postID, true, $config['redirect_http']);
|
||||
} else {
|
||||
@ -1438,7 +1445,8 @@ function mod_delete($board, $post) {
|
||||
modLog("Deleted post #{$post}");
|
||||
// Rebuild board
|
||||
buildIndex();
|
||||
|
||||
// Rebuild themes
|
||||
rebuildThemes('post-delete', $board['uri']);
|
||||
// Redirect
|
||||
header('Location: ?/' . sprintf($config['board_path'], $board) . $config['file_index'], true, $config['redirect_http']);
|
||||
}
|
||||
@ -1459,6 +1467,8 @@ function mod_deletefile($board, $post) {
|
||||
|
||||
// Rebuild board
|
||||
buildIndex();
|
||||
// Rebuild themes
|
||||
rebuildThemes('post-delete', $board['uri']);
|
||||
|
||||
// Redirect
|
||||
header('Location: ?/' . sprintf($config['board_path'], $board) . $config['file_index'], true, $config['redirect_http']);
|
||||
@ -1497,6 +1507,9 @@ function mod_spoiler_image($board, $post) {
|
||||
|
||||
// Rebuild board
|
||||
buildIndex();
|
||||
|
||||
// Rebuild themes
|
||||
rebuildThemes('post-delete', $board['uri']);
|
||||
|
||||
// Redirect
|
||||
header('Location: ?/' . sprintf($config['board_path'], $board) . $config['file_index'], true, $config['redirect_http']);
|
||||
@ -1547,6 +1560,8 @@ function mod_deletebyip($boardName, $post, $global = false) {
|
||||
|
||||
deletePost($post['id'], false, false);
|
||||
|
||||
rebuildThemes('post-delete', $board['uri']);
|
||||
|
||||
if ($post['thread'])
|
||||
$threads_to_rebuild[$post['board']][$post['thread']] = true;
|
||||
else
|
||||
|
@ -26,7 +26,8 @@ function load_twig() {
|
||||
$loader->setPaths($config['dir']['template']);
|
||||
$twig = new Twig_Environment($loader, array(
|
||||
'autoescape' => false,
|
||||
'cache' => "{$config['dir']['template']}/cache",
|
||||
'cache' => is_writable('templates') && (!is_dir('templates/cache') || is_writable('templates/cache')) ?
|
||||
"{$config['dir']['template']}/cache" : false,
|
||||
'debug' => $config['debug']
|
||||
));
|
||||
$twig->addExtension(new Twig_Extensions_Extension_Tinyboard());
|
||||
|
32
install.php
32
install.php
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
// Installation/upgrade file
|
||||
define('VERSION', 'v0.9.6-dev-12 + <a href="https://int.vichan.net/devel/">vichan-devel-4.0.11-gold</a>');
|
||||
define('VERSION', 'v0.9.6-dev-14 + <a href="https://int.vichan.net/devel/">vichan-devel-4.0.12</a>');
|
||||
|
||||
require 'inc/functions.php';
|
||||
|
||||
@ -377,6 +377,12 @@ if (file_exists($config['has_installed'])) {
|
||||
}
|
||||
case 'v0.9.6-dev-12':
|
||||
case 'v0.9.6-dev-12 + <a href="https://int.vichan.net/devel/">vichan-devel-4.0.10</a>':
|
||||
case 'v0.9.6-dev-12 + <a href="https://int.vichan.net/devel/">vichan-devel-4.0.11-gold</a>':
|
||||
foreach ($boards as &$board) {
|
||||
query(sprintf("ALTER TABLE ``posts_%s`` ADD INDEX `ip` (`ip`)", $board['uri'])) or error(db_error());
|
||||
}
|
||||
case 'v0.9.6-dev-13':
|
||||
query("ALTER TABLE ``antispam`` ADD INDEX `expires` (`expires`)") or error(db_error());
|
||||
case false:
|
||||
// Update version number
|
||||
file_write($config['has_installed'], VERSION);
|
||||
@ -525,6 +531,13 @@ if ($step == 0) {
|
||||
'required' => false,
|
||||
'message' => '(Optional) `identify` was not found or executable; command-line ImageMagick image processing cannot be enabled.',
|
||||
),
|
||||
array(
|
||||
'category' => 'Image processing',
|
||||
'name' => '`gm` (command-line GraphicsMagick)',
|
||||
'result' => $can_exec && shell_exec('which gm'),
|
||||
'required' => false,
|
||||
'message' => '(Optional) `gm` was not found or executable; command-line GraphicsMagick (faster than ImageMagick) cannot be enabled.',
|
||||
),
|
||||
array(
|
||||
'category' => 'Image processing',
|
||||
'name' => '`gifsicle` (command-line animted GIF thumbnailing)',
|
||||
@ -539,12 +552,27 @@ if ($step == 0) {
|
||||
'required' => true,
|
||||
'message' => 'Tinyboard does not have permission to create directories (boards) here. You will need to <code>chmod</code> (or operating system equivalent) appropriately.'
|
||||
),
|
||||
array(
|
||||
'category' => 'File permissions',
|
||||
'name' => getcwd() . '/templates/cache',
|
||||
'result' => is_writable('templates') && (!is_dir('templates/cache') || is_writable('templates/cache')),
|
||||
'required' => true,
|
||||
'message' => 'You must give Tinyboard permission to create (and write to) the <code>templates/cache</code> directory or performance will be drastically reduced.'
|
||||
),
|
||||
array(
|
||||
'category' => 'File permissions',
|
||||
'name' => getcwd() . '/inc/instance-config.php',
|
||||
'result' => is_writable('inc/instance-config.php'),
|
||||
'required' => false,
|
||||
'message' => 'Tinyboard does not have permission to make changes to inc/instance-config.php. To complete the installation, you will be asked to manually copy and paste code into the file instead.'
|
||||
'message' => 'Tinyboard does not have permission to make changes to <code>inc/instance-config.php</code>. To complete the installation, you will be asked to manually copy and paste code into the file instead.'
|
||||
),
|
||||
array(
|
||||
'category' => 'Misc',
|
||||
'name' => 'Caching available (APC, XCache, Memcached or Redis)',
|
||||
'result' => extension_loaded('apc') || extension_loaded('xcache')
|
||||
|| extension_loaded('memcached') || extension_loaded('redis'),
|
||||
'required' => false,
|
||||
'message' => 'You will not be able to enable the additional caching system, designed to minimize SQL queries and significantly improve performance. <a href="http://php.net/manual/en/book.apc.php">APC</a> is the recommended method of caching, but <a href="http://xcache.lighttpd.net/">XCache</a>, <a href="http://www.php.net/manual/en/intro.memcached.php">Memcached</a> and <a href="http://pecl.php.net/package/redis">Redis</a> are also supported.'
|
||||
),
|
||||
array(
|
||||
'category' => 'Misc',
|
||||
|
@ -29,7 +29,8 @@ CREATE TABLE IF NOT EXISTS `antispam` (
|
||||
`expires` int(11) DEFAULT NULL,
|
||||
`passed` smallint(6) NOT NULL,
|
||||
PRIMARY KEY (`hash`),
|
||||
KEY `board` (`board`,`thread`)
|
||||
KEY `board` (`board`,`thread`),
|
||||
KEY `expires` (`expires`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=ascii COLLATE=ascii_bin;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
20
post.php
20
post.php
@ -75,6 +75,9 @@ if (isset($_POST['delete'])) {
|
||||
}
|
||||
|
||||
buildIndex();
|
||||
|
||||
|
||||
rebuildThemes('post-delete', $board['uri']);
|
||||
|
||||
$is_mod = isset($_POST['mod']) && $_POST['mod'];
|
||||
$root = $is_mod ? $config['root'] . $config['file_mod'] . '?/' : $config['root'];
|
||||
@ -275,14 +278,19 @@ if (isset($_POST['delete'])) {
|
||||
if (!preg_match($config['url_regex'], $post['file_url']))
|
||||
error($config['error']['invalidimg']);
|
||||
|
||||
|
||||
$post['extension'] = strtolower(mb_substr($post['file_url'], mb_strrpos($post['file_url'], '.') + 1));
|
||||
if (mb_strpos($post['file_url'], '?') !== false)
|
||||
$url_without_params = mb_substr($post['file_url'], 0, mb_strpos($post['file_url'], '?'));
|
||||
else
|
||||
$url_without_params = $post['file_url'];
|
||||
|
||||
$post['extension'] = strtolower(mb_substr($url_without_params, mb_strrpos($url_without_params, '.') + 1));
|
||||
if (!in_array($post['extension'], $config['allowed_ext']) && !in_array($post['extension'], $config['allowed_ext_files']))
|
||||
error($config['error']['unknownext']);
|
||||
|
||||
$post['file_tmp'] = tempnam($config['tmp'], 'url');
|
||||
function unlink_tmp_file($file) {
|
||||
@unlink($file);
|
||||
fatal_error_handler();
|
||||
}
|
||||
register_shutdown_function('unlink_tmp_file', $post['file_tmp']);
|
||||
|
||||
@ -307,7 +315,7 @@ if (isset($_POST['delete'])) {
|
||||
fclose($fp);
|
||||
|
||||
$_FILES['file'] = array(
|
||||
'name' => basename($post['file_url']),
|
||||
'name' => basename($url_without_params),
|
||||
'tmp_name' => $post['file_tmp'],
|
||||
'error' => 0,
|
||||
'size' => filesize($post['file_tmp'])
|
||||
@ -520,7 +528,8 @@ if (isset($_POST['delete'])) {
|
||||
escapeshellarg($upload));
|
||||
if ($config['use_exiftool'] && !$config['strip_exif']) {
|
||||
if ($exiftool_error = shell_exec_error(
|
||||
'exiftool -q -orientation=1 -n ' . escapeshellarg($upload)))
|
||||
'exiftool -overwrite_original -q -q -orientation=1 -n ' .
|
||||
escapeshellarg($upload)))
|
||||
error('exiftool failed!', null, $exiftool_error);
|
||||
} else {
|
||||
// TODO: Find another way to remove the Orientation tag from the EXIF profile
|
||||
@ -583,7 +592,8 @@ if (isset($_POST['delete'])) {
|
||||
|
||||
if ($config['redraw_image'] || (!@$post['exif_stripped'] && $config['strip_exif'] && ($post['extension'] == 'jpg' || $post['extension'] == 'jpeg'))) {
|
||||
if (!$config['redraw_image'] && $config['use_exiftool']) {
|
||||
if($error = shell_exec_error('exiftool -ignoreMinorErrors -q -q -all= ' . escapeshellarg($upload)))
|
||||
if($error = shell_exec_error('exiftool -overwrite_original -ignoreMinorErrors -q -q -all= ' .
|
||||
escapeshellarg($upload)))
|
||||
error('Could not strip EXIF metadata!', null, $error);
|
||||
} else {
|
||||
$image->to($post['file']);
|
||||
|
File diff suppressed because one or more lines are too long
BIN
stylesheets/img/dark_roach_bg.png
Normal file
BIN
stylesheets/img/dark_roach_bg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
BIN
stylesheets/img/dark_roach_top.png
Normal file
BIN
stylesheets/img/dark_roach_top.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
0
stylesheets/img/rect820.png
Executable file → Normal file
0
stylesheets/img/rect820.png
Executable file → Normal file
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
0
stylesheets/img/rect821.png
Executable file → Normal file
0
stylesheets/img/rect821.png
Executable file → Normal file
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
88
stylesheets/notsuba.css
Normal file
88
stylesheets/notsuba.css
Normal file
@ -0,0 +1,88 @@
|
||||
/**
|
||||
* notsuba.css
|
||||
* Tagechan is the best
|
||||
* you are forbidden by law from making any unauthorized edits to this file. I-I'll sue! ;_;
|
||||
*/
|
||||
body {
|
||||
background: #f2edd0
|
||||
}
|
||||
|
||||
a:link, a:visited {
|
||||
text-decoration: none;
|
||||
color: #608673;
|
||||
}
|
||||
|
||||
a:link:hover, a:visited:hover {
|
||||
color: #DD0000;
|
||||
}
|
||||
|
||||
a.post_no {
|
||||
color: #000033;
|
||||
}
|
||||
|
||||
p.intro a.email span.name {
|
||||
color: #608673;
|
||||
}
|
||||
|
||||
p.intro a.email:hover span.name {
|
||||
color: #DD0000;
|
||||
}
|
||||
|
||||
h2, div.title, h1 {
|
||||
color: #800000;
|
||||
}
|
||||
|
||||
form table tr th {
|
||||
background: #ded8b7;
|
||||
}
|
||||
|
||||
div.banner {
|
||||
background-color: #E04000;
|
||||
}
|
||||
|
||||
div.post.op hr {
|
||||
border-color: #608673;
|
||||
}
|
||||
|
||||
p.intro span.subject {
|
||||
color: #8a2e2e;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
p.intro span.name {
|
||||
color: #117743;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
div.post.reply.highlighted {
|
||||
background: #dcae9b;
|
||||
}
|
||||
|
||||
div.post.reply {
|
||||
background: #e9d1be;
|
||||
border-color: #dcae9b;
|
||||
}
|
||||
|
||||
div.ban {
|
||||
border: 1px solid #B0C2B9;
|
||||
}
|
||||
|
||||
div.ban h2 {
|
||||
background: #e9d1be;
|
||||
color: #608673;
|
||||
}
|
||||
|
||||
div.pages {
|
||||
color: #8899AA;
|
||||
background: #e9d1be;
|
||||
border-right: 1px solid #8FCCCD;
|
||||
border-bottom: 1px solid #8FCCCD;
|
||||
}
|
||||
|
||||
hr {
|
||||
border-color: #B0C2B9;
|
||||
}
|
||||
|
||||
div.boardlist {
|
||||
color: #608673;
|
||||
}
|
@ -28,6 +28,7 @@ CREATE TABLE IF NOT EXISTS ``posts_{{ board }}`` (
|
||||
UNIQUE KEY `id` (`id`),
|
||||
KEY `thread_id` (`thread`,`id`),
|
||||
KEY `time` (`time`),
|
||||
FULLTEXT KEY `body` (`body`)
|
||||
FULLTEXT KEY `body` (`body`),
|
||||
KEY `ip` (`ip`),
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ;
|
||||
|
@ -20,7 +20,7 @@
|
||||
$b = new Catalog();
|
||||
$b->build($settings, $board);
|
||||
}
|
||||
} elseif ($action == 'post-thread' || ($settings['update_on_posts'] && $action == 'post') && in_array($board, $boards)) {
|
||||
} elseif ($action == 'post-thread' || ($settings['update_on_posts'] && $action == 'post') || ($settings['update_on_posts'] && $action == 'post-delete') && in_array($board, $boards)) {
|
||||
$b = new Catalog();
|
||||
$b->build($settings, $board);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
$this->excluded = explode(' ', $settings['exclude']);
|
||||
|
||||
if ($action == 'all' || $action == 'post' || $action == 'post-thread')
|
||||
if ($action == 'all' || $action == 'post' || $action == 'post-thread' || $action == 'post-delete')
|
||||
file_write($config['dir']['home'] . $settings['html'], $this->homepage($settings));
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,15 @@
|
||||
'default' => 'hourly',
|
||||
'size' => '20'
|
||||
);
|
||||
|
||||
$theme['config'][] = Array(
|
||||
'title' => 'Minimum time between regenerating',
|
||||
'name' => 'regen_time',
|
||||
'type' => 'text',
|
||||
'comment' => '(in seconds)',
|
||||
'default' => '0',
|
||||
'size' => '8'
|
||||
);
|
||||
|
||||
$__boards = listBoards();
|
||||
$__default_boards = Array();
|
||||
|
@ -11,9 +11,16 @@
|
||||
// - post (a post has been made)
|
||||
// - thread (a thread has been made)
|
||||
|
||||
if ($action != 'post' && $action != 'post-thread')
|
||||
if ($action != 'post-thread' && $action != 'post-delete')
|
||||
return;
|
||||
|
||||
if ($settings['regen_time'] > 0) {
|
||||
if ($last_gen = @filemtime($settings['path'])) {
|
||||
if (time() - $last_gen < (int)$settings['regen_time'])
|
||||
return; // Too soon
|
||||
}
|
||||
}
|
||||
|
||||
$boards = explode(' ', $settings['boards']);
|
||||
|
||||
$threads = array();
|
||||
|
Loading…
Reference in New Issue
Block a user