Browse Source

Merge remote-tracking branch 'upstream/config' into news

pull/40/head
nonmakina 3 years ago
parent
commit
857597db94
  1. 6
      .gitignore
  2. 4
      inc/api.php
  3. 4
      inc/functions.php
  4. 13
      inc/instance-config.php
  5. 1182
      inc/mod/pages.php
  6. 150
      stylesheets/anons_dark_red.css
  7. 175
      stylesheets/bunker_like.css
  8. 200
      stylesheets/demain_dark.css
  9. 207
      stylesheets/demain_light.css
  10. 103
      stylesheets/temp_dark.css
  11. 101
      stylesheets/temp_dark_red.css
  12. 115
      stylesheets/tomorrow.css
  13. 4
      templates/themes/catalog/catalog.html
  14. 39
      templates/themes/catalog/theme.php
  15. 32
      tests/ProtectIPTest.php

6
.gitignore

@ -61,9 +61,9 @@ tf/
[._]s[a-w][a-z]
# special boards
all/
mod/
random/
/all/
/mod/
/random/
# Banners
banners/*

4
inc/api.php

@ -35,11 +35,13 @@ class Api {
'cycle' => 'cyclical',
'bump' => 'last_modified',
'embed' => 'embed',
'board' => 'board',
);
$this->threadsPageFields = array(
'id' => 'no',
'bump' => 'last_modified'
'bump' => 'last_modified',
'board' => 'board',
);
$this->fileFields = array(

4
inc/functions.php

@ -1322,7 +1322,7 @@ function index($page, $mod=false, $brief = false) {
$body = '';
$offset = round($page*$config['threads_per_page']-$config['threads_per_page']);
$query = prepare(sprintf("SELECT * FROM ``posts_%s`` WHERE `thread` IS NULL ORDER BY `sticky` DESC, `bump` DESC LIMIT :offset,:threads_per_page", $board['uri']));
$query = prepare(sprintf("SELECT *,'%s' as board FROM ``posts_%s`` WHERE `thread` IS NULL ORDER BY `sticky` DESC, `bump` DESC LIMIT :offset,:threads_per_page", $board['uri'], $board['uri']));
$query->bindValue(':offset', $offset, PDO::PARAM_INT);
$query->bindValue(':threads_per_page', $config['threads_per_page'], PDO::PARAM_INT);
$query->execute() or error(db_error($query));
@ -2292,7 +2292,7 @@ function buildThread($id, $return = false, $mod = false) {
$action = generation_strategy('sb_thread', array($board['uri'], $id));
if ($action == 'rebuild' || $return || $mod) {
$query = prepare(sprintf("SELECT * FROM ``posts_%s`` WHERE (`thread` IS NULL AND `id` = :id) OR `thread` = :id ORDER BY `thread`,`id`", $board['uri']));
$query = prepare(sprintf("SELECT *,'%s' as board FROM ``posts_%s`` WHERE (`thread` IS NULL AND `id` = :id) OR `thread` = :id ORDER BY `thread`,`id`", $board['uri'],$board['uri']));
$query->bindValue(':id', $id, PDO::PARAM_INT);
$query->execute() or error(db_error($query));

13
inc/instance-config.php

@ -81,9 +81,9 @@ $config['db']['password'] = '';
$config['cookies']['mod'] = 'mod';
$config['cookies']['salt'] = 'MGYwNjhlNjU5Y2QxNWU3YjQ3MzQ1Yj';
$config['flood_time'] = 0;
$config['flood_time_ip'] = 0;
$config['flood_time_same'] = 0;
$config['flood_time'] = 30;
$config['flood_time_ip'] = 60;
$config['flood_time_same'] = 60;
$config['max_body'] = 100000;
$config['reply_limit'] = 250;
$config['max_links'] = 40;
@ -284,6 +284,13 @@ $config['stylesheets']['Notsuba'] = 'notsuba.css';
$config['stylesheets']['Photon'] = 'photon.css';
$config['stylesheets']['Szalet'] = 'szalet.css';
$config['stylesheets']['Tsuki'] = 'tsuki.css';
$config['stylesheets']['DemainLight'] = 'demain_light.css';
$config['stylesheets']['DemainDark'] = 'demain_dark.css';
$config['stylesheets']['TempDark'] = 'temp_dark.css';
$config['stylesheets']['TempDarkRed'] = 'temp_dark_red.css';
$config['stylesheets']['Tomorrow'] = 'tomorrow.css';
$config['stylesheets']['AnonsDarkRed'] = 'anons_dark_red.css';
$config['stylesheets']['BunkerLike'] = 'bunker_like.css';
$config['default_stylesheet'] = array('Dark Red', $config['stylesheets']['Dark Red']);
/*

1182
inc/mod/pages.php

File diff suppressed because it is too large

150
stylesheets/anons_dark_red.css

@ -0,0 +1,150 @@
/* General */
body {
background: #1d1f21 url('img/fade-yotsuba.png') repeat-x 50% 0%;
color: #ACACAC;
}
/* Link colors */
a:link, a:visited, .intro a.email span.name {
color: #81a2be;
}
a:hover, .intro a.post_no:hover {
color: #cc6666;
}
/* Board title and subtitle */
header div.subtitle, h1 {
color: indianred;
}
/* Post number*/
a.post_no {
color: #c5c8c6;
}
/* Replies */
/* Background color and border */
div.post.reply {
background: #282A2E;
border-color: #373b41;
border-style: solid;
border-width: 0.8px;
border-radius: 5px;
}
div.post.reply.highlighted {
background: #282A2E;
border-color: #5f89ac;
border-style: solid;
border-width: 0.8px;
border-radius: 5px;
}
div.post.reply div.body a {
color: #5f89ac;
}
.intro span.subject {
color: #b294bb;
}
/* Greentext */
span.quote {
color: #b5bd68
}
/* Catalog grids */
/* Background color and green border */
.thread.grid-li.grid-size-vsmall, .thread.grid-li.grid-size-vsmall:hover,
.thread.grid-li.grid-size-small, .thread.grid-li.grid-size-small:hover,
.thread.grid-li.grid-size-large, .thread.grid-li.grid-size-large:hover {
background-color: #282A2E;
border: 1px solid #373b41;
}
/* Posting form */
/* Field names */
form table tr th {
background: #282A2E;
color: #ACACAC;
border: 1px solid #373b41;
}
/* Input fields */
textarea, input:not([type="file"]):not([type="checkbox"]), [type="submit"] {
color: #ACACAC;
background: #282A2E;
border: 1px double #1d1f21;
border-radius: 5px;
}
/* Input fields, focused */
textarea:focus, input:not([type="file"]):not([type="checkbox"]):focus, [type="submit"]:hover {
border: 1px solid #1d1f21;
-moz-box-shadow: 0 0 10px #1d1f21;
-webkit-box-shadow: 0 0 10px #1d1f21;
box-shadow: 0 0 10px #1d1f21;
}
/* Top bar */
/* Background, border and fade */
.bar {
background-color: #151515;
border-color: #81a2be!important;;
/* comment these out to remove the fade */
/*
-moz-box-shadow: 0 0 40px #FFB300;
-webkit-box-shadow: 0 0 40px #FFB300;
box-shadow: 0 0 40px #FFB300;
*/
}
/* Bottom bar, not visible in catalog mode */
div.pages {
background: #151515;
border-color: #81a2be;
}
div.pages a.selected {
color: #cc6666;
}
hr {
border-color: #373b41;
}
div.boardlist {
color: #81a2be;
font-size: 14px;
}
div.boardlist a {
color: #cc6666;
}
table.modlog tr th {
background: #1d1f21;
}
/* options.js */
#options_div, #alert_div {
background: #151515;
}
.desktop-style div.boardlist:nth-child(1) {
background-color: #151515;
}
/* Red text */
span.heading {
color: indianred;
}
/* Buggy shit */
div.post.reply div.body a {
color: #5f89ac;
text-decoration: none;
}
/* OP */
/* Subject */
.intro span.subject {
color: #b294bb;
}
/* name */
.intro span.name {
color: #5f89ac;
}
/* tripcode */
.intro span.trip {
color: #8abeb7;
}
/* Quick reply */
/* Quick reply banner */
div.banner {background-color:#9988ee;}
#quick-reply th, #quick-reply td {background-color:#1F1F1F;}
#quick-reply table {border-color:#373b41}
/* Buggy shit */
div.post.reply div.body a {
color: #5f89ac;
text-decoration: none;
}
/* b5bd68*/

175
stylesheets/bunker_like.css

@ -0,0 +1,175 @@
body {
background: #1D1F21;
color: #ACACAC;
font-family: Courier, monospace;
font-size: 13px;
}
/* LINKS */
a, a:link, a:visited, .intro a.email span.name {
color: #FFB300;
text-decoration: none;
}
a:link:hover, a:visited:hover {
color: #FFB300;
text-shadow: 0px 0px 5px #117743;
}
div.pages a.selected {
color: #FFB300;
}
/* INTRO */
h1, div.title, header div.subtitle {
color: #663E11;
font-family: Courier, monospace;
}
h1 {
font-size: 24pt;
font-weight: normal;
letter-spacing: 0px;
}
header div.subtitle {
font-size: 12pt;
}
/* FORMS AND BUTTONS */
div.banner {
background-color: inherit;
color: #ACACAC;
}
form table {
border: 1px dashed #117743;
padding-right: 1px;
}
form table tr th {
background: #282A2E;
border: 1px solid #117743;
border-radius: 5px;
}
input[type="text"], input[type="password"], textarea, select {
border: 1px double #07371F;
border-radius: 5px;
background: #282A2E;
color: #ACACAC;
font-family: Courier, monospace;
}
input[type="text"]:focus, input[type="password"]:focus, textarea:focus {
box-shadow: 0px 0px 5px 2px #117743;
}
input[type="submit"] {
border: 3px double #07371F;
border-radius: 5px;
background: #16171A;
color: #ACACAC;
font-family: Courier, monospace;
font-weight: bold;
}
.dropzone {
background: #16171A;
border: 3px double #07371F;
color: #ACACAC;
}
.dropzone .file-hint {
color: #ACACAC;
font-weight: bold;
}
#quick-reply table {
background: #1D1F21 !important;
}
fieldset {
border: 1px dashed #117743;
}
/* POST IDENTIFIERS */
.intro span.subject {
color: #34ED3A;
}
.intro span.name {
color: #117743;
}
.intro span.trip {
color: #117743;
}
.intro a.capcode, p.intro a.nametag {
color: #FF0000;
font-weight: bold;
}
.intro a.email, p.intro a.email span.name, p.intro a.email:hover, p.intro a.email:hover span.name {
color: #34ED97;
}
.intro time {
font-weight: bold;
}
.intro a.post_no {
color: #ACACAC;
font-weight: bold;
}
/* POST BOXES */
div.post.reply {
background: #282A2E;
border: 1px solid #117743;
border-radius: 5px;
}
div.post.reply.highlighted {
background: rgba(59, 22, 43, 0.4);
border: 1px solid #117743;
border-radius: 5px;
}
/* POST CONTENT */
div.post.reply div.body a {
color: #FFB300;
}
.quote {
color: #789922;
}
/* BARS */
.bar {
background-color: #151515;
}
.bar.top {
border-bottom: 1px solid #B0790A;
}
.bar.bottom {
border-top: 1px solid #B0790A;
}
div.boardlist {
color: #ACACAC;
}
hr {
border: none;
border-top: 1pt solid #117743;
}
/* CATALOG */
.theme-catalog h1 {
color: #ACACAC;
font-size: 18pt;
font-weight: bold;
}
.theme-catalog h1 a {
font-weight: normal;
}
.theme-catalog div.thread, .theme-catalog div.thread:hover {
background: #282A2E;
border: 1px solid #117743;
border-radius: 5px;
font-size: 10pt;
}
/* OPTIONS */
#options_div, #alert_div {
background: #1D1F21;
border: 1px dashed #117743;
}
#options_tablist {
border-right: 1px dashed #117743;
}
.options_tab_icon {
color: #ACACAC;
}
.options_tab_icon.active {
color: #FFB300;
}

200
stylesheets/demain_dark.css

@ -0,0 +1,200 @@
/* Demain_light theme for leftypol.org adapted from Seaweed theme for 4chan*/
/* Work in progress*/
/* General */
/* Main page */
legend {
background: indianred
}
div.module, div.ban {
background: #1d1f21;;
border: 1px solid #373b41;
max-width: 700px;
margin: 30px auto;
}
/* Text */
body {
background: #1d1f21;
color: #ACACAC;
font-size: 14pt;
font-family: "LiberationSansRegular";
}
/* Link colors */
a:link, a:visited, .intro a.email span.name {
color: #81a2be;
}
a:hover,
.intro a.post_no:hover {
color: #cc6666;
}
/* Board title and subtitle */
header div.subtitle,
h1 {
color: indianred;
font-size: 20pt;
font-family: "LiberationSansRegular";
}
header div.subtitle {
font-size: 10pt;
}
/* Post number*/
a.post_no {
color: #c5c8c6;
}
/* Replies */
/* Background color and border */
div.post.reply {
background: #282A2E;
border-color: #373b41;
border-style: solid;
border-width: 0.8px;
border-radius: 5px;
}
div.post.reply.highlighted {
background: #1b1c21;
border-color: #5f89ac;
border-style: solid;
border-width: 0.8px;
border-radius: 5px;
}
div.post.reply div.body a {
color: #5f89ac;
}
.intro span.subject {
color: #b294bb;
}
/* Greentext */
span.quote {
color: #b5bd68
}
/* Orangetext */
span.orangeQuote {
color: #b294bb
}
/* Catalog grids */
/* Background color and green border */
.thread.grid-li.grid-size-vsmall,
.thread.grid-li.grid-size-small,
.thread.grid-li.grid-size-large {
background-color: #282A2E;
border: 1px solid #373b41;
}
.thread.grid-li.grid-size-vsmall:hover,
.thread.grid-li.grid-size-small:hover,
.thread.grid-li.grid-size-large:hover {
background: #1b1c21;
border-color: #5f89ac;
border-style: solid;
border-width: 0.8px;
border-radius: 5px;
}
/* Posting form */
/* Field names */
form table tr th {
background: #282A2E;
color: #ACACAC;
border: 1px solid #373b41;
}
/* Input fields */
textarea, input:not([type="file"]):not([type="checkbox"]), [type="submit"] {
color: #ACACAC;
background: #282A2E;
border: 1px double #1d1f21;
border-radius: 5px;
}
/* Input fields, focused */
textarea:focus, input:not([type="file"]):not([type="checkbox"]):focus, [type="submit"]:hover {
border: 1px solid #1d1f21;
-moz-box-shadow: 0 0 10px #1d1f21;
-webkit-box-shadow: 0 0 10px #1d1f21;
box-shadow: 0 0 10px #1d1f21;
}
/* Top bar */
/* Background, border and fade */
.bar {
background-color: #151515;
border-color: #81a2be!important;;
/* comment these out to remove the fade */
/*
-moz-box-shadow: 0 0 40px #FFB300;
-webkit-box-shadow: 0 0 40px #FFB300;
box-shadow: 0 0 40px #FFB300;
*/
}
/* Bottom bar, not visible in catalog mode */
div.pages {
background: #151515;
border-color: #81a2be;
}
div.pages a.selected {
color: #cc6666;
}
hr {
border-color: #373b41;
}
div.boardlist {
color: #81a2be;
font-size: 14pt;
}
div.boardlist a {
color: #cc6666;
}
table.modlog tr th {
background: #1d1f21;
}
/* options.js */
#options_div, #alert_div {
background: #151515;
}
.options_tab_icon {
color: gray;
}
.desktop-style div.boardlist:nth-child(1) {
background-color: #151515;
}
/* Red text */
span.heading {
color: indianred;
}
/* Buggy shit */
div.post.reply div.body a {
color: #5f89ac;
text-decoration: none;
}
/* OP */
/* Subject */
.intro span.subject {
color: #b294bb;
}
/* name */
.intro span.name {
color: #5f89ac;
}
.desktop-style div.boardlist:nth-child(1) {
background-color: #151515;
}
/* Red text */
span.heading {
color: indianred;
}
/* Upper part of a post */
div.post p {
display: block;
margin: 0;
line-height: 1.16em;
font-size: 13pt;
min-height: 1.16em;
}
/* Buggy shit */
div.post.reply div.body a {
color: #5f89ac;
text-decoration: none;
}
/* OP */
/* Subject */
.intro span.subject {
color: #b294bb;
}
/* name */
.intro span.name {
color: #5f89ac;
}

207
stylesheets/demain_light.css

@ -0,0 +1,207 @@
/* Demain_light theme for leftypol.org adapted from Seaweed theme for 4chan*/
/* Work in progress*/
/* General */
/* Main page */
legend {
background: #477085
}
div.module, div.ban {
background: #e9eced;
border: 1px solid #cccccc;
max-width: 700px;
margin: 30px auto;
}
/* Text */
body {
background: #e9eced;
color: #4c4c4c;
font-size: 13pt;
font-family: "Open Sans", sans-serif;
}
/* Link colors */
a:link,
a:visited,
.intro a.email span.name {
color: #477085;
}
a:hover,
.intro a.post_no:hover {
color: #5d6678;
}
/* Board title and subtitle */
header div.subtitle,
h1 {
color: #d93f42;
font-size: 20pt;
font-family: "Open Sans", sans-serif;
}
header div.subtitle {
font-size: 10pt;
}
/* Post number*/
a.post_no {
color: #477085;
}
/* "Top bar" of the replies*/
p.intro {
background: #e3e7e8;
border-color: #cccccc;
border-style: solid;
border-width: 0.8px;
border-radius: 5px;
}
/* Replies */
/* Background color and border */
div.post.reply {
background: #e9eced;
border-color: #cccccc;
border-style: solid;
border-width: 0.8px;
border-radius: 5px;
}
div.post.reply.highlighted {
background: #d5dada;
border-color: #477085;
border-style: solid;
border-width: 0.8px;
border-radius: 5px;
}
div.post.reply div.body a {
color: #477085;
}
.intro span.subject {
color: #6b7a1e;
}
/* Upper part of a post */
div.post p {
display: block;
margin: 0;
line-height: 1.16em;
font-size: 13pt;
min-height: 1.16em;
}
/* Greentext */
span.quote {
color: #6b7a1e
}
/* Orangetext */
orangeText {
color: #ffb854
}
* Catalog grids */
/* Background color and green border */
.thread.grid-li.grid-size-vsmall,
.thread.grid-li.grid-size-small,
.thread.grid-li.grid-size-large {
background-color: #e9eced;
border: 1px solid #cccccc;
}
.thread.grid-li.grid-size-vsmall:hover,
.thread.grid-li.grid-size-small:hover,
.thread.grid-li.grid-size-large:hover {
background: #d5dada;
border-color: #477085;
border-style: solid;
border-width: 0.8px;
border-radius: 5px;
}
/* Posting form */
/* Field names */
form table tr th {
background: #e9eced;
color: #4c4c4c;
border: 1px solid #cccccc;
}
/* Input fields */
textarea,
input:not([type="file"]):not([type="checkbox"]),
[type="submit"] {
color: #4c4c4c;
background: #e9eced;
border: 1px double #cccccc;
border-radius: 5px;
}
/* Input fields, focused */
textarea:focus,
input:not([type="file"]):not([type="checkbox"]):focus,
[type="submit"]:hover {
border: 1px solid #d5dada;
-moz-box-shadow: 0 0 10px #d5dada;
-webkit-box-shadow: 0 0 10px #d5dada;
box-shadow: 0 0 10px #d5dada;
}
/* Top bar */
/* Background, border and fade */
.bar {
background-color: #e9eced;
border-color: #cccccc!important;
;
/* comment these out to remove the fade */
/*
-moz-box-shadow: 0 0 40px #FFB300;
-webkit-box-shadow: 0 0 40px #FFB300;
box-shadow: 0 0 40px #FFB300;
*/
}
/* Bottom bar, not visible in catalog mode */
div.pages {
background: #e9eced;
border-color: #cccccc;
}
div.pages a.selected {
color: #5d6678;
}
hr {
border-color: #cccccc;
}
div.boardlist {
color: #81a2be;
font-size: 14pt;
}
div.boardlist a {
color: #477085;
}
table.modlog tr th {
background: #e9eced;
}
/* options.js */
#options_div,
#alert_div {
background: #e9eced;
}
.desktop-style div.boardlist:nth-child(1) {
background-color: #e9eced;
}
/* Red text */
span.heading {
color: #d93f42;
}
/* OP */
/* Subject */
.intro span.subject {
color: #617d6f;
}
/* name */
.intro span.name {
color: #4c4c4c;
}
/* tripcode */
.intro span.trip {
color: #5d6678;
}
/* Fix OP file bleeding out of the border*/
.post-image {
margin: 37px
}
/* Quick reply */
/* Quick reply banner */
div.banner {
background-color: #477085;
}
/* Buggy shit */
div.post.reply div.body a {
color: #477085;
text-decoration: none;
}

103
stylesheets/temp_dark.css

@ -0,0 +1,103 @@
@-moz-document domain("leftypol.org") {
/* Bunker Theme for Leftypol.org */
/* General */
body {
background: #1d1f21 url('img/fade-yotsuba.png') repeat-x 50% 0%;
color: #ACACAC;
}
/* Top bar */
/* Background, border and fade */
.bar {
background-color: #151515;
border-color: #FFB300!important;
/* comment these out to remove the fade */
/*
-moz-box-shadow: 0 0 40px #FFB300;
-webkit-box-shadow: 0 0 40px #FFB300;
box-shadow: 0 0 40px #FFB300;
*/
}
/* Board links */
div.boardlist {
color: #acacac;
font-size: 14px;
}
/* Bottom bar, not visible in catalog mode */
div.pages {
background: #151515;
border-color: #117743;
}
div.pages a.selected {
color: #ff0000;
}
/* Thread separators */
hr {
border-color: #117743;
}
/* Link colors, might or might not work */
a:link, a:visited, .intro a.email span.name {
color: #FFB300;
}
a:link:hover {
color: #d00;
}
/* Catalog grids */
/* Background color and green border */
.thread.grid-li.grid-size-vsmall, .thread.grid-li.grid-size-vsmall:hover,
.thread.grid-li.grid-size-small, .thread.grid-li.grid-size-small:hover,
.thread.grid-li.grid-size-large, .thread.grid-li.grid-size-large:hover {
background-color: #282A2E;
border: 1px solid #117743;
}
/* Posting form */
/* Field names */
form table tr th {
background: #282A2E;
color: #ACACAC;
border: 1px solid #117743;
}
/* Input fields */
textarea, input:not([type="file"]):not([type="checkbox"]), [type="submit"] {
color: #ACACAC;
background: #282A2E;
border: 1px double #07371F;
border-radius: 5px;
}
/* Input fields, focused */
textarea:focus, input:not([type="file"]):not([type="checkbox"]):focus, [type="submit"]:hover {
border: 1px solid #117743;
-moz-box-shadow: 0 0 10px #117743;
-webkit-box-shadow: 0 0 10px #117743;
box-shadow: 0 0 10px #117743;
}
/* OP */
/* Subject */
.intro span.subject {
color: #34ED3A;
}
/* Replies */
/* Background color and green border */
div.post.reply {
background: #282A2E;
border-color: #117743;
border-style: solid;
border-width: 0.8px;
border-radius: 5px;
}
/* Highlighted replies */
div.post.reply.highlighted {
background: rgba(59, 22, 43, 0.4);
}
/* Buggy shit */
div.post.reply div.body a {
color: #ff0000;
text-decoration: none;
}
}

101
stylesheets/temp_dark_red.css

@ -0,0 +1,101 @@
/* Red Bunker Theme for Leftypol.org */
/* General */
body {
background: #1d1f21 url('img/fade-yotsuba.png') repeat-x 50% 0%;
color: #ACACAC;
}
/* Top bar */
/* Background, border and fade */
.bar {
background-color: #151515;
border-color: #ffd700!important;
/* comment these out to remove the fade */
/*
-moz-box-shadow: 0 0 40px #FFB300;
-webkit-box-shadow: 0 0 40px #FFB300;
box-shadow: 0 0 40px #FFB300;
*/
}
/* Board links */
div.boardlist {
color: #acacac;
font-size: 14px;
}
/* Bottom bar, not visible in catalog mode */
div.pages {
background: #151515;
border-color: #cd0000;
}
div.pages a.selected {
color: #ff0000;
}
/* Thread separators */
hr {
border-color: #CD0000;
}
/* Link colors, might or might not work */
a:link, a:visited, .intro a.email span.name {
color: #ffd700;
}
a:link:hover {
color: #d00;
}
/* Catalog grids */
/* Background color and green border */
.thread.grid-li.grid-size-vsmall, .thread.grid-li.grid-size-vsmall:hover,
.thread.grid-li.grid-size-small, .thread.grid-li.grid-size-small:hover,
.thread.grid-li.grid-size-large, .thread.grid-li.grid-size-large:hover {
background-color: #282A2E;
border: 1px solid #cd0000;
}
/* Posting form */
/* Field names */
form table tr th {
background: #282A2E;
color: #ACACAC;
border: 1px solid #cd0000;
}
/* Input fields */
textarea, input:not([type="file"]):not([type="checkbox"]), [type="submit"] {
color: #ACACAC;
background: #282A2E;
border: 1px double #07371F;
border-radius: 5px;
}
/* Input fields, focused */
textarea:focus, input:not([type="file"]):not([type="checkbox"]):focus, [type="submit"]:hover {
border: 1px solid #cd0000;
-moz-box-shadow: 0 0 10px #cd0000;
-webkit-box-shadow: 0 0 10px #cd0000;
box-shadow: 0 0 10px #cd0000;
}
/* OP */
/* Subject */
.intro span.subject {
color: #ffd700;
}
/* Replies */
/* Background color and green border */
div.post.reply {
background: #282A2E;
border-color: #cd0000;
border-style: solid;
border-width: 0.8px;
border-radius: 5px;
}
/* Highlighted replies */
div.post.reply.highlighted {
background: rgba(59, 22, 43, 0.4);
}
/* Buggy shit */
div.post.reply div.body a {
color: #ff0000;
text-decoration: none;
}

115
stylesheets/tomorrow.css

@ -0,0 +1,115 @@
/* Tomorrow Theme for Leftypol.org */
/* General */
body {
background: #1d1f21 url('img/fade-yotsuba.png') repeat-x 50% 0%;
color: #ACACAC;
}
/* Top bar */
/* Background, border and fade */
.bar {
background-color: #151515;
border-color: #81a2be!important;
/* comment these out to remove the fade */
/*
-moz-box-shadow: 0 0 40px #FFB300;
-webkit-box-shadow: 0 0 40px #FFB300;
box-shadow: 0 0 40px #FFB300;
*/
}
/* Board links */
div.boardlist {
color: #81a2be;
font-size: 14px;
}
/* Bottom bar, not visible in catalog mode */
div.pages {
background: #151515;
border-color: #81a2be;
}
div.pages a.selected {
color: #cc6666;
}
/* Thread separators */
hr {
border-color: #373b41;
}
/* Link colors, might or might not work */
a:link, a:visited, .intro a.email span.name {
color: #81a2be;
}
a:link:hover {
color: #cc6666;
}
/* Catalog grids */
/* Background color and green border */
.thread.grid-li.grid-size-vsmall, .thread.grid-li.grid-size-vsmall:hover,
.thread.grid-li.grid-size-small, .thread.grid-li.grid-size-small:hover,
.thread.grid-li.grid-size-large, .thread.grid-li.grid-size-large:hover {
background-color: #282A2E;
border: 1px solid #373b41;
}
/* Posting form */
/* Field names */
form table tr th {
background: #282A2E;
color: #ACACAC;
border: 1px solid #373b41;
}
/* Input fields */
textarea, input:not([type="file"]):not([type="checkbox"]), [type="submit"] {
color: #ACACAC;
background: #282A2E;
border: 1px double #1d1f21;
border-radius: 5px;
}
/* Input fields, focused */
textarea:focus, input:not([type="file"]):not([type="checkbox"]):focus, [type="submit"]:hover {
border: 1px solid #1d1f21;
-moz-box-shadow: 0 0 10px #1d1f21;
-webkit-box-shadow: 0 0 10px #1d1f21;
box-shadow: 0 0 10px #1d1f21;
}
/* OP */
/* Subject */
.intro span.subject {
color: #b294bb;
}
/* name */
.intro span.name {
color: #5f89ac;
}
/* tripcode */
.intro span.trip {
color: #8abeb7;
}
/* Replies */
/* Background color and green border */
div.post.reply {
background: #282A2E;
border-color: #373b41;
border-style: solid;
border-width: 0.8px;
border-radius: 5px;
}
/* Highlighted replies */
div.post.reply.highlighted {
background: #282A2E;
border-color: #5f89ac;
border-style: solid;
border-width: 0.8px;
border-radius: 5px;
}
/* Buggy shit */
div.post.reply div.body a {
color: #5f89ac;
text-decoration: none;
}

4
templates/themes/catalog/catalog.html

@ -48,7 +48,7 @@
<div id="Grid">
{% for post in recent_posts %}
<div class="mix"
data-reply="{{ post.reply_count }}"
data-reply="{{ post.replies }}"
data-bump="{{ post.bump }}"
data-time="{{ post.time }}"
data-id="{{ post.id }}"
@ -65,7 +65,7 @@
id="img-{{ post.id }}" data-subject="{% if post.subject %}{{ post.subject|e }}{% endif %}" data-name="{{ post.name|e }}" data-muhdifference="{{ post.muhdifference }}" class="{{post.board}} thread-image" title="{{post.bump|date('%b %d %H:%M')}}">
</a>
<div class="replies">
<strong>R: {{ post.reply_count }} / I: {{ post.image_count }}{% if post.sticky %} (sticky){% endif %}{% if post.locked %} <span class="fa fa-lock">&nbsp;</span>{% endif %}</strong>
<strong>R: {{ post.replies }} / I: {{ post.images }}{% if post.sticky %} (sticky){% endif %}{% if post.locked %} <span class="fa fa-lock">&nbsp;</span>{% endif %}</strong>
{% if post.subject %}
<p class="intro">
<span class="subject">

39
templates/themes/catalog/theme.php

@ -337,8 +337,8 @@
private function buildThreadsQuery($board) {
$sql = "SELECT *, `id` AS `thread_id`, " .
"(SELECT COUNT(`id`) FROM ``posts_$board`` WHERE `thread` = `thread_id`) AS `reply_count`, " .
"(SELECT SUM(`num_files`) FROM ``posts_$board`` WHERE `thread` = `thread_id` AND `num_files` IS NOT NULL) AS `image_count`, " .
"(SELECT COUNT(`id`) FROM ``posts_$board`` WHERE `thread` = `thread_id`) AS `replies`, " .
"(SELECT SUM(`num_files`) FROM ``posts_$board`` WHERE `thread` = `thread_id` AND `num_files` IS NOT NULL) AS `images`, " .
"'$board' AS `board` FROM ``posts_$board`` WHERE `thread` IS NULL";
return $sql;
@ -348,6 +348,8 @@
* Build and save the HTML of the catalog for the overboard
*/
public function buildOverboardCatalog($settings, $boards) {
global $config;
$board_name = $settings['overboard_location'];
if (array_key_exists($board_name, $this->threadsCache)) {
@ -371,6 +373,33 @@
$recent_posts = $this->generateRecentPosts($threads);
$this->saveForBoard($board_name, $recent_posts, '/' . $settings['overboard_location']);
// Build the overboard JSON outputs
if ($config['api']['enabled']) {
$api = new Api();
// Separate the threads into pages
$pages = array(array());
$totalThreads = count($recent_posts);
$page = 0;
for ($i = 1; $i <= $totalThreads; $i++) {
$pages[$page][] = new Thread($recent_posts[$i-1]);
// If we have not yet visited all threads,
// and we hit the limit on the current page,
// skip to the next page
if ($i < $totalThreads && ($i % $config['threads_per_page'] == 0)) {
$page++;
$pages[$page] = array();
}
}
$json = json_encode($api->translateCatalog($pages));
file_write($config['dir']['home'] . $board_name . '/catalog.json', $json);
$json = json_encode($api->translateCatalog($pages, true));
file_write($config['dir']['home'] . $board_name . '/threads.json', $json);
}
}
private function generateRecentPosts($threads) {
@ -416,8 +445,8 @@
$post['file'] = $config['root'] . $config['image_deleted'];
}
if (empty($post['image_count']))
$post['image_count'] = 0;
if (empty($post['images']))
$post['images'] = 0;
$post['pubdate'] = date('r', $post['time']);
$posts[] = $post;
@ -457,6 +486,6 @@
'config' => $config,
'recent_posts' => $recent_posts,
'board' => $board
)));
)));
}
}

32
tests/ProtectIPTest.php

@ -0,0 +1,32 @@
<?php
use PHPUnit\Framework\TestCase;
ob_start();
define('TINYBOARD', true);
require_once "inc/mod/pages.php";
ob_end_clean();
// This is probably best done with property testing library, but let's
// wait add another dependency
final class ProtectIPTest extends TestCase
{
public function testProtectsIpv4Address(){
$expected = 'Some ban message: xxxx';
// Random IP, hope it's not yours
$input = 'Some ban message: <a href="?/IP/33.57.252.246">33.57.252.246</a>';
$output = protect_ip($input);
$this->assertEquals($output, $expected);
}
public function testProtectsIpv6Address(){
$expected = 'Some ban message: xxxx';
// Random IP, hope it's not yours
$input = 'Some ban message: <a href="?/IP/5e85:f252:9baf:2131:8984:6ab2:3db0:fa48">5e85:f252:9baf:2131:8984:6ab2:3db0:fa48</a>';
$output = protect_ip($input);
$this->assertEquals($output, $expected);
}
}
Loading…
Cancel
Save