SF.net SVN: postfixadmin:[1350] trunk
Brought to you by:
christian_boltz,
gingerdog
From: <chr...@us...> - 2012-04-08 21:18:33
|
Revision: 1350 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=1350&view=rev Author: christian_boltz Date: 2012-04-08 21:18:27 +0000 (Sun, 08 Apr 2012) Log Message: ----------- templates/list-virtual_alias.tpl, templates/list-virtual_mailbox.tpl: - change edit-alias.php links to edit.php?table=alias edit-alias.php, templates/edit-alias.tpl: - now obsolete :-) -> deleted Modified Paths: -------------- trunk/templates/list-virtual_alias.tpl trunk/templates/list-virtual_mailbox.tpl Removed Paths: ------------- trunk/edit-alias.php trunk/templates/edit-alias.tpl Deleted: trunk/edit-alias.php =================================================================== --- trunk/edit-alias.php 2012-04-08 21:17:56 UTC (rev 1349) +++ trunk/edit-alias.php 2012-04-08 21:18:27 UTC (rev 1350) @@ -1,178 +0,0 @@ -<?php -/** - * Postfix Admin - * - * LICENSE - * This source file is subject to the GPL license that is bundled with - * this package in the file LICENSE.TXT. - * - * Further details on the project are available at : - * http://www.postfixadmin.com or http://postfixadmin.sf.net - * - * @version $Id$ - * @license GNU GPL v2 or later. - * - * File: edit-alias.php - * Used to update an alias. - * - * Template File: edit-alias.tpl - * - * Template Variables: - * - * tGoto - * - * Form POST \ GET Variables: - * - * fAddress - * fDomain - * fGoto - */ - -require_once('common.php'); - -authentication_require_role('admin'); -$SESSID_USERNAME = authentication_get_username(); - -if($CONF['alias_control_admin'] == 'NO' && !authentication_has_role('global-admin')) { - die("Check config.inc.php - domain administrators do not have the ability to edit user's aliases (alias_control_admin)"); -} - -/* retrieve existing alias record for the user first... may be via GET or POST */ - -$fAddress = safepost('address', safeget('address')); # escaped below -$fDomain = escape_string(preg_replace("/.*@/", "", $fAddress)); -$fAddress = escape_string($fAddress); # escaped now -if ($fAddress == "") { - die("Required parameters not present"); -} - -/* Check the user is able to edit the domain's aliases */ - - if(!check_owner($SESSID_USERNAME, $fDomain) && !authentication_has_role('global-admin')) - { - die("You lack permission to do this. yes."); - } - - $table_alias = table_by_key('alias'); - $alias_list = array(); - $orig_alias_list = array(); - $result = db_query ("SELECT * FROM $table_alias WHERE address='$fAddress' AND domain='$fDomain'"); - if ($result['rows'] == 1) - { - $row = db_array ($result['result']); - $tGoto = $row['goto']; - $orig_alias_list = explode(',', $tGoto); - $tGoto = str_replace(',', "\n", $tGoto); - $alias_list = $orig_alias_list; - //. if we are not a global admin, and alias_control_admin is NO, hide the alias that's the mailbox name. - if($CONF['alias_control_admin'] == 'NO' && !authentication_has_role('global-admin')) { - - /* Has a mailbox as well? Remove the address from $tGoto in order to edit just the real aliases */ - $result = db_query ("SELECT * FROM $table_mailbox WHERE username='$fAddress' AND domain='$fDomain'"); - if ($result['rows'] == 1) - { - $alias_list = array(); // empty it, repopulated again below - foreach($orig_alias_list as $alias) { - if(strtolower($alias) == strtolower($fAddress)) { - // mailbox address is dropped if they don't have special_alias_control enabled, and/or not a global-admin - } - else { - $alias_list[] = $alias; - } - } - } - } -} -else { - die("Invalid alias"); -} - -if ($_SERVER['REQUEST_METHOD'] == "POST") -{ - $pEdit_alias_goto = $PALANG['pEdit_alias_goto']; - - if (isset ($_POST['fGoto'])) $fGoto = escape_string ($_POST['fGoto']); - $fGoto = strtolower ($fGoto); - - if (!check_alias_owner ($SESSID_USERNAME, $fAddress)) - { - $error = 1; - $tGoto = $fGoto; - flash_error($PALANG['pEdit_alias_result_error']); - } - - $goto = preg_replace ('/\\\r\\\n/', ',', $fGoto); - $goto = preg_replace ('/\r\n/', ',', $goto); - $goto = preg_replace ('/,[\s]+/i', ',', $goto); - $goto = preg_replace ('/[\s]+,/i', ',', $goto); - $goto = preg_replace ('/,*$|^,*/', '', $goto); - $goto = preg_replace ('/,,*/', ',', $goto); - - if (empty ($goto) && !authentication_has_role('global-admin')) - { - $error = 1; - $tGoto = $_POST['fGoto']; - flash_error($PALANG['pEdit_alias_goto_text_error1']); - } - - $new_aliases = array(); - if ($error != 1) - { - $new_aliases = explode(',', $goto); - } - $new_aliases = array_unique($new_aliases); - - foreach($new_aliases as $address) { - if (in_array($address, $CONF['default_aliases'])) continue; - if (empty($address)) continue; # TODO: should never happen - remove after 2.2 release - if (!check_email($address)) - { - $error = 1; - $tGoto = $_POST['fGoto']; - flash_error($PALANG['pEdit_alias_goto_text_error2'] . "$address"); - } - } - - $result = db_query ("SELECT * FROM $table_mailbox WHERE username='$fAddress' AND domain='$fDomain'"); - if ($result['rows'] == 1) - { - if($CONF['alias_control_admin'] == 'NO' && !authentication_has_role('global-admin')) { - // if original record had a mailbox alias, so ensure the updated one does too. - if(in_array($fAddress, $orig_alias_list)) { - $new_aliases[] = $fAddress; - } - } - - } - // duplicates suck, mmkay.. - $new_aliases = array_unique($new_aliases); - - $goto = implode(',', $new_aliases); - - if ($error != 1) - { - $goto = escape_string($goto); - $result = db_query ("UPDATE $table_alias SET goto='$goto',modified=NOW() WHERE address='$fAddress' AND domain='$fDomain'"); - if ($result['rows'] != 1) - { - flash_error($PALANG['pEdit_alias_result_error']); - } - else - { - db_log ($fDomain, 'edit_alias', "$fAddress -> $goto"); - - header ("Location: list-virtual.php?domain=$fDomain"); - exit; - } - } -} - -$smarty->assign ('mode', 'edit'); -$smarty->assign ('pCreate_alias_address_text_error', ''); -$smarty->assign ('fAddress', $fAddress); -$smarty->assign ('tGoto', $tGoto); -$smarty->assign ('smarty_template', 'edit-alias'); -$smarty->display ('index.tpl'); - -/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */ -?> Deleted: trunk/templates/edit-alias.tpl =================================================================== --- trunk/templates/edit-alias.tpl 2012-04-08 21:17:56 UTC (rev 1349) +++ trunk/templates/edit-alias.tpl 2012-04-08 21:18:27 UTC (rev 1350) @@ -1,47 +0,0 @@ -<div id="edit_form"> -<form name="alias" method="post" action=""> -<table> - <tr> - <th colspan="4"> -{if $mode == 'edit'} - {$PALANG.pEdit_alias_welcome} -{else} - {$PALANG.pCreate_alias_welcome}</th> -{/if} - </tr> - <tr> - <td class="label"><label>{$PALANG.pEdit_alias_address}:</label></td> - <td> -{if $mode == 'edit'} - <em>{$fAddress}</em> -{else} - <input class="flat" type="text" name="fAddress" value="{$tAddress}" /> - @ - <select class="flat" name="fDomain">{$select_options}</select> -{/if} - </td> - <td>{if $mode == 'create'}{$PALANG.pCreate_alias_catchall_text}{/if}</td> - <td><span class="error_msg">{$pCreate_alias_address_text_error}</span></td> - </tr> - <tr> - <td class="label"><label>{$PALANG.pEdit_alias_goto}:</label></td> - <td><textarea class="flat" rows="10" cols="35" name="fGoto">{$tGoto}</textarea></td> - <td>{$PALANG.pCreate_alias_goto_text}<br /><br />{$PALANG.pEdit_alias_help}</td> - <td> </td> - </tr> -{if $mode == 'create'} -<!-- TODO: 'active' should also be available in edit-alias --> - <tr> - <td class="label"><label>{$PALANG.pCreate_alias_active}:</label></td> - <td><input class="flat" type="checkbox" name="fActive" checked="checked"/></td> - <td colspan="2"> </td> - </tr> -{/if} - <tr> - <td> </td> - <td colspan="3"><input class="button" type="submit" name="submit" - value="{if $mode == 'edit'}{$PALANG.save}{else}{$PALANG.pCreate_alias_button}{/if}" /></td> - </tr> -</table> -</form> -</div> Modified: trunk/templates/list-virtual_alias.tpl =================================================================== --- trunk/templates/list-virtual_alias.tpl 2012-04-08 21:17:56 UTC (rev 1349) +++ trunk/templates/list-virtual_alias.tpl 2012-04-08 21:18:27 UTC (rev 1350) @@ -35,12 +35,12 @@ {if $authentication_has_role.global_admin==true} {assign var="address" value=$item.address|escape:"url"} <td><a href="edit-active.php?alias={$item.address|escape:"url"}&domain={$fDomain|escape:"url"}&return={$file|escape:"url"}?domain={$fDomain|escape:"url"}&limit={$current_limit|escape:"url"}">{if $item.active==1}{$PALANG.YES}{else}{$PALANG.NO}{/if}</a></td> - <td><a href="edit-alias.php?address={$item.address|escape:"url"}&domain={$fDomain|escape:"url"}">{$PALANG.edit}</a></td> + <td><a href="edit.php?table=alias&edit={$item.address|escape:"url"}">{$PALANG.edit}</a></td> <td><a href="delete.php?table=alias&delete={$item.address|escape:"url"}&domain={$fDomain|escape:"url"}" onclick="return confirm ('{$PALANG.confirm}{$PALANG.pOverview_get_aliases}: {$item.address}');">{$PALANG.del}</a></td> {else} {if $CONF.special_alias_control===YES || $check_alias_owner[$i]==true} <td><a href="edit-active.php?alias={$item.address|escape:"url"}&domain={$fDomain|escape:"url"}">{if $item.active==1}{$PALANG.YES}{else}{$PALANG.NO}{/if}</a></td> - <td><a href="edit-alias.php?address={$item.address|escape:"url"}&domain={$fDomain|escape:"url"}">{$PALANG.edit}</a></td> + <td><a href="edit.php?table=alias&edit={$item.address|escape:"url"}">{$PALANG.edit}</a></td> <td><a href="delete.php?table=alias&delete={$item.address|escape:"url"}&domain={$fDomain|escape:"url"}" onclick="return confirm ('{$PALANG.confirm}{$PALANG.pOverview_get_aliases}: {$item.address}');">{$PALANG.del}</a></td> {else} <td>{if $item.active==1}{$PALANG.YES}{else}{$PALANG.NO}{/if}</td> Modified: trunk/templates/list-virtual_mailbox.tpl =================================================================== --- trunk/templates/list-virtual_mailbox.tpl 2012-04-08 21:17:56 UTC (rev 1349) +++ trunk/templates/list-virtual_mailbox.tpl 2012-04-08 21:18:27 UTC (rev 1350) @@ -83,7 +83,7 @@ {if $authentication_has_role.global_admin!==true && $CONF.alias_control_admin===YES}{assign var="edit_aliases" value=1}{/if} {if $authentication_has_role.global_admin==true && $CONF.alias_control===YES}{assign var="edit_aliases" value=1}{/if} {if $edit_aliases==1} - <td><a href="edit-alias.php?address={$item.username|escape:"url"}&domain={$fDomain|escape:"url"}">{$PALANG.pOverview_alias_edit}</a></td> + <td><a href="edit.php?table=alias&edit={$item.username|escape:"url"}">{$PALANG.pOverview_alias_edit}</a></td> {/if} <td><a href="edit-mailbox.php?username={$item.username|escape:"url"}&domain={$fDomain|escape:"url"}">{$PALANG.edit}</a></td> <td><a href="delete.php?table=mailbox&delete={$item.username|escape:"url"}&domain={$fDomain|escape:"url"}" onclick="return confirm ('{$PALANG.confirm}{$PALANG.pOverview_get_mailboxes}: {$item.username}');">{$PALANG.del}</a></td> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |