diff options
Diffstat (limited to 'config/postfix/postfix_view_config.php')
-rw-r--r-- | config/postfix/postfix_view_config.php | 196 |
1 files changed, 120 insertions, 76 deletions
diff --git a/config/postfix/postfix_view_config.php b/config/postfix/postfix_view_config.php index ab136a2a..2c0b973e 100644 --- a/config/postfix/postfix_view_config.php +++ b/config/postfix/postfix_view_config.php @@ -2,7 +2,7 @@ /* postfix_view_config.php part of pfSense (http://www.pfsense.com/) - Copyright (C) 2010 Marcello Coutinho <marcellocoutinho@gmail.com> + Copyright (C) 2011 Marcello Coutinho <marcellocoutinho@gmail.com> based on varnish_view_config. All rights reserved. @@ -29,83 +29,127 @@ */ require("guiconfig.inc"); +function get_file($file){ + $files['main']="/usr/local/etc/postfix/main.cf"; + $files['master']="/usr/local/etc/postfix/master.cf"; + $files['recipients']="/usr/local/etc/postfix/relay_recipients"; + $files['header']="/usr/local/etc/postfix/header_check"; + $files['mime']="/usr/local/etc/postfix/mime_check"; + $files['body']="/usr/local/etc/postfix/body_check"; + $files['cidr']="/usr/local/etc/postfix/cal_cidr"; + $files['pcre']="/usr/local/etc/postfix/cal_pcre"; -$pfSversion = str_replace("\n", "", file_get_contents("/etc/version")); -if(strstr($pfSversion, "1.2")) - $one_two = true; + if ($files[$file]!="" && file_exists($files[$file])){ + print '<textarea rows="50" cols="100%">'; + print $files[$file]."\n".file_get_contents($files[$file]); + print '</textarea>'; + } +} -$pgtitle = "Services: Postfix View Configuration"; -include("head.inc"); - -?> -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> -<?php include("fbegin.inc"); ?> - -<?php if($one_two): ?> -<p class="pgtitle"><?=$pgtitle?></font></p> -<?php endif; ?> - -<?php if ($savemsg) print_info_box($savemsg); ?> - -<form action="postfix_view_config.php" method="post"> +if ($_REQUEST['file']!=""){ + get_file($_REQUEST['file']); + } +else{ + $pfSversion = str_replace("\n", "", file_get_contents("/etc/version")); + if(strstr($pfSversion, "1.2")) + $one_two = true; -<div id="mainlevel"> - <table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr><td> -<?php - $tab_array = array(); - $tab_array[] = array(gettext("General"), false, "/pkg_edit.php?xml=postfix.xml&id=0"); - $tab_array[] = array(gettext("ACLs / Filter Maps"), false, "/pkg_edit.php?xml=postfix_acl.xml&id=0"); - $tab_array[] = array(gettext("Valid Recipients"), false, "/pkg_edit.php?xml=postfix_recipients.xml&id=0"); - $tab_array[] = array(gettext("Antispam"), false, "/pkg_edit.php?xml=postfix_antispam.xml&id=0"); - $tab_array[] = array(gettext("XMLRPC Sync"), false, "/pkg_edit.php?xml=postfix_sync.xml&id=0"); - $tab_array[] = array(gettext("View config files"), true, "/postfix_view_config.php"); - $tab_array[] = array(gettext("Search Email"), false, "/postfix_search.php"); - display_top_tabs($tab_array); -?> - </td></tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> + $pgtitle = "Services: Postfix View Configuration"; + include("head.inc"); + + ?> + <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> + <?php include("fbegin.inc"); ?> + + <?php if($one_two): ?> + <p class="pgtitle"><?=$pgtitle?></font></p> + <?php endif; ?> + + <?php if ($savemsg) print_info_box($savemsg); ?> + + <form action="postfix_view_config.php" method="post"> + + <div id="mainlevel"> + <table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr><td> + <?php + $tab_array = array(); + $tab_array[] = array(gettext("General"), false, "/pkg_edit.php?xml=postfix.xml&id=0"); + $tab_array[] = array(gettext("Domains"), false, "/pkg_edit.php?xml=postfix_domains.xml&id=0"); + $tab_array[] = array(gettext("Recipients"), false, "/pkg_edit.php?xml=postfix_recipients.xml&id=0"); + $tab_array[] = array(gettext("Access Lists"), false, "/pkg_edit.php?xml=postfix_acl.xml&id=0"); + $tab_array[] = array(gettext("Antispam"), false, "/pkg_edit.php?xml=postfix_antispam.xml&id=0"); + $tab_array[] = array(gettext("Sync"), false, "/pkg_edit.php?xml=postfix_sync.xml&id=0"); + $tab_array[] = array(gettext("View config"), true, "/postfix_view_config.php"); + $tab_array[] = array(gettext("Search mail"), false, "/postfix_search.php"); + $tab_array[] = array(gettext("Queue"), false, "/postfix_queue.php"); + $tab_array[] = array(gettext("About"), false, "/postfix_about.php"); + display_top_tabs($tab_array); + ?> + </td></tr> + <tr> + <td> + <div id="mainarea"> + <table class="tabcont" width="100%" border="0" cellpadding="8" cellspacing="0"> + <tr><td></td></tr> <tr> - <td class="tabcont" > - <input type="button" onClick="location.href='./postfix_view_config.php?file=0'" value="main.cf"> - <input type="button" onClick="location.href='./postfix_view_config.php?file=1'" value="master.cf"> - <input type="button" onClick="location.href='./postfix_view_config.php?file=2'" value="relay_recipients"> - <input type="button" onClick="location.href='./postfix_view_config.php?file=3'" value="header_check"> - <input type="button" onClick="location.href='./postfix_view_config.php?file=4'" value="mime_check"> - <input type="button" onClick="location.href='./postfix_view_config.php?file=5'" value="body_check"> - <input type="button" onClick="location.href='./postfix_view_config.php?file=6'" value="client CIDR"> - <input type="button" onClick="location.href='./postfix_view_config.php?file=7'" value="client PCRE"> - </td> - </tr> - <tr> - <td class="tabcont" > - <textarea id="varnishlogs" rows="50" cols="100%"> -<?php - $files_array[]="/usr/local/etc/postfix/main.cf"; - $files_array[]="/usr/local/etc/postfix/master.cf"; - $files_array[]="/usr/local/etc/postfix/relay_recipients"; - $files_array[]="/usr/local/etc/postfix/header_check"; - $files_array[]="/usr/local/etc/postfix/mime_check"; - $files_array[]="/usr/local/etc/postfix/body_check"; - $files_array[]="/usr/local/etc/postfix/cal_cidr"; - $files_array[]="/usr/local/etc/postfix/cal_pcre"; - $id=($_REQUEST['file']?$_REQUEST['file']:"0"); - $config_file = file_get_contents("$files_array[$id]"); - echo $files_array[$id]."\n".$config_file; -?> - </textarea> - </td> + <td colspan="2" valign="top" class="listtopic"><?=gettext("View Postfix configuration files"); ?></td></tr> + <tr><td></td></tr> </tr> - </table> - </div> - </td> - </tr> - </table> -</div> -</form> -<?php include("fend.inc"); ?> -</body> -</html> + <tr> + <td class="tabcont" > + <input type="button" onClick="get_postfix_file('main');" id='btn_main' value="main.cf"> + <input type="button" onClick="get_postfix_file('master');" id='btn_master' value="master.cf"> + <input type="button" onClick="get_postfix_file('recipients');" id='btn_recipients' value="relay_recipients"> + <input type="button" onClick="get_postfix_file('header');" id='btn_header' value="header_check"> + <input type="button" onClick="get_postfix_file('mime');" id='btn_mime' value="mime_check"> + <input type="button" onClick="get_postfix_file('body');" id='btn_body' value="body_check"> + <input type="button" onClick="get_postfix_file('cidr');" id='btn_cidr' value="client CIDR"> + <input type="button" onClick="get_postfix_file('pcre');" id='btn_pcre' value="client PCRE"> + </td> + </tr> + <tr> + <td class="tabcont" > + <div id="file_div"></div> + + </td> + </tr> + </table> + </div> + </td> + </tr> + </table> + </div> + </form> + <script type="text/javascript"> + function get_postfix_file(file) { + $('btn_'+file).value="reading..."; + var pars = 'file='+file; + var url = "/postfix_view_config.php"; + var myAjax = new Ajax.Request( + url, + { + method: 'post', + parameters: pars, + onComplete: activitycallback_postfix_file + }); + } + function activitycallback_postfix_file(transport) { + $('file_div').innerHTML = transport.responseText; + $('btn_main').value="main.cf"; + $('btn_master').value="master.cf"; + $('btn_recipients').value="relay_recipients"; + $('btn_header').value="header_check"; + $('btn_mime').value="mime_check"; + $('btn_body').value="body_check"; + $('btn_cidr').value="client CIDR"; + $('btn_pcre').value="client PCRE"; + scroll(0,0); + } + </script> + <?php + include("fend.inc"); + } + ?> + </body> + </html> |