function section_rules_list()
{
    if ($_GET["tab"] == 1) {
        section_config();
        exit;
    }
    $page = CurrentPageName();
    $tpl = new templates();
    $member = $tpl->_ENGINE_parse_body("{member}");
    $server = $tpl->_ENGINE_parse_body("{server}");
    $proto = $tpl->_ENGINE_parse_body("{proto}");
    $uri = $tpl->_ENGINE_parse_body("{url}");
    $member = $tpl->_ENGINE_parse_body("{member}");
    $user = $tpl->_ENGINE_parse_body("{user}");
    $title = $tpl->_ENGINE_parse_body("{today}: {realtime_requests} " . date("H") . "h");
    $new_rule = $tpl->_ENGINE_parse_body("{new_rule}");
    $delete_rule = $tpl->javascript_parse_text("{delete_rule}");
    $refresh = $tpl->_ENGINE_parse_body("{refresh}");
    $deleteAll = $tpl->_ENGINE_parse_body("{delete_all}");
    $apply = $tpl->_ENGINE_parse_body("{apply_parameters}");
    $export = $tpl->_ENGINE_parse_body("{export}");
    $t = time();
    $import = $tpl->_ENGINE_parse_body("{import}");
    $buttons = "\n\tbuttons : [\n\t{name: '{$new_rule}', bclass: 'Add', onpress : add_fetchmail_rules{$t}},\n\t{name: '{$import}', bclass: 'import', onpress : ImportBulk{$t}},\n\t{name: '{$export}', bclass: 'export', onpress : ExportTable{$t}},\n\t{name: '{$deleteAll}', bclass: 'Delz', onpress : DeletAll{$t}},\n\t{name: '{$refresh}', bclass: 'Reload', onpress : Reload{$t}},\n\t{name: '{$apply}', bclass: 'Reconf', onpress : ApplyParams{$t}},\n\t\n\t\t],\t";
    $html = Field_hidden("FETCHMAIL_FLEXRT", "flexRT{$t}") . "\n<table class='flexRT{$t}' style='display: none' id='flexRT{$t}' style='width:100%'></table>\n\n\t\n<script>\nvar fetchid=0;\n\$(document).ready(function(){\n\$('#flexRT{$t}').flexigrid({\n\turl: '{$page}?search-list=yes&t={$t}',\n\tdataType: 'json',\n\tcolModel : [\n\t\t{display: '{$member}', name : 'uid', width :169, sortable : true, align: 'left'},\n\t\t{display: '{$server}', name : 'poll', width :169, sortable : false, align: 'left'},\n\t\t{display: '{$proto}', name : 'proto', width : 78, sortable : false, align: 'center'},\n\t\t{display: '{$user}', name : 'user', width : 169, sortable : false, align: 'left'},\n\t\t{display: '&nbsp;', name : 'enabled', width : 31, sortable : true, align: 'left'},\n\t\t{display: 'DEL', name : 'DEL', width : 45, sortable : false, align: 'left'},\n\t\t],{$buttons}\n\t\n\tsearchitems : [\n\t\t{display: '{$member}', name : 'uid'},\n\t\t{display: '{$server}', name : 'poll'},\n\t\t{display: '{$user}', name : 'user'},\n\t\t],\n\tsortname: 'uid',\n\tsortorder: 'asc',\n\tusepager: true,\n\ttitle: '',\n\tuseRp: true,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: 408,\n\tsingleSelect: true,\n\trpOptions: [10, 20, 30, 50,100,200]\n\t\n\t});   \n});\n\nfunction ImportBulk{$t}(){\n\tLoadjs('fetchmail.import.php?t={$t}');\n}\n\nfunction ExportTable{$t}(){\n\tLoadjs('fetchmail.export.php?t={$t}');\n}\n\nfunction UserFetchMailRule{$t}(num,userid){\n\tif(document.getElementById('dialog3_c')){\n        if(document.getElementById('dialog3_c').style.visibility=='visible'){\n\t            YahooWin4('1050','artica.wizard.fetchmail.php?LdapRules='+ num + '&uid='+ userid+'&t={$t}',userid+'&raquo;&raquo;'+num);\n\t            return true;\n\t        }\n\t\t}\n       \tYahooWin2('1050','artica.wizard.fetchmail.php?LdapRules='+ num + '&uid='+ userid+'&t={$t}',userid+'&raquo;&raquo;'+num);\n        }\n        \nvar x_DeleteFetchmailRule= function (obj) {\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue);return;}\n   \t\$('#rowfetch'+fetchid).remove();\n\t}        \n        \n  function DeleteFetchmailRule(ID){\n  \tif(confirm('{$delete_rule} '+ID+' ?')){\n  \t\tfetchid=ID;\n\t    var XHR = new XHRConnection();\n        XHR.appendData('DeleteRule',ID);\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_DeleteFetchmailRule);  \t\n  \t}\n  \n  }\n  \n\tvar x_DeletAll{$t}= function (obj) {\n\t\tvar tempvalue=obj.responseText;\n\t\tif(tempvalue.length>3){alert(tempvalue);return;}\n\t\tReload{$t}();\n\t}    \n  \n  function DeletAll{$t}(){\n  \tif(confirm('{$deleteAll} ?')){\n   \t var XHR = new XHRConnection();\n  \t XHR.appendData('DeleteAll','yes');\n  \t XHR.sendAndLoad('{$page}', 'POST',x_DeletAll{$t});   \t\n  \t}\n  }\n  \n  function ApplyParams{$t}(){\n  \tLoadjs('fetchmail.compile.progress.php?t={$t}');\n  }\n  \n  function Reload{$t}(){\n  \t\$('#flexRT{$t}').flexReload();\n  }\n  \n\tvar x_CheckFetchmailRule= function (obj) {\n\t\tvar tempvalue=obj.responseText;\n\t\tif(tempvalue.length>3){alert(tempvalue);return;}\n\t}   \n  \n  function CheckFetchmailRule(md,ID){\n  \t var XHR = new XHRConnection();\n  \t if(document.getElementById(md).checked){XHR.appendData('enabled',1);}else{XHR.appendData('enabled',0);}\n  \t XHR.appendData('ID',ID);\n  \t XHR.sendAndLoad('{$page}', 'POST',x_CheckFetchmailRule);  \n  }\n\nfunction add_fetchmail_rules{$t}(){\n\tYahooWinHide();\n\tYahooWin2('1050','artica.wizard.fetchmail.php?AddNewFetchMailRule=yes&t={$t}','{$new_rule}');\n}\n\n</script>";
    echo $html;
    return;
}
function section_rules_list()
{
    if ($_GET["tab"] == 1) {
        section_config();
        exit;
    }
    $fetch = new Fetchmail_settings();
    $rules = $fetch->LoadAllRules();
    $html = section_tabs() . "<br><H5>{fetchmail_rules}</H5>";
    $rd = "<table style='width:1OO%' class=table_form>";
    while (list($num, $hash) = each($rules)) {
        $uid = $hash["uid"];
        $user = new user($uid);
        if ($hash["enabled"] == 0) {
            $img = 'status_ok-grey.gif';
        } else {
            $img = "status_ok.gif";
        }
        $link = CellRollOver("UserFetchMailRule('{$num}','{$uid}')", '{edit}');
        $rd = $rd . "<tr {$link}>\n\t\t<td width=1% valign='top'><img src='img/{$img}'></td>\n\t\t<td valign='top'><strong>{$user->mail}</strong></td>\n\t\t<td ><strong>{$hash["poll"]}</strong></td>\n\t\t<td ><strong>{$hash["proto"]}</strong></td>\n\t\t<td ><strong>{$hash["user"]}</strong></td>\n\t\t\n\t\t</tr>";
    }
    $rd = $rd . "</table>";
    $rd = "<div style='width:100%;height:400px;overflow:auto'>{$rd}</div>";
    $tpl = new templates();
    if (isset($_GET["ajax"])) {
        return $tpl->_ENGINE_parse_body($html . $rd);
    }
    echo $tpl->_ENGINE_parse_body($html . $rd);
}
Beispiel #3
0
function section_rules_list()
{
    if ($_GET["tab"] == 1) {
        section_config();
        exit;
    }
    $fetch = new Fetchmail_settings();
    $rules = $fetch->LoadAllRules();
    include_once dirname(__FILE__) . "/ressources/class.user.inc";
    $html = "";
    $rd = "\t<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:98%'>\n\t<thead class='thead'>\n\t\t<tr>\n\t\t<th width=5%>{date}</th>\n\t\t{$th_add}\n\t\t<th width=99% colsan=2>{website}</th>\n\t\t<th width=1% colspan=2>{size}</th>\n\t\t<th width=1% colspan=2>{client}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody class='tbody'>";
    $classtr = "";
    while (list($num, $hash) = each($rules)) {
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        $uid = $hash["uid"];
        $user = new user($uid);
        if ($hash["enabled"] == 0) {
            $img = 'status_ok-grey.gif';
        } else {
            $img = "status_ok.gif";
        }
        $js = "UserFetchMailRule('{$num}','{$uid}')";
        $href = "<a href=\"javascript:blur();\" OnClick=\"javascript:{$js}\" style='font-size:13px;font-weight:bold;text-decoration:underline' >";
        $rd = $rd . "<tr class={$classtr}>\n\t\t<td width=1%><img src='img/{$img}'></td>\n\t\t<td >{$href}{$user->mail}</a></td>\n\t\t<td >{$href}{$hash["poll"]}</a></td>\n\t\t<td >{$href}{$hash["proto"]}</a></td>\n\t\t<td >{$href}{$hash["user"]}</a></td>\n\t\t</tr>";
    }
    $rd = $rd . "</table>";
    $tpl = new templates();
    if (isset($_GET["ajax"])) {
        return $tpl->_ENGINE_parse_body($html . $rd);
    }
    echo $tpl->_ENGINE_parse_body($html . $rd);
}