diff --git a/expire.php b/expire.php index 6eae29b2..2b316af7 100644 --- a/expire.php +++ b/expire.php @@ -8,8 +8,8 @@ $protected = array('burgers', 'cow', 'wilno', 'cute', 'yoga'); $q = query("SELECT uri FROM boards"); $boards = $q->fetchAll(PDO::FETCH_COLUMN); $now = new DateTime(); -$ago = (new DateTime)->sub(new DateInterval('P7D')); -$mod_ago = (new DateTime)->sub(new DateInterval('P14D')); +$ago = (new DateTime)->sub(new DateInterval('P14D')); +$mod_ago = (new DateTime)->sub(new DateInterval('P7D')); // Find out the last activity for our board $delete = array(); @@ -53,7 +53,7 @@ foreach($boards as $board) { } } - if (($last_activity_date < $ago or ($last_mod_date and $last_mod_date < $mod_ago)) and (int)$count['count'] < 30 and isset($mods[0]['id'])) { + if (($last_activity_date < $ago or ($last_mod_date and $last_mod_date < $mod_ago)) and (int)$count['count'] < 5 and isset($mods[0]['id'])) { #if (($last_activity_date < $ago or ($last_mod_date and $last_mod_date < $mod_ago)) and isset($mods[0]['id'])) { echo $board, ' ', $last_activity_date->format('Y-m-d H:i:s'), ' ', ($last_mod_date ? $last_mod_date->format('Y-m-d H:i:s') : 'false'), ' ', $count['count'], ' ', $mod, "\r\n"; $delete[] = array('board' => $board, 'last_activity' => $last_activity_date, 'last_mod' => $last_mod_date, 'mod' => isset($mods[0]['username']) ? $mods[0]['username'] : false, 'count' => $count['count']); @@ -63,12 +63,11 @@ if ($argc > 1) { $f = fopen('rip.txt', 'a'); fwrite($f, "--\r\n".date('c')."\r\n"); foreach($delete as $i => $d){ - file_get_contents('http://8ch.net/listboards.php'); //I think this is bad $s = "RIP /".$d['board']."/, created by ".($d['mod']?$d['mod']:'?')." and last active on ".$d['last_activity']->format('Y-m-d H:i:s.').($d['last_mod'] ? ' Mod last active on ' . $d['last_mod']->format('Y-m-d H:i:s.') : ' Mod never active.') . " Number of posts: {$d['count']}." . "\r\n"; echo $s; fwrite($f, $s); - openBoard($d['board']); + if (!openBoard($d['board'])) continue;; $query = prepare('DELETE FROM ``boards`` WHERE `uri` = :uri'); $query->bindValue(':uri', $board['uri']); @@ -129,13 +128,14 @@ foreach($delete as $i => $d){ } // Delete entire board directory - rrmdir($board['uri'] . '/'); + exec('rm -rf ' . $board['uri'] . '/'); rrmdir('static/banners/' . $board['uri']); + file_unlink("stylesheets/board/{$board['uri']}.css"); // HAAAAAX if($config['dir']['img_root'] != '') rrmdir($config['dir']['img_root'] . $board['uri']); - cache::delete('board_' . $board['uri']); + if ($config['cache']['enabled']) cache::delete('board_' . $board['uri']); _syslog(LOG_NOTICE, "Board deleted: {$board['uri']}"); if ($d['mod']) { diff --git a/inc/instance-config.php b/inc/instance-config.php index f140ed2c..4d463751 100644 --- a/inc/instance-config.php +++ b/inc/instance-config.php @@ -151,6 +151,8 @@ $config['additional_javascript'][] = 'js/wPaint/plugins/shapes/wPaint.menu.main.shapes.min.js'; $config['additional_javascript'][] = 'js/wPaint/plugins/file/wPaint.menu.main.file.min.js'; $config['additional_javascript'][] = 'js/wpaint.js'; + // Code tags (fix because we no longer have different scripts for each board) + $config['additional_javascript'][] = 'js/code_tags/run_prettify.js'; //$config['font_awesome_css'] = '/netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css'; diff --git a/inc/lib/Twig/Extensions/Extension/Tinyboard.php b/inc/lib/Twig/Extensions/Extension/Tinyboard.php index b7b55de7..1c5b8981 100644 --- a/inc/lib/Twig/Extensions/Extension/Tinyboard.php +++ b/inc/lib/Twig/Extensions/Extension/Tinyboard.php @@ -17,6 +17,7 @@ class Twig_Extensions_Extension_Tinyboard extends Twig_Extension new Twig_SimpleFilter('extension', 'twig_extension_filter'), new Twig_SimpleFilter('sprintf', 'sprintf'), new Twig_SimpleFilter('capcode', 'capcode'), + new Twig_SimpleFilter('remove_modifiers', 'remove_modifiers'), new Twig_SimpleFilter('hasPermission', 'twig_hasPermission_filter'), new Twig_SimpleFilter('date', 'twig_date_filter'), new Twig_SimpleFilter('remove_whitespace', 'twig_remove_whitespace_filter'), diff --git a/js/auto-reload.js b/js/auto-reload.js index 32b58b86..a976a019 100644 --- a/js/auto-reload.js +++ b/js/auto-reload.js @@ -58,7 +58,11 @@ $(document).ready(function(){ var setting = $(this).parent().attr('id'); if ($(this).is(':checked')) { - Notification.requestPermission(); + Notification.requestPermission(function(permission){ + if (permission === "granted") { + localStorage[setting] = 'true'; + } + }); if (Notification.permission === "granted") { localStorage[setting] = 'true'; } diff --git a/js/multi-image.js b/js/multi-image.js index de9b151e..7a7ac9ee 100644 --- a/js/multi-image.js +++ b/js/multi-image.js @@ -20,7 +20,7 @@ function multi_image() { if (!(images_len >= max_images)) { var new_file = '
'; - $('[type=file]:last').after(new_file); + $('div#quick-reply [type=file]:last, div#post-form-outer [type=file]:last').after(new_file); if (typeof setup_form !== 'undefined') setup_form($('form[name="post"]')); } }) diff --git a/js/options/fav.js b/js/options/fav.js new file mode 100644 index 00000000..f8d12bf3 --- /dev/null +++ b/js/options/fav.js @@ -0,0 +1,94 @@ +//Setting global variables +var favorites = JSON.parse(localStorage.favorites); +Options.add_tab('fav-tab','star',_("Favorites")); + +//Creating functions +var generateList = function(){ + var favStor = []; + for(var i=1; i div:nth-child("+i+")").html()); + } + return JSON.stringify(favStor); +} //This will generate a list of boards based off of the list on the screen +function removeBoard(boardNumber){ + favorites.splice(boardNumber, 1); + localStorage.favorites = JSON.stringify(favorites); + $("#sortable > div:nth-child("+(boardNumber+1)+")").remove(); + $("#minusList > div:nth-child("+(favorites.length+1)+")").remove(); +} //This removes a board from favorites, localStorage.favorites and the page +function addBoard(){ + $("#sortable").append("
"+($("#plusBox").val())+"
"); + $("#minusList").append("
-
"); + favorites.push($("#plusBox").val()); + localStorage.favorites = JSON.stringify(favorites); + $("#space").remove(); + $("#plusBox").remove(); //Refreshing the last 3 elements to move the box down + $("#plus").remove(); + $("#submitFavorites").remove(); + $("

").appendTo(Options.get_tab('fav-tab').content); + $("").appendTo(Options.get_tab('fav-tab').content); + $("#plusBox").keydown(function( event ) { + if(event.keyCode == 13){ + $("#plus").click(); + } + }); //Adding enter to submit + document.getElementById("plusBox").value = ""; //Removing text from textbox + $("#plusBox").focus(); //Moving cursor into text box again after refresh + $("
+
").css({ + cursor: "pointer", + color: "#0000FF" + }).appendTo(Options.get_tab('fav-tab').content); //Adding the plus to the tab + $("").css({ + height: 25, bottom: 5, + width: "calc(100% - 10px)", + left: 5, right: 5 + }).appendTo(Options.get_tab('fav-tab').content); //Adding button to the tab +} //This adds the text inside the textbox to favorites, localStorage.favorites and the page + +//Making as many functions and variables non-global +$(document).ready(function(){ + +//Pregenerating list of boards +var favList = ['
']; +for(var i=0; i'; +} +favList += '
'; + +//Creating list of minus symbols to remove unwanted boards +var minusList = ['
']; +for(var i=0; i-
'; +} +minusList += ""; + +//Help message so people understand how sorting boards works +$("Drag the boards to sort them.

").appendTo(Options.get_tab('fav-tab').content); + +//Adding list of boards and minus symbols to remove boards with +$(favList).appendTo(Options.get_tab('fav-tab').content); //Adding the list of favorite boards to the tab +$(minusList).appendTo(Options.get_tab('fav-tab').content); //Adding the list of minus symbols to the tab + +//Adding spacing and text box to right boards into +$("

").appendTo(Options.get_tab('fav-tab').content); +$("").appendTo(Options.get_tab('fav-tab').content); +$("#plusBox").keydown(function( event ) { + if(event.keyCode == 13){ + $("#plus").click(); + } +}); + +//Adding plus symbol to use to add board +$("
+
").css({ + cursor: "pointer", + color: "#0000FF" +}).appendTo(Options.get_tab('fav-tab').content); //Adding the plus button +$("").css({ + height: 25, bottom: 5, + width: "calc(100% - 10px)", + left: 5, right: 5 +}).appendTo(Options.get_tab('fav-tab').content); //Adding submit button to the tab + +$("#sortable").sortable(); //Making boards with sortable id use the sortable jquery function + +}); diff --git a/stylesheets/dark.css b/stylesheets/dark.css index beb12364..0287959e 100644 --- a/stylesheets/dark.css +++ b/stylesheets/dark.css @@ -194,3 +194,7 @@ div.report { #quick-reply table { background: none repeat scroll 0% 0% #333 !important; } + +.modlog tr:nth-child(even), .modlog th { + background-color: #282A2E; +} diff --git a/stylesheets/tomorrow.css b/stylesheets/tomorrow.css index 29b2a68d..04860284 100644 --- a/stylesheets/tomorrow.css +++ b/stylesheets/tomorrow.css @@ -152,3 +152,7 @@ div#watchlist a:hover,a.watchThread:hover { max-height:160px; max-width:160px } + +.modlog tr:nth-child(even), .modlog th { + background-color: #282A2E; +} diff --git a/templates/main.js b/templates/main.js index 5d0c6370..3408bf7e 100644 --- a/templates/main.js +++ b/templates/main.js @@ -1,4 +1,11 @@ {% raw %} +/* + * main.js - This file is compiled and contains code from the following scripts, concatenated together in order: + * {% endraw %}{{ config.additional_javascript|join(', ') }}{% raw %} + * Please see those files for licensing and authorship information. + * Compiled on {% endraw %}{{ time()|date("%c") }}{% raw %} + */ + /* gettext-compatible _ function, example of usage: * * > // Loading pl_PL.json here (containing polish translation strings generated by tools/i18n_compile.php) diff --git a/templates/themes/catalog/index.rss b/templates/themes/catalog/index.rss index c187e45a..248b494a 100644 --- a/templates/themes/catalog/index.rss +++ b/templates/themes/catalog/index.rss @@ -7,7 +7,7 @@ {% for post in recent_posts %} - {% if post.subject %}{{ post.subject|e }}{% else %}{{ post.body_nomarkup[:256]|e }}{% endif %} + {% if post.subject %}{{ post.subject|e }}{% else %}{{ post.body_nomarkup[:256]|remove_modifiers|e }}{% endif %} https://8ch.net/{{ board.uri }}/res/{{ post.id }}.html https://8ch.net/{{ board.uri }}/res/{{ post.id }}.html https://8ch.net/{{ board.uri }}/res/{{ post.id }}.html diff --git a/templates/thread.html b/templates/thread.html index b3a90846..dc5296ab 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -9,7 +9,7 @@ {% include 'header.html' %} - {% set meta_subject %}{% if config.thread_subject_in_title and thread.subject %}{{ thread.subject|e }}{% else %}{{ thread.body_nomarkup[:256]|e }}{% endif %}{% endset %} + {% set meta_subject %}{% if config.thread_subject_in_title and thread.subject %}{{ thread.subject|e }}{% else %}{{ thread.body_nomarkup[:256]|remove_modifiers|e }}{% endif %}{% endset %}