diff --git a/banners/1619614700009.png b/banners/1619614700009.png deleted file mode 100644 index fb4c8610..00000000 Binary files a/banners/1619614700009.png and /dev/null differ diff --git a/banners/flagsroom2.png b/banners/flagsroom2.png new file mode 100644 index 00000000..45ef98e1 Binary files /dev/null and b/banners/flagsroom2.png differ diff --git a/banners/pencilbanner.png b/banners/pencilbanner.png new file mode 100644 index 00000000..bd7353a5 Binary files /dev/null and b/banners/pencilbanner.png differ diff --git a/banners/pencilbanner2.png b/banners/pencilbanner2.png deleted file mode 100644 index 8fc78850..00000000 Binary files a/banners/pencilbanner2.png and /dev/null differ diff --git a/inc/api.php b/inc/api.php index 52419445..a60d9b41 100644 --- a/inc/api.php +++ b/inc/api.php @@ -45,8 +45,9 @@ class Api { ); $this->fileFields = array( - 'thumbheight' => 'tn_h', - 'thumbwidth' => 'tn_w', + 'file_id' => 'id', + 'type' => 'mime', + 'extension' => 'ext', 'height' => 'h', 'width' => 'w', 'size' => 'fsize', @@ -90,13 +91,12 @@ class Api { } private function translateFile($file, $post, &$apiPost) { + global $config; + $this->translateFields($this->fileFields, $file, $apiPost); $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); if (isset ($file->thumb) && $file->thumb) { - $apiPost['spoiler'] = $file->thumb === 'spoiler' ? 1 : 0; + $apiPost['spoiler'] = $file->thumb === 'spoiler'; } if (isset ($file->hash) && $file->hash) { $apiPost['md5'] = base64_encode(hex2bin($file->hash)); @@ -104,6 +104,25 @@ class Api { else if (isset ($post->filehash) && $post->filehash) { $apiPost['md5'] = base64_encode(hex2bin($post->filehash)); } + + $apiPost['file_path'] = $config['uri_img'] . $file->file; + + // Pick the correct thumbnail + if (isset($file->thumb) && $file->thumb === 'spoiler') { + // Spoiler + $apiPost['thumb_path'] = $config['root'] . $config['spoiler_image']; + } else if (!isset($file->thumb) || $file->thumb === 'file') { + // Default file format image + $thumbFile = $config['file_icons']['default']; + if (isset($file->extension) && isset($config['file_icons'][$file->extension])) { + $thumbFile = $config['file_icons'][$file->extension]; + } + + $apiPost['thumb_path'] = $config['root'] . sprintf($config['file_thumb'], $thumbFile); + } else { + // The file's own thumbnail + $apiPost['thumb_path'] = $config['uri_thumb'] . $file->thumb; + } } private function translatePost($post, $threadsPage = false) { @@ -115,6 +134,11 @@ class Api { if (isset($config['poster_ids']) && $config['poster_ids']) $apiPost['id'] = poster_id($post->ip, $post->thread, $board['uri']); if ($threadsPage) return $apiPost; + // Load board info + if (isset($post->board)) { + openBoard($post->board); + } + // Handle special fields if (isset($post->body_nomarkup) && ($this->config['country_flags'] || $this->config['user_flag'])) { $modifiers = extract_modifiers($post->body_nomarkup); @@ -138,21 +162,13 @@ class Api { } // Handle files - // Note: 4chan only supports one file, so only the first file is taken into account for 4chan-compatible API. if (isset($post->files) && $post->files && !$threadsPage) { - $file = $post->files[0]; - $this->translateFile($file, $post, $apiPost); - if (sizeof($post->files) > 1) { - $extra_files = array(); - foreach ($post->files as $i => $f) { - if ($i == 0) continue; + $apiPost['files'] = []; + foreach ($post->files as $f) { + $file = array(); + $this->translateFile($f, $post, $file); - $extra_file = array(); - $this->translateFile($f, $post, $extra_file); - - $extra_files[] = $extra_file; - } - $apiPost['extra_files'] = $extra_files; + $apiPost['files'][] = $file; } } diff --git a/inc/config.php b/inc/config.php index dd607039..98bec6bb 100644 --- a/inc/config.php +++ b/inc/config.php @@ -484,8 +484,11 @@ // Strip superfluous new lines at the end of a post. $config['strip_superfluous_returns'] = true; - // Strip combining characters from Unicode strings (eg. "Zalgo"). + // Strip combining characters from Unicode strings (eg. "Zalgo"). This will impact some non-English languages. $config['strip_combining_chars'] = true; + // Maximum number of combining characters in a row allowed in Unicode strings so that they can still be used in moderation. + // Requires $config['strip_combining_chars'] = true; + $config['max_combining_chars'] = 0; // Maximum post body length. $config['max_body'] = 1800; diff --git a/inc/functions.php b/inc/functions.php index 3e9fffd0..0e89388b 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -2196,8 +2196,8 @@ function markup(&$body, $track_cites = false, $op = false) { $code = rtrim(ltrim($code, "\r\n")); - $code = "
".str_replace(array("\n","\t"), array(" "," "), htmlspecialchars($code)).""; - + $code = "
".str_replace(array("\n","\t"), array(" "," "), htmlspecialchars($code, ENT_COMPAT, "UTF-8", false)).""; + $body = str_replace("
", $code, $body);
}
}
@@ -2257,19 +2257,11 @@ function ordutf8($string, &$offset) {
return $code;
}
+// Limit Non_Spacing_Mark and Enclosing_Mark characters
function strip_combining_chars($str) {
- $chars = preg_split('//u', $str, -1, PREG_SPLIT_NO_EMPTY);
- $str = '';
- foreach ($chars as $char) {
- $o = 0;
- $ord = ordutf8($char, $o);
-
- if ( ($ord >= 768 && $ord <= 879) || ($ord >= 1536 && $ord <= 1791) || ($ord >= 3655 && $ord <= 3659) || ($ord >= 7616 && $ord <= 7679) || ($ord >= 8400 && $ord <= 8447) || ($ord >= 65056 && $ord <= 65071))
- continue;
-
- $str .= $char;
- }
- return $str;
+ global $config;
+ $limit = strval($config['max_combining_chars']+1);
+ return preg_replace('/(\p{Me}|\p{Mn}){'.$limit.',}/u','', $str);
}
function buildThread($id, $return = false, $mod = false) {
diff --git a/inc/instance-config.php b/inc/instance-config.php
index 18d24103..a5475db9 100644
--- a/inc/instance-config.php
+++ b/inc/instance-config.php
@@ -106,6 +106,10 @@ $config['threads_preview'] = 5;
$config['root'] = '/';
$config['secure_trip_salt'] = 'ODQ2NDM0ODlmMmRhNzk2M2EyNjJlOW';
+$config['strip_combining_chars'] = true;
+// Maximum number of combining characters in a row allowed so that they can still be used in moderation.
+$config['max_combining_chars'] = 3;
+
//Banners
$config['url_banner'] = '/banners.php';
@@ -273,6 +277,7 @@ $config['user_flags'] = array (
'ndfp' => 'NDFP',
'palestine' => 'Palestine',
'pan-africanism' => 'Pan-Africanism',
+ 'cenzopapa' => 'Papież',
'phrygian_cap' => 'Phrygian Cap',
'pirate' => 'Pirate',
'porky' => 'Porky',
@@ -439,6 +444,8 @@ $config['markup'][] = array("/~~(.+?)~~/", "\$1');
+ $('.clear').after('');
+
var el = $('#thread_stats');
el.prepend('Page ?');
if (IDsupport){
diff --git a/post.php b/post.php
index f794d917..38270c17 100644
--- a/post.php
+++ b/post.php
@@ -1092,8 +1092,13 @@ function handle_post(){
if ($config['redraw_image'] || (!@$file['exif_stripped'] && $config['strip_exif'] && ($file['extension'] == 'jpg' || $file['extension'] == 'jpeg'))) {
if (!$config['redraw_image'] && $config['use_exiftool']) {
if($error = shell_exec_error('exiftool -overwrite_original -ignoreMinorErrors -q -q -all= ' .
- escapeshellarg($file['tmp_name'])))
+ escapeshellarg($file['tmp_name']))) {
error(_('Could not strip EXIF metadata!'), null, $error);
+ } else {
+ clearstatcache(true, $file['tmp_name']);
+ if (($newfilesize = filesize($file['tmp_name'])) !== false)
+ $file['size'] = $newfilesize;
+ }
} else {
$image->to($file['file']);
$dont_copy_file = true;
diff --git a/static/flags/antifa.png b/static/flags/antifa.png
old mode 100755
new mode 100644
diff --git a/static/flags/atheism.png b/static/flags/atheism.png
new file mode 100644
index 00000000..9dae35c4
Binary files /dev/null and b/static/flags/atheism.png differ
diff --git a/static/flags/cenzopapa.png b/static/flags/cenzopapa.png
new file mode 100644
index 00000000..d9e6ea02
Binary files /dev/null and b/static/flags/cenzopapa.png differ
diff --git a/static/flags/council_communism.png b/static/flags/council_communism.png
old mode 100755
new mode 100644
diff --git a/status.php b/status.php
index dcda0af3..30bb116c 100644
--- a/status.php
+++ b/status.php
@@ -1,41 +1,43 @@
'overboard', 'title' => 'Overboard'];
-$board_list[] = ['uri' => 'sfw', 'title' => 'SFW Overboard'];
-$board_list[] = ['uri' => 'alt', 'title' => 'Alternate Overboard'];
+foreach ($overboards_config as $overboard) {
+ $board_list[] = $overboard;
+}
/**
* Allowed fields for the board object:
* - code: The board code ('b', 'tech', ...)
* - name: The board user-readable name ('Siberia', ...)
- * - description: The board description ('Leftist Politically Incorrect', ...)
* - sfw: Is this board sfw?
- * - alternate_spoilers: Does this board use the alunya spoiler?
+ * - posting_enabled: Can new posts be created belonging to this board?
*/
$boards = [];
foreach ($board_list as $board) {
- // Skip archives
- if (endsWith($board['uri'], '_archive')) {
+ // Skip non-whitelisted boards
+ if (!in_array($board['uri'], $whitelist)) {
continue;
}
@@ -43,7 +45,6 @@ foreach ($board_list as $board) {
'code' => $board['uri'],
'name' => $board['title'],
'sfw' => !in_array($board['uri'], $nsfw_boards),
- 'alternate_spoilers' => in_array($board['uri'], $alunya_spoiler),
'posting_enabled' => !in_array($board['uri'], $readonly_boards),
];
}
diff --git a/stylesheets/demain_dark.css b/stylesheets/demain_dark.css
index cfa60f78..057cb40e 100644
--- a/stylesheets/demain_dark.css
+++ b/stylesheets/demain_dark.css
@@ -1,9 +1,9 @@
-/* Demain_light theme for leftypol.org adapted from Seaweed theme for 4chan*/
+/* Demain_light theme for leftypol.org adapted from "Tomorrow" theme for 4chan*/
/* Work in progress*/
/* General */
/* Main page */
legend {
- background: indianred
+ color: indianred
}
div.module, div.ban {
background: #1d1f21;;
@@ -154,6 +154,7 @@ table.modlog tr th {
/* Red text */
span.heading {
color: indianred;
+ font-size: 14pt;
}
/* Buggy shit */
div.post.reply div.body a {
@@ -172,10 +173,6 @@ div.post.reply div.body a {
.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;
@@ -189,12 +186,28 @@ div.post.reply div.body a {
color: #5f89ac;
text-decoration: none;
}
-/* OP */
-/* Subject */
-.intro span.subject {
- color: #b294bb;
+/* Watchlist options */
+#watchlist-toggle, .watchThread, .watchlist-remove, #clearList, #clearGhosts {
+ color: indianred
}
-/* name */
-.intro span.name {
- color: #5f89ac;
+/* Mod things */
+div.report {
+ color: grey;
+}
+.banlist-opts .checkboxes label {
+ display: block;
+ color: grey;
+}
+tr.tblhead > th {
+ color: grey;
+}
+.desktop-style div.boardlist:not(.bottom) {
+ background-color: #151515;
+}
+.banlist-opts .checkboxes label {
+ display: block;
+ color: grey;
+}
+tr.tblhead > th {
+ color: indianred
}
diff --git a/stylesheets/demain_light.css b/stylesheets/demain_light.css
index 793fa94b..bd4516d8 100644
--- a/stylesheets/demain_light.css
+++ b/stylesheets/demain_light.css
@@ -3,7 +3,7 @@
/* General */
/* Main page */
legend {
- background: #477085
+ color: #477085
}
div.module, div.ban {
background: #e9eced;
@@ -86,7 +86,7 @@ span.quote {
}
/* Orangetext */
orangeText {
- color: #ffb854
+ color: ##bb8359
}
* Catalog grids */
/* Background color and green border */
@@ -177,13 +177,14 @@ table.modlog tr th {
/* Red text */
span.heading {
color: #d93f42;
+ font-size: 14pt;
}
/* OP */
/* Subject */
.intro span.subject {
color: #617d6f;
}
-/* name */
+/* Name */
.intro span.name {
color: #4c4c4c;
}
@@ -205,3 +206,18 @@ div.post.reply div.body a {
color: #477085;
text-decoration: none;
}
+/* WatchList options */
+#watchlist-toggle, .watchThread, .watchlist-remove, #clearList, #clearGhosts {
+ color: #617d6f
+}
+/* Mod tools */
+div.report {
+ color: black;
+}
+.banlist-opts .checkboxes label {
+ display: block;
+ color: black;
+}
+.desktop-style div.boardlist:not(.bottom) {
+ background-color: #e9eced;
+}
diff --git a/templates/mod/ban_form.html b/templates/mod/ban_form.html
index 91281359..b79c8ee1 100644
--- a/templates/mod/ban_form.html
+++ b/templates/mod/ban_form.html
@@ -24,7 +24,7 @@
{% if not hide_ip %}
-
+
{% else %}
{% trans 'hidden' %}
{% endif %}
@@ -61,7 +61,7 @@
-
+
(eg. "2d1h30m" or "2 days")
diff --git a/templates/post/fileinfo.html b/templates/post/fileinfo.html
index 6c5d06ae..a551e8bb 100644
--- a/templates/post/fileinfo.html
+++ b/templates/post/fileinfo.html
@@ -22,9 +22,9 @@
{% if config.show_filename and file.filename %}
,
{% if file.filename|length > config.max_filename_display %}
- {{ file.filename|truncate_filename(config.max_filename_display)|e|bidi_cleanup }}
+ {{ file.filename|truncate_filename(config.max_filename_display)|e|bidi_cleanup }}
{% else %}
- {{ file.filename|e|bidi_cleanup }}
+ {{ file.filename|e|bidi_cleanup }}
{% endif %}
{% endif %}
)
@@ -36,4 +36,3 @@
{% endfor %}
{% endif %}
-