-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcontrol-panel.php
More file actions
167 lines (157 loc) · 7.51 KB
/
control-panel.php
File metadata and controls
167 lines (157 loc) · 7.51 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<?php
/**
* control-panel.php
* Created with PhpStorm
* User: Robin | Juraji
* Date: 12 okt 2015
* Time: 12:47
*/
define('BASEPATH', realpath(dirname(__FILE__)));
require_once BASEPATH . '/app/php/classes/Configuration.class.php';
require_once BASEPATH . '/app/php/classes/ConnectionHandler.class.php';
require_once BASEPATH . '/app/php/classes/Functions.class.php';
require_once BASEPATH . '/app/php/classes/ComponentTemplates.class.php';
require_once BASEPATH . '/app/php/classes/PanelSession.class.php';
$session = new PanelSession();
$config = new Configuration();
$connection = new ConnectionHandler($config);
$functions = new Functions($config, $connection);
$templates = new ComponentTemplates();
$session->createToken();
$botSettings = $functions->getIniArray('settings');
$isBotOnline = ($connection->testConnection()[2] == 52);
$hostHandlerActive = $functions->getIniValueByKey('modules.ini', 'hostHandler.js', true);
$subscribeHandlerActive = $functions->getIniValueByKey('modules.ini', 'subscribeHandler.js', true);
$musicPlayerCurrentSong = $functions->getOtherFile('/addons/youtubePlayer/currentsong.txt');
$NOHosts = -1;
$NOSubscribers = -1;
$partsList = $functions->getPartsList();
$renderedMenu = '';
foreach ($partsList as $parentName => $subItems) {
$parentId = 'menu-parent-' . $parentName;
$renderedMenu .= '<li class="dropdown" id="' . $parentId . '"><a nohref class="dropdown-toggle" role="button">' . ucwords($parentName) . '</a><ul class="dropdown-menu" role="menu">';
$icon = 'fa-cog';
switch ($parentName) {
case 'games':
$icon = 'fa-gamepad';
break;
case 'extras':
$icon = 'fa-plug';
break;
}
foreach ($subItems as $item) {
$openPartParam = '\'' . $parentName . '/' . $item['partFile'] . '\'';
$customScriptIcon = ($item['isCustom'] ? ' <span class="fa fa-wrench"></span>' : '');
$renderedMenu .= '<li><a nohref onclick="openPart(' . $openPartParam . ')" role="button"><span class="fa ' . $icon . '"></span> ' . $item['partName'] . $customScriptIcon . '</a></li>';
}
if ($parentName == 'extras') {
$renderedMenu .= '<li class="divider"></li>'
. '<li><a nohref onclick="toggleChat(false, this);" id="toggle-chat" role="button"><span class="fa fa-eject"></span> Show Chat</a></li>'
. '<li><a nohref onclick="toggleMusicPlayerControls(false, this);" id="player-controls-toggle" role="button"><span class="fa fa-eject"></span> Show Music Player Controls</a></li>'
. '<li class="divider"></li>'
. '<li><a href="http://www.phantombot.net/threads/command-list-by-script.13/" target="_blank" role="button"><span class="fa fa-question-circle"></span> PhantomBot Commands ist</a></li>'
. '<li><a href="http://www.phantombot.net" target="_blank"><span class="fa fa-question-circle" role="button"></span> PhantomBot Forums</a></li>';
}
$renderedMenu .= '</ul></li>';
}
if ($hostHandlerActive == 1) {
$NOHosts = $functions->getIniValueByKey('stream_info.ini', 'hosts_amount');
}
if ($subscribeHandlerActive == 1) {
$subscribers = $functions->getIniArray('subscribed.ini');
$NOSubscribers = 0;
foreach ($subscribers as $subActive) {
$NOSubscribers += ($subActive == 1 ? 1 : 0);
}
}
?>
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<link href="app/css/<?= (array_key_exists('theme', $config->paths) ? $config->paths['theme'] : 'style_dark') ?>.css" rel="stylesheet" type="text/css"/>
<link href="app/css/jquery-ui.css" rel="stylesheet" type="text/css"/>
<link rel="icon" href="favicon.ico" type="image/x-icon"/>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
<script src="app/js/jquery-1.11.3.min.js" type="text/javascript"></script>
<script src="app/js/jquery-ui.min.js" type="text/javascript"></script>
<script src="app/js/date.min.js" type="text/javascript"></script>
<script src="app/js/app.min.js" type="text/javascript"></script>
<script src="app/js/tooltip.min.js" type="text/javascript"></script>
<script src="app/js/switch-toggle.min.js" type="text/javascript"></script>
</head>
<body>
<div id="page-wrapper" class="chat-responsive">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" nohref>
<img alt="PhantomBot Web Panel" src="app/content/static/logo-small.png" role="button" onclick="loadPartFromStorage()" />
<span class="panel-version text-muted">version <?= $config->version ?></span>
</a>
</div>
<ul class="nav navbar-nav">
<li id="menu-parent-dashboard">
<a nohref onclick="openPart('static/dashboard.php')" role="button">Dashboard</a>
</li>
<?=$renderedMenu?>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a nohref onclick="logOut()">Logout</a>
</li>
</ul>
</div>
<div class="container-fluid">
<ul id="favorites-menu" class="nav navbar-nav">
<?=$templates->addTooltip('<li class="favorites-menu-icon"><span class="fa fa-star-half-empty"></span></li>', 'Favorites',
['position' => ComponentTemplates::TOOLTIP_POS_LEFT, 'offsetX' => 10, 'offsetY' => 21, 'appendToBody' => true])?>
</ul>
</div>
</nav>
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">
<?=$config->botName?> on channel <?=$config->channelOwner?>
<?=str_repeat('<span class="pull-right info-banner-space-left"> </span>', 3)?>
<?=$templates->streamInfoBanner($NOSubscribers, 'dollar', 'warning', 'Subscriber Count', '', ($NOSubscribers > -1))?>
<?=$templates->streamInfoBanner($NOHosts, 'forward', 'info', 'Host Count', 'stream-hosts', ($NOHosts > -1))?>
<?=$templates->streamInfoBanner('NA', 'heartbeat', 'danger', 'Follower Count', 'stream-followers')?>
<?=$templates->streamInfoBanner('NA', 'users', 'success', 'Viewer Count', 'stream-viewer-count')?>
<?=$templates->streamInfoBanner('Offline', 'rss', 'info', 'Stream Status', 'stream-status')?>
<?=(!$isBotOnline ? $templates->streamInfoBanner('Bot Offline', 'exclamation-circle', 'danger',
'<span class="text-danger">Could not contact the bot.</span><br />Make sure it\'s running and the HTTP server is active.') : '')?>
</h3>
</div>
<div class="panel-body">
<div>
<span class="fa fa-desktop"></span> <span id="stream-title" class="text-muted">NA <a nohref onclick="loadChannelData(true)">Retry</a></span>
</div>
<div>
<span class="fa fa-gamepad"></span> <span id="stream-game" class="text-muted">NA</span>
</div>
</div>
</div>
<div id="part-window"></div>
<div class="panel panel-default page-footer">
<div class="panel-body text-muted">
PhantomBot Control Panel
<small><?=$config->version?></small>
Developed by <a href="//juraji.nl" target="_blank">juraji</a> ©<?=date('Y')?><br/>
Compatible with <a href="//www.phantombot.net/" target="_blank">PhantomBot <?=$config->pBCompat?></a>,
developed by <a href="//phantombot.net/members/phantomindex.1/" target="_blank">phantomindex</a>,
<a href="//phantombot.net/members/gloriouseggroll.2/" target="_blank">gloriouseggroll</a> &
<a href="//phantombot.net/members/gmt2001.28/" target="_blank">gmt2001</a>.
</div>
</div>
</div>
<div id="chat-sidebar" class="chat-responsive">
<iframe id="chat-iframe" src="" scrolling="no"></iframe>
</div>
<div id="general-alert" class="alert"></div>
<div id="music-player-controls">
<?php require_once BASEPATH . '/app/parts/static/music-player-controls.php';?>
</div>
</body>
</html>