diff --git a/htdocs/application/config/stikked.php.dist b/htdocs/application/config/stikked.php.dist index 347ef3a..c6b3ebb 100644 --- a/htdocs/application/config/stikked.php.dist +++ b/htdocs/application/config/stikked.php.dist @@ -178,6 +178,19 @@ $config['per_page'] = 15; **/ $config['apikey'] = ''; +/** + * Soft API + * + * When set to true, allow interaction: + * without apikey: badword-check applies + * with apikey: badwords are ignored + * + * this is useful to maintain a restrictive blocklist + * for spammers and bypass it using the apikey. + * +**/ +$config['soft_api'] = false; + /** * Anti spam * diff --git a/htdocs/application/controllers/Api.php b/htdocs/application/controllers/Api.php index 990725f..43bd306 100644 --- a/htdocs/application/controllers/Api.php +++ b/htdocs/application/controllers/Api.php @@ -40,7 +40,7 @@ class Api extends Main function create() { - if (config_item('apikey') != $this->input->get('apikey')) + if (config_item('apikey') != $this->input->get('apikey') && config_item('soft_api') == false) { die("Invalid API key\n"); } @@ -74,9 +74,19 @@ class Api extends Main die("You are not allowed to paste\n"); } - if (!$this->_blockwords_check()) + if (config_item('soft_api') == true && (config_item('apikey') == $this->input->get('apikey'))) { - die("Your paste contains blocked words\n"); + + //pass + + } + else + { + + if (!$this->_blockwords_check()) + { + die("Your paste contains blocked words\n"); + } } //create paste