2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
//
|
|
|
|
// ZoneMinder web options view file, $Date$, $Revision$
|
2008-07-25 17:48:16 +08:00
|
|
|
// Copyright (C) 2001-2008 Philip Coombes
|
2008-07-14 21:54:50 +08:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; either version 2
|
|
|
|
// 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( 'System' ) )
|
|
|
|
{
|
2008-09-26 17:47:20 +08:00
|
|
|
$view = "error";
|
2008-07-14 21:54:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-10-09 17:15:53 +08:00
|
|
|
$canEdit = canEdit( 'System' );
|
|
|
|
|
2008-07-14 21:54:50 +08:00
|
|
|
$tabs = array();
|
2010-11-24 09:35:12 +08:00
|
|
|
$tabs['skins'] = $SLANG['Display']; // change me to be supported by SLANG...
|
2008-07-14 21:54:50 +08:00
|
|
|
$tabs['system'] = $SLANG['System'];
|
|
|
|
$tabs['config'] = $SLANG['Config'];
|
|
|
|
$tabs['paths'] = $SLANG['Paths'];
|
|
|
|
$tabs['web'] = $SLANG['Web'];
|
|
|
|
$tabs['images'] = $SLANG['Images'];
|
2011-06-21 17:19:10 +08:00
|
|
|
$tabs['logging'] = $SLANG['Logging'];
|
2008-07-14 21:54:50 +08:00
|
|
|
$tabs['network'] = $SLANG['Network'];
|
|
|
|
$tabs['mail'] = $SLANG['Email'];
|
2011-08-23 22:10:20 +08:00
|
|
|
$tabs['upload'] = $SLANG['Upload'];
|
2008-07-14 21:54:50 +08:00
|
|
|
$tabs['x10'] = $SLANG['X10'];
|
|
|
|
$tabs['highband'] = $SLANG['HighBW'];
|
|
|
|
$tabs['medband'] = $SLANG['MediumBW'];
|
|
|
|
$tabs['lowband'] = $SLANG['LowBW'];
|
|
|
|
$tabs['phoneband'] = $SLANG['PhoneBW'];
|
2011-02-20 04:25:54 +08:00
|
|
|
$tabs['eyeZm'] = "eyeZm";
|
2008-07-14 21:54:50 +08:00
|
|
|
if ( ZM_OPT_USE_AUTH )
|
|
|
|
$tabs['users'] = $SLANG['Users'];
|
|
|
|
|
2008-09-26 17:47:20 +08:00
|
|
|
if ( isset($_REQUEST['tab']) )
|
|
|
|
$tab = validHtmlStr($_REQUEST['tab']);
|
|
|
|
else
|
|
|
|
$tab = "system";
|
2008-07-14 21:54:50 +08:00
|
|
|
|
|
|
|
$focusWindow = true;
|
|
|
|
|
|
|
|
xhtmlHeaders( __FILE__, $SLANG['Options'] );
|
|
|
|
?>
|
|
|
|
<body>
|
|
|
|
<div id="page">
|
|
|
|
<div id="header">
|
|
|
|
<h2><?= $SLANG['Options'] ?></h2>
|
|
|
|
</div>
|
|
|
|
<div id="content">
|
|
|
|
<ul class="tabList">
|
|
|
|
<?php
|
|
|
|
foreach ( $tabs as $name=>$value )
|
|
|
|
{
|
2008-09-26 17:47:20 +08:00
|
|
|
if ( $tab == $name )
|
2008-07-14 21:54:50 +08:00
|
|
|
{
|
|
|
|
?>
|
|
|
|
<li class="active"><?= $value ?></li>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
?>
|
2009-10-17 01:09:16 +08:00
|
|
|
<li><a href="?view=<?= $view ?>&tab=<?= $name ?>"><?= $value ?></a></li>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</ul>
|
2008-07-18 22:53:44 +08:00
|
|
|
<div class="clear"></div>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2010-11-24 09:35:12 +08:00
|
|
|
if($tab == 'skins') {
|
|
|
|
$current_skin = $_COOKIE['zmSkin'];
|
|
|
|
if (isset($_GET['skin-choice'])) {
|
|
|
|
setcookie('zmSkin',$_GET['skin-choice']);
|
|
|
|
//header("Location: index.php?view=options&tab=skins&reset_parent=1");
|
2014-04-11 15:40:23 +08:00
|
|
|
echo "<script type=\"text/javascript\">window.opener.location.reload();window.location.href=\"{$_SERVER['PHP_SELF']}?view={$view}&tab={$tab}\"</script>";
|
2010-11-24 09:35:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
<form name="optionsForm" method="get" action="<?= $_SERVER['PHP_SELF'] ?>">
|
|
|
|
<input type="hidden" name="view" value="<?= $view ?>"/>
|
|
|
|
<input type="hidden" name="tab" value="<?= $tab ?>"/>
|
|
|
|
<table class="contentTable major optionTable" cellspacing="0">
|
|
|
|
<thead><tr><th><?= $SLANG['Name'] ?></th><th><?= $SLANG['Description'] ?></th> <th><?= $SLANG['Value'] ?></th></tr></thead>
|
|
|
|
<tbody>
|
|
|
|
<td>ZM_SKIN</td>
|
|
|
|
<td><?php echo $SLANG['SkinDescription']; ?></td>
|
|
|
|
<td><select name="skin-choice">
|
|
|
|
<?php
|
|
|
|
foreach(glob('skins/*',GLOB_ONLYDIR) as $dir) {
|
|
|
|
$dir = basename($dir);
|
|
|
|
echo '<option value="'.$dir.'" '.($current_skin==$dir ? 'SELECTED' : '').'>'.$dir.'</option>';
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</select>
|
|
|
|
</td>
|
|
|
|
</table>
|
|
|
|
<div id="contentButtons">
|
|
|
|
<input type="submit" value="<?= $SLANG['Save'] ?>"<?= $canEdit?'':' disabled="disabled"' ?>/>
|
|
|
|
<input type="button" value="<?= $SLANG['Cancel'] ?>" onclick="closeWindow();"/>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
elseif ( $tab == "users" )
|
2008-07-14 21:54:50 +08:00
|
|
|
{
|
|
|
|
?>
|
|
|
|
<form name="userForm" method="post" action="<?= $_SERVER['PHP_SELF'] ?>">
|
2008-09-26 17:47:20 +08:00
|
|
|
<input type="hidden" name="view" value="<?= $view ?>"/>
|
|
|
|
<input type="hidden" name="tab" value="<?= $tab ?>"/>
|
2008-07-14 21:54:50 +08:00
|
|
|
<input type="hidden" name="action" value="delete"/>
|
|
|
|
<table id="contentTable" class="major userTable" cellspacing="0">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th class="colUsername"><?= $SLANG['Username'] ?></th>
|
|
|
|
<th class="colLanguage"><?= $SLANG['Language'] ?></th>
|
|
|
|
<th class="colEnabled"><?= $SLANG['Enabled'] ?></th>
|
|
|
|
<th class="colStream"><?= $SLANG['Stream'] ?></th>
|
|
|
|
<th class="colEvents"><?= $SLANG['Events'] ?></th>
|
|
|
|
<th class="colControl"><?= $SLANG['Control'] ?></th>
|
|
|
|
<th class="colMonitors"><?= $SLANG['Monitors'] ?></th>
|
|
|
|
<th class="colSystem"><?= $SLANG['System'] ?></th>
|
|
|
|
<th class="colBandwidth"><?= $SLANG['Bandwidth'] ?></th>
|
|
|
|
<th class="colMonitor"><?= $SLANG['Monitor'] ?></th>
|
|
|
|
<th class="colMark"><?= $SLANG['Mark'] ?></th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<?php
|
|
|
|
$sql = "select * from Monitors order by Sequence asc";
|
|
|
|
$monitors = array();
|
|
|
|
foreach( dbFetchAll( $sql ) as $monitor )
|
|
|
|
{
|
|
|
|
$monitors[$monitor['Id']] = $monitor;
|
|
|
|
}
|
|
|
|
|
|
|
|
$sql = "select * from Users";
|
|
|
|
foreach( dbFetchAll( $sql ) as $row )
|
|
|
|
{
|
|
|
|
$userMonitors = array();
|
|
|
|
if ( !empty($row['MonitorIds']) )
|
|
|
|
{
|
2010-02-16 01:11:37 +08:00
|
|
|
foreach ( explode( ",", $row['MonitorIds'] ) as $monitorId )
|
2008-07-14 21:54:50 +08:00
|
|
|
{
|
|
|
|
$userMonitors[] = $monitors[$monitorId]['Name'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<tr>
|
2009-10-17 01:09:16 +08:00
|
|
|
<td class="colUsername"><?= makePopupLink( '?view=user&uid='.$row['Id'], 'zmUser', 'user', validHtmlStr($row['Username']).($user['Username']==$row['Username']?"*":""), $canEdit ) ?></td>
|
2008-09-26 17:47:20 +08:00
|
|
|
<td class="colLanguage"><?= $row['Language']?validHtmlStr($row['Language']):'default' ?></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
<td class="colEnabled"><?= $row['Enabled']?$SLANG['Yes']:$SLANG['No'] ?></td>
|
2008-09-26 17:47:20 +08:00
|
|
|
<td class="colStream"><?= validHtmlStr($row['Stream']) ?></td>
|
|
|
|
<td class="colEvents"><?= validHtmlStr($row['Events']) ?></td>
|
|
|
|
<td class="colControl"><?= validHtmlStr($row['Control']) ?></td>
|
|
|
|
<td class="colMonitors"><?= validHtmlStr($row['Monitors']) ?></td>
|
|
|
|
<td class="colSystem"><?= validHtmlStr($row['System']) ?></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
<td class="colBandwidth"><?= $row['MaxBandwidth']?$bwArray[$row['MaxBandwidth']]:' ' ?></td>
|
|
|
|
<td class="colMonitor"><?= $row['MonitorIds']?(join( ", ", $userMonitors )):" " ?></td>
|
2008-10-09 17:15:53 +08:00
|
|
|
<td class="colMark"><input type="checkbox" name="markUids[]" value="<?= $row['Id'] ?>" onclick="configureDeleteButton( this );"<?php if ( !$canEdit ) { ?> disabled="disabled"<?php } ?>/></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<div id="contentButtons">
|
2009-10-17 01:09:16 +08:00
|
|
|
<input type="button" value="<?= $SLANG['AddNewUser'] ?>" onclick="createPopup( '?view=user&uid=0', 'zmUser', 'user' );"<?php if ( !canEdit( 'System' ) ) { ?> disabled="disabled"<?php } ?>/><input type="submit" name="deleteBtn" value="<?= $SLANG['Delete'] ?>" disabled="disabled"/><input type="button" value="<?= $SLANG['Cancel'] ?>" onclick="closeWindow();"/>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-09-26 17:47:20 +08:00
|
|
|
if ( $tab == "system" )
|
2008-07-14 21:54:50 +08:00
|
|
|
{
|
2008-09-26 17:47:20 +08:00
|
|
|
$configCats[$tab]['ZM_LANG_DEFAULT']['Hint'] = join( '|', getLanguages() );
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
<form name="optionsForm" method="post" action="<?= $_SERVER['PHP_SELF'] ?>">
|
2008-09-26 17:47:20 +08:00
|
|
|
<input type="hidden" name="view" value="<?= $view ?>"/>
|
|
|
|
<input type="hidden" name="tab" value="<?= $tab ?>"/>
|
2008-07-14 21:54:50 +08:00
|
|
|
<input type="hidden" name="action" value="options"/>
|
|
|
|
<table id="contentTable" class="major optionTable" cellspacing="0">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th><?= $SLANG['Name'] ?></th>
|
|
|
|
<th><?= $SLANG['Description'] ?></th>
|
|
|
|
<th><?= $SLANG['Value'] ?></th>
|
|
|
|
</tr>
|
2008-07-18 00:59:25 +08:00
|
|
|
</thead>
|
|
|
|
<tbody>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2008-09-26 17:47:20 +08:00
|
|
|
$configCat = $configCats[$tab];
|
2008-07-14 21:54:50 +08:00
|
|
|
foreach ( $configCat as $name=>$value )
|
|
|
|
{
|
2009-02-19 22:17:33 +08:00
|
|
|
$shortName = preg_replace( '/^ZM_/', '', $name );
|
|
|
|
$optionPromptText = !empty($OLANG[$shortName])?$OLANG[$shortName]:$value['Prompt'];
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
<tr>
|
2009-02-19 22:17:33 +08:00
|
|
|
<td><?= $shortName ?></td>
|
2009-10-17 01:09:16 +08:00
|
|
|
<td><?= validHtmlStr($optionPromptText) ?> (<?= makePopupLink( '?view=optionhelp&option='.$name, 'zmOptionHelp', 'optionhelp', '?' ) ?>)</td>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
if ( $value['Type'] == "boolean" )
|
|
|
|
{
|
|
|
|
?>
|
2009-02-19 22:17:33 +08:00
|
|
|
<td><input type="checkbox" id="<?= $name ?>" name="newConfig[<?= $name ?>]" value="1"<?php if ( $value['Value'] ) { ?> checked="checked"<?php } ?><?= $canEdit?'':' disabled="disabled"' ?>/></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
elseif ( preg_match( "/\|/", $value['Hint'] ) )
|
|
|
|
{
|
|
|
|
?>
|
|
|
|
<td class="nowrap">
|
|
|
|
<?php
|
2010-02-16 01:11:37 +08:00
|
|
|
$options = explode( '|', $value['Hint'] );
|
2008-07-14 21:54:50 +08:00
|
|
|
if ( count( $options ) > 3 )
|
|
|
|
{
|
|
|
|
?>
|
2011-06-21 17:19:10 +08:00
|
|
|
<select name="newConfig[<?= $name ?>]"<?= $canEdit?'':' disabled="disabled"' ?>>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
foreach ( $options as $option )
|
|
|
|
{
|
2011-06-21 17:19:10 +08:00
|
|
|
if ( preg_match( '/^([^=]+)=(.+)$/', $option, $matches ) )
|
|
|
|
{
|
|
|
|
$optionLabel = $matches[1];
|
|
|
|
$optionValue = $matches[2];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$optionLabel = $optionValue = $option;
|
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2011-06-21 17:19:10 +08:00
|
|
|
<option value="<?= $optionValue ?>"<?php if ( $value['Value'] == $optionValue ) { echo ' selected="selected"'; } ?>><?= htmlspecialchars($optionLabel) ?></option>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</select>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
foreach ( $options as $option )
|
|
|
|
{
|
2011-06-21 17:19:10 +08:00
|
|
|
if ( preg_match( '/^([^=]+)=(.+)$/', $option ) )
|
|
|
|
{
|
|
|
|
$optionLabel = $matches[1];
|
|
|
|
$optionValue = $matches[2];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$optionLabel = $optionValue = $option;
|
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2011-06-21 17:19:10 +08:00
|
|
|
<span><input type="radio" id="<?= $name.'_'.preg_replace( '/[^a-zA-Z0-9]/', '', $optionValue ) ?>" name="newConfig[<?= $name ?>]" value="<?= $optionValue ?>"<?php if ( $value['Value'] == $optionValue ) { ?> checked="checked"<?php } ?><?= $canEdit?'':' disabled="disabled"' ?>/> <?= htmlspecialchars($optionLabel) ?></span>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</td>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
elseif ( $value['Type'] == "text" )
|
|
|
|
{
|
|
|
|
?>
|
2009-02-19 22:17:33 +08:00
|
|
|
<td><textarea id="<?= $name ?>" name="newConfig[<?= $name ?>]" rows="5" cols="40"<?= $canEdit?'':' disabled="disabled"' ?>><?= validHtmlStr($value['Value']) ?></textarea></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
elseif ( $value['Type'] == "integer" )
|
|
|
|
{
|
|
|
|
?>
|
2009-02-19 22:17:33 +08:00
|
|
|
<td><input type="text" id="<?= $name ?>" name="newConfig[<?= $name ?>]" value="<?= validHtmlStr($value['Value']) ?>" class="small"<?= $canEdit?'':' disabled="disabled"' ?>/></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
elseif ( $value['Type'] == "hexadecimal" )
|
|
|
|
{
|
|
|
|
?>
|
2009-02-19 22:17:33 +08:00
|
|
|
<td><input type="text" id="<?= $name ?>" name="newConfig[<?= $name ?>]" value="<?= validHtmlStr($value['Value']) ?>" class="medium"<?= $canEdit?'':' disabled="disabled"' ?>/></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
elseif ( $value['Type'] == "decimal" )
|
|
|
|
{
|
|
|
|
?>
|
2009-02-19 22:17:33 +08:00
|
|
|
<td><input type="text" id="<?= $name ?>" name="newConfig[<?= $name ?>]" value="<?= validHtmlStr($value['Value']) ?>" class="small"<?= $canEdit?'':' disabled="disabled"' ?>/></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
?>
|
2009-02-19 22:17:33 +08:00
|
|
|
<td><input type="text" id="<?= $name ?>" name="newConfig[<?= $name ?>]" value="<?= validHtmlStr($value['Value']) ?>" class="large"<?= $canEdit?'':' disabled="disabled"' ?>/></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<div id="contentButtons">
|
2008-10-09 17:15:53 +08:00
|
|
|
<input type="submit" value="<?= $SLANG['Save'] ?>"<?= $canEdit?'':' disabled="disabled"' ?>/><input type="button" value="<?= $SLANG['Cancel'] ?>" onclick="closeWindow();"/>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|