1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-12-11 23:36:02 +01:00
This commit is contained in:
Fredrick Brennan 2015-05-06 13:58:26 +08:00
commit b96b33e548
8 changed files with 16 additions and 10 deletions

View File

@ -92,7 +92,7 @@ class Api {
$apiPost['filename'] = @substr($file->name, 0, strrpos($file->name, '.')); $apiPost['filename'] = @substr($file->name, 0, strrpos($file->name, '.'));
$dotPos = strrpos($file->file, '.'); $dotPos = strrpos($file->file, '.');
$apiPost['ext'] = substr($file->file, $dotPos); $apiPost['ext'] = substr($file->file, $dotPos);
$apiPost['tim'] = substr($file->file, 0, $dotPos); $apiPost['tim'] = urlencode(substr($file->file, 0, $dotPos));
if (isset($file->hash)) if (isset($file->hash))
$apiPost['md5'] = base64_encode(hex2bin($file->hash)); $apiPost['md5'] = base64_encode(hex2bin($file->hash));
} }

View File

@ -187,8 +187,10 @@ class Bans {
if ($ban['post']) { if ($ban['post']) {
$post = json_decode($ban['post']); $post = json_decode($ban['post']);
if ($post) {
$ban['message'] = $post->body; $ban['message'] = $post->body;
} }
}
unset($ban['ipstart'], $ban['ipend'], $ban['post'], $ban['creator']); unset($ban['ipstart'], $ban['ipend'], $ban['post'], $ban['creator']);
if ($board_access === false || in_array ($ban['board'], $board_access)) { if ($board_access === false || in_array ($ban['board'], $board_access)) {

View File

@ -1783,4 +1783,4 @@
$config['report_captcha'] = false; $config['report_captcha'] = false;
// Allowed HTML tags in ?/edit_pages. // Allowed HTML tags in ?/edit_pages.
$config['allowed_html'] = 'a[href|title],p,br,li,ol,ul,strong,em,u,h2,b,i,tt,div,img[src|alt|title],hr'; $config['allowed_html'] = 'a[href|title],p,br,li,ol,ul,strong,em,u,h2,b,i,tt,div,img[src|alt|title],hr,h1,h2,h3,h4,h5';

View File

@ -986,7 +986,7 @@ function fetchBoardTags( $uris ) {
$boardTags[ $tagRow['uri'] ] = array(); $boardTags[ $tagRow['uri'] ] = array();
} }
$boardTags[ $tagRow['uri'] ][] = htmlentities( utf8_encode( $tag ) ); $boardTags[ $tagRow['uri'] ][] = $tag;
} }
} }

View File

@ -57,17 +57,17 @@ function make_webm_thumbnail($filename, $thumbnail, $width, $height, $duration)
global $board, $config; global $board, $config;
$filename = escapeshellarg($filename); $filename = escapeshellarg($filename);
//$thumbnail = escapeshellarg($thumbnail); // Should be safe by default but you $thumbnailfc = escapeshellarg($thumbnail); // Should be safe by default but you
// can never be too safe. // can never be too safe.
$ffmpeg = $config['webm']['ffmpeg_path']; $ffmpeg = $config['webm']['ffmpeg_path'];
$ret = 0; $ret = 0;
$ffmpeg_out = array(); $ffmpeg_out = array();
exec("$ffmpeg -strict -2 -ss " . floor($duration / 2) . " -i $filename -v quiet -an -vframes 1 -f mjpeg -vf scale=$width:$height $thumbnail 2>&1", $ffmpeg_out, $ret); exec("$ffmpeg -strict -2 -ss " . floor($duration / 2) . " -i $filename -v quiet -an -vframes 1 -f mjpeg -vf scale=$width:$height $thumbnailfc 2>&1", $ffmpeg_out, $ret);
// Work around for https://trac.ffmpeg.org/ticket/4362 // Work around for https://trac.ffmpeg.org/ticket/4362
if (filesize($thumbnail) === 0) { if (filesize($thumbnail) === 0) {
// try again with first frame // try again with first frame
exec("$ffmpeg -y -strict -2 -ss 0 -i $filename -v quiet -an -vframes 1 -f mjpeg -vf scale=$width:$height $thumbnail 2>&1", $ffmpeg_out, $ret); exec("$ffmpeg -y -strict -2 -ss 0 -i $filename -v quiet -an -vframes 1 -f mjpeg -vf scale=$width:$height $thumbnailfc 2>&1", $ffmpeg_out, $ret);
clearstatcache(); clearstatcache();
// failed if no thumbnail size even if ret code 0, ffmpeg is buggy // failed if no thumbnail size even if ret code 0, ffmpeg is buggy
if (filesize($thumbnail) === 0) { if (filesize($thumbnail) === 0) {

View File

@ -664,7 +664,7 @@ elseif (isset($_POST['post'])) {
} }
} }
if ($config['allowed_tags'] && $post['op'] && isset($_POST['tag']) && isset($config['allowed_tags'][$_POST['tag']])) { if ($config['allowed_tags'] && $post['op'] && isset($_POST['tag']) && $_POST['tag'] && isset($config['allowed_tags'][$_POST['tag']])) {
$post['body'] .= "\n<tinyboard tag>" . $_POST['tag'] . "</tinyboard>"; $post['body'] .= "\n<tinyboard tag>" . $_POST['tag'] . "</tinyboard>";
} }

View File

@ -8,7 +8,7 @@
<td><a class="post_no" onclick="citeReply({{ post.id }})" href="{{ post.link('q') }}">{{ post.id }}</a> <td><a class="post_no" onclick="citeReply({{ post.id }})" href="{{ post.link('q') }}">{{ post.id }}</a>
<td>{% include 'post/name.html' %} <td>{% include 'post/name.html' %}
{% include 'post/flag.html' %} {% include 'post/flag.html' %}
<td>[<a href="{{ config.uri_img }}{{ post.files[0].file }}">{{ post.files[0].filename|e|bidi_cleanup }}</a>] <td>[<a target="_blank" href="{{ config.uri_img }}{{ post.files[0].file }}">{{ post.files[0].filename|e|bidi_cleanup }}</a>]
<td>{% if post.modifiers['tag'] %}[{{ post.modifiers['tag']|e }}]{% endif %} <td>{% if post.modifiers['tag'] %}[{{ post.modifiers['tag']|e }}]{% endif %}
<td>{% include 'post/subject.html' %} <td>{% include 'post/subject.html' %}
{% if post.sticky %} {% if post.sticky %}

View File

@ -82,7 +82,11 @@
$post['file'] = '/' . $config['spoiler_image']; $post['file'] = '/' . $config['spoiler_image'];
} }
else { else {
if ($files[0]->thumb == 'file') {
$post['file'] = $config['root'] . sprintf($config['file_thumb'], 'file.png');
} else {
$post['file'] = $config['uri_thumb'] . $files[0]->thumb; $post['file'] = $config['uri_thumb'] . $files[0]->thumb;
}
$post['fullimage'] = $config['uri_img'] . $files[0]->file; $post['fullimage'] = $config['uri_img'] . $files[0]->file;
} }
} }