From f8e6fae013ee80d2bc8a19ff9caa6f1270cbcd6b Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 29 Oct 2021 18:53:23 -0400 Subject: [PATCH] spacing and check for permission to view the specific event instead of events in general --- web/skins/classic/views/frame.php | 124 +++++++++++++++--------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/web/skins/classic/views/frame.php b/web/skins/classic/views/frame.php index bdd2e1071..9931c910a 100644 --- a/web/skins/classic/views/frame.php +++ b/web/skins/classic/views/frame.php @@ -18,30 +18,28 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -if ( !canView('Events') ) { - $view = 'error'; - return; -} - require_once('includes/Frame.php'); $eid = validInt($_REQUEST['eid']); $fid = empty($_REQUEST['fid']) ? 0 : validInt($_REQUEST['fid']); $Event = new ZM\Event($eid); +if (!$Event->canView()) { + $view = 'error'; + return; +} $Monitor = $Event->Monitor(); # This is kinda weird.. so if we pass fid=0 or some other non-integer, then it loads max score # perhaps we should consider being explicit, like fid = maxscore -if ( !empty($fid) ) { - $sql = 'SELECT * FROM Frames WHERE EventId = ? AND FrameId = ?'; - if ( !($frame = dbFetchOne($sql, NULL, array($eid, $fid))) ) +if (!empty($fid)) { + $sql = 'SELECT * FROM Frames WHERE EventId=? AND FrameId=?'; + if (!($frame = dbFetchOne($sql, NULL, array($eid, $fid)))) $frame = array('EventId'=>$eid, 'FrameId'=>$fid, 'Type'=>'Normal', 'Score'=>0); } else { - $frame = dbFetchOne('SELECT * FROM Frames WHERE EventId = ? AND Score = ?', NULL, array($eid, $Event->MaxScore())); + $frame = dbFetchOne('SELECT * FROM Frames WHERE EventId=? AND Score=?', NULL, array($eid, $Event->MaxScore())); } $Frame = new ZM\Frame($frame); - $maxFid = $Event->Frames(); $firstFid = 1; @@ -51,11 +49,11 @@ $lastFid = $maxFid; $alarmFrame = ( $Frame->Type() == 'Alarm' ) ? 1 : 0; -if ( isset($_REQUEST['scale']) ) { +if (isset($_REQUEST['scale'])) { $scale = validNum($_REQUEST['scale']); -} else if ( isset($_COOKIE['zmWatchScale'.$Monitor->Id()]) ) { +} else if (isset($_COOKIE['zmWatchScale'.$Monitor->Id()])) { $scale = validNum($_COOKIE['zmWatchScale'.$Monitor->Id()]); -} else if ( isset($_COOKIE['zmWatchScale']) ) { +} else if (isset($_COOKIE['zmWatchScale'])) { $scale = validNum($_COOKIE['zmWatchScale']); } else { $scale = max(reScale(SCALE_BASE, $Monitor->DefaultScale(), ZM_WEB_DEFAULT_SCALE), SCALE_BASE); @@ -63,7 +61,7 @@ if ( isset($_REQUEST['scale']) ) { $scale = $scale ? $scale : 0; $imageData = $Event->getImageSrc($frame, $scale, 0); -if ( !$imageData ) { +if (!$imageData) { ZM\Error("No data found for Event $eid frame $fid"); $imageData = array(); } @@ -92,78 +90,80 @@ xhtmlHeaders(__FILE__, translate('Frame').' - '.$Event->Id().' - '.$Frame->Frame
- - - - + + + +

Id().'-'.$Frame->FrameId().' ('.$Frame->Score().')' ?>

-
'changeScale','id'=>'scale')); ?>
+
+ + 'changeScale','id'=>'scale')); ?> +
-