Permalink
Browse files

Live stats popup

Ref #2 and #3 regarding live stats popup.

Fixed issues with PHP notices with undefined index/offset/variables/
  • Loading branch information...
mattyribbo committed Jun 21, 2016
1 parent 7ef5f2e commit 76595ce92babcf9e361569137c4bcd9402b745b8
Showing with 47 additions and 12 deletions.
  1. +4 −2 inc/class.stream.php
  2. +27 −2 inc/functions.interface.php
  3. +8 −3 inc/functions.stats.php
  4. +2 −2 inc/functions.stream.php
  5. +2 −2 inc/functions.users.php
  6. +4 −1 index.php
@@ -57,8 +57,10 @@ public function getData() {
xml_parser_free($xmlParser);
// Find the correct stream
for($i = 0; $i < sizeof($this->_indexes["SOURCE"]); $i++) {
if($this->_values[$this->_indexes["SOURCE"][$i*2]]["attributes"]["MOUNT"] == $this->mountpoint) {
for($i = 0; $i < floor(sizeof($this->_indexes["SOURCE"]) / 2); $i++) {
if((isset($this->_values[$this->_indexes["SOURCE"][$i*2]])) &&
(isset($this->mountpoint)) &&
($this->_values[$this->_indexes["SOURCE"][$i*2]]["attributes"]["MOUNT"] == $this->mountpoint)) {
$this->index = $i;
}
}
@@ -113,7 +113,10 @@ function display_footer() {
<div id="footer">
<div class="container">
<!-- Don't remove the link back. Or you can feel guilty. Your choice. -->
<p class="text-muted">Powered by RadioPanel<?php echo _VER; ?> &nbsp;&nbsp;&nbsp;&bull;&nbsp;&nbsp;&nbsp;<a href="http://www.mattyribbo.co.uk/radiopanel">mattyribbo.co.uk</a>&nbsp;&nbsp;&nbsp;&bull;&nbsp;&nbsp;&nbsp;<a href="./?page=credits">Credits</a></p>
<p class="text-muted">Powered by RadioPanel <?php echo _VER; ?> &nbsp;&nbsp;&nbsp;&bull;&nbsp;&nbsp;&nbsp;
<a href="https://github.com/mattyribbo/radiopanel/" target="_blank">Fork me on GitHub</a>&nbsp;&nbsp;&nbsp;&bull;&nbsp;&nbsp;&nbsp;
<a href="http://www.mattyribbo.co.uk/radiopanel" target="_blank">mattyribbo.co.uk</a>&nbsp;&nbsp;&nbsp;&bull;&nbsp;&nbsp;&nbsp;
<a href="./?page=credits">Credits</a></p>
</div>
</div>
@@ -123,6 +126,19 @@ function display_footer() {
<?php
}
function display_footer_lite() {
?>
</div>
</div>
</body>
</html>
<?php
}
function display_loginbox() {
?>
<form class="form-signin" action="index.php?page=login" method="post">
@@ -144,7 +160,7 @@ function display_homepage() {
echo "<div id=\"streamstats\">";
stream_getlivestats();
echo "</div><br />";
echo "<p style=\"font-style:italic;\">Note: figures are live and will automatically update<br />Do <strong>not</strong> disclose live figures on-air under any circumstances!</p><br /><a href=\"#\" id=\"dialog_link\" class=\"ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only\"><span class=\"ui-icon ui-icon-newwin\"></span>Open live stats in a popup window</a>\n";
echo "<p style=\"font-style:italic;\">Note: figures are live and will automatically update.</p><br /><a href=\"#\" id=\"dialog_link\" target=\"popup\" onclick=\"window.open('/.?page=popup','Live Stats','width=600,height=300'); return false;\" class=\"ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only\"><span class=\"ui-icon ui-icon-newwin\"></span>Open live stats in a popup window</a>\n";
display_footer();
}
@@ -166,4 +182,13 @@ function display_credits() {
<?php
display_footer();
}
function display_live_popup() {
display_head("Live Stats");
echo "<div id=\"streamstats\">";
stream_getlivestats();
echo "</div>";
display_footer_lite();
}
?>
@@ -4,6 +4,7 @@
//
// - stats_week() - View statistics/figures per week
// - stats_search() - Search statistics/figures by hour/time period
// - stats_search_display() - Display search results
function stats_week() {
global $db_session;
@@ -219,10 +220,13 @@ function stats_search() {
global $db_session;
display_head("Search");
display_header("Search");
$date = NULL;
$hour = NULL;
$date = $_GET['date'];
if(isset($_GET['date'])) $date = $_GET['date'];
if(isset($_GET['todate'])) { $todate = $_GET['todate']; } else { $todate = $date; }
$hour = $_GET['time'];
if(isset($_GET['time'])) $hour = $_GET['time'];
if(isset($_GET['totime'])) { $tohour = $_GET['totime']; } else { $tohour = $hour+1; }
stats_search_display();
@@ -304,7 +308,7 @@ function stats_search_display() {
$peak = $listeners[$timestamp];
}
}
$average = round($total/$plots);
if($plots > 0) { $average = round($total/$plots); } else { $average = 0; }
// Generate jqGraph
echo "<div class=\"search_chart_figures\" id=\"chart_figures_search\"></div>\n";
echo "<script type=\"text/javascript\">\n";
@@ -327,4 +331,5 @@ function stats_search_display() {
echo "<hr />\n";
}
}
?>
@@ -13,8 +13,8 @@
// Stream Interface
function stream_interface() {
global $user_session;
$task = ($_GET['task']);
$sid = ($_GET['sid']);
if(isset($_GET['task'])) { $task = ($_GET['task']); } else { $task = ""; }
if(isset($_GET['sid'])) { $sid = ($_GET['sid']); } else { $sid = 0; }
display_head("Stream Management");
display_header("Stream Management");
@@ -5,8 +5,8 @@
function user_interface() {
global $user_session;
$task = ($_GET['task']);
$uid = ($_GET['uid']);
if(isset($_GET['task'])) { $task = ($_GET['task']); } else { $task = ""; }
if(isset($_GET['sid'])) { $sid = ($_GET['sid']); } else { $sid = 0; }
display_head("User Management");
display_header("User Management");
@@ -21,7 +21,7 @@
require("inc/class.user.php");
// Defines
define('_VER', '1.0b3');
define('_VER', '1.0.4');
//error_reporting(E_ALL ^ E_NOTICE);
// Initialisation
@@ -82,6 +82,9 @@
case "credits":
display_credits();
break;
case "popup":
display_live_popup();
break;
default:
display_homepage();
break;

0 comments on commit 76595ce

Please sign in to comment.