diff --git a/inc/functions.php b/inc/functions.php index 3553f908..c176a481 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -953,6 +953,8 @@ function deletePost($id, $error_if_doesnt_exist=true, $rebuild_after=true) { // Delete posts and maybe replies while ($post = $query->fetch(PDO::FETCH_ASSOC)) { + event('delete', $post); + if (!$post['thread']) { // Delete thread HTML page file_unlink($board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], $post['id'])); @@ -1509,10 +1511,12 @@ function markup(&$body, $track_cites = false) { $modifiers = extract_modifiers($body); - $body = preg_replace('@(.+?)@us', '', $body); + $body = preg_replace('@(.+?)@us', '', $body); + $body = preg_replace('@<(tinyboard) escape ([\w\s]+)>@i', '<$1 $2>', $body); - if (isset($modifiers['raw html']) && $modifiers['raw html'] == '1') - return $body; + if (isset($modifiers['raw html']) && $modifiers['raw html'] == '1') { + return array(); + } $body = str_replace("\r", '', $body); $body = utf8tohtml($body); @@ -1658,7 +1662,7 @@ function markup(&$body, $track_cites = false) { } function escape_markup_modifiers($string) { - return preg_replace('@@m', '', $string); + return preg_replace('@<(tinyboard) ([\w\s]+)>@mi', '<$1 escape $2>', $string); } function utf8tohtml($utf8) { diff --git a/js/expand-all-images.js b/js/expand-all-images.js new file mode 100644 index 00000000..6cca09c8 --- /dev/null +++ b/js/expand-all-images.js @@ -0,0 +1,28 @@ +/* + * expand-all-images.js + * https://github.com/savetheinternet/Tinyboard/blob/master/js/expand-all-images.js + * + * Adds an "Expand all images" button to the top of the page. + * + * Released under the MIT license + * Copyright (c) 2012-2013 Michael Save + * + * Usage: + * $config['additional_javascript'][] = 'js/jquery.min.js'; + * $config['additional_javascript'][] = 'js/inline-expanding.js'; + * $config['additional_javascript'][] = 'js/expand-all-images.js'; + * + */ + +onready(function(){ + $('hr:first').before('
'); + $('div#expand-all-images a') + .text(_('Expand all images')) + .click(function() { + $('a img.post-image').each(function() { + if (!$(this).parent()[0].dataset.expanded) + $(this).parent().click(); + }); + $(this).parent().remove(); + }); +}); diff --git a/js/post-hover.js b/js/post-hover.js index 783740df..10542f20 100644 --- a/js/post-hover.js +++ b/js/post-hover.js @@ -110,6 +110,7 @@ onready(function(){ } $post = $('[data-board="' + board + '"] div.post#reply_' + id + ', [data-board="' + board + '"]div#thread_' + id); + if(hovering && $post.length > 0) { start_hover($link); } diff --git a/post.php b/post.php index d2749632..91ecbabe 100644 --- a/post.php +++ b/post.php @@ -432,8 +432,9 @@ if (isset($_POST['delete'])) { error('GeoIP not available: ' . geoip_db_filename(GEOIP_COUNTRY_EDITION)); } if ($country_code = @geoip_country_code_by_name($_SERVER['REMOTE_ADDR'])) { - $post['body'] .= "\n" . strtolower($country_code) . "" . - "\n" . @geoip_country_name_by_name($_SERVER['REMOTE_ADDR']) . ""; + if (!in_array(strtolower($country_code), array('eu', 'ap', 'o1', 'a1', 'a2'))) + $post['body'] .= "\n" . strtolower($country_code) . "" . + "\n" . @geoip_country_name_by_name($_SERVER['REMOTE_ADDR']) . ""; } }