Exemple #1
0
    }
} else {
    $mode = validHtmlStr($_REQUEST['mode']);
}
$group = '';
$groupSql = '';
if (!empty($_REQUEST['group'])) {
    $group = validInt($_REQUEST['group']);
    $row = dbFetchOne('SELECT * FROM Groups WHERE Id = ?', NULL, array($group));
    $groupSql = " and find_in_set( Id, '" . $row['MonitorIds'] . "' )";
}
$sql = "SELECT * FROM Monitors WHERE Function != 'None'{$groupSql} ORDER BY Sequence";
$monitors = array();
$monIdx = 0;
foreach (dbFetchAll($sql) as $row) {
    if (!visibleMonitor($row['Id'])) {
        continue;
    }
    if (isset($_REQUEST['mid']) && $row['Id'] == $_REQUEST['mid']) {
        $monIdx = count($monitors);
    }
    $row['ScaledWidth'] = reScale($row['Width'], $row['DefaultScale'], ZM_WEB_DEFAULT_SCALE);
    $row['ScaledHeight'] = reScale($row['Height'], $row['DefaultScale'], ZM_WEB_DEFAULT_SCALE);
    $monitors[] = $row;
}
$monitor = $monitors[$monIdx];
$nextMid = $monIdx == count($monitors) - 1 ? $monitors[0]['Id'] : $monitors[$monIdx + 1]['Id'];
$montageWidth = $monitor['ScaledWidth'];
$montageHeight = $monitor['ScaledHeight'];
$widthScale = $montageWidth * SCALE_BASE / $monitor['Width'];
$heightScale = $montageHeight * SCALE_BASE / $monitor['Height'];
Exemple #2
0
$eventCounts = array(array("title" => $SLANG['Events'], "filter" => array("terms" => array())), array("title" => $SLANG['Hour'], "filter" => array("terms" => array(array("attr" => "Archived", "op" => "=", "val" => "0"), array("cnj" => "and", "attr" => "DateTime", "op" => ">=", "val" => "-1 hour")))), array("title" => $SLANG['Day'], "filter" => array("terms" => array(array("attr" => "Archived", "op" => "=", "val" => "0"), array("cnj" => "and", "attr" => "DateTime", "op" => ">=", "val" => "-1 day")))), array("title" => $SLANG['Week'], "filter" => array("terms" => array(array("attr" => "Archived", "op" => "=", "val" => "0"), array("cnj" => "and", "attr" => "DateTime", "op" => ">=", "val" => "-7 day")))), array("title" => $SLANG['Month'], "filter" => array("terms" => array(array("attr" => "Archived", "op" => "=", "val" => "0"), array("cnj" => "and", "attr" => "DateTime", "op" => ">=", "val" => "-1 month")))), array("title" => $SLANG['Archived'], "filter" => array("terms" => array(array("attr" => "Archived", "op" => "=", "val" => "1")))));
$running = daemonCheck();
$status = $running ? $SLANG['Running'] : $SLANG['Stopped'];
if ($group = dbFetchOne("select * from Groups where Id = '" . (empty($_COOKIE['zmGroup']) ? 0 : dbEscape($_COOKIE['zmGroup'])) . "'")) {
    $groupIds = array_flip(split(',', $group['MonitorIds']));
}
$maxWidth = 0;
$maxHeight = 0;
$cycleCount = 0;
$minSequence = 0;
$maxSequence = 1;
$seqIdList = array();
$monitors = dbFetchAll("select * from Monitors order by Sequence asc");
$displayMonitors = array();
for ($i = 0; $i < count($monitors); $i++) {
    if (!visibleMonitor($monitors[$i]['Id'])) {
        continue;
    }
    if ($group && !empty($groupIds) && !array_key_exists($monitors[$i]['Id'], $groupIds)) {
        continue;
    }
    $monitors[$i]['Show'] = true;
    if (empty($minSequence) || $monitors[$i]['Sequence'] < $minSequence) {
        $minSequence = $monitors[$i]['Sequence'];
    }
    if ($monitors[$i]['Sequence'] > $maxSequence) {
        $maxSequence = $monitors[$i]['Sequence'];
    }
    if (isset($_GET['nostatus'])) {
        $monitors[$i]['zmc'] = 1;
        $monitors[$i]['zma'] = 1;
Exemple #3
0
echo validHtmlStr($newGroup['Name']);
?>
"/></td>
            </tr>
            <tr>
              <th scope="row"><?php 
echo translate('MonitorIds');
?>
</th>
              <td>
                <select name="newGroup[MonitorIds][]" size="4" multiple="multiple">
<?php 
$monitors = dbFetchAll("select Id,Name from Monitors order by Sequence asc");
$monitorIds = array_flip(explode(',', $newGroup['MonitorIds']));
foreach ($monitors as $monitor) {
    if (visibleMonitor($monitor['Id'])) {
        ?>
                  <option value="<?php 
        echo $monitor['Id'];
        ?>
"<?php 
        if (array_key_exists($monitor['Id'], $monitorIds)) {
            ?>
 selected="selected"<?php 
        }
        ?>
><?php 
        echo validHtmlStr($monitor['Name']);
        ?>
</option>
<?php 
Exemple #4
0
            <tr>
              <td><?php 
        echo translate('LinkedMonitors');
        ?>
</td>
              <td>
                <select name="monitorIds" size="4" multiple="multiple" onchange="updateLinkedMonitors( this )">
<?php 
        $monitors = dbFetchAll("select Id,Name from Monitors order by Sequence asc");
        if (!empty($newMonitor['LinkedMonitors'])) {
            $monitorIds = array_flip(explode(',', $newMonitor['LinkedMonitors']));
        } else {
            $monitorIds = array();
        }
        foreach ($monitors as $monitor) {
            if ((empty($newMonitor['Id']) || $monitor['Id'] != $newMonitor['Id']) && visibleMonitor($monitor['Id'])) {
                ?>
                  <option value="<?php 
                echo $monitor['Id'];
                ?>
"<?php 
                if (array_key_exists($monitor['Id'], $monitorIds)) {
                    ?>
 selected="selected"<?php 
                }
                ?>
><?php 
                echo validHtmlStr($monitor['Name']);
                ?>
</option>
<?php 
Exemple #5
0
function monitorIdsToNames($ids)
{
    global $mITN_monitors;
    if (!$mITN_monitors) {
        $sql = "select Id, Name from Monitors";
        foreach (dbFetchAll($sql) as $monitor) {
            $mITN_monitors[$monitor['Id']] = $monitor;
        }
    }
    $names = array();
    foreach (preg_split('/\\s*,\\s*/', $ids) as $id) {
        if (visibleMonitor($id)) {
            if (isset($mITN_monitors[$id])) {
                $names[] = $mITN_monitors[$id]['Name'];
            }
        }
    }
    $name_string = join(', ', $names);
    return $name_string;
}
Exemple #6
0
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
require_once 'includes/Monitor.php';
if (!canView('Stream')) {
    $view = "error";
    return;
}
// This is for input sanitation
$mid = intval($_REQUEST['mid']);
if (!visibleMonitor($mid)) {
    $view = "error";
    return;
}
$sql = 'SELECT C.*, M.* FROM Monitors AS M LEFT JOIN Controls AS C ON (M.ControlId = C.Id ) WHERE M.Id = ?';
$monitor = new Monitor($mid);
#dbFetchOne( $sql, NULL, array( $_REQUEST['mid'] ) );
if (isset($_REQUEST['showControls'])) {
    $showControls = validInt($_REQUEST['showControls']);
} else {
    $showControls = canView('Control') && $monitor->DefaultView() == 'Control';
}
$showPtzControls = ZM_OPT_CONTROL && $monitor->Controllable() && canView('Control');
if (isset($_REQUEST['scale'])) {
    $scale = validInt($_REQUEST['scale']);
} else {
Exemple #7
0
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
if (!canView('Stream')) {
    $view = "error";
    return;
}
if (!visibleMonitor($_REQUEST['mid'])) {
    $view = "error";
    return;
}
$sql = 'SELECT C.*, M.* FROM Monitors AS M LEFT JOIN Controls AS C ON (M.ControlId = C.Id ) WHERE M.Id = ?';
$monitor = dbFetchOne($sql, NULL, array($_REQUEST['mid']));
if (isset($_REQUEST['showControls'])) {
    $showControls = validInt($_REQUEST['showControls']);
} else {
    $showControls = canView('Control') && $monitor['DefaultView'] == 'Control';
}
$showPtzControls = ZM_OPT_CONTROL && $monitor['Controllable'] && canView('Control');
if (isset($_REQUEST['scale'])) {
    $scale = validInt($_REQUEST['scale']);
} else {
    $scale = reScale(SCALE_BASE, $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE);