<?php
/********************

   Engsoc PHP Registry

 Copyright 2000 Philip Steinke and Kevin Everets
 Licensed under the GNU General Public License

********************/ 
include ('includes/header.inc.php'); 
disp_header("Registry Email Preferences");
if (!
check_auth()) {
    
disp_not_logged_in();
}
disp_navbar();

/*****
 * Email Forwarding
 *****/
$homedir "/home/" substr($webuser->handle01) . "/" .  $webuser->handle;
$forward_file "$homedir/.forward";
// if the user has specified a new address, replace the forward file
if (isset($forward)) {
    
// ensure there's no whitespace before or after the address
    
$forward trim($forward);
    
// if they put no address, ensure there's no forward file
    
if (empty($forward)) {
        
unlink($forward_file);
    
// otherwise overwrite anything that's there with the new address
    
} else {
        
// allow group www-data to write to it as well
        
$fwd_handle fopen($forward_file'w');
        
umask(0022);
        
fwrite($fwd_handle$forward);
        
fclose($fwd_handle);
    }
} else {
    
// put the first line of the .forward file into $forward
    
if (file_exists($forward_file)) {
        
$contents file($forward_file);
        
$forward $contents[0];
    }
}

?>
<h3>Forwarding Address</h3>
<p>
Entering an email address here will forward any email sent to your registry
account (<tt><?php echo $webuser->handle.'@'.$reg_domain ?></tt>) to that address.
To cancel forwarding and keep your mail on the registry server, simply
remove any forwarding address and select "Update".
</p>
<form action="<?php echo basename($PHP_SELF?>" method="post">
<p>
    Forward mail to:
    <input type="text" size="30" name="forward" value="<?php echo $forward ?>" />
</p>
<p>
    <input type="image" src="images/buttons/update.png" name="update"
           alt="Update" value="Update" 
           <?php if ($using_ns4) print 'border="0" '?>/>
</p>
</form>
<h3>Help!</h3>
<p>Confused about how registry email works, or what limits there might be?
<a href="email_help.php">Read this</a>.
</p>
<?php 
/*****
 * Procmail Filters
 *****/

/*  Filters are disabled for now.

// we could always offer a toggle to let people use junkfilter on their
// mail, dumping any matches into a folder called 'spam'.  Maybe after
// production.

// copy the interface from evolution; theirs seems good:
// when (text) is in the (to / from / subject / body) store the
// mail in (folder)

// make (folder) a drop-down list of available folders.  Make them use a
// mail reader to add a new folder.  Some help will be needed here on:
//  - how to add a folder
//  - what a filter will match (words.. wildcards)
//  - filter examples
?>
<hr />
<h3>Filters</h3>
<p>
Filters let you sort your email as it's delivered.  It will then appear in
these same sorted folders in the registry web-mail or any program you use 
to read it.
</p>
<?php  // display help
if (!isset($filterHelp)) { ?>
<p>
    <a href="<?php echo basename($PHP_SELF) . '?filterHelp=1' ?>">Help!</a>
</p>
<?php } else { ?>
<h4>Filter Help</h4>
<p>
    filter help goes here.
</p>
<?php
} // end help display

// A few different options for filters:
//  - list existing (default)
//  - add new
//  - delete selected (chosen while listing)
switch ($filterDo) {
    case "

*/

include ('includes/footer.inc.php'); ?>