From 4ef7feabf25831100a2f7439eeb9bfae5c819162 Mon Sep 17 00:00:00 2001 From: h00j Date: Fri, 12 Mar 2021 21:51:42 +0100 Subject: [PATCH 1/6] add telegrams --- inc/config.php | 6 ++ inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo | Bin 26105 -> 26188 bytes inc/locale/pl_PL/LC_MESSAGES/tinyboard.po | 6 ++ inc/mod/pages.php | 51 +++++++++++++- install.sql | 15 +++++ mod.php | 5 +- post.php | 55 +++++++++++---- templates/important.html | 12 ++++ templates/mod/view_ip.html | 78 ++++++++++++++++++++++ 9 files changed, 210 insertions(+), 18 deletions(-) create mode 100644 templates/important.html diff --git a/inc/config.php b/inc/config.php index 04fe48e6..25350fe7 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1554,6 +1554,12 @@ $config['mod']['create_notes'] = $config['mod']['view_notes']; // Remote notes $config['mod']['remove_notes'] = ADMIN; + // View telegrams + $config['mod']['view_telegrams'] = JANITOR; + // Create telegrams + $config['mod']['create_telegrams'] = $config['mod']['view_telegrams']; + // Remote telegrams + $config['mod']['remove_telegrams'] = ADMIN; // Create a new board $config['mod']['newboard'] = ADMIN; // Manage existing boards (change title, etc) diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo index b72324eaec51d52ec0e65c4b31220ebd28733f8a..f24fd2e47adf52223a114910497ecc7fc5a6b138 100644 GIT binary patch delta 7570 zcmYk=30PKD9>?*^CZHg)2nZseAc}~fq9TI(0*c}WsHmWz;RxiKxxHyxmK7PAW13cz zrIwCpIxaQlnx<(kGo_`bWoo%r+L$%W_xIl8Je{Zi`}v=9?>+b2bI!f^^x&w=v12Zd z3jyxSEJ~4!Wi`Z@I+k^jJRw-EmbEUzvchmZ2H^n=z_U0DZ=er8*2uEB)S8A(a31RX zwHSiCuoj*|Pdsba9o8k1x-?wF+W0HZN7qQpYJdx|KCVG;+=jlm2X({GFbB_KI>tv4 z_!!1w6*kA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uPS z=~zd!rJjeYiHSr8(U7)hu<{sBVNL0{$S^yDGapno;~XN0Xhb|p{FBge+QIWXi{EHs zkEh1}$KW9P(J_qZt^&uG#Gk}iVjH2O57+I)`uK*{({G+;=cg)--HAlv0ZqZgG2%ty z1d%{{3-m!9L$D3@Aig775tYYJ6l_y@6FU*P#0#cPguBcYF?7_L@G&Px;98;^ZSygf z7(jU_v4gS>7iArHiO)SH=O=~s=@d^Ag_P?M|DYUB1XFHI=y-)_rJbTf9rK7>&gp1J zJjWhc8NJrGY-r-Hs%5DuJA)E?r?;OpYWS2f;~z`UA3kMNi`XXajHc-s?(~f8*o@2; cO|w$nP2BFXi>;>AEPK4ud9SjPZr4Kp2Xb8@0ssI2 diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po index eb73784d..50d24b64 100644 --- a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po +++ b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po @@ -2286,6 +2286,9 @@ msgstr "usuń" #: ../../../../templates/cache/b1/4c/16a427b0d49ecf353c259d9fb606841783484eca9d790e766fdf0e3e9754.php:208 msgid "New note" msgstr "Nowa notka" + +msgid "New telegram" +msgstr "Nowa depesza" #. line 94 #. line 7 @@ -3510,3 +3513,6 @@ msgstr "Pokazuj bany tylko z boardów, które moderuję" #: ../../../../templates/cache/ba/55/2553cc018aecf7d29a62331aec4bedc71b646817c7e4c4e7d1a885263676.php:55 msgid "Show only active bans" msgstr "Pokazuj tylko aktywne bany" + +msgid "Important message from Moderation" +msgstr "Ważna wiadomość od Moderacji" diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 3379898a..782daee1 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -793,6 +793,27 @@ function mod_ip_remove_note($cloaked_ip, $id) { header('Location: ?/IP/' . $cloaked_ip . '#notes', true, $config['redirect_http']); } +function mod_ip_remove_telegram($cloaked_ip, $id) { + $ip = uncloak_ip($cloaked_ip); + global $config, $mod; + + if (!hasPermission($config['mod']['remove_telegrams'])) + error($config['error']['noaccess']); + + if (filter_var($ip, FILTER_VALIDATE_IP) === false) + error("Invalid IP address."); + + $query = prepare('DELETE FROM ``telegrams`` WHERE `ip` = :ip AND `id` = :id'); + $query->bindValue(':ip', $ip); + $query->bindValue(':id', $id); + $query->execute() or error(db_error($query)); + + modLog("Removed a telegram for {$cloaked_ip}"); + + header('Location: ?/IP/' . $cloaked_ip . '#telegrams', true, $config['redirect_http']); +} + + function mod_page_ip($cip) { $ip = uncloak_ip($cip); global $config, $mod; @@ -828,7 +849,26 @@ function mod_page_ip($cip) { header('Location: ?/IP/' . $cip . '#notes', true, $config['redirect_http']); return; } - + + if (isset($_POST['telegram'])) { + if (!hasPermission($config['mod']['create_telegrams'])) + error($config['error']['noaccess']); + + $_POST['telegram'] = escape_markup_modifiers($_POST['telegram']); + markup($_POST['telegram']); + $query = prepare('INSERT INTO ``telegrams`` VALUES (NULL, :mod_id, :ip, :message, 0, :created_at)'); + $query->bindValue(':ip', $ip); + $query->bindValue(':mod_id', $mod['id']); + $query->bindValue(':created_at', time()); + $query->bindValue(':message', $_POST['telegram']); + $query->execute() or error(db_error($query)); + + modLog("Added a telegram for {$cip}"); + + header('Location: ?/IP/' . $cip . '#telegrams', true, $config['redirect_http']); + return; + } + $args = array(); $args['ip'] = $ip; $args['posts'] = array(); @@ -872,7 +912,14 @@ function mod_page_ip($cip) { $query->execute() or error(db_error($query)); $args['notes'] = $query->fetchAll(PDO::FETCH_ASSOC); } - + + if (hasPermission($config['mod']['view_telegrams'])) { + $query = prepare("SELECT ``telegrams``.*, `username` FROM ``telegrams`` LEFT JOIN ``mods`` ON `mod_id` = ``mods``.`id` WHERE `ip` = :ip ORDER BY `created_at` DESC"); + $query->bindValue(':ip', $ip); + $query->execute() or error(db_error($query)); + $args['telegrams'] = $query->fetchAll(PDO::FETCH_ASSOC); + } + if (hasPermission($config['mod']['modlog_ip'])) { $query = prepare("SELECT `username`, `mod`, `ip`, `board`, `time`, `text` FROM ``modlogs`` LEFT JOIN ``mods`` ON `mod` = ``mods``.`id` WHERE `text` LIKE :search ORDER BY `time` DESC LIMIT 50"); $query->bindValue(':search', '%' . $cip . '%'); diff --git a/install.sql b/install.sql index ca60a58a..0c6e44eb 100644 --- a/install.sql +++ b/install.sql @@ -346,6 +346,21 @@ CREATE TABLE IF NOT EXISTS `captchas` ( PRIMARY KEY (`cookie`,`extra`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; +-- -------------------------------------------------------- + +-- +-- Table structure for table `telegrams` +-- + +CREATE TABLE IF NOT EXISTS `telegrams` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `mod_id` int(11) unsigned NOT NULL, + `ip` varchar(39) CHARACTER SET ascii NOT NULL, + `message` text NOT NULL, + `seen` tinyint(1) NOT NULL DEFAULT FALSE, + `created_at` INT(11), + PRIMARY KEY(`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; diff --git a/mod.php b/mod.php index ee087262..2d48b9ea 100644 --- a/mod.php +++ b/mod.php @@ -1,4 +1,4 @@ - 'secure_POST ip', // view ip address '/IP/([\w.:]+)/remove_note/(\d+)' => 'secure ip_remove_note', // remove note from ip address - + '/IP/([\w.:-]+)/remove_telegram/(\d+)' => 'secure ip_remove_telegram', // remove telegram from ip address + '/ban' => 'secure_POST ban', // new ban '/bans' => 'secure_POST bans', // ban list '/bans.json' => 'secure bans_json', // ban list JSON diff --git a/post.php b/post.php index 22532356..70a21c5d 100644 --- a/post.php +++ b/post.php @@ -402,17 +402,19 @@ if (isset($_POST['delete'])) { if (!$resp['success']) { error($config['error']['captcha']); } - // Same, but now with our custom captcha provider - if (($config['captcha']['enabled']) || (($post['op']) && ($config['new_thread_capt'])) ) { - $resp = file_get_contents($config['captcha']['provider_check'] . "?" . http_build_query([ - 'mode' => 'check', - 'text' => $_POST['captcha_text'], - 'extra' => $config['captcha']['extra'], - 'cookie' => $_POST['captcha_cookie'] - ])); - if ($resp !== '1') { - error($config['error']['captcha'] . - ''); + // Same, but now with our custom captcha provider + if (($config['captcha']['enabled']) || (($post['op']) && ($config['new_thread_capt'])) ) { + $resp = file_get_contents($config['captcha']['provider_check'] . "?" . http_build_query([ + 'mode' => 'check', + 'text' => $_POST['captcha_text'], + 'extra' => $config['captcha']['extra'], + 'cookie' => $_POST['captcha_cookie'] + ])); + if ($resp !== '1') { + error($config['error']['captcha'] . + ''); + } + } } } } @@ -1201,6 +1203,15 @@ if (isset($_POST['delete'])) { if (!$post['mod']) header('X-Associated-Content: "' . $redirect . '"'); + // Any telegrams to show? + $query = prepare('SELECT * FROM ``telegrams`` WHERE ``ip`` = :ip AND ``seen`` = 0'); + $query->bindValue(':ip', $_SERVER['REMOTE_ADDR']); + $query->execute() or error(db_error($query)); + $telegrams = $query->fetchAll(PDO::FETCH_ASSOC); + + if (count($telegrams) > 0) + goto skip_redirect; + if (!isset($_POST['json_response'])) { header('Location: ' . $redirect, true, $config['redirect_http']); } else { @@ -1211,7 +1222,9 @@ if (isset($_POST['delete'])) { 'id' => $id )); } - + + skip_redirect: + if ($config['try_smarter'] && $post['op']) $build_pages = range(1, $config['max_pages']); @@ -1222,6 +1235,20 @@ if (isset($_POST['delete'])) { buildIndex(); + if (count($telegrams) > 0) { + $ids = implode(', ', array_map(function($x) { return (int)$x['id']; }, $telegrams)); + query("UPDATE ``telegrams`` SET ``seen`` = 1 WHERE ``id`` IN({$ids})") or error(db_error()); + die(Element('page.html', array( + 'title' => _('Important message from Moderation'), + 'config' => $config, + 'body' => Element('important.html', array( + 'config' => $config, + 'redirect' => $redirect, + 'telegrams' => $telegrams, + )) + ))); + } + // We are already done, let's continue our heavy-lifting work in the background (if we run off FastCGI) if (function_exists('fastcgi_finish_request')) @fastcgi_finish_request(); @@ -1230,7 +1257,7 @@ if (isset($_POST['delete'])) { rebuildThemes('post-thread', $board['uri']); else rebuildThemes('post', $board['uri']); - + } elseif (isset($_POST['appeal'])) { if (!isset($_POST['ban_id'])) error($config['error']['bot']); @@ -1279,4 +1306,4 @@ if (isset($_POST['delete'])) { // They opened post.php in their browser manually. error($config['error']['nopost']); } -} \ No newline at end of file +} diff --git a/templates/important.html b/templates/important.html new file mode 100644 index 00000000..bbf37873 --- /dev/null +++ b/templates/important.html @@ -0,0 +1,12 @@ +
+ {% for telegram in telegrams %} +
+ {{ telegram.created_at|date(config.post_date) }} +

{{ telegram.message }}

+
+
+ {% endfor %} + +
diff --git a/templates/mod/view_ip.html b/templates/mod/view_ip.html index 7b6727f8..e86c7a71 100644 --- a/templates/mod/view_ip.html +++ b/templates/mod/view_ip.html @@ -81,6 +81,84 @@ {% endif %} +{% if mod|hasPermission(config.mod.view_telegrams) %} +
+ + {% set telegrams_on_record = 'telegram' ~ (telegrams|count != 1 ? 's' : '') ~ ' on record' %} + {{ telegrams|count }} {% trans telegrams_on_record %} + + + {% if telegrams|count > 0 %} + + + + + + + {% if mod|hasPermission(config.mod.remove_telegrams) %} + + {% endif %} + + {% for telegram in telegrams %} + + + + + + {% if mod|hasPermission(config.mod.remove_telegrams) %} + + {% endif %} + + {% endfor %} +
{% trans 'Staff' %}{% trans 'Message' %}{% trans 'Date' %}{% trans 'Seen' %}{% trans 'Actions' %}
+ {% if telegram.username %} + {{ telegram.username|e }} + {% else %} + {% trans 'deleted?' %} + {% endif %} + + {{ telegram.message }} + + {{ telegram.time|date(config.post_date) }} + + {% if telegram.seen %} + {% trans 'Yes' %} + {% else %} + {% trans 'No' %} + {% endif %} + + + [{% trans 'remove' %}] + +
+ {% endif %} + + {% if mod|hasPermission(config.mod.create_telegrams) %} +
+ + + + + + + + + + + + + + +
{% trans 'Staff' %}{{ mod.username|e }}
+ + + +
+
+ {% endif %} +
+{% endif %} + {% if bans|count > 0 and mod|hasPermission(config.mod.view_ban) %}
{% set bans_on_record = 'ban' ~ (bans|count != 1 ? 's' : '') ~ ' on record' %} From 59c0f788d2f0a9f65236fab85a6659d4e7d60032 Mon Sep 17 00:00:00 2001 From: h00j Date: Fri, 12 Mar 2021 21:52:37 +0100 Subject: [PATCH 2/6] typo --- inc/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/config.php b/inc/config.php index 25350fe7..401a01db 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1558,7 +1558,7 @@ $config['mod']['view_telegrams'] = JANITOR; // Create telegrams $config['mod']['create_telegrams'] = $config['mod']['view_telegrams']; - // Remote telegrams + // Remove telegrams $config['mod']['remove_telegrams'] = ADMIN; // Create a new board $config['mod']['newboard'] = ADMIN; From f43b5ffbc42624bdb5b6312a19140cac1cbd03a8 Mon Sep 17 00:00:00 2001 From: h00j Date: Fri, 12 Mar 2021 21:53:16 +0100 Subject: [PATCH 3/6] woops --- mod.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod.php b/mod.php index 2d48b9ea..38b9e07a 100644 --- a/mod.php +++ b/mod.php @@ -1,4 +1,4 @@ -6 Date: Fri, 12 Mar 2021 21:54:31 +0100 Subject: [PATCH 4/6] important.html relative time --- templates/important.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/important.html b/templates/important.html index bbf37873..9ad4460e 100644 --- a/templates/important.html +++ b/templates/important.html @@ -1,7 +1,7 @@
{% for telegram in telegrams %}
- {{ telegram.created_at|date(config.post_date) }} +

{{ telegram.message }}


From 064deec26ff1617b39e0194d291813b57b21f70d Mon Sep 17 00:00:00 2001 From: h00j Date: Fri, 12 Mar 2021 21:55:27 +0100 Subject: [PATCH 5/6] fix date --- templates/mod/view_ip.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/mod/view_ip.html b/templates/mod/view_ip.html index e86c7a71..891e4e21 100644 --- a/templates/mod/view_ip.html +++ b/templates/mod/view_ip.html @@ -112,7 +112,7 @@ {{ telegram.message }} - {{ telegram.time|date(config.post_date) }} + {{ telegram.created_at|date(config.post_date) }} {% if telegram.seen %} From 61d6132bb307cc4a89d5085ed01389180b49b348 Mon Sep 17 00:00:00 2001 From: 27chan <27chan@protonmail.com> Date: Wed, 17 Mar 2021 21:22:40 -0300 Subject: [PATCH 6/6] Fix post.php I believe that you ended up closing some functions by mistake and then gave the following error when making a post: PHP message: PHP Parse error: syntax error, unexpected '}', expecting end of file in /var/www/vichan/html/post.php on line 462 --- post.php | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/post.php b/post.php index 70a21c5d..be155e84 100644 --- a/post.php +++ b/post.php @@ -402,19 +402,17 @@ if (isset($_POST['delete'])) { if (!$resp['success']) { error($config['error']['captcha']); } - // Same, but now with our custom captcha provider - if (($config['captcha']['enabled']) || (($post['op']) && ($config['new_thread_capt'])) ) { - $resp = file_get_contents($config['captcha']['provider_check'] . "?" . http_build_query([ - 'mode' => 'check', - 'text' => $_POST['captcha_text'], - 'extra' => $config['captcha']['extra'], - 'cookie' => $_POST['captcha_cookie'] - ])); - if ($resp !== '1') { - error($config['error']['captcha'] . - ''); - } - } + // Same, but now with our custom captcha provider + if (($config['captcha']['enabled']) || (($post['op']) && ($config['new_thread_capt'])) ) { + $resp = file_get_contents($config['captcha']['provider_check'] . "?" . http_build_query([ + 'mode' => 'check', + 'text' => $_POST['captcha_text'], + 'extra' => $config['captcha']['extra'], + 'cookie' => $_POST['captcha_cookie'] + ])); + if ($resp !== '1') { + error($config['error']['captcha'] . + ''); } } } @@ -1222,9 +1220,9 @@ if (isset($_POST['delete'])) { 'id' => $id )); } - skip_redirect: + if ($config['try_smarter'] && $post['op']) $build_pages = range(1, $config['max_pages']); @@ -1234,8 +1232,8 @@ if (isset($_POST['delete'])) { event('post-after', $post); buildIndex(); - - if (count($telegrams) > 0) { + + if (count($telegrams) > 0) { $ids = implode(', ', array_map(function($x) { return (int)$x['id']; }, $telegrams)); query("UPDATE ``telegrams`` SET ``seen`` = 1 WHERE ``id`` IN({$ids})") or error(db_error()); die(Element('page.html', array( @@ -1257,7 +1255,7 @@ if (isset($_POST['delete'])) { rebuildThemes('post-thread', $board['uri']); else rebuildThemes('post', $board['uri']); - + } elseif (isset($_POST['appeal'])) { if (!isset($_POST['ban_id'])) error($config['error']['bot']);