URLs validity check

This commit is contained in:
p1rox 2015-03-14 00:31:26 +01:00
parent a54409d624
commit e4a729ac74

View file

@ -20,6 +20,20 @@ class Downloader
return;
}
foreach ($this->urls as $url)
{
if(!$this->is_valid_url($url))
{
$this->errors[] = "\"".$url."\" is not a valid url !";
}
}
if(isset($this->errors) && count($this->errors) > 0)
{
$_SESSION['errors'] = $this->errors;
return;
}
if($this->config["max_dl"] == 0)
{
$this->do_download();
@ -140,6 +154,11 @@ class Downloader
return $r;
}
private function is_valid_url($url)
{
return filter_var($url, FILTER_VALIDATE_URL);
}
private function check_outuput_folder()
{
if(!is_dir($this->download_path))