function policies_search()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $t = time();
    $html = "<p class=text-info>{amavis_users_policies_explain}</p>";
    $boot = new boostrap_form();
    $user = new user($_SESSION["uid"]);
    $mails = $user->HASH_ALL_MAILS;
    $amavis = new amavisdb();
    $search = string_to_flexregex();
    while (list($b, $email) = each($mails)) {
        if ($search != null) {
            if (!preg_match("#{$search}#", $email)) {
                continue;
            }
        }
        $id = $amavis->policyid_from_mail($email);
        $ligne = $amavis->policy_array($id);
        $policy_name = $ligne["policy_name"];
        $tr[] = "\n\t\t<tr id='{$id}' " . $boot->trswitch("Loadjs('{$page}?policy-email-js={$email}')") . ">\n\t\t<td width=30%><i class='icon-envelope'></i> {$email}</td>\n\t\t<td width=30%><i class='icon-filter'></i> {$policy_name}</td>\n\t\t<td width=1%><i class='icon-eye-open'></i> {$ligne["spam_tag_level"]}</td>\n\t\t<td width=1%><i class='icon-fire'></i> {$ligne["spam_tag2_level"]}</td>\n\t\t<td width=1%><i class='icon-trash'></i> {$ligne["spam_kill_level"]}</td>\n\t\t\n\t\t</tr>\n\t\t";
    }
    echo $tpl->_ENGINE_parse_body("<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t<tr>\n\t\t\t\t<th>{email} &laquo;{$_SESSION["uid"]}&raquo;</th>\n\t\t\t\t<th>{policy}</th>\n\t\t\t\t<th width=1% nowrap>TAG {level}</th>\n\t\t\t\t<th width=1% nowrap>QUAR {level}</th>\n\t\t\t\t<th width=1% nowrap>KILL {level}</th>\n\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>\n\t\t\t") . @implode("\n", $tr) . " </tbody>\n\t\t\t\t</table>";
}
function domains_search()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $t = time();
    $boot = new boostrap_form();
    $ldap = new clladp();
    $mails = $ldap->hash_get_domains_ou($_SESSION["ou"], true);
    $amavis = new amavisdb();
    $search = string_to_flexregex();
    while (list($b, $domain) = each($mails)) {
        if ($search != null) {
            if (!preg_match("#{$search}#", $domain)) {
                continue;
            }
        }
        $id = $amavis->policyid_from_mail("@{$domain}");
        $ligne = $amavis->policy_array($id);
        $policy_name = $ligne["policy_name"];
        $tr[] = "\n\t\t<tr id='{$id}' " . $boot->trswitch("Loadjs('{$page}?policy-domain-js={$domain}')") . ">\n\t\t<td width=30%><i class='icon-envelope'></i> {$domain}</td>\n\t\t<td width=30%><i class='icon-filter'></i> {$policy_name}</td>\n\t\t<td width=1%><i class='icon-eye-open'></i> {$ligne["spam_tag_level"]}</td>\n\t\t<td width=1%><i class='icon-fire'></i> {$ligne["spam_tag2_level"]}</td>\n\t\t<td width=1%><i class='icon-trash'></i> {$ligne["spam_kill_level"]}</td>\n\t\n\t\t</tr>\n\t\t";
    }
    echo $tpl->_ENGINE_parse_body("<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t<tr>\n\t\t\t<th>{domains_policies} &laquo;{$_SESSION["ou"]}&raquo;</th>\n\t\t\t<th>{policy}</th>\n\t\t\t<th width=1% nowrap>TAG {level}</th>\n\t\t\t<th width=1% nowrap>QUAR {level}</th>\n\t\t\t<th width=1% nowrap>KILL {level}</th>\n\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>\n\t\t\t") . @implode("\n", $tr) . " </tbody>\n\t\t\t</table>";
}