-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.php
More file actions
32 lines (28 loc) · 828 Bytes
/
Copy pathapi.php
File metadata and controls
32 lines (28 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
$config = require "config.php";
require "misc/tools.php";
$query = $_REQUEST["q"];
$type = isset($_REQUEST["type"]) ? (int) $_REQUEST["type"] : 0;
$results = array();
switch ($type)
{
case 0:
require "results/search_results.php";
get_search_results($query);
break;
case 1:
require "results/channel_results.php";
get_channel_results($query);
break;
case 2:
require "results/watch_results.php";
get_watch_results($query);
break;
default:
require "results/search_results.php";
get_search_results($query);
break;
}
header("Content-Type: application/json");
echo json_encode($results, JSON_PRETTY_PRINT);
?>