From 7241d6e65b95b569418c84385e2ef9254f4c1f73 Mon Sep 17 00:00:00 2001 From: czaks Date: Thu, 23 Apr 2015 05:18:43 +0200 Subject: [PATCH] fileboard/8chan: anal filenames, webms for op --- inc/8chan-mod-pages.php | 8 ++++++++ inc/instance-functions.php | 6 ++++++ templates/mod/settings.html | 5 +++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/inc/8chan-mod-pages.php b/inc/8chan-mod-pages.php index f0c2bd58..ab8a058a 100644 --- a/inc/8chan-mod-pages.php +++ b/inc/8chan-mod-pages.php @@ -452,6 +452,11 @@ FLAGS; if (isset ($_POST['allowed_ext_op'])) { $file_board .= "\$config['allowed_ext_op'] = \$config['allowed_ext_files'];\n"; + + if (isset ($_POST['allowed_ext_op_video'])) { + $file_board .= "\$config['allowed_ext_op'][] = 'webm'; + \$config['allowed_ext_op'][] = 'mp4';\n"; + } } if (isset ($_POST['tag_id'])) { @@ -470,6 +475,8 @@ FLAGS; } } + $anal_filenames = ($imgboard || $fileboard) && isset($_POST['anal_filenames']) ? "\$config['filename_func'] = 'filename_func';\n" : ''; + $anonymous = base64_encode($_POST['anonymous']); $blotter = base64_encode(purify_html(html_entity_decode($_POST['blotter']))); $add_to_config = @file_get_contents($b.'/extra_config.php'); @@ -586,6 +593,7 @@ if (\$config['disable_images']) \$config['max_pages'] = 10000; $locale +$anal_filenames $file_board $add_to_config EOT; diff --git a/inc/instance-functions.php b/inc/instance-functions.php index 71e933d1..aa4bf010 100644 --- a/inc/instance-functions.php +++ b/inc/instance-functions.php @@ -22,3 +22,9 @@ function max_posts_per_hour($post) { function page_404() { include('404.php'); } + +function filename_func($a) { + $f = basename($a['filename'], '.'.$a['extension']); + $f = str_replace(array("\0", "\n", "<", ">", "/", "&"), array("?", "?", "«", "»", "⁄", "and"), $f); + return $f; +} diff --git a/templates/mod/settings.html b/templates/mod/settings.html index eb2673bf..931651dd 100644 --- a/templates/mod/settings.html +++ b/templates/mod/settings.html @@ -73,8 +73,9 @@ {% endfor %} - {% trans %}Disable OP image upload{% endtrans %} - + {% trans %}Disable OP image upload{% endtrans %} + + {% trans %}Keep original filename{% endtrans %} {% trans %}Max images per post{% endtrans %}