diff --git a/srv/mob/index.php b/srv/mob/index.php
index f64dec8..ea6cc22 100644
--- a/srv/mob/index.php
+++ b/srv/mob/index.php
@@ -65,7 +65,7 @@ if ( file_exists($config_file) ) {
// Give a new location to the browser.
// Does not work with lynx, unfortunately, but then the link can be used.
// For the mobile version, lynx does not matter, of course.
-function answer_redirect($sub)
+function answer_redirect_mob($sub)
{
header( "refresh:3;url=/mob/s/$sub" );
@@ -84,7 +84,7 @@ function answer_redirect($sub)
// Translate simple bbcode to html, and highlight quotes, like so:
// [b bold],[i italic],[u underlined],[s strikethrough]
// [h headline],[sp spoiler],[li list element],[url link],>>quote\r\n
-function bbcode_to_html($text, $settings)
+function bbcode_to_html_mob($text, $settings)
{
if ( ($settings['enable_bbcode'] == FALSE) ) {
return $text;
@@ -118,322 +118,14 @@ function bbcode_to_html($text, $settings)
}
-// checks if the bot trap has been called recently from the ip.
-// according to the parameters in the config file, the request is then
-// either granted or blocked.
-// if the blocking of tor is enabled, 127.0.0.1 will be included in the
-// blocking, which can mean that no connections from tor or local are taken
-// during the block time.
-function bot_block($db, $settings, $ip)
-{
- if ( ($settings['enable_bot_block'] != TRUE) ) {
- return;
- }
-
- if ( ($settings['enable_tor_block'] != TRUE)
- && ($_SERVER['REMOTE_ADDR'] == '127.0.0.1') ) {
- return;
- }
-
- $current = time();
- $max_age = $current - ($settings['block_time'] * 60);
- // max age is in minutes, so times 60 to go to seconds
-
- if ($settings['superstrict_block'] == TRUE) {
- $statement = $db->prepare("SELECT unix_timestamp
- FROM logs
- WHERE type = 'bot'
- AND ip = '$ip'
- AND event in ('Level 2',
- 'Level 1',
- '429')
- AND unix_timestamp > '$max_age'");
- } else {
- $statement = $db->prepare("SELECT unix_timestamp
- FROM logs
- WHERE type = 'bot'
- AND ip = '$ip'
- AND event in ('Level 2',
- 'Level 1')
- AND unix_timestamp > '$max_age'");
- }
-
- $result = $statement->execute();
-
- $trap_visits = 0;
-
- while ($row = $result->fetchArray(SQLITE3_NUM)) {
- $trap_visits++;
- }
-
- if ( ($trap_visits > $settings['max_trap_visits']) ) {
- $bot_block_message = '429';
- log_event($db, $settings, 'bot', $bot_block_message, $ip);
- header( 'HTTP/1.1 429 Too Many Requests' );
- quit($db, '429');
- }
-
- if ( ($settings['max_landing'] > 0)
- && ($settings['superstrict_block'] == TRUE) ) {
- $statement = $db->prepare("SELECT unix_timestamp
- FROM logs
- WHERE type = 'bot'
- AND ip = '$ip'
- AND event in ('landing page bot request',
- '429')
- AND unix_timestamp > '$max_age'");
- } elseif ( ($settings['max_landing'] > 0) ) {
- $statement = $db->prepare("SELECT unix_timestamp
- FROM logs
- WHERE type = 'bot'
- AND ip = '$ip'
- AND event = 'landing page bot request'
- AND unix_timestamp > '$max_age'");
- } else {
- return;
- }
-
- $result = $statement->execute();
-
- $landing_visits = 0;
-
- while ($row = $result->fetchArray(SQLITE3_NUM)) {
- $landing_visits++;
- }
-
- if ( ($landing_visits > $settings['max_landing']) ) {
- $bot_block_message = '429';
- log_event($db, $settings, 'bot', $bot_block_message, $ip);
- header( 'HTTP/1.1 429 Too Many Requests' );
- quit($db, '429');
- }
-
- return;
-}
-
-// If the post is a reply, put the original post on top.
-function bump_message($db, $org_id, $sub)
-{
- return;
- // REWRITE TO INCLUDE ORIGINAL
-
- $statement = $db->prepare("SELECT text, global_id, text_id
- FROM threads
- WHERE post_id = '$org_id'
- AND org_id = '$org_id'
- AND sub = '$sub'");
- $result = $statement->execute();
-
- while ($row = $result->fetchArray(SQLITE3_NUM)) {
- $text = "{$row[0]}";
- $global_id = "{$row[1]}";
- $text_id = "{$row[2]}";
- }
-
- $statement = $db->prepare("DELETE FROM threads
- WHERE post_id = '$org_id'
- AND org_id = '$org_id'
- AND sub = '$sub'");
- $result = $statement->execute();
-
- $statement = $db->prepare("INSERT INTO threads(post_id, sub, text,
- org_id, shadow,
- global_id, text_id)
- VALUES ('$org_id', '$sub', ?, '$org_id',
- 'no', '$global_id', '$text_id')");
- $statement->bindParam(1, $text);
-
- $statement->execute();
-
-}
-
-// Break text according to config.php, also transform \r\n to
-function break_text($text)
-{
-
- $post_text = nl2br($text, FALSE);
- return $post_text;
-
-}
-
-// Check the hashed captcha against the hashed solutions in the db.
-function check_captcha($db, $settings)
-{
- if ( (!isset($_POST['post_token'])) ) {
- quit($db, '