function ruleslist() { $user = new user($_SESSION["uid"]); $html = "<table class=table_inside>\n\t<tr>\n\t\t<th>{server}</th>\n\t\t<th colspan=2>{protocol}</th>\n\t</tr>\n\t"; $f = new Fetchmail_settings(); $fetchmail_rules = $f->LoadUsersRules($_SESSION["uid"]); $users = new usersMenus(); $AllowFetchMails = $users->AllowFetchMails; while (list($num, $line) = each($fetchmail_rules)) { $server = $line["poll"]; $proto = $line["proto"]; $user = $line["user"]; $delete = imgtootltip("ed_delete.gif", "{delete}", "DeleteFetchmail({$num})"); $edit = "EditRuleFetchmail({$num})"; if (!$AllowFetchMails) { $delete = " "; $edit = null; } $edit = CellRollOver($edit); $html = $html . "<tr>\n\t\t<td nowrap {$edit}>{$server}<hr style='margin:0px'><i style='font-size:10px;font-weight:normal'>{$user}</i></td>\n\t\t<td {$edit}>{$proto}</td>\n\t\t<td >{$delete}</td>\n\t\t</tr>\n\n\t\t"; } $html = $html . "</table>"; $tpl = new templates(); return $tpl->_ENGINE_parse_body($html); }
function page_list(){ $fetch=new Fetchmail_settings(); $page=CurrentPageName(); $rules=$fetch->LoadUsersRules($_GET["page-display"]); $user=new user($_GET["page-display"]); $sock=new sockets(); $EnablePostfixMultiInstance=$sock->GET_INFO("EnablePostfixMultiInstance"); if(count($rules)>0){ if(count($user->FetchMailMatchAddresses)==0){ $error=Paragraphe("64-red.png","{no_fetchmail_aliases}","{no_fetchmail_aliases_intro}","javascript:AliasesFetchmail()",null,210,null,1); }else{ $error=Paragraphe("recup-remote-mail.png","{fetchmail_aliases}","{no_fetchmail_aliases_intro}","javascript:AliasesFetchmail()",null,210,null,1); } } if(is_array($rules)){ $tbl="<table style='width:98%'> <tr> <th colspan=2><strong>{user}</strong></th> <th><strong>{imap_server_name}</th> <th colspan=3><strong>{enabled}</th> </tr>"; while (list ($num, $ligne) = each ($rules) ){ $enabled=Field_checkbox("{$num}_enabled",1,$ligne["enabled"],"Loadjs('$page?enable-js-rule=$num&uid={$_GET["page-display"]}')"); if($ligne["enabled"]==0){$color="#E60B03";}else{$color="black";} $edit=imgtootltip("24-administrative-tools.png","{edit}","ModifyFetchAccount($num)"); $delete=imgtootltip("ed_delete.gif","{delete}","DeleteFetchAccount($num,'{$ligne["poll"]}');"); $warn=" "; if($EnablePostfixMultiInstance==1){ if(trim($ligne["smtp_host"])==null){ $warn=imgtootltip("icon_mini_warning.gif","{smtp_host_not_set}"); } } $tbl=$tbl." <tr ". CellRollOver()."> <td>$warn</td> <td style='font-size:11px;color:$color' align='left' nowrap>{$ligne["user"]}</td> <td style='font-size:11px;color:$color' align='left' nowrap>{$ligne["poll"]}:{$ligne["proto"]}</td> <td style='font-size:11px;color:$color' align='right' nowrap>$enabled</td> <td style='font-size:11px;color:$color' align='right' nowrap>$edit</td> <td style='font-size:11px;color:$color' align='right' nowrap>$delete</td> </tr>"; } }else{ $tbl="<tr><td colspan=3>{click_on_add}</td></tr>"; } $tbl=$tbl." <tr> <td colspan=5><hr></td> </tr> </table>"; $html=" <div style='margin-bottom:10px'> <table style='width:100%'> <tr> <td valign='top'> <strong style='font-size:18px;margin-top:10px;color:#005447'>{fetchmail_modify_rules}<hr></strong> </td> <td valign='top'>". imgtootltip("plus-24.png","{add}","AddFetchAccount()")."</td> </tr> </table> </div> <table style='width:100%;'> <tr> <td valign='top'> <div> <table style='width:100%'> <tr> <td valign='top'><div id='fetchmail-rules-js' style='height:250px;overflow:auto'>$tbl</div></td> <td valign='top'>$error</td> </tr> </table> </div> </td> <td valign='top'> <div id='rightbutton'></div> </td> </tr> </table> "; $tpl=new templates(); echo $tpl->_ENGINE_parse_body($html); }
function page_list_old(){ $fetch=new Fetchmail_settings(); $page=CurrentPageName(); $tpl=new templates(); $fetchmail_execute_debug_warn=$tpl->javascript_parse_text("{fetchmail_execute_debug_warn}"); $rules=$fetch->LoadUsersRules($_GET["page-display"]); $user=new user($_GET["page-display"]); $sock=new sockets(); $EnablePostfixMultiInstance=$sock->GET_INFO("EnablePostfixMultiInstance"); $imgerr="recup-remote-mail-48.png"; $imgerr_text="{add_alias}"; if(count($rules)>0){ if(count($user->FetchMailMatchAddresses)==0){$imgerr="user-error-48.png";$imgerr_text="{no_fetchmail_aliases}";} $error="<table class=form><tbody><tr> <td width=1%>".imgtootltip($imgerr,"{no_fetchmail_aliases_intro}","AliasesFetchmail()")."</td> <td> <div style='font-size:14px;font-weight:bold'>$imgerr_text</div> <a href=\"javascript:blur();\" OnClick=\"javascript:AliasesFetchmail()\" style='text-decoration:underline;font-size:12px'>{no_fetchmail_aliases_intro}</a> </td> </tr> </table> "; } $tbl=" <center> <table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'> <thead class='thead'> <tr> <th width=1%>".imgtootltip("plus-24.png","{add}","AddFetchAccount()")."</th> <th><strong>{user}</strong></th> <th><strong>{imap_server_name}</th> <th colspan=5><strong>{enabled}</th> </tr> </thead> <tbody class='tbody'>"; if(is_array($rules)){ $q=new mysql(); while (list ($num, $ligne) = each ($rules) ){ if($classtr=="oddRow"){$classtr=null;}else{$classtr="oddRow";} $enabled=Field_checkbox("{$num}_enabled",1,$ligne["enabled"],"Loadjs('$page?enable-js-rule=$num&uid={$_GET["page-display"]}')"); if($ligne["enabled"]==0){$color="#E60B03";}else{$color="black";} $edit=imgtootltip("32-administrative-tools.png","{apply}","ModifyFetchAccount($num)"); $delete=imgtootltip("delete-32.png","{delete}","DeleteFetchAccount($num,'{$ligne["poll"]}');"); $execute=imgtootltip("mailbox-32.png","{execute_in_debug}","ExecuteFetchAccount($num);"); $warn="<img src='img/fetchmail-rule-32.png'>"; $showdebuglogs=" "; $sql="SELECT COUNT(ID) as tcount FROM fetchmail_debug_execute WHERE account_id='$num'"; $ligneCOUNT=mysql_fetch_array($q->QUERY_SQL($sql,"artica_events")); if(!$q->ok){echo "<H2>$q->mysql_error</H2>";} if($ligneCOUNT["tcount"]>0){ $showdebuglogs=imgtootltip("script-32.png","{events}","FetchAccountDebugs($num)"); } if($EnablePostfixMultiInstance==1){ if(trim($ligne["smtp_host"])==null){ $warn=imgtootltip("status_warning.png","{smtp_host_not_set}"); $execute=imgtootltip("mailbox-32-grey.png","{execute_in_debug}"); } } $tbl=$tbl." <tr class=$classtr> <td>$warn</td> <td style='font-size:14px;color:$color' align='left' nowrap>{$ligne["user"]}</td> <td style='font-size:14px;color:$color' align='left' nowrap>{$ligne["poll"]}:{$ligne["proto"]}</td> <td style='font-size:14px;color:$color' align='right' nowrap>$enabled</td> <td style='font-size:14px;color:$color' align='right' nowrap>$edit</td> <td style='font-size:14px;color:$color' align='right' nowrap>$execute</td> <td style='font-size:14px;color:$color' align='right' nowrap>$showdebuglogs</td> <td style='font-size:14px;color:$color' align='right' nowrap>$delete</td> </tr>"; } }else{ $tbl="<tr><td colspan=3>{click_on_add}</td></tr>"; } $tbl=$tbl."</tbody></table>"; $html=" <div id='fetchmail-rules-js' style='height:250px;overflow:auto'>$tbl</div> <div id='rightbutton'></div> $error <script> var x_ExecuteFetchAccount=function (obj) { var results=obj.responseText; if(results.length>3){alert('results');} } function ExecuteFetchAccount(ID){ var XHR = new XHRConnection(); if(confirm('$fetchmail_execute_debug_warn')){ XHR.appendData('ExecuteFetchAccount',ID); XHR.sendAndLoad('$page', 'POST',x_ExecuteFetchAccount); } } function FetchAccountDebugs(ID){ RTMMail('550','$page?debug-popup=yes&ID='+ID,ID); } "; $tpl=new templates(); echo $tpl->_ENGINE_parse_body($html); }