Location: PHPKode > projects > CsWebmail > cswebmail-3.10/cswebmail-3.10/templates/filters.php
<?
if(VALID_DOCUMENT != 1) die('what?');
if($action == 'filters-edit'){
  $entry = get_var('entry');
?>
<script type="text/javascript">
function check_form(form){
  if(form["name"].value=="") alert("Fill name");
  else form.submit();
}
</script>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<input type="hidden" name="entry" value="<?=$entry?>"/>
<input type="hidden" name="action" value=""/>
<table class="content hsides">
<?$_SESSION['procmail']->get_edit_presentation($entry)?>
<tr><td colspan="3">
<input type="button" value="save" onclick="action.value='filters-save';check_form(this.form)"/>
<input type="button" value="cancel" onclick="action.value='filters-cancel';this.form.submit()"/>
</td></tr>
</table>
</form>
    
<?}else if($action == 'filters-new' || $action == 'filters-spam-filter' || $action == 'filters-vacation-filter'){?>
 
<script type="text/javascript">
function check_form(form){
  if(form["name"].value=="") alert("Fill name");
  else form.submit();
}
</script>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<input type="hidden" name="entry" value="<?=$entry?>"/>
<input type="hidden" name="action" value=""/>
<table class="content hsides">
<?
    if($action == 'filters-new')
      $_SESSION['procmail']->get_edit_presentation();
    else if($action == 'filters-spam-filter')
      $_SESSION['procmail']->get_edit_presentation($_SESSION['procmail']->anti_spam_rule_name);
    else if($action == 'filters-vacation-filter')
      $_SESSION['procmail']->get_edit_presentation($_SESSION['procmail']->vacation_rule_name);
?>
<tr><td colspan="3">
<input type="button" value="add" onclick="action.value='filters-add';check_form(this.form)"/>
<input type="button" value="cancel" onclick="action.value='filters-cancel';this.form.submit()"/>
</td></tr>
</table>
</form>
<?}
else if($action == 'filters-refresh'){
  $_SESSION['procmail'] = new Procmail(PROCMAIL_FILE);
  location_header($_SERVER['PHP_SELF'].'?action=filters');
}
else if($action == 'filters-block'){
  if(preg_match('/.+@.+/',get_var('email'))){
    $_SESSION['procmail']->block_email(get_var('email'));
    $_SESSION['procmail']->store();
    $title = 'Address Blocking';
    include(TMPLPATH."html_start.php");
?>
<table class="content hsides">
   <tr><td><b><?=get_var('email')?></b> blocked</td></tr>
   <tr><td class="center"><input type="button" value="close" onclick="window.close()"/></td></tr>
</table>
  <?
   include(TMPLPATH."html_end.php");
  }
}
else if($action == 'filters-add' || $action == 'filters-save'){
  $_SESSION['procmail']->load(get_var('entry'));
  $_SESSION['procmail']->store();
  location_header($_SERVER['PHP_SELF'].'?action=filters');
}
else if($action == 'filters-delete'){
  $_SESSION['procmail']->delete(get_var('key'));
  $_SESSION['procmail']->store();
  location_header($_SERVER['PHP_SELF'].'?action=filters');
}
else if($action == 'filters-move-up'){
  $_SESSION['procmail']->move_up(get_var('entry'));
  $_SESSION['procmail']->store();
  location_header($_SERVER['PHP_SELF'].'?action=filters');
}
else if($action == 'filters-move-down'){
  $_SESSION['procmail']->move_down(get_var('entry'));
  $_SESSION['procmail']->store();
  location_header($_SERVER['PHP_SELF'].'?action=filters');
}
else{
  ?>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<input type="hidden" name="action" value=""/>
<table class="content hsides">
<tr><th colspan="4" class="title">Filters Management</th></tr>
<?$_SESSION['procmail']->get_presentation()?>
<tr><td colspan="6">
<input type="button" value="check all" onclick="javascript:setChecked(this.form,'key',1)"/>
<input type="button" value="clear all" onclick="javascript:setChecked(this.form,'key',0)"/>
&nbsp;&nbsp;
<input type="button" value="delete" onclick="action.value='filters-delete';this.form.submit()"/>
<input type="button" value="refresh" onclick="action.value='filters-refresh';this.form.submit()"/>
<br/>
<input type="button" value="new filter" onclick="action.value='filters-new';this.form.submit()"/>
<input type="button" value="new spam filter" onclick="action.value='filters-spam-filter';this.form.submit()"/>
<input type="button" value="new vacation message" onclick="action.value='filters-vacation-filter';this.form.submit()"/>
<br/>
</td></tr>
</table>
<?}?>
Return current item: CsWebmail