Exemple #1
0
        $name = strtolower($details["name"]);
        if (count($details)) {
            foreach ($whitelist as $term) {
                if (strlen($term) > 3 && trim($term)) {
                    if (stristr($name, $term) or stristr($artist, $term)) {
                        return true;
                    }
                }
            }
            foreach ($blacklist as $term) {
                if (strlen($term) > 3 && trim($term)) {
                    if (stristr($name, $term) or stristr($artist, $term)) {
                        return false;
                    }
                }
            }
        }
    }
    return true;
}
if (!checkBlacklist($details)) {
    json_response(['success' => false, 'reason' => "That song matches the blacklist in this room."]);
}
if (count($details)) {
    $details['success'] = true;
    json_response($details);
}
$response = $video->responseArray();
if (isset($response['error'])) {
    json_response(['success' => false, 'message' => $response['error']['message']]);
}
                    if (stristr($name, $term) or stristr($artist, $term)) {
                        return true;
                    }
                }
            }
            foreach ($blacklist as $term) {
                if (strlen($term) > 3 && trim($term)) {
                    if (stristr($name, $term) or stristr($artist, $term)) {
                        return false;
                    }
                }
            }
        }
    }
    return true;
}
$failed = 0;
$info = [];
foreach (explode(",", $_GET['data']) as $data) {
    $video = YoutubeSongInfo::withId($data);
    $details = $video->details();
    if (!checkBlacklist($data)) {
        $failed++;
        continue;
    }
    if (count($details)) {
        $details['success'] = true;
        $info[] = $details;
    }
}
json_response(["info" => $info, "failed" => $failed]);