Changed the filter query format from PHP serialize to &= delimited so

perl can read it.


git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@130 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2002-11-29 11:21:37 +00:00
parent c1c742946e
commit 25a0e86afe
2 changed files with 41 additions and 27 deletions

View File

@ -324,7 +324,13 @@ if ( $action )
$filter_query[$op_name] = $$op_name;
$filter_query[$value_name] = $$value_name;
}
$filter_query_string = serialize( $filter_query );
$filter_parms = array();
while( list( $key, $value ) = each( $filter_query ) )
{
$filter_parms[] = "$key=$value";
}
$filter_query_string = join( '&', $filter_parms );
//$filter_query_string = serialize( $filter_query );
$sql = "replace into Filters set MonitorId = '$mid', Name = '$filter_name', Query = '$filter_query_string', AutoDelete = '$auto_delete'";
#echo "<html>$sql</html>";
$result = mysql_query( $sql );

View File

@ -830,6 +830,40 @@ location.href = '<?php echo $PHP_SELF ?>?view=events&mid=<?php echo $mid ?><?php
die( mysql_error() );
$monitor = mysql_fetch_assoc( $result );
$select_name = "filter_name";
$filter_names = array( ''=>'Choose Filter' );
$result = mysql_query( "select * from Filters where MonitorId = '$mid' order by Name" );
if ( !$result )
die( mysql_error() );
while ( $row = mysql_fetch_assoc( $result ) )
{
$filter_names[$row[Name]] = $row[Name];
if ( $filter_name == $row[Name] )
{
$filter_data = $row;
}
}
if ( $filter_data )
{
//$filter_query = unserialize( $filter_data[Query] );
//if ( is_array($filter_query) )
//{
//while( list( $key, $value ) = each( $filter_query ) )
//{
//$$key = $value;
//}
//}
foreach( split( '&', $filter_data[Query] ) as $filter_parm )
{
list( $key, $value ) = split( '=', $filter_parm, 2 );
if ( $key )
{
$$key = $value;
}
}
}
$conjunction_types = array( 'and'=>'and', 'or'=>'or' );
$obracket_types = array( ''=>'' );
$cbracket_types = array( ''=>'' );
@ -948,21 +982,6 @@ window.focus();
<td valign="top"><table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td align="left" class="text">Use&nbsp;<select name="trms" class="form" onChange="submitToFilter( filter_form );"><?php for ( $i = 0; $i <= 8; $i++ ) { ?><option value="<?php echo $i ?>"<?php if ( $i == $trms ) { echo " selected"; } ?>><?php echo $i ?></option><?php } ?></select>&nbsp;filter&nbsp;expressions</td>
<?php
$select_name = "filter_name";
$filter_names = array( ''=>'Choose Filter' );
$result = mysql_query( "select * from Filters where MonitorId = '$mid' order by Name" );
if ( !$result )
die( mysql_error() );
while ( $row = mysql_fetch_assoc( $result ) )
{
$filter_names[$row[Name]] = $row[Name];
if ( $filter_name == $row[Name] )
{
$filter_data = $row;
}
}
?>
<td align="center" class="text">Use filter:&nbsp;<?php if ( count($filter_names) > 1 ) { buildSelect( $select_name, $filter_names, "submitToFilter( filter_form );" ); } else { ?><select class="form" disabled><option>No Saved Filters</option></select><?php } ?></td>
<td align="center" class="text"><a href="javascript: saveFilter( filter_form );">Save</a></td>
<?php if ( $filter_data ) { ?>
@ -979,17 +998,6 @@ window.focus();
<td colspan="5">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<?php
if ( $filter_data )
{
$filter_query = unserialize( $filter_data[Query] );
if ( is_array($filter_query) )
{
while( list( $key, $value ) = each( $filter_query ) )
{
$$key = $value;
}
}
}
for ( $i = 1; $i <= $trms; $i++ )
{
$conjunction_name = "cnj$i";