mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-12 01:54:26 +02:00
Make validate_url more intuitive
- Remove the parameter passed by reference - Add modified url in return value
This commit is contained in:
parent
e16852c2f5
commit
1724dd3841
5 changed files with 21 additions and 20 deletions
|
@ -932,11 +932,12 @@ function get_my_url()
|
|||
|
||||
function zrl_init(App $a)
|
||||
{
|
||||
$tmp_str = get_my_url();
|
||||
if (validate_url($tmp_str)) {
|
||||
$my_url = get_my_url();
|
||||
$my_url = validate_url($my_url);
|
||||
if ($my_url) {
|
||||
// Is it a DDoS attempt?
|
||||
// The check fetches the cached value from gprobe to reduce the load for this system
|
||||
$urlparts = parse_url($tmp_str);
|
||||
$urlparts = parse_url($my_url);
|
||||
|
||||
$result = Cache::get("gprobe:" . $urlparts["host"]);
|
||||
if ((!is_null($result)) && (in_array($result["network"], array(NETWORK_FEED, NETWORK_PHANTOM)))) {
|
||||
|
@ -944,8 +945,8 @@ function zrl_init(App $a)
|
|||
return;
|
||||
}
|
||||
|
||||
Worker::add(PRIORITY_LOW, 'GProbe', $tmp_str);
|
||||
$arr = array('zrl' => $tmp_str, 'url' => $a->cmd);
|
||||
Worker::add(PRIORITY_LOW, 'GProbe', $my_url);
|
||||
$arr = array('zrl' => $my_url, 'url' => $a->cmd);
|
||||
call_hooks('zrl_init', $arr);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue