function form_rule() { $rule_id = $_GET["edit-rule"]; $user = new user($_SESSION["uid"]); $ligne = $user->fetchmail_rules[$rule_id]; $f = new Fetchmail_settings(); $sock = new sockets(); $EnablePostfixMultiInstance = $sock->GET_INFO("EnablePostfixMultiInstance"); $array = $f->LoadRule($rule_id); $proto = array("" => "{select}", "auto" => "AUTO IMAP, POP3", "pop3" => "POP3", "imap" => "IMAP", "hotmail" => "Get Live Hotmail (@hotmail.x/@live.x)"); $proto = Field_array_Hash($proto, 'proto', $array["proto"], "", null, 0, 'width:180px'); if ($array["ssl"]) { $ssl = 1; } else { $ssl = 0; } $sslcheck = Field_checkbox("ssl", 1, $ssl); if ($EnablePostfixMultiInstance == 1) { $smtp_sender = "<tr>\n\t\t\t<td valign='top' class=legend nowrap>{local_smtp_host}:</td>\n\t\t\t<td valign='top'>" . Field_array_Hash(fetchmail_PostFixMultipleInstanceList($user->ou), "smtp_host", $array["smtp_host"]) . "</td>\n\t\t</tr>"; } $table = "\n\t<div id='mypool'>\n\t<table class=table_form>\n\t<tr>\n\t\t<td class=legend>{server_type}:</td>\n\t\t<td>{$proto}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend>{server_name}:</td>\n\t\t<td>" . Field_text('poll', $array["poll"], 'width:70%') . "</td>\n\t</tr>\n\t{$smtp_sender}\n\t<tr>\n\t\t<td class=legend>ssl:</td>\n\t\t<td>{$sslcheck}</td>\n\t</tr>\t\n\t<tr>\n\t\t<td align='right' class=legend>{remoteuser}</strong>: </td>\n\t\t<td align='left'>" . Field_text('user', $array["user"], 'width:70%') . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td align='right' class=legend>{password}</strong>: </td>\n\t\t<td align='left'>" . Field_password('pass', $array["pass"], 'width:70%') . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td colspan=2 align='right'><hr>" . button("{edit}", "SaveFetchmailRule('{$rule_id}')") . "</td>\n\t</tr>\t\n\t</table>\n\t</div>\n\t"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($table); }
function page_modify_rule(){ $user=new user($_GET["uid"]); $fetch=new Fetchmail_settings(); $page=CurrentPageName(); $array=$fetch->LoadRule($_GET["page-modify"]); $sock=new sockets(); $warn=" "; if($sock->GET_INFO("EnablePostfixMultiInstance")==1){ if($array["smtp_host"]==null){$warn="<img src='img/icon_mini_warning.gif'>";} $smtp_sender= "<tr> <td width=1%>$warn</td> <td valign='top' class=legend nowrap>{local_smtp_host}:</td> <td valign='top'>". Field_array_Hash(fetchmail_PostFixMultipleInstanceList($user->ou),"smtp_host",$array["smtp_host"])."</td> </tr>"; } $buttonadd="{edit}"; $advanced=button("{advanced_options}...","UserFetchMailRule({$_GET["page-modify"]},'{$_GET["uid"]}')"); if($_GET["page-modify"]<0){ $advanced=null; $array["keep"]=true; $array["proto"]="imap"; $buttonadd="{add}"; $find_isp=Paragraphe("64-infos.png","{GET_RIGHT_ISP_SETTINGS}","{GET_RIGHT_ISP_SETTINGS_TEXT}","javascript:Loadjs('$page?find-isp-js=yes')"); } $arraypr=array("imap"=>"imap","pop3"=>"pop3"); $keep=Field_checkbox('keep',1,$array["keep"]); $html=" <div style='margin-bottom:10px'><br> <h3 style='font-size:18px;color:#005447;border-bottom:1px solid #005447'>{$array["poll"]}</h3> </div> <div style='width:100%;overflow:auto' id='fetchmail-rule'> <form name='ffmfetch'> <input type='hidden' name='fetchmail_rule_id' id='fetchmail_rule_id' value='{$_GET["page-modify"]}'> <input type='hidden' name='is' id='is' value='$user->mail'> <input type='hidden' name='uid' id='uid' value='{$_GET["uid"]}'> <table style='width:100%'> <tr> <td valign='top'> <table style='width:350px;'> <tr> <td valign='top' colspan=2 style='font-size:13px;font-weight:bold;padding-bottom:10px;padding-top:15px'>{session_information}:<br></td> </tr> <tr> <td width=1%> </td> <td class=legend nowrap>{username}:</td> <td>" . Field_text('user',$array["user"])."</td> </tr> <tr> <td width=1%> </td> <td class=legend nowrap>{password}:</td> <td>" . Field_password('pass',$array["pass"])."</td> </tr> <tr> <td valign='top' colspan=3 style='font-size:13px;font-weight:bold;padding-bottom:10px;padding-top:15px'>{server_information}:<br></td> </tr> <tr> <td width=1%> </td> <td class=legend nowrap valign='top'>{imap_server_name}:</td> <td> <table style='width:100%'> <tr> <td valign='top'> " . Field_text('poll',$array["poll"])." </td> <td valign='top'>" . imgtootltip('22-infos.png','<strong>{GET_RIGHT_ISP_SETTINGS}</strong><br>{GET_RIGHT_ISP_SETTINGS_TEXT}', "LoadFetchmailISPList()")." <span id='choosen_isp' style='font-weight:bolder'></span> </td> </tr> </table> </td> </tr> <tr> <td width=1%> </td> <td class=legend nowrap>{protocol}:</td> <td>" . Field_array_Hash($arraypr,'proto',$array["proto"])."</td> </tr> $smtp_sender <tr> <td width=1%> </td> <td class=legend nowrap>{not_delete_messages}:</td> <td>$keep</td> </tr> <tr> <td valign='top' colspan=3 align='right'>$advanced</td> </tr> </table> </td> </tr> </table> </form> <hr> <div style='text-align:right;width:100%'>". button("{cancel}","YahooWin4Hide()")." ". button("$buttonadd","SaveAccount()")." </div> </div> "; $tpl=new templates(); echo $tpl->_ENGINE_parse_body($html); }
function page_modify_rule(){ $tt=$_GET["t"]; if(!is_numeric($tt)){$tt=0;} $tpl=new templates(); $t=time(); $server=$tpl->_ENGINE_parse_body('{server_name}'); $username=$tpl->_ENGINE_parse_body('{username}'); $user=new user($_GET["uid"]); $fetch=new Fetchmail_settings(); $page=CurrentPageName(); $array=$fetch->LoadRule($_GET["page-modify"]); $sock=new sockets(); if($array["smtp_host"]==null){$array["smtp_host"]="127.0.0.1";} if(!is_numeric($array["smtp_port"])){$array["smtp_port"]=25;} $warn=" "; if($sock->GET_INFO("EnablePostfixMultiInstance")==1){ if($array["smtp_host"]==null){$warn="<img src='img/status_warning.png'>";} $smtp_sender= "<tr> <td width=1%>$warn</td> <td valign='top' class=legend nowrap style='font-size:14px'>{local_smtp_host}:</td> <td valign='top'>". Field_array_Hash(fetchmail_PostFixMultipleInstanceList($user->ou),"smtp_host-$t", $array["smtp_host"],"blur()",null,0,"font-size:14px")."</td> </tr>"; }else{ $smtp_sender= "<tr> <td width=1%>$warn</td> <td valign='top' class=legend nowrap style='font-size:14px'>{hostname} SMTP:</td> <td valign='top'>". Field_text("smtp_host-$t",$array["smtp_host"],"blur()",null,0,"font-size:14px")."</td> </tr>"; } $buttonadd="{apply}"; $advanced=button("{advanced_options}...","UserFetchMailRule({$_GET["page-modify"]},'{$_GET["uid"]}')","14px"); if($_GET["page-modify"]<0){ $advanced=null; $array["keep"]=true; $array["proto"]="imap"; $buttonadd="{add}"; $find_isp=Paragraphe("64-infos.png","{GET_RIGHT_ISP_SETTINGS}","{GET_RIGHT_ISP_SETTINGS_TEXT}","javascript:Loadjs('$page?find-isp-js=yes')"); } $arraypr=array("imap"=>"imap","pop3"=>"pop3"); $keep=Field_checkbox("keep-$t",1,$array["keep"]); $title=$array["poll"]; if($title==null){$title=$tpl->_ENGINE_parse_body("{new_rule}");} $html=" <div style='margin-bottom:15px'> <div style='font-size:18px;border-bottom:3px solid #CCCCCC'>$title</div> </div> <div style='width:100%;overflow:auto' id='fetchmail-rule'> <form name='ffmfetch'> <input type='hidden' name='is' id='is' value='$user->mail'> <table style='width:98%' class=form> <tr> <td valign='top'> <table style='width:450px;'> <tr> <td valign='top' colspan=3 style='font-size:16px;font-weight:bold;padding-bottom:10px;padding-top:15px'>{session_information}:<br></td> </tr> <tr> <td width=1%> </td> <td class=legend nowrap style='font-size:14px'>{username}:</td> <td>" . Field_text("user-$t",$array["user"],"font-size:14px;width:200px")."</td> </tr> <tr> <td width=1%> </td> <td class=legend nowrap style='font-size:14px'>{password}:</td> <td>" . Field_password("pass-$t",$array["pass"],"font-size:14px;width:200px")."</td> </tr> <tr> <td width=1%> </td> <td class=legend nowrap style='font-size:14px'>{original_emailaddr}:</td> <td>" . Field_text("orgmail-$t",$array["orgmail"],"font-size:14px;width:200px")."</td> </tr> <tr> <td valign='top' colspan=3 style='font-size:16px;font-weight:bold;padding-bottom:10px;padding-top:15px'>{server_information}:<br></td> </tr> <tr> <td width=1%> </td> <td class=legend nowrap valign='top' style='font-size:14px'>{imap_server_name}:</td> <td> <table style='width:100%'> <tr> <td valign='top'> " . Field_text("poll-$t",$array["poll"],"font-size:14px;width:200px")." </td> <td valign='top'>" . imgtootltip('22-infos.png','<strong>{GET_RIGHT_ISP_SETTINGS}</strong><br>{GET_RIGHT_ISP_SETTINGS_TEXT}', "LoadFetchmailISPList()")." <span id='choosen_isp' style='font-weight:bolder'></span> </td> </tr> </table> </td> </tr> <tr> <td width=1%> </td> <td class=legend nowrap style='font-size:14px'>{protocol}:</td> <td>" . Field_array_Hash($arraypr,"proto-$t",$array["proto"],"blur()",null,0,"font-size:14px")."</td> </tr> $smtp_sender <tr> <td width=1%> </td> <td class=legend nowrap style='font-size:14px'>{smtp_port}:</td> <td>" . Field_text("smtp_port-$t",$array["smtp_port"],"font-size:14px;width:90px")."</td> </tr> <tr> <td width=1%> </td> <td class=legend nowrap style='font-size:14px'>{not_delete_messages}:</td> <td>$keep</td> </tr> <tr> <td valign='top' colspan=3 align='right'>$advanced</td> </tr> </table> </td> </tr> </table> </form> <hr> <div style='text-align:right;width:100%'>". button("{cancel}","YahooWin4Hide()","14px")." ". button("$buttonadd","SaveAccount$t()","14px")." </div> </div> <script> var x_FetchmailSaveAccount$t= function (obj) { var tempvalue=obj.responseText; var tt=$tt; if(tempvalue.length>3){alert(tempvalue)}; YahooWin4Hide(); if(tt>0){ $('#flexRT$tt').flexReload(); return; } DisplayAccount(); } function SaveAccount$t(){ if(document.getElementById('poll-$t').value==''){alert('$server=NULL!');return true;} if(document.getElementById('user-$t').value==''){alert('$username=NULL!');return true;} var XHR = new XHRConnection(); if(document.getElementById('smtp_host-$t')){XHR.appendData('smtp_host',document.getElementById('smtp_host-$t').value);} XHR.appendData('fetchmail_rule_id','{$_GET["page-modify"]}'); XHR.appendData('is',document.getElementById('is').value); var pp=encodeURIComponent(document.getElementById('pass-$t').value); XHR.appendData('uid','{$_GET["uid"]}'); XHR.appendData('user',document.getElementById('user-$t').value); XHR.appendData('pass',pp); XHR.appendData('poll',document.getElementById('poll-$t').value); XHR.appendData('proto',document.getElementById('proto-$t').value); XHR.appendData('orgmail',document.getElementById('orgmail-$t').value); if(document.getElementById('keep-$t').checked){XHR.appendData('keep',1);}else{XHR.appendData('keep',0);} AnimateDiv('fetchmail-rule'); XHR.sendAndLoad('$page', 'POST',x_FetchmailSaveAccount$t); } </script> "; echo $tpl->_ENGINE_parse_body($html); }