diff options
author | Jesús <heckyel@hyperbola.info> | 2019-05-25 14:29:25 -0500 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2019-05-25 14:29:25 -0500 |
commit | 27ef7aafcf88fc4b29d097fd95c6a9c999be8989 (patch) | |
tree | 6a3a92539b14c09cbd950a67ee5d8124fc406db4 | |
parent | a95b901045aef0ea7337f9ed2fa5d75edb486f85 (diff) | |
download | ytlibre-27ef7aafcf88fc4b29d097fd95c6a9c999be8989.tar.lz ytlibre-27ef7aafcf88fc4b29d097fd95c6a9c999be8989.tar.xz ytlibre-27ef7aafcf88fc4b29d097fd95c6a9c999be8989.zip |
BugFix boolean validation
-rw-r--r-- | tools/init.php | 5 | ||||
-rw-r--r-- | tools/processor.php | 8 |
2 files changed, 8 insertions, 5 deletions
diff --git a/tools/init.php b/tools/init.php index deb20e5..51d4ee8 100644 --- a/tools/init.php +++ b/tools/init.php @@ -36,12 +36,15 @@ function url_exists( $url = NULL ) { function video_exists($url) { @$headers = get_headers($url); + + $result = FALSE; + foreach ($headers as $hdr) { if (preg_match('/^HTTP\/\d\.\d\s+(403)/', $hdr)){ $result = TRUE; // Found 403 Error } } - if ( $result = TRUE ) { + if ( $result === TRUE ) { return FALSE; // Not exist video } else { return TRUE; // Exist video diff --git a/tools/processor.php b/tools/processor.php index 005396d..e38a8ef 100644 --- a/tools/processor.php +++ b/tools/processor.php @@ -8,7 +8,7 @@ if (empty($_GET['link'])){ $baselink = htmlspecialchars($_GET['link']); $urlexists = url_exists( $baselink ); -if ($urlexists == TRUE) { +if ($urlexists === TRUE) { // Regex - filter URL id is match[5] $rx = '/^((?:https?:)?\/\/)? # Optional protocol ((?:www|m)[.])? # Optional sub-domain @@ -74,16 +74,16 @@ $node0on = video_exists($node0); $node1on = video_exists($node1); // check nodes -if ($node0on == TRUE) { +if ( $node0on === TRUE ) { $breakurl = $node0; -} elseif ($node1on == TRUE) { +} elseif ( $node1on === TRUE ) { $breakurl = $node1; } else { $breakurl = $drmv; $formatdrm = 'video/webm'; } -if ($url_standar == FALSE) { +if ($url_standar === FALSE) { // Liberty data $breakquality = trim($streamFormats[0]->resolution, 'p'); $breaklink = <<<EOT |