Location: PHPKode > projects > XMail PHP Admin Interface (XPAI) > xpai/includes/aliaslist.php
<?php
if (!$in_xpai)
  die;

if (($_SESSION['loginstatus'] >= $login_level['LoginPostmaster']) && ($_SESSION['edit_user'] != "*") && ($_SESSION['edit_domain'] != "*"))
{
  echo "<h1><a href=\"javascript:help('xpai_help.html#aliaslist','".$helpwidth."','".$helpheight."')\"><img src='gfx/ico_help.png' alt='Help' border='0'></a>&nbsp;&nbsp;";
  echo "Aliases for user<br><span class=\"blue\">".$_SESSION['edit_user']."@".$_SESSION['edit_domain']."</span></h1>";
  if (!isset($_REQUEST['Go']))
  {
?>
  	<form name='frmAliasLst' action='main.php' method='post'>
		  <input type='hidden' name='action' value='aliaslist' />
			<input type='hidden' name='edit_domain' value='<?php echo $_SESSION['edit_domain']; ?>' />
			<input type='hidden' name='edit_user' value='<?php echo $_SESSION['edit_user']; ?>'/>
  		<input type='hidden' name='enabled' value='' />
		  <input type='hidden' name='Go' value='true' />
			  <table border='0' class='tbl'>
				 	<tr>
						<td>&nbsp;</td>
					  <td>
							<a href='main.php?action=aliasadd'>
							<img src='gfx/ico_new.png' alt='New user' height='16' width='16' border='0' />
							</a>
						</td>
						<td>
							<a href='main.php?action=aliasadd'><strong>Add new alias</strong></a>
						</td>
					</tr>
<?php
//    $aliaslist = $mail_server->aliaslist($_SESSION['edit_domain'], "*", $_SESSION['edit_user']);
    $aliaslist = $mail_server->aliaslist("*", "*", $_SESSION['edit_user'].'@'.$_SESSION['edit_domain']);
    sort($aliaslist);
    foreach($aliaslist as $user) {
  	  $alias_name1 = $user[1]."@".$user[0];
  	  $alias_name1 = str_replace(".", "/.", $alias_name1);
    	echo '<tr>';
			  if (($_SESSION['loginstatus'] == $login_level['LoginSuperuser']) || !strcmp($user[0], $_SESSION['edit_domain']))
				{  
?>
  			<td>
  				<input type='checkbox' name='check_<?php echo $alias_name1; ?>' /> 
  			</td>
  		 	<td>
  		  	<a href="main.php?action=aliasdel&orig=aliaslist&sel_alias=<?php echo $user[1]; ?>&sel_aliasdom=<?php echo $user[0]; ?>" onclick="return window.confirm('Really delete alias <?php echo $user[1]."@".$user[0]; ?>?')">
		   			<img src='gfx/ico_delete.png' alt='Delete alias' height='16' width='16' border='0' />
    			</a>
<?php
				} else {
  				echo "<td>&nbsp;</td>";
  				echo "<td>&nbsp;</td>";
				}
  		  echo "</td>";
    		echo "<td>".$user[1]."@".$user[0]."</td>";
					echo "</tr>";
    }
?>
		<tr>
			<td><input type='checkbox' name='empty' disabled checked /></td>
			<td>-&gt;</td>
			<td><input type='submit' name='ask_del_marked' value=' Delete selected user aliases ' /></td>
		</tr>
		</table>
	</form>
<?php
  } else
	if (isset($_REQUEST['ask_del_marked']) && $_REQUEST['ask_del_marked'])
	{
		echo "<p><strong>You are about to delete the following user aliases:</strong></p>";
		$was_deleted = false;
		foreach($_REQUEST as $var=>$val)
    {
			if (ereg("check_", $var) && $val != '')
      {
				$var = substr($var, 6);
				$var = str_replace("/_", ".", $var);
				echo $var."<br>";
				$was_deleted = true;
			}
		}
		if (!$was_deleted)
		{
      echo "No user aliases selected.<br>";
		}
?>
	<p>Do you really want to delete these user aliases?</p>

	<form action='main.php' method='get'>
	  <input type='hidden' name='action' value='aliaslist' />
		<input type='hidden' name='edit_domain' value='<?php echo $_REQUEST['edit_domain']; ?>' />
		<input type='hidden' name='edit_user' value='<?php echo $_REQUEST['edit_user']; ?>' />
<?php
		foreach($_REQUEST as $var=>$val)
    {
			if (ereg("check_", $var) && $val != '')
      {
					echo "<input type='hidden' name='".$var."' value='".$val."'/>\n";
			}
		}
?>
		<input type='hidden' name='Go' value='true' />
		<input type='submit' name='del_marked' style='width: 50px;' value=' No '/>
		<input type='submit' name='del_marked' style='width: 50px;' value=' Yes '/>
	</form>
<?php
  } else
	if (isset($_REQUEST['del_marked']) && (trim($_REQUEST['del_marked']) == "Yes"))
	{	
	  $was_deleted = false;
		foreach($_REQUEST as $var=>$val)
    {
			if (ereg("check_", $var) && $val != '')
      {
				$var = substr($var, 6);
				$var = str_replace("/_", ".", $var);
				$del_alias = explode("@", $var);
				
  			if ($mail_server->aliasdel($del_alias[1], $del_alias[0]))
        {
  				echo "Alias <strong>".$del_alias[0]."@".$del_alias[1]."</strong> for user <strong>".$_SESSION['edit_user']."@".$_SESSION['edit_domain']."</strong> was deleted successfully.<br>";
          echo "Server result: ".$_SESSION['LastXMAILResult']."<br><br>";
  			} else {
  				echo "Alias <strong>".$del_alias[0]."@".$del_alias[1]."</strong> for user <strong>".$_SESSION['edit_user']."@".$_SESSION['edit_domain']."</strong> could not be deleted.<br>";
          echo "Server result: ".$_SESSION['LastXMAILResult']."<br><br>";
        }
				
			  $was_deleted = true;
			}
		}
		if (!$was_deleted)
		{
      echo "No user aliases for deletion selected.<br>";
		}
	?>
	<form action='main.php' method='post'>
		<input type='hidden' name='action' value='aliaslist'>
		<input type='submit' name='click' style='width: 50px;' value=' OK '>
	</form>

<?php 
  } else
	if (isset($_REQUEST['del_marked']) && (trim($_REQUEST['del_marked']) == "No"))
	{
      echo "No user aliases deleted.<br>";
	?>
	<form action='main.php' method='post'>
		<input type='hidden' name='action' value='aliaslist'>
		<input type='submit' name='click' style='width: 50px;' value=' OK '>
	</form>
<?php
	}
} else {
  echo "<br><br><h2>Authorization failed to access this function!</h2><br><br>";
}
?>

Return current item: XMail PHP Admin Interface (XPAI)