-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathajax.php
More file actions
77 lines (61 loc) · 2.91 KB
/
Copy pathajax.php
File metadata and controls
77 lines (61 loc) · 2.91 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
/*--------------------------------------------------------+
| IRC Log Viewer |
| Copyright (C) 2016 https://monsterprojects.org |
+---------------------------------------------------------+
| This program is free software and is released under |
| the terms of the GNU Affero General Public License |
| version 3 as published by the Free Software Foundation. |
| You can redistribute it and/or modify it under the |
| terms of this license, which is included with this |
| software as LICENSE.txt or is viewable at |
| http://www.gnu.org/licenses/agpl-3.0.html |
+--------------------------------------------------------*/
// Set content type to JSON
header('Content-Type: application/json; charset=utf-8');
define('IN_APP', true);
// Include the core file.
require_once('includes/core.php');
// Check request
if(!isset($_GET['fetch']) || empty($_GET['fetch']))
finish('Required parameter \'fetch\' not set');
switch($_GET['fetch']) {
case 'network-list':
$NetworkList = GetNetworkList();
if(!is_array($NetworkList))
finish($NetworkList);
else
finish(array('networks'=>$NetworkList), true);
break;
case 'channel-list':
if(!isset($_GET['for_network']) || empty($_GET['for_network']))
finish('Required parameter \'for_network\' not set');
$ChannelList = GetChannelList($_GET['for_network']);
if(!is_array($ChannelList))
finish($ChannelList);
else
finish(array('channels'=>$ChannelList), true);
break;
case 'log-list':
if(!isset($_GET['for_network'], $_GET['for_channel']) || empty($_GET['for_network']) || empty($_GET['for_channel']))
finish('Required parameter \'for_network\' or \'for_channel\' not set');
$LogList = GetLogList($_GET['for_network'], $_GET['for_channel']);
if(!is_array($LogList))
finish($LogList);
else
finish(array('logs'=>$LogList), true);
break;
case 'log':
if(!isset($_GET['for_network'], $_GET['for_channel'], $_GET['for_logdate']) || empty($_GET['for_network']) || empty($_GET['for_channel'])|| empty($_GET['for_logdate']))
finish('Required parameter \'for_network\', \'for_channel\' or \'for_logdate\' not set');
$LogLines = GetLogLines($_GET['for_network'], $_GET['for_channel'], $_GET['for_logdate']);
if(!is_array($LogLines))
finish($LogLines);
else
finish(array('loglines'=>$LogLines), true);
break;
default:
finish('Invalid value for parameter \'fetch\' set');
break;
}
?>