From 915fb8729e6795e19ac36e8be1f1799952f05f29 Mon Sep 17 00:00:00 2001 From: fuzzykitten Date: Sun, 23 Feb 2025 12:00:17 -0500 Subject: [PATCH] bugfix check_org_id_exists --- srv/index.php | 20 +++++++++++++++++++- srv/mob/index.php | 3 ++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/srv/index.php b/srv/index.php index 90caf9f..8f04419 100644 --- a/srv/index.php +++ b/srv/index.php @@ -125,6 +125,23 @@ function bbcode_to_html($text, $settings) '/>>(.*)\r\n/' ); +/* +>> 123 +and + +'$1 in /s/$2' + +the regex could probably be tweaked to have an actual end (a dot or something), although compromising usability r smthin + +so: +'/^>> ([0-9]+) in (?:/)?s/(.+)$/gm' (also, space is a literal character, don't backslash it) + +it checks for '>>' being the start of the string, then captures whatever number is there ('+' captures if there is one or more) +'(?:/)?' just makes the initial '/' optional, i am not sure if it gets added to the capture groups but it really shouldn't +'(.+)' at the (somewhat) end just takes anything, although it should be limited to the sub char. limit (by '{1,}' (change the '1' with the max)) +the '$' makes sure it finishes with that, and the '/gm' is regex flags for "global multiline" + +*/ $replace = array ( '$2', '$2', @@ -826,13 +843,14 @@ function check_org_id_exists($db, $sub, $org_id) FROM threads WHERE sub = '$sub' AND shadow = 'no' - AND post_id = '$org_id'"); + AND org_id = '$org_id'"); $result = $statement->execute(); $counter = 0; while ($row = $result->fetchArray(SQLITE3_NUM)) { $counter++; + break; } if ( ($counter < 1) ) { diff --git a/srv/mob/index.php b/srv/mob/index.php index 769ab15..639d552 100644 --- a/srv/mob/index.php +++ b/srv/mob/index.php @@ -429,13 +429,14 @@ function check_org_id_exists($db, $sub, $org_id) FROM threads WHERE sub = '$sub' AND shadow = 'no' - AND post_id = '$org_id'"); + AND org_id = '$org_id'"); $result = $statement->execute(); $counter = 0; while ($row = $result->fetchArray(SQLITE3_NUM)) { $counter++; + break; } if ( ($counter < 1) ) {