diff --git a/inc/api.php b/inc/api.php index c097f82c..0a4dca76 100644 --- a/inc/api.php +++ b/inc/api.php @@ -130,8 +130,9 @@ class Api { } } - private function translatePost($post, $threadsPage = false) { + function translatePost($post, $threadsPage = false) { global $config, $board; + $apiPost = array(); $fields = $threadsPage ? $this->threadsPageFields : $this->postFields; $this->translateFields($fields, $post, $apiPost); diff --git a/inc/display.php b/inc/display.php index 06971bc9..76468bea 100644 --- a/inc/display.php +++ b/inc/display.php @@ -380,6 +380,10 @@ class PostProps { class Post extends PostProps { + private $op; + private $raw_body; + private $has_file; + private $tracked_cites; public function __construct($post, $root=null, $mod=false) { global $config; diff --git a/inc/instance-config.php b/inc/instance-config.php index 3289756d..430fcd48 100644 --- a/inc/instance-config.php +++ b/inc/instance-config.php @@ -563,7 +563,7 @@ $config['filters'][] = array( $config['filters'][] = array( 'condition' => array( - 'body' => '/(^|\s)((https?):\/\/)?[\w-]{2,6}\.[a-z]{2,4}\/\w{2,8}/i', // url shorteners are not allowed + 'body' => '/(^|\s)((https?):\/\/)?[\w-]{2,6}\.[a-z]{2,4}\/\w{2,8}(\s|$)/i', // url shorteners are not allowed ), 'action' => 'reject', 'message' => 'Url shorteners are not allowed' diff --git a/post.php b/post.php index 95ddf512..43dd359a 100644 --- a/post.php +++ b/post.php @@ -458,7 +458,6 @@ function handle_post(){ global $config,$dropped_post,$board, $mod,$pdo; if (!isset($_POST['body'], $_POST['board']) && !$dropped_post) { - print_err('handle_post bot error 1'); error($config['error']['bot']); } @@ -1488,10 +1487,12 @@ function handle_post(){ header('Location: ' . $redirect, true, $config['redirect_http']); } else { header('Content-Type: text/json; charset=utf-8'); + $api = new Api(); echo json_encode(array( 'redirect' => $redirect, 'noko' => $noko, - 'id' => $id + 'id' => $id, + 'post' => $api->translatePost(new Post($post)) )); }