Example #1
0
function listemails()
{
    $order = "ORDER BY zDate DESC";
    $page = CurrentPageName();
    if (isset($_GET["filter-sender"])) {
        if ($_GET["filter-sender"] != null) {
            $_SESSION["QUARANTINE"]["SENDER"] = $_GET["filter-sender"];
            if (strpos($_GET["filter-sender"], '*') > 0 or $_GET["filter-sender"][0] == '*') {
                $and = " AND mailfrom LIKE '" . str_replace("*", "%", "{$_GET["filter-sender"]}") . "'";
            } else {
                $and = " AND mailfrom='{$_GET["filter-sender"]}'";
            }
            $back = true;
        }
    }
    if ($_GET["body"] != null) {
        $_SESSION["QUARANTINE"]["body"] = $_GET["body"];
        $pertinance = ",MATCH (MessageBody) AGAINST (\"{$_GET["body"]}\") AS pertinence ";
        $order = "ORDER BY pertinence DESC";
    }
    $mailto = mailto($and);
    $q = new mysql();
    $sql = "select MessageID,mailfrom,mailto,zDate,subject{$pertinance} FROM quarantine WHERE ({$mailto})  {$order} LIMIT 0,150";
    writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
    $results = $q->QUERY_SQL($sql, "artica_backup");
    $head = "\n\t<table>\n\t<td valign='middle' width=99%>\n\t\t<H3>{quarantine_mails}</H3>\n\t</td>\n\t<td>" . imgtootltip("48-logs.png", '{quarantine_email_report}', "Loadjs('quarantine.report.php')") . "</td>\n\t<td>" . imgtootltip("question-48.png", '{search}', "Loadjs('{$page}?search-js=yes')") . "</td>\n\t<td>" . imgtootltip("48-infos.png", '{infos}', "Loadjs('user.messaging.php?email-infos-js=quarantine')") . "</td>\n\t</tr>\n\t</table>\n\t";
    $table = "<table style='width:95%' class=table_form>\n\t\t<tr>\n\t\t<th><span style='color:white'>{date}</span></th>\n\t\t<th><span style='color:white'>{subject}</span></th>\n\t\t<th><span style='color:white'>{senderm}</span></th>\t\t\n\t\t<th><span style='color:white'>{recipient}</span></th>\n\t\t</tr>\n\t\t\n\t\t";
    $date_hier = strftime("%Y-%m-%d", mktime(0, 0, 0, date('m'), date('d') - 1, date('Y')));
    $date = date('Y-m-d');
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $ligne["zDate"] = str_replace($date, '{today}', $ligne["zDate"]);
        $ligne["zDate"] = str_replace($date_hier, '{yesterday}', $ligne["zDate"]);
        if ($class == "row1") {
            $class = "row2";
        } else {
            $class = "row1";
        }
        if (strlen($ligne["subject"]) > 40) {
            $ligne["subject"] = substr($ligne["subject"], 0, 37) . "...";
        }
        $table = $table . "<tr class={$class}>\n\t\t<td valign='top' nowrap class={$class} width=1%>{$ligne["zDate"]}</td>\n\t\t<td valign='top' class={$class}>" . divlien("Loadjs('{$page}?ShowID={$ligne["MessageID"]}')", $ligne["subject"]) . "</td>\n\t\t<td valign='top' class={$class}>{$ligne["mailfrom"]}</a></td>\n\t\t<td valign='top' class={$class}>{$ligne["mailto"]}</td>\n\t\t\n\t\t</tr>";
    }
    $table = $table . "</table>";
    if ($back) {
        return "{$head}{$table}";
    }
    return "<div style='width:100%;height:500px;overflow:auto' id='rtmm-panel'>{$head}{$table}</div>\n\t\n\t\n\t";
}
Example #2
0
function listemails()
{
    $page = CurrentPageName();
    $and = "AND filesize>0";
    $head = "\n\t<table>\n\t<td valign='middle' width=99%>\n\t\t<H3>{user_backup_emails_query_text}</H3>\n\t</td>\n\t<td>" . imgtootltip("question-48.png", '{search}', "Loadjs('{$page}?search-js=yes')") . "</td>\n\t<td>" . imgtootltip("48-infos.png", '{infos}', "Loadjs('user.messaging.php?email-infos-js=quarantine')") . "</td>\n\t</tr>\n\t</table>\n\t";
    //filter-body
    //$sql="SELECT storage.MessageID,storage.mailfrom$recipient_to_find_fields,storage.zDate,storage.subject,storage.MessageBody,MATCH (storage.MessageBody)
    //		AGAINST (\"$stringtofind\") AS pertinence
    //		FROM storage,storage_recipients WHERE storage.MessageID=storage_recipients.MessageID$recipient_to_find$sender_to_find ORDER BY pertinence DESC LIMIT 0,90";
    $order = "ORDER BY zDate DESC";
    if (isset($_GET["filter-sender"])) {
        if ($_GET["filter-sender"] != null) {
            if (strpos($_GET["filter-sender"], '*') > 0 or $_GET["filter-sender"][0] == '*') {
                $and = $and . " AND mailfrom LIKE '" . str_replace("*", "%", "{$_GET["filter-sender"]}") . "'";
            } else {
                $and = $and . " AND mailfrom='{$_GET["filter-sender"]}'";
            }
            $back = true;
        }
    }
    if ($_GET["body"] != null) {
        $pertinance = ",MATCH (MessageBody) AGAINST (\"{$_GET["filter-body"]}\") AS pertinence ";
        $order = "ORDER BY pertinence DESC";
    }
    $delivery_users = mailto($and);
    $q = new mysql();
    $sql = "select MessageID,mailfrom,mailto,DATE_FORMAT(zDate,'%Y-%m-%d %H:%i') as tdate ,filesize,subject{$pertinance} FROM storage WHERE ({$delivery_users}) {$order} LIMIT 0,150";
    writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if ($back) {
        $html = $html . "<table style='width:90%'>\n\t\t<tr>\n\t\t\t<td><a href='backup.php'><H3>&laquo;&nbsp;{back}</H3></td>\n\t\t</tr>\n\t\t</table>";
    }
    $html = $html . "<table style='width:95%' class=table_form>\n\t\n\t\t<tr>\n\t\t<th>{date}</span></th>\n\t\t<th>{size}</span></th>\n\t\t<th>{subject}</span></th>\n\t\t<th>{senderm}</span></th>\t\t\n\t\t<th>{recipient}</span></th>\n\n\t\t</tr>\n\t\t\n\t\t";
    $date_hier = strftime("%y-%m-%d", mktime(0, 0, 0, date('m'), date('d') - 1, date('y')));
    $date = date('Y-m-d');
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $filesize = $ligne["filesize"] / 1024;
        if ($class == "row1") {
            $class = "row2";
        } else {
            $class = "row1";
        }
        $filesize = FormatBytes($filesize);
        if (strlen($ligne["subject"]) > 40) {
            $ligne["subject"] = substr($ligne["subject"], 0, 37) . "...";
        }
        $ligne["tdate"] = str_replace($date, '{today}', $ligne["tdate"]);
        $ligne["tdate"] = str_replace($date_hier, '{yesterday}', $ligne["tdate"]);
        $html = $html . "\n\t\t<tr class={$class}>\n\t\t<td valign='top' nowrap width=1%>&nbsp;{$ligne["tdate"]}&nbsp;</td>\n\t\t<td valign='top' >&nbsp;{$filesize}&nbsp;</td>\n\t\t\t<td valign='top' class={$class}>" . divlien("Loadjs('{$page}?ShowID={$ligne["MessageID"]}')", $ligne["subject"]) . "</td>\n\t\t<td valign='top' >{$ligne["mailfrom"]}</td>\n\t\t<td valign='top' >{$ligne["mailto"]}</td>\n\t\t</tr>";
    }
    $html = $html . "</table>";
    $tpl = new templates();
    return $tpl->_ENGINE_parse_body("<div style='width:100%;height:500px;overflow:auto'>{$head}{$html}</div>");
}