SF.net SVN: postfixadmin:[1086] trunk
Brought to you by:
christian_boltz,
gingerdog
From: <chr...@us...> - 2011-07-18 22:48:53
|
Revision: 1086 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=1086&view=rev Author: christian_boltz Date: 2011-07-18 22:48:46 +0000 (Mon, 18 Jul 2011) Log Message: ----------- edit-alias.php, edit-domain.php, edit-vacation.php, create-alias-domain.php, password.php, viewlog.php: - replaced tMessage with flash_error() / flash_info() edit-alias.php: - removed now superfluous code to merge multiple tMessage with <br> - removed a </span> that was added after $PALANG['pEdit_alias_goto_text_error2'] This commit is part of the huge cleanup patch by Dale Blount (lnxus@SF), https://sourceforge.net/tracker/?func=detail&atid=937966&aid=3370510&group_id=191583 Modified Paths: -------------- trunk/create-alias-domain.php trunk/edit-alias.php trunk/edit-domain.php trunk/edit-vacation.php trunk/password.php trunk/viewlog.php Modified: trunk/create-alias-domain.php =================================================================== --- trunk/create-alias-domain.php 2011-07-18 22:36:38 UTC (rev 1085) +++ trunk/create-alias-domain.php 2011-07-18 22:48:46 UTC (rev 1086) @@ -19,7 +19,7 @@ * * Template Variables: * - * tMessage + * none * * Form POST \ GET Variables: * @@ -66,9 +66,10 @@ if (isset($list_aliases[$dom]) || in_array($dom,$list_aliases)) continue; $alias_domains[] = $dom; } + if (count($alias_domains) == 0) { $error = 1; - $tMessage = $PALANG['pCreate_alias_domain_error4']; + flash_error($PALANG['pCreate_alias_domain_error4']); } # filter available target domains @@ -102,7 +103,7 @@ check_owner ($SESSID_USERNAME, $fTargetDomain))) { $error = 1; - $tMessage = $PALANG['pCreate_alias_domain_error1']; + flash_error($PALANG['pCreate_alias_domain_error1']); } if (isset($list_aliases[$fAliasDomain]) || // alias_domain is unique (primary key, a domain can't be an alias for multiple others) @@ -112,7 +113,7 @@ empty($fAliasDomain) || empty($fTargetDomain)) // explain this, do i? { $error = 1; - $tMessage = $PALANG['pCreate_alias_domain_error2']; + flash_error($PALANG['pCreate_alias_domain_error2']); } $sqlActive = db_get_boolean($fActive); @@ -121,7 +122,7 @@ $result = db_query ("INSERT INTO $table_alias_domain (alias_domain,target_domain,created,modified,active) VALUES ('$fAliasDomain','$fTargetDomain',NOW(),NOW(),'$sqlActive')"); if ($result['rows'] != 1) { $error = 1; - $tMessage = $PALANG['pCreate_alias_domain_error3']; + flash_error($PALANG['pCreate_alias_domain_error3']); } else { db_log ($fAliasDomain, 'create_alias_domain', "$fAliasDomain -> $fTargetDomain"); @@ -133,14 +134,14 @@ } } - $tMessage .= "<br />($fAliasDomain -> $fTargetDomain)<br />\n"; + flash_info("<br />($fAliasDomain -> $fTargetDomain)<br />\n"); } + + $smarty->assign ('alias_domains', (count($alias_domains) > 0)); $smarty->assign ('select_options_alias', select_options ($alias_domains, array ($fAliasDomain)), false); $smarty->assign ('select_options_target', select_options ($target_domains, array ($fTargetDomain)), false); if ($fActive) $smarty->assign ('fActive', ' checked="checked"'); -if ($error == 1) $tMessage = '<span class="error_msg">'.$tMessage.'</span>'; -$smarty->assign ('tMessage', $tMessage, false); $smarty->assign ('smarty_template', 'create-alias-domain'); $smarty->display ('index.tpl'); /* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */ Modified: trunk/edit-alias.php =================================================================== --- trunk/edit-alias.php 2011-07-18 22:36:38 UTC (rev 1085) +++ trunk/edit-alias.php 2011-07-18 22:48:46 UTC (rev 1086) @@ -19,7 +19,6 @@ * * Template Variables: * - * tMessage * tGoto * * Form POST \ GET Variables: @@ -99,7 +98,7 @@ { $error = 1; $tGoto = $fGoto; - $tMessage = $PALANG['pEdit_alias_result_error']; + flash_error($PALANG['pEdit_alias_result_error']); } $goto = preg_replace ('/\\\r\\\n/', ',', $fGoto); @@ -113,7 +112,7 @@ { $error = 1; $tGoto = $_POST['fGoto']; - $tMessage = $PALANG['pEdit_alias_goto_text_error1']; + flash_error($PALANG['pEdit_alias_goto_text_error1']); } $new_aliases = array(); @@ -130,8 +129,7 @@ { $error = 1; $tGoto = $goto; - if (!empty($tMessage)) $tMessage .= "<br />"; - $tMessage .= $PALANG['pEdit_alias_goto_text_error2'] . "$address</span>"; + flash_error($PALANG['pEdit_alias_goto_text_error2'] . "$address"); } } @@ -157,7 +155,7 @@ $result = db_query ("UPDATE $table_alias SET goto='$goto',modified=NOW() WHERE address='$fAddress' AND domain='$fDomain'"); if ($result['rows'] != 1) { - $tMessage = $PALANG['pEdit_alias_result_error']; + flash_error($PALANG['pEdit_alias_result_error']); } else { @@ -174,7 +172,6 @@ $smarty->assign ('fAddress', $fAddress); $smarty->assign ('tGoto', $tGoto); $smarty->assign ('array', $array, false); -$smarty->assign ('tMessage', $tMessage, false); $smarty->assign ('smarty_template', 'edit-alias'); $smarty->display ('index.tpl'); Modified: trunk/edit-domain.php =================================================================== --- trunk/edit-domain.php 2011-07-18 22:36:38 UTC (rev 1085) +++ trunk/edit-domain.php 2011-07-18 22:48:46 UTC (rev 1086) @@ -115,7 +115,7 @@ header ("Location: list-domain.php"); exit; } else { - $tMessage = $PALANG['pAdminEdit_domain_result_error']; + flash_error($PALANG['pAdminEdit_domain_result_error']); } } @@ -128,7 +128,6 @@ $smarty->assign ('select_options', select_options($CONF['transport_options'], array($tTransport)), false); if ($tBackupmx) $smarty->assign ('tBackupmx', ' checked="checked"'); if ($tActive) $smarty->assign ('tActive', ' checked="checked"'); -$smarty->assign ('tMessage', $tMessage,false); $smarty->assign ('smarty_template', 'admin_edit-domain'); $smarty->display ('index.tpl'); Modified: trunk/edit-vacation.php =================================================================== --- trunk/edit-vacation.php 2011-07-18 22:36:38 UTC (rev 1085) +++ trunk/edit-vacation.php 2011-07-18 22:48:46 UTC (rev 1086) @@ -20,7 +20,6 @@ * Template Variables: * * tUseremail - * tMessage * tSubject * tBody * @@ -72,7 +71,6 @@ if ($result['rows'] == 1) { $row = db_array($result['result']); - $tMessage = ''; $tSubject = $row['subject']; $tBody = $row['body']; $tActiveFrom = $row['activefrom']; @@ -137,14 +135,14 @@ if($error == 0) { if(!empty ($fBack)) { - $tMessage = $PALANG['pVacation_result_removed']; + flash_info($PALANG['pVacation_result_removed']); } if(!empty($fChange)) { - $tMessage= $PALANG['pVacation_result_added']; + flash_info($PALANG['pVacation_result_added']); } } else { - $tMessage = $PALANG['pVacation_result_error']; + flash_error($PALANG['pVacation_result_error']); } if (empty ($tActiveFrom)) $tActiveFrom = date ("Y-m-d"); @@ -154,7 +152,6 @@ $smarty->assign ('tUseremail', $tUseremail); $smarty->assign ('tSubject', $tSubject); $smarty->assign ('tBody', $tBody ,false); -$smarty->assign ('tMessage', $tMessage, false); $smarty->assign ('tActiveFrom', date ("d.m.Y", strtotime ($tActiveFrom))); $smarty->assign ('tActiveUntil', date ("d.m.Y", strtotime ($tActiveUntil))); $smarty->assign ('fCanceltarget', $fCanceltarget); Modified: trunk/password.php =================================================================== --- trunk/password.php 2011-07-18 22:36:38 UTC (rev 1085) +++ trunk/password.php 2011-07-18 22:48:46 UTC (rev 1086) @@ -18,7 +18,7 @@ * * Template Variables: * - * tMessage + * none * * Form POST \ GET Variables: * @@ -83,17 +83,16 @@ $result = db_query ("UPDATE $table_admin SET password='$password',modified=NOW() WHERE username='$username'"); if ($result['rows'] == 1) { - $tMessage = $PALANG['pPassword_result_success']; + flash_info($PALANG['pPassword_result_success']); } else { - $tMessage = $PALANG['pPassword_result_error']; + flash_error($PALANG['pPassword_result_error']); } } $smarty->assign ('pPassword_password_current_text', $pPassword_password_current_text); $smarty->assign ('pPassword_password_text', $pPassword_password_text); - $smarty->assign ('tMessage', $tMessage,false); $smarty->display ('index.tpl'); } Modified: trunk/viewlog.php =================================================================== --- trunk/viewlog.php 2011-07-18 22:36:38 UTC (rev 1085) +++ trunk/viewlog.php 2011-07-18 22:48:46 UTC (rev 1086) @@ -19,7 +19,6 @@ * * Template Variables: * - * tMessage * tLog * * Form POST \ GET Variables: @@ -50,7 +49,7 @@ if (! (check_owner ($SESSID_USERNAME, $fDomain) || authentication_has_role('global-admin'))) { $error = 1; - $tMessage = $PALANG['pViewlog_result_error']; + flash_error($PALANG['pViewlog_result_error']); } // we need to initialize $tLog as an array! This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |