X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fsearch.php;h=c15dfae3fea8d981cf74efe685f9fef59078413f;hb=93fd6dce843d74f36192a7960de63766755aff0f;hp=a01984d2444c7255e363489622e266a1e76c7ed3;hpb=0a998f99dfada0f201cdaad638447ea2a35b6e7a;p=friendica.git diff --git a/mod/search.php b/mod/search.php index a01984d244..c15dfae3fe 100644 --- a/mod/search.php +++ b/mod/search.php @@ -1,4 +1,8 @@ t("Public access denied."), + "description" => t("Only logged in users are permitted to perform a search."))); + killme(); + //notice(t('Public access denied.').EOL); + //return; + } + + if (get_config('system','permit_crawling') AND !local_user()) { + // To-Do: + // - 10 requests are "free", after the 11th only a call per minute is allowed + + $remote = $_SERVER["REMOTE_ADDR"]; + $result = Cache::get("remote_search:".$remote); + if (!is_null($result)) { + if ($result > (time() - 60)) { + http_status_exit(429, + array("title" => t("Too Many Requests"), + "description" => t("Only one search per minute is permitted for not logged in users."))); + killme(); + } + } + Cache::set("remote_search:".$remote, time(), CACHE_HOUR); + } + nav_set_selected('search'); - require_once("include/bbcode.php"); - require_once('include/security.php'); - require_once('include/conversation.php'); $o = '