forked from GithubBackups/vichan
Merge branch 'master' of https://github.com/ctrlcctrlv/infinity
This commit is contained in:
commit
51510f09ce
14
expire.php
14
expire.php
@ -8,8 +8,8 @@ $protected = array('burgers', 'cow', 'wilno', 'cute', 'yoga');
|
|||||||
$q = query("SELECT uri FROM boards");
|
$q = query("SELECT uri FROM boards");
|
||||||
$boards = $q->fetchAll(PDO::FETCH_COLUMN);
|
$boards = $q->fetchAll(PDO::FETCH_COLUMN);
|
||||||
$now = new DateTime();
|
$now = new DateTime();
|
||||||
$ago = (new DateTime)->sub(new DateInterval('P7D'));
|
$ago = (new DateTime)->sub(new DateInterval('P14D'));
|
||||||
$mod_ago = (new DateTime)->sub(new DateInterval('P14D'));
|
$mod_ago = (new DateTime)->sub(new DateInterval('P7D'));
|
||||||
|
|
||||||
// Find out the last activity for our board
|
// Find out the last activity for our board
|
||||||
$delete = array();
|
$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'])) {
|
#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";
|
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']);
|
$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');
|
$f = fopen('rip.txt', 'a');
|
||||||
fwrite($f, "--\r\n".date('c')."\r\n");
|
fwrite($f, "--\r\n".date('c')."\r\n");
|
||||||
foreach($delete as $i => $d){
|
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";
|
$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;
|
echo $s;
|
||||||
fwrite($f, $s);
|
fwrite($f, $s);
|
||||||
|
|
||||||
openBoard($d['board']);
|
if (!openBoard($d['board'])) continue;;
|
||||||
|
|
||||||
$query = prepare('DELETE FROM ``boards`` WHERE `uri` = :uri');
|
$query = prepare('DELETE FROM ``boards`` WHERE `uri` = :uri');
|
||||||
$query->bindValue(':uri', $board['uri']);
|
$query->bindValue(':uri', $board['uri']);
|
||||||
@ -129,13 +128,14 @@ foreach($delete as $i => $d){
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete entire board directory
|
// Delete entire board directory
|
||||||
rrmdir($board['uri'] . '/');
|
exec('rm -rf ' . $board['uri'] . '/');
|
||||||
rrmdir('static/banners/' . $board['uri']);
|
rrmdir('static/banners/' . $board['uri']);
|
||||||
|
file_unlink("stylesheets/board/{$board['uri']}.css");
|
||||||
// HAAAAAX
|
// HAAAAAX
|
||||||
if($config['dir']['img_root'] != '')
|
if($config['dir']['img_root'] != '')
|
||||||
rrmdir($config['dir']['img_root'] . $board['uri']);
|
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']}");
|
_syslog(LOG_NOTICE, "Board deleted: {$board['uri']}");
|
||||||
if ($d['mod']) {
|
if ($d['mod']) {
|
||||||
|
@ -151,6 +151,8 @@
|
|||||||
$config['additional_javascript'][] = 'js/wPaint/plugins/shapes/wPaint.menu.main.shapes.min.js';
|
$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/plugins/file/wPaint.menu.main.file.min.js';
|
||||||
$config['additional_javascript'][] = 'js/wpaint.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';
|
//$config['font_awesome_css'] = '/netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css';
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ class Twig_Extensions_Extension_Tinyboard extends Twig_Extension
|
|||||||
new Twig_SimpleFilter('extension', 'twig_extension_filter'),
|
new Twig_SimpleFilter('extension', 'twig_extension_filter'),
|
||||||
new Twig_SimpleFilter('sprintf', 'sprintf'),
|
new Twig_SimpleFilter('sprintf', 'sprintf'),
|
||||||
new Twig_SimpleFilter('capcode', 'capcode'),
|
new Twig_SimpleFilter('capcode', 'capcode'),
|
||||||
|
new Twig_SimpleFilter('remove_modifiers', 'remove_modifiers'),
|
||||||
new Twig_SimpleFilter('hasPermission', 'twig_hasPermission_filter'),
|
new Twig_SimpleFilter('hasPermission', 'twig_hasPermission_filter'),
|
||||||
new Twig_SimpleFilter('date', 'twig_date_filter'),
|
new Twig_SimpleFilter('date', 'twig_date_filter'),
|
||||||
new Twig_SimpleFilter('remove_whitespace', 'twig_remove_whitespace_filter'),
|
new Twig_SimpleFilter('remove_whitespace', 'twig_remove_whitespace_filter'),
|
||||||
|
@ -58,7 +58,11 @@ $(document).ready(function(){
|
|||||||
var setting = $(this).parent().attr('id');
|
var setting = $(this).parent().attr('id');
|
||||||
|
|
||||||
if ($(this).is(':checked')) {
|
if ($(this).is(':checked')) {
|
||||||
Notification.requestPermission();
|
Notification.requestPermission(function(permission){
|
||||||
|
if (permission === "granted") {
|
||||||
|
localStorage[setting] = 'true';
|
||||||
|
}
|
||||||
|
});
|
||||||
if (Notification.permission === "granted") {
|
if (Notification.permission === "granted") {
|
||||||
localStorage[setting] = 'true';
|
localStorage[setting] = 'true';
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ function multi_image() {
|
|||||||
if (!(images_len >= max_images)) {
|
if (!(images_len >= max_images)) {
|
||||||
var new_file = '<br class="file_separator"/><input type="file" name="file'+(images_len+1)+'" id="upload_file'+(images_len+1)+'">';
|
var new_file = '<br class="file_separator"/><input type="file" name="file'+(images_len+1)+'" id="upload_file'+(images_len+1)+'">';
|
||||||
|
|
||||||
$('[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"]'));
|
if (typeof setup_form !== 'undefined') setup_form($('form[name="post"]'));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
94
js/options/fav.js
Normal file
94
js/options/fav.js
Normal file
@ -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<favorites.length+1; i++){
|
||||||
|
favStor.push($("#sortable > 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("<div>"+($("#plusBox").val())+"</div>");
|
||||||
|
$("#minusList").append("<div onclick=\"removeBoard("+favorites.length+")\" style=\"cursor: pointer; margin-left: 5px\">-</div>");
|
||||||
|
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();
|
||||||
|
$("<br id=\"space\"></br>").appendTo(Options.get_tab('fav-tab').content);
|
||||||
|
$("<input id=\"plusBox\" type=\"text\">").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
|
||||||
|
$("<div id=\"plus\" onclick=\"addBoard()\">+</div>").css({
|
||||||
|
cursor: "pointer",
|
||||||
|
color: "#0000FF"
|
||||||
|
}).appendTo(Options.get_tab('fav-tab').content); //Adding the plus to the tab
|
||||||
|
$("<input id=\"submitFavorites\" onclick=\"localStorage.favorites=generateList();document.location.reload();\" type=\"button\" value=\""+_("Refresh")+"\">").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 = ['<div id="sortable" style="cursor: pointer; float: left;display: inline-block">'];
|
||||||
|
for(var i=0; i<favorites.length; i++){
|
||||||
|
favList += '<div>'+favorites[i]+'</div>';
|
||||||
|
}
|
||||||
|
favList += '</div>';
|
||||||
|
|
||||||
|
//Creating list of minus symbols to remove unwanted boards
|
||||||
|
var minusList = ['<div id="minusList" style="color: #0000FF;display: inline-block">'];
|
||||||
|
for(var i=0; i<favorites.length; i++){
|
||||||
|
minusList += '<div onclick="removeBoard('+i+')" style="cursor: pointer; margin-left: 5px">-</div>';
|
||||||
|
}
|
||||||
|
minusList += "</div>";
|
||||||
|
|
||||||
|
//Help message so people understand how sorting boards works
|
||||||
|
$("<span>Drag the boards to sort them.</span><br></br>").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
|
||||||
|
$("<br id=\"space\"></br>").appendTo(Options.get_tab('fav-tab').content);
|
||||||
|
$("<input id=\"plusBox\" type=\"text\">").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
|
||||||
|
$("<div id=\"plus\" onclick=\"addBoard()\">+</div>").css({
|
||||||
|
cursor: "pointer",
|
||||||
|
color: "#0000FF"
|
||||||
|
}).appendTo(Options.get_tab('fav-tab').content); //Adding the plus button
|
||||||
|
$("<input id=\"submitFavorites\" onclick=\"localStorage.favorites=generateList();document.location.reload();\" type=\"button\" value=\""+_("Submit")+"\">").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
|
||||||
|
|
||||||
|
});
|
@ -194,3 +194,7 @@ div.report {
|
|||||||
#quick-reply table {
|
#quick-reply table {
|
||||||
background: none repeat scroll 0% 0% #333 !important;
|
background: none repeat scroll 0% 0% #333 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modlog tr:nth-child(even), .modlog th {
|
||||||
|
background-color: #282A2E;
|
||||||
|
}
|
||||||
|
@ -152,3 +152,7 @@ div#watchlist a:hover,a.watchThread:hover {
|
|||||||
max-height:160px;
|
max-height:160px;
|
||||||
max-width:160px
|
max-width:160px
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modlog tr:nth-child(even), .modlog th {
|
||||||
|
background-color: #282A2E;
|
||||||
|
}
|
||||||
|
@ -1,4 +1,11 @@
|
|||||||
{% raw %}
|
{% 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:
|
/* gettext-compatible _ function, example of usage:
|
||||||
*
|
*
|
||||||
* > // Loading pl_PL.json here (containing polish translation strings generated by tools/i18n_compile.php)
|
* > // Loading pl_PL.json here (containing polish translation strings generated by tools/i18n_compile.php)
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<atom:link href="https://8ch.net/{{ board.uri }}/index.rss" rel="self" type="application/rss+xml"/>
|
<atom:link href="https://8ch.net/{{ board.uri }}/index.rss" rel="self" type="application/rss+xml"/>
|
||||||
{% for post in recent_posts %}
|
{% for post in recent_posts %}
|
||||||
<item>
|
<item>
|
||||||
<title>{% if post.subject %}{{ post.subject|e }}{% else %}{{ post.body_nomarkup[:256]|e }}{% endif %}</title>
|
<title>{% if post.subject %}{{ post.subject|e }}{% else %}{{ post.body_nomarkup[:256]|remove_modifiers|e }}{% endif %}</title>
|
||||||
<link>https://8ch.net/{{ board.uri }}/res/{{ post.id }}.html</link>
|
<link>https://8ch.net/{{ board.uri }}/res/{{ post.id }}.html</link>
|
||||||
<guid>https://8ch.net/{{ board.uri }}/res/{{ post.id }}.html</guid>
|
<guid>https://8ch.net/{{ board.uri }}/res/{{ post.id }}.html</guid>
|
||||||
<comments>https://8ch.net/{{ board.uri }}/res/{{ post.id }}.html</comments>
|
<comments>https://8ch.net/{{ board.uri }}/res/{{ post.id }}.html</comments>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
{% include 'header.html' %}
|
{% 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 %}
|
||||||
|
|
||||||
<meta name="description" content="8chan /{{ board.uri }}/ - {{ board.title|e }} - {{ meta_subject }}" />
|
<meta name="description" content="8chan /{{ board.uri }}/ - {{ board.title|e }} - {{ meta_subject }}" />
|
||||||
<meta name="twitter:card" value="summary">
|
<meta name="twitter:card" value="summary">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user