diff --git a/inc/api.php b/inc/api.php index c9608f06..db723962 100644 --- a/inc/api.php +++ b/inc/api.php @@ -109,7 +109,7 @@ class Api { if (isset($post->files) && $post->files && !$threadsPage) { $file = $post->files[0]; $this->translateFields($this->fileFields, $file, $apiPost); - $apiPost['filename'] = substr($file->name, 0, strrpos($file->name, '.')); + $apiPost['filename'] = @substr($file->name, 0, strrpos($file->name, '.')); $dotPos = strrpos($file->file, '.'); $apiPost['ext'] = substr($file->file, $dotPos); $apiPost['tim'] = substr($file->file, 0, $dotPos); diff --git a/inc/config.php b/inc/config.php index d359c234..ddf23279 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1223,21 +1223,21 @@ $config['capcode'] = ' ## %s'; // "## Custom" becomes lightgreen, italic and bold: - $config['custom_capcode']['Custom'] =' ## %s'; + //$config['custom_capcode']['Custom'] =' ## %s'; // "## Mod" makes everything purple, including the name and tripcode: - $config['custom_capcode']['Mod'] = array( - ' ## %s', - 'color:purple', // Change name style; optional - 'color:purple' // Change tripcode style; optional - ); + //$config['custom_capcode']['Mod'] = array( + // ' ## %s', + // 'color:purple', // Change name style; optional + // 'color:purple' // Change tripcode style; optional + //); // "## Admin" makes everything red and bold, including the name and tripcode: - $config['custom_capcode']['Admin'] = array( - ' ## %s', - 'color:red;font-weight:bold', // Change name style; optional - 'color:red;font-weight:bold' // Change tripcode style; optional - ); + //$config['custom_capcode']['Admin'] = array( + // ' ## %s', + // 'color:red;font-weight:bold', // Change name style; optional + // 'color:red;font-weight:bold' // Change tripcode style; optional + //); // Enable the moving of single replies $config['move_replies'] = false; diff --git a/inc/functions.php b/inc/functions.php index 48a399ec..3504cc38 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -831,7 +831,7 @@ function checkBan($board = false) { return; } - Bans::purge(); + //Bans::purge(); if ($config['cache']['enabled']) cache::set('purged_bans_last', time()); @@ -1546,7 +1546,7 @@ function buildJavascript() { } if ($config['additional_javascript_compile']) { - foreach ($config['additional_javascript'] as $file) { + foreach (array_unique($config['additional_javascript']) as $file) { $script .= file_get_contents($file); } } diff --git a/inc/instance-config.php b/inc/instance-config.php index 4c8c707e..079629f1 100644 --- a/inc/instance-config.php +++ b/inc/instance-config.php @@ -18,7 +18,7 @@ $config['db']['user'] = 'root'; $config['db']['password'] = ''; $config['timezone'] = 'UTC'; - $config['cache']['enabled'] = false; + $config['cache']['enabled'] = 'apc'; $config['cookies']['mod'] = 'mod'; @@ -82,10 +82,15 @@ $config['mod']['manageusers'] = SUPERMOD; $config['mod']['noticeboard_post'] = SUPERMOD; $config['mod']['search'] = SUPERMOD; + $config['mod']['clean_global'] = SUPERMOD; $config['mod']['debug_recent'] = ADMIN; $config['mod']['debug_antispam'] = ADMIN; $config['mod']['modlog'] = SUPERMOD; $config['mod']['editpost'] = MOD; + $config['mod']['edit_banners'] = MOD; + $config['mod']['edit_flags'] = MOD; + $config['mod']['edit_settings'] = MOD; + $config['mod']['clean'] = MOD; $config['mod']['recent_reports'] = 65535; $config['mod']['ip_less_recentposts'] = 75; $config['ban_show_post'] = true; @@ -93,10 +98,14 @@ // Board shit $config['max_links'] = 40; $config['poster_id_length'] = 6; - $config['ayah_enabled'] = true; + $config['ayah_enabled'] = false; + $config['cbRecaptcha'] = true; $config['url_banner'] = '/banners.php'; + $config['additional_javascript_compile'] = true; //$config['default_stylesheet'] = array('Notsuba', 'notsuba.css'); $config['additional_javascript'][] = 'js/jquery.min.js'; + $config['additional_javascript'][] = 'js/jquery.mixitup.min.js'; + $config['additional_javascript'][] = 'js/catalog.js'; $config['additional_javascript'][] = 'js/jquery.tablesorter.min.js'; $config['additional_javascript'][] = 'js/options.js'; $config['additional_javascript'][] = 'js/style-select.js'; @@ -136,6 +145,8 @@ $config['additional_javascript'][] = 'js/infinite-scroll.js'; $config['additional_javascript'][] = 'js/download-original.js'; $config['additional_javascript'][] = 'js/thread-watcher.js'; + $config['additional_javascript'][] = 'js/ajax.js'; + $config['additional_javascript'][] = 'js/show-own-posts.js'; //$config['font_awesome_css'] = '/netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css'; @@ -176,11 +187,72 @@ } } + $config['mod']['custom_pages']['/flags/(\%b)'] = function($b) { + global $config, $mod, $board; + require_once 'inc/image.php'; + + if (!hasPermission($config['mod']['edit_flags'], $b)) + error($config['mod']['noaccess']); + + if (!openBoard($b)) + error("Could not open board!"); + + $dir = 'static/custom-flags/'.$b; + + if (!is_dir($dir)){ + mkdir($dir, 0777, true); + } + + if (isset($_FILES['file'])){ + $upload = $_FILES['file']['tmp_name']; + $banners = array_diff(scandir($dir), array('..', '.')); + + if (!is_readable($upload)) + error($config['error']['nomove']); + + $id = time() . substr(microtime(), 2, 3); + $extension = strtolower(mb_substr($_FILES['file']['name'], mb_strrpos($_FILES['file']['name'], '.') + 1)); + + if ($extension != 'png') { + error(_('Flags must be in PNG format.')); + } + + if (filesize($upload) > 48000){ + error(_('File too large!')); + } + + if (!$size = @getimagesize($upload)) { + error($config['error']['invalidimg']); + } + + if ($size[0] != 16 or $size[1] != 11){ + error(_('Image wrong size!')); + } + if (sizeof($banners) >= 100) { + error(_('Too many flags.')); + } + + copy($upload, "$dir/$id.$extension"); + } + + if (isset($_POST['delete'])){ + foreach ($_POST['delete'] as $i => $d){ + if (!preg_match('/[0-9+]\.(png|jpeg|jpg|gif)/', $d)){ + error('Nice try.'); + } + unlink("$dir/$d"); + } + } + + $banners = array_diff(scandir($dir), array('..', '.')); + mod_page(_('Edit banners'), 'mod/banners.html', array('board'=>$board,'banners'=>$banners,'token'=>make_secure_link_token('banners/'.$board['uri']))); + }; + $config['mod']['custom_pages']['/banners/(\%b)'] = function($b) { global $config, $mod, $board; require_once 'inc/image.php'; - if (!in_array($b, $mod['boards']) and $mod['boards'][0] != '*') + if (!hasPermission($config['mod']['edit_banners'], $b)) error($config['error']['noaccess']); if (!openBoard($b)) @@ -263,12 +335,12 @@ $auto_unicode = isset($_POST['auto_unicode']) ? 'true' : 'false'; $allow_roll = isset($_POST['allow_roll']) ? 'true' : 'false'; $image_reject_repost = isset($_POST['image_reject_repost']) ? 'true' : 'false'; + $allow_delete = isset($_POST['allow_delete']) ? 'true' : 'false'; $allow_flash = isset($_POST['allow_flash']) ? '$config[\'allowed_ext_files\'][] = \'swf\';' : ''; $code_tags = isset($_POST['code_tags']) ? '$config[\'additional_javascript\'][] = \'js/code_tags/run_prettify.js\';$config[\'markup\'][] = array("/\[code\](.+?)\[\/code\]/ms", "
\$1
");' : ''; $katex = isset($_POST['katex']) ? '$config[\'katex\'] = true;$config[\'additional_javascript\'][] = \'js/katex/katex.min.js\'; $config[\'markup\'][] = array("/\[tex\](.+?)\[\/tex\]/ms", "\$1"); $config[\'additional_javascript\'][] = \'js/katex-enable.js\';' : ''; $oekaki_js = <<bindValue(':board', $mod['boards'][0]); } else { $query = prepare('SELECT (SELECT COUNT(id) FROM reports WHERE global = 0) AS total_reports, (SELECT COUNT(id) FROM reports WHERE global = 1) AS global_reports'); @@ -1032,7 +1032,7 @@ function mod_bans_json() { error($config['error']['noaccess']); // Compress the json for faster loads - if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); + if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); Bans::stream_json(false, !hasPermission($config['mod']['show_ip']), !hasPermission($config['mod']['view_banstaff']), $mod['boards']); } @@ -2298,7 +2298,7 @@ function mod_reports() { error($config['error']['noaccess']); } - if( $mod['type'] == '20' and $global ) { + if( $mod['type'] == MOD and $global) { error($config['error']['noaccess']); } @@ -2306,10 +2306,10 @@ function mod_reports() { $report_scope = $global ? "global" : "local"; // Get REPORTS. - $query = prepare("SELECT * FROM ``reports`` " . ($mod["type"] == "20" ? "WHERE board = :board" : "") . " WHERE ``".($global ? "global" : "local")."`` = TRUE LIMIT :limit"); + $query = prepare("SELECT * FROM ``reports`` WHERE " . ($mod["type"] == MOD ? "board = :board AND" : "") . " ``".($global ? "global" : "local")."`` = TRUE LIMIT :limit"); // Limit reports by board if the moderator is local. - if( $mod['type'] == '20' ) { + if( $mod['type'] == MOD ) { $query->bindValue(':board', $mod['boards'][0]); } @@ -2527,7 +2527,7 @@ function mod_report_dismiss() { $global = in_array( "global", $arguments ); $content = in_array( "content", $arguments ); - if( $mod['type'] == '20' and $global ) { + if( $mod['type'] == MOD and $global ) { error($config['error']['noaccess']); } @@ -2649,7 +2649,7 @@ function mod_report_dismiss() { function mod_report_demote() { global $config, $mod; - if( $mod['type'] == '20' ) { + if( $mod['type'] == MOD ) { error($config['error']['noaccess']); } diff --git a/stylesheets/style.css b/stylesheets/style.css index 062b2731..717db79b 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -301,6 +301,10 @@ div.post_modified div.content-status:first-child { margin-top: 1.3em; } +div.post_modified div.content-status:first-child { + margin-top: 1.3em; +} + span.trip { color: #228854; } diff --git a/templates/8chan/index.html b/templates/8chan/index.html index 3e97809d..dc120787 100644 --- a/templates/8chan/index.html +++ b/templates/8chan/index.html @@ -236,7 +236,7 @@ {% trans %}Welcome to ∞chan, the infinitely expanding imageboard.{% endtrans %}
{% trans %}Featured boards:{% endtrans %} - +
{% trans %}Boards of the week:{% endtrans %} [  diff --git a/templates/mod/settings.html b/templates/mod/settings.html index 3305555e..d9a94594 100644 --- a/templates/mod/settings.html +++ b/templates/mod/settings.html @@ -41,6 +41,7 @@ {% trans %}Allow SWF uploading{% endtrans %} {% trans %}Enable dice rolling{% endtrans %} {% trans %}Don't allow users to repost images{% endtrans %} + {% trans %}Allow a poster to delete his own posts{% endtrans %} {% trans %}Language{% endtrans %}
{% trans %}To contribute translations, register at Transifex{% endtrans %}