diff options
-rw-r--r-- | config/postfix/postfix.php | 2 | ||||
-rwxr-xr-x | config/postfix/postfix.widget.php | 117 | ||||
-rw-r--r-- | config/postfix/postfix.xml | 6 | ||||
-rwxr-xr-x | config/postfix/postfix_search.php | 17 | ||||
-rw-r--r-- | pkg_config.8.xml | 5 | ||||
-rw-r--r-- | pkg_config.8.xml.amd64 | 5 |
6 files changed, 143 insertions, 9 deletions
diff --git a/config/postfix/postfix.php b/config/postfix/postfix.php index 992c82c2..d50fd326 100644 --- a/config/postfix/postfix.php +++ b/config/postfix/postfix.php @@ -268,7 +268,7 @@ if ($_REQUEST['files']!= ""){ $stm_fetch=array();
$total_result=0;
foreach ($files as $postfix_db)
- if (file_exists($postfix_dir.'/'.$postfix_db)){
+ if (file_exists($postfix_dir.'/'.$postfix_db)){
$last_next="";
$dbhandle = sqlite_open($postfix_dir.'/'.$postfix_db, 0666, $error);
$stm='select * from '.$queue;
diff --git a/config/postfix/postfix.widget.php b/config/postfix/postfix.widget.php new file mode 100755 index 00000000..dd43afa4 --- /dev/null +++ b/config/postfix/postfix.widget.php @@ -0,0 +1,117 @@ +<?php +/* + Copyright 2011 Marcello Coutinho + Part of pfSense widgets (www.pfsense.com) + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ +@require_once("guiconfig.inc"); +@require_once("pfsense-utils.inc"); +@require_once("functions.inc"); +function open_table(){ + echo "<table style=\"padding-top:0px; padding-bottom:0px; padding-left:0px; padding-right:0px\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"; + echo" <tr>"; +} +function close_table(){ + echo" </tr>"; + echo"</table>"; + +} + +$pfb_table=array(); +$img['Sick']="<img src ='/themes/{$g['theme']}/images/icons/icon_interface_down.gif'>"; +$img['Healthy']="<img src ='/themes/{$g['theme']}/images/icons/icon_interface_up.gif'>"; + + +#var_dump($pfb_table); +#exit; +?><div id='postfix'><?php + +$postfix_dir="/var/db/postfix/"; +$curr_time = time(); +for ($z = 0; $z > -3; $z--){ + +if ($z==0) + $postfix_db=date("Y-m-d"); +else + $postfix_db=date("Y-m-d",strtotime("$z day",$curr_time)); + +if (file_exists($postfix_dir.'/'.$postfix_db.".db")){ + $dbhandle = sqlite_open($postfix_dir.'/'.$postfix_db.".db", 0666, $error); + #noqueue + open_table(); + print "<td class=\"vncellt\"><strong><center>$postfix_db</center></strong></td>"; + close_table(); + open_table(); + $stm="select count(*) as total from mail_noqueue"; + $result = sqlite_query($dbhandle, $stm); + $row_noqueue = sqlite_fetch_array($result, SQLITE_ASSOC); + + #queue + $result = sqlite_query($dbhandle, $stm); + $stm="select status,count(*) as total from mail_queue group by status order by status"; + $result = sqlite_query($dbhandle, $stm); + $reader=""; + $count=""; + for ($i = 1; $i <= 15; $i++) { + $row = sqlite_fetch_array($result, SQLITE_ASSOC); + if (is_array($row)){ + if (preg_match("/\w+/",$row['status'])){ + $reader.="<td class=\"listlr\"width=50%><strong>".ucfirst($row['status'])."</strong></td>\n"; + if ($row['status']=="reject") + $row['total']=+$row_noqueue['total']; + $count.="<td class=\"listlr\">".$row['total']."</td>\n"; + } + } + } + print "<tr>".$reader."</tr>"; + print "<tr>".$count."</tr>"; + close_table(); + echo "<br>"; + $result = sqlite_query($dbhandle, $stm); + sqlite_close($dbhandle); +} +} +echo" </tr>"; +echo"</table></div>"; + +?> +<script type="text/javascript"> + function getstatus_postfix() { + scroll(0,0); + var url = "/widgets/widgets/postfix.widget.php"; + var pars = 'getupdatestatus=yes'; + var myAjax = new Ajax.Request( + url, + { + method: 'get', + parameters: pars, + onComplete: activitycallback_postfix + }); + //I know it's ugly but works. + setTimeout('getstatus_postfix()', 60000); + } + function activitycallback_postfix(transport) { + $('postfix').innerHTML = transport.responseText; + } + getstatus_postfix(); +</script> diff --git a/config/postfix/postfix.xml b/config/postfix/postfix.xml index 06caf4ec..aaa279f7 100644 --- a/config/postfix/postfix.xml +++ b/config/postfix/postfix.xml @@ -109,7 +109,11 @@ <prefix>/usr/local/www/</prefix> <chmod>0755</chmod> </additional_files_needed> - + <additional_files_needed> + <item>http://www.pfsense.org/packages/config/postfix/postfix.widget.php</item> + <prefix>/usr/local/www/widget/widget/</prefix> + <chmod>0755</chmod> + </additional_files_needed> <additional_files_needed> <item>http://www.pfsense.org/packages/config/postfix/adexport.pl</item> <prefix>/usr/local/etc/postfix/</prefix> diff --git a/config/postfix/postfix_search.php b/config/postfix/postfix_search.php index f347dbf0..d11505d4 100755 --- a/config/postfix/postfix_search.php +++ b/config/postfix/postfix_search.php @@ -91,7 +91,7 @@ include("head.inc"); <tr> <td width="22%" valign="top" class="vncell"><?=gettext("Subject: ");?></td> <td width="78%" class="vtable"><input type="text" class="formfld unknown" id="subject" size="65%"> - <br><?=gettext("");?></td> + <br><?=gettext("Subject to search, wildcard is '%'");?></td> </tr> <tr> <td width="22%" valign="top" class="vncell"><?=gettext("Message_id: ");?></td> @@ -168,7 +168,7 @@ include("head.inc"); <tr> <td width="22%" valign="top"></td> - <td width="78%"><input name="Submit" type="submit" class="formbtn" value="<?=gettext("Search");?>" onclick="getsearch_results(true)"> + <td width="78%"><input name="Submit" type="submit" class="formbtn" id="search" value="<?=gettext("Search");?>" onclick="getsearch_results(true)"> </table> </div> @@ -197,12 +197,20 @@ function loopSelected(id) } function getsearch_results() { - scroll(0,0); var $new_from=$('from').value.replace("\n", "','"); var $new_to=$('to').value.replace("\n", "','"); var $new_sid=$('sid').value.replace("\n", "','"); var $files=loopSelected('Select1'); var $fields=loopSelected('fields'); + if ($files ==""){ + alert ("Please select at least one file."); + } + if ($fields ==""){ + alert ("Please select at least one message field to display results."); + } + else{ + $('search').value="Searching..."; + $('search_results').innerHTML=""; var $queuetype=$('queuetype').options[$('queuetype').selectedIndex].text; var $queuemax=$('queuemax').options[$('queuemax').selectedIndex].text; var $pars="from="+$new_from+"&to="+$new_to+"&sid="+$new_sid+"&limit="+$queuemax+"&fields="+$fields+"&status="+$('status').value; @@ -217,8 +225,11 @@ function getsearch_results() { onComplete: activitycallback_postfix_search }); } + } function activitycallback_postfix_search(transport) { $('search_results').innerHTML = transport.responseText; + scroll(0,900); + $('search').value="Search"; } </script> <!-- </form> --> diff --git a/pkg_config.8.xml b/pkg_config.8.xml index 1ec6820f..5eb664fd 100644 --- a/pkg_config.8.xml +++ b/pkg_config.8.xml @@ -59,7 +59,7 @@ <configurationfile>countryblock.xml</configurationfile> </package> <package> - <name>pfBlocker-dev</name> + <name>pfBlocker</name> <website/> <descr><![CDATA[Introduce Enhanced Aliastable Feature to pfsense.<br> Assign many IP urls lists from sites like I-blocklist to a single alias and then choose rule action to take.<br> @@ -390,9 +390,10 @@ Postfix can also detect zombies, check RBLS, SPF, seach ldap for valid recipients and use third part antispam engines like policyd and mailscanner for better antispam solution.]]></descr> <category>Services</category> <config_file>http://www.pfsense.com/packages/config/postfix/postfix.xml</config_file> + <pkginfolink>http://forum.pfsense.org/index.php/topic,40622.0.html</pkginfolink> <depends_on_package_base_url>http://files.pfsense.org/packages/8/All/</depends_on_package_base_url> <depends_on_package>postfix-2.8.5,1.tbz</depends_on_package> - <version>2.8.5,1 pkg v.2.1</version> + <version>2.8.5,1 pkg v.2.2</version> <status>RC1</status> <required_version>2.0</required_version> <configurationfile>postfix.xml</configurationfile> diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64 index 2e45d0ae..4d3702d7 100644 --- a/pkg_config.8.xml.amd64 +++ b/pkg_config.8.xml.amd64 @@ -134,7 +134,7 @@ <configurationfile>countryblock.xml</configurationfile> </package> <package> - <name>pfBlocker-dev</name> + <name>pfBlocker</name> <website/> <descr><![CDATA[Introduce Enhanced Aliastable Feature to pfsense.<br> Assign many IP urls lists from sites like I-blocklist to a single alias and then choose rule action to take.<br> @@ -471,11 +471,12 @@ It can do first and second line antispam combat before sending incoming mail to local mail servers.<br> Postfix can also detect zombies, check RBLS, SPF, seach ldap for valid recipients and use third part antispam engines like policyd and mailscanner for better antispam solution.]]></descr> <category>Services</category> + <pkginfolink>http://forum.pfsense.org/index.php/topic,40622.0.html</pkginfolink> <config_file>http://www.pfsense.com/packages/config/postfix/postfix.xml</config_file> <depends_on_package_base_url>http://files.pfsense.org/packages/amd64/8/All/</depends_on_package_base_url> <depends_on_package>postfix-2.8.5,1.tbz</depends_on_package> <depends_on_package_pbi>spamd-4.9.1-amd64.pbi</depends_on_package_pbi> - <version>2.8.5,1 pkg v.2.1</version> + <version>2.8.5,1 pkg v.2.2</version> <status>RC1</status> <required_version>2.0</required_version> <configurationfile>postfix.xml</configurationfile> |