forked from leftypol/leftypol
Merge remote-tracking branch 'upstream/master' into vichan-merge
This commit is contained in:
commit
4b40f69a4e
223 changed files with 65256 additions and 2969 deletions
|
@ -115,7 +115,7 @@ function mod_dashboard() {
|
|||
$latest = unserialize($_COOKIE['update']);
|
||||
} else {
|
||||
$ctx = stream_context_create(array('http' => array('timeout' => 5)));
|
||||
if ($code = @file_get_contents('http://tinyboard.org/version.txt', 0, $ctx)) {
|
||||
if ($code = @file_get_contents('http://engine.vichan.net/version.txt', 0, $ctx)) {
|
||||
$ver = strtok($code, "\n");
|
||||
|
||||
if (preg_match('@^// v(\d+)\.(\d+)\.(\d+)\s*?$@', $ver, $matches)) {
|
||||
|
@ -124,7 +124,7 @@ function mod_dashboard() {
|
|||
'major' => $matches[2],
|
||||
'minor' => $matches[3]
|
||||
);
|
||||
if (preg_match('/v(\d+)\.(\d)\.(\d+)(-dev.+)?$/', $config['version'], $matches)) {
|
||||
if (preg_match('/(\d+)\.(\d)\.(\d+)(-dev.+)?$/', $config['version'], $matches)) {
|
||||
$current = array(
|
||||
'massive' => (int) $matches[1],
|
||||
'major' => (int) $matches[2],
|
||||
|
@ -770,7 +770,7 @@ function mod_page_ip($ip) {
|
|||
if (!hasPermission($config['mod']['unban']))
|
||||
error($config['error']['noaccess']);
|
||||
|
||||
Bans::delete($_POST['ban_id'], true);
|
||||
Bans::delete($_POST['ban_id'], true, $mod['boards']);
|
||||
|
||||
header('Location: ?/IP/' . $ip . '#bans', true, $config['redirect_http']);
|
||||
return;
|
||||
|
@ -867,18 +867,16 @@ function mod_ban() {
|
|||
require_once 'inc/mod/ban.php';
|
||||
|
||||
Bans::new_ban($_POST['ip'], $_POST['reason'], $_POST['length'], $_POST['board'] == '*' ? false : $_POST['board']);
|
||||
|
||||
|
||||
if (isset($_POST['redirect']))
|
||||
header('Location: ' . $_POST['redirect'], true, $config['redirect_http']);
|
||||
else
|
||||
header('Location: ?/', true, $config['redirect_http']);
|
||||
}
|
||||
|
||||
function mod_bans($page_no = 1) {
|
||||
function mod_bans() {
|
||||
global $config;
|
||||
|
||||
if ($page_no < 1)
|
||||
error($config['error']['404']);
|
||||
global $mod;
|
||||
|
||||
if (!hasPermission($config['mod']['view_banlist']))
|
||||
error($config['error']['noaccess']);
|
||||
|
@ -896,29 +894,33 @@ function mod_bans($page_no = 1) {
|
|||
error(sprintf($config['error']['toomanyunban'], $config['mod']['unban_limit'], count($unban)));
|
||||
|
||||
foreach ($unban as $id) {
|
||||
Bans::delete($id, true);
|
||||
Bans::delete($id, true, $mod['boards'], true);
|
||||
}
|
||||
rebuildThemes('bans');
|
||||
header('Location: ?/bans', true, $config['redirect_http']);
|
||||
return;
|
||||
}
|
||||
|
||||
$bans = Bans::list_all(($page_no - 1) * $config['mod']['banlist_page'], $config['mod']['banlist_page']);
|
||||
|
||||
if (empty($bans) && $page_no > 1)
|
||||
error($config['error']['404']);
|
||||
|
||||
foreach ($bans as &$ban) {
|
||||
if (filter_var($ban['mask'], FILTER_VALIDATE_IP) !== false)
|
||||
$ban['single_addr'] = true;
|
||||
}
|
||||
|
||||
mod_page(_('Ban list'), 'mod/ban_list.html', array(
|
||||
'bans' => $bans,
|
||||
'count' => Bans::count(),
|
||||
'token' => make_secure_link_token('bans')
|
||||
'mod' => $mod,
|
||||
'boards' => json_encode($mod['boards']),
|
||||
'token' => make_secure_link_token('bans'),
|
||||
'token_json' => make_secure_link_token('bans.json')
|
||||
));
|
||||
}
|
||||
|
||||
function mod_bans_json() {
|
||||
global $config, $mod;
|
||||
|
||||
if (!hasPermission($config['mod']['ban']))
|
||||
error($config['error']['noaccess']);
|
||||
|
||||
// Compress the json for faster loads
|
||||
if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler");
|
||||
|
||||
Bans::stream_json(false, false, !hasPermission($config['mod']['view_banstaff']), $mod['boards']);
|
||||
}
|
||||
|
||||
function mod_ban_appeals() {
|
||||
global $config, $board;
|
||||
|
||||
|
@ -1163,7 +1165,7 @@ function mod_move_reply($originBoard, $postID) {
|
|||
$post = $query->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
// redirect
|
||||
header('Location: ?/' . sprintf($config['board_path'], $board['uri']) . $config['dir']['res'] . sprintf($config['file_page'], $post['thread'] ? $post['thread'] : $newID) . '#' . $newID, true, $config['redirect_http']);
|
||||
header('Location: ?/' . sprintf($config['board_path'], $board['uri']) . $config['dir']['res'] . link_for($post) . '#' . $newID, true, $config['redirect_http']);
|
||||
}
|
||||
|
||||
else {
|
||||
|
@ -1226,7 +1228,10 @@ function mod_move($originBoard, $postID) {
|
|||
|
||||
// create the new thread
|
||||
$newID = post($post);
|
||||
|
||||
|
||||
$op = $post;
|
||||
$op['id'] = $newID;
|
||||
|
||||
if ($post['has_file']) {
|
||||
// copy image
|
||||
foreach ($post['files'] as $i => &$file) {
|
||||
|
@ -1324,6 +1329,8 @@ function mod_move($originBoard, $postID) {
|
|||
// trigger themes
|
||||
rebuildThemes('post', $targetBoard);
|
||||
|
||||
$newboard = $board;
|
||||
|
||||
// return to original board
|
||||
openBoard($originBoard);
|
||||
|
||||
|
@ -1334,7 +1341,7 @@ function mod_move($originBoard, $postID) {
|
|||
$query->execute() or error(db_error($query));
|
||||
|
||||
// leave a reply, linking to the new thread
|
||||
$post = array(
|
||||
$spost = array(
|
||||
'mod' => true,
|
||||
'subject' => '',
|
||||
'email' => '',
|
||||
|
@ -1348,23 +1355,23 @@ function mod_move($originBoard, $postID) {
|
|||
'op' => false
|
||||
);
|
||||
|
||||
$post['body'] = $post['body_nomarkup'] = sprintf($config['mod']['shadow_mesage'], '>>>/' . $targetBoard . '/' . $newID);
|
||||
$spost['body'] = $spost['body_nomarkup'] = sprintf($config['mod']['shadow_mesage'], '>>>/' . $targetBoard . '/' . $newID);
|
||||
|
||||
markup($post['body']);
|
||||
markup($spost['body']);
|
||||
|
||||
$botID = post($post);
|
||||
$botID = post($spost);
|
||||
buildThread($postID);
|
||||
|
||||
buildIndex();
|
||||
|
||||
header('Location: ?/' . sprintf($config['board_path'], $originBoard) . $config['dir']['res'] .sprintf($config['file_page'], $postID) .
|
||||
header('Location: ?/' . sprintf($config['board_path'], $newboard['uri']) . $config['dir']['res'] . link_for($op, false, $newboard) .
|
||||
'#' . $botID, true, $config['redirect_http']);
|
||||
} else {
|
||||
deletePost($postID);
|
||||
buildIndex();
|
||||
|
||||
openBoard($targetBoard);
|
||||
header('Location: ?/' . sprintf($config['board_path'], $board['uri']) . $config['dir']['res'] . sprintf($config['file_page'], $newID), true, $config['redirect_http']);
|
||||
header('Location: ?/' . sprintf($config['board_path'], $newboard['uri']) . $config['dir']['res'] . link_for($op, false, $newboard), true, $config['redirect_http']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1506,7 +1513,7 @@ function mod_edit_post($board, $edit_raw_html, $postID) {
|
|||
|
||||
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']);
|
||||
header('Location: ?/' . sprintf($config['board_path'], $board) . $config['dir']['res'] . link_for($post) . '#' . $postID, true, $config['redirect_http']);
|
||||
} else {
|
||||
if ($config['minify_html']) {
|
||||
$post['body_nomarkup'] = str_replace("\n", '
', utf8tohtml($post['body_nomarkup']));
|
||||
|
@ -1585,10 +1592,12 @@ function mod_spoiler_image($board, $post, $file) {
|
|||
$result = $query->fetch(PDO::FETCH_ASSOC);
|
||||
$files = json_decode($result['files']);
|
||||
|
||||
|
||||
$size_spoiler_image = @getimagesize($config['spoiler_image']);
|
||||
file_unlink($board . '/' . $config['dir']['thumb'] . $files[$file]->thumb);
|
||||
$files[$file]->thumb = 'spoiler';
|
||||
$files[$file]->thumbheight = 128;
|
||||
$files[$file]->thumbwidth = 128;
|
||||
$files[$file]->thumbwidth = $size_spoiler_image[0];
|
||||
$files[$file]->thumbheight = $size_spoiler_image[1];
|
||||
|
||||
// Make thumbnail spoiler
|
||||
$query = prepare(sprintf("UPDATE ``posts_%s`` SET `files` = :files WHERE `id` = :id", $board));
|
||||
|
@ -2510,10 +2519,14 @@ function mod_theme_configure($theme_name) {
|
|||
$query->bindValue(':value', $_POST[$conf['name']]);
|
||||
$query->execute() or error(db_error($query));
|
||||
}
|
||||
|
||||
|
||||
$query = prepare("INSERT INTO ``theme_settings`` VALUES(:theme, NULL, NULL)");
|
||||
$query->bindValue(':theme', $theme_name);
|
||||
$query->execute() or error(db_error($query));
|
||||
|
||||
// Clean cache
|
||||
Cache::delete("themes");
|
||||
Cache::delete("theme_settings_".$theme_name);
|
||||
|
||||
$result = true;
|
||||
$message = false;
|
||||
|
@ -2561,11 +2574,15 @@ function mod_theme_uninstall($theme_name) {
|
|||
|
||||
if (!hasPermission($config['mod']['themes']))
|
||||
error($config['error']['noaccess']);
|
||||
|
||||
|
||||
$query = prepare("DELETE FROM ``theme_settings`` WHERE `theme` = :theme");
|
||||
$query->bindValue(':theme', $theme_name);
|
||||
$query->execute() or error(db_error($query));
|
||||
|
||||
// Clean cache
|
||||
Cache::delete("themes");
|
||||
Cache::delete("theme_settings_".$theme);
|
||||
|
||||
header('Location: ?/themes', true, $config['redirect_http']);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue