Пример #1
0
function SuperAdminQuery()
{
    $del = false;
    $okdelete = false;
    if ($_GET["zDate"] != null) {
        if (preg_match('#^([0-9]+)#', $_GET["zDate"], $re)) {
            $okdelete = true;
            if (strlen($re[1]) == 4) {
                $q_zdate = "AND DATE_FORMAT(zDate,'%Y')={$re[1]}";
            }
        }
        if (preg_match('#^([0-9]+)-([0-9]+)#', $_GET["zDate"], $re)) {
            $okdelete = true;
            $q_zdate = "AND DATE_FORMAT(zDate,'%Y-%m')='{$re[1]}-{$re[2]}'";
        }
        if (preg_match('#^([0-9]+)-([0-9]+)-([0-9]+)#', $_GET["zDate"], $re)) {
            $okdelete = true;
            $q_zdate = "AND DATE_FORMAT(zDate,'%Y-%m-%d')='{$re[1]}-{$re[2]}-{$re[3]}'";
        }
        if (preg_match('#^([0-9]+)-([0-9]+)-([0-9]+)\\s+([0-9]+)#', $_GET["zDate"], $re)) {
            $okdelete = true;
            $q_zdate = "AND DATE_FORMAT(zDate,'%Y-%m-%d %H')='{$re[1]}-{$re[2]}-{$re[3]} {$re[4]}'";
        }
        if (preg_match('#^([0-9]+)-([0-9]+)-([0-9]+)\\s+([0-9]+):([0-9]+)#', $_GET["zDate"], $re)) {
            $okdelete = true;
            $q_zdate = "AND DATE_FORMAT(zDate,'%Y-%m-%d %H:%i')='{$re[1]}-{$re[2]}-{$re[3]} {$re[4]}:{$re[5]}'";
        }
    }
    $limit = "LIMIT 0,100";
    if ($_GET["mailfrom"] != null) {
        $okdelete = true;
        $_GET["mailfrom"] = str_replace('*', '%', $_GET["mailfrom"]);
        $q_mailfrom = "AND mailfrom LIKE '{$_GET["mailfrom"]}%'";
    }
    if ($_GET["recipient"] != null) {
        $okdelete = true;
        $_GET["recipient"] = str_replace('*', '%', $_GET["recipient"]);
        $q_mailfrom = "AND mailto LIKE '{$_GET["recipient"]}%'";
    }
    if ($_GET["subject"] != null) {
        $okdelete = true;
        $_GET["subject"] = str_replace('*', '%', $_GET["subject"]);
        $q_mailfrom = "AND subject LIKE '{$_GET["subject"]}%'";
    }
    if ($_GET["delete"] == "yes") {
        if ($okdelete) {
            $del = true;
        }
        $limit = null;
    }
    $sql = "SELECT MessageID,zDate,mailfrom,subject,mailto FROM storage WHERE 1 {$q_zdate} {$q_mailfrom} ORDER BY zDate DESC {$limit}";
    $sql = str_replace('%%', '%', $sql);
    $q = new mysql();
    writelogs("{$sql}", __FUNCTION__, __FILE__, __LINE__);
    $html = "<table style='width:99%' class=form>\n\t<tr>\n\t\t<th>&nbsp;</th>\n\t\t<th>{date}</th>\n\t\t<th>{from}</th>\n\t\t<th>{recipient}</th>\n\t\t<th>{subject}</th>\n\t</tr>";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        if ($del) {
            DeleteOrgMail($ligne["MessageID"]);
            $ligne["subject"] = "<strong style='color:#d32d2d'>{deleted}</strong>";
        }
        if (strlen($ligne["subject"]) > 50) {
            $ligne["subject"] = texttooltip(substr($ligne["subject"], 0, 47) . '...', $ligne["subject"]);
        }
        $html = $html . "<tr " . CellRollOver("AdminBackup('{$ligne["MessageID"]}')") . ">\n\t\t\t<td width=1%><img src='img/fw_bold.gif'></td>\n\t\t\t<td nowrap>{$ligne["zDate"]}</td>\n\t\t\t<td nowrap>{$ligne["mailfrom"]}</td>\n\t\t\t<td nowrap>{$ligne["mailto"]}</td>\n\t\t\t<td>{$ligne["subject"]}</td>\n\t\t</tr>\n\t\t\t\n\t\t";
    }
    $html = $html . "</table>";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}
Пример #2
0
function SuperAdminQuery2()
{
    $del = false;
    $okdelete = false;
    $page = CurrentPageName();
    if ($_GET["zDate"] != null) {
        if (preg_match('#^([0-9]+)#', $_GET["zDate"], $re)) {
            $okdelete = true;
            if (strlen($re[1]) == 4) {
                $q_zdate = "AND DATE_FORMAT(zDate,'%Y')={$re[1]}";
            }
        }
        if (preg_match('#^([0-9]+)-([0-9]+)#', $_GET["zDate"], $re)) {
            $okdelete = true;
            $q_zdate = "AND DATE_FORMAT(zDate,'%Y-%m')='{$re[1]}-{$re[2]}'";
        }
        if (preg_match('#^([0-9]+)-([0-9]+)-([0-9]+)#', $_GET["zDate"], $re)) {
            $okdelete = true;
            $q_zdate = "AND DATE_FORMAT(zDate,'%Y-%m-%d')='{$re[1]}-{$re[2]}-{$re[3]}'";
        }
        if (preg_match('#^([0-9]+)-([0-9]+)-([0-9]+)\\s+([0-9]+)#', $_GET["zDate"], $re)) {
            $okdelete = true;
            $q_zdate = "AND DATE_FORMAT(zDate,'%Y-%m-%d %H')='{$re[1]}-{$re[2]}-{$re[3]} {$re[4]}'";
        }
        if (preg_match('#^([0-9]+)-([0-9]+)-([0-9]+)\\s+([0-9]+):([0-9]+)#', $_GET["zDate"], $re)) {
            $okdelete = true;
            $q_zdate = "AND DATE_FORMAT(zDate,'%Y-%m-%d %H:%i')='{$re[1]}-{$re[2]}-{$re[3]} {$re[4]}:{$re[5]}'";
        }
    }
    $limit = "LIMIT 0,100";
    if ($_GET["mailfrom"] != null) {
        $okdelete = true;
        $_GET["mailfrom"] = str_replace('*', '%', $_GET["mailfrom"]);
        $q_mailfrom = "AND mailfrom LIKE '{$_GET["mailfrom"]}%'";
    }
    if ($_GET["recipient"] != null) {
        $okdelete = true;
        $_GET["recipient"] = str_replace('*', '%', $_GET["recipient"]);
        $q_mailfrom = "AND mailto LIKE '{$_GET["recipient"]}%'";
    }
    if ($_GET["subject"] != null) {
        $okdelete = true;
        $_GET["subject"] = str_replace('*', '%', $_GET["subject"]);
        $q_mailfrom = "AND subject LIKE '{$_GET["subject"]}%'";
    }
    if ($_GET["delete"] == "yes") {
        if ($okdelete) {
            $del = true;
        }
        $limit = null;
    }
    $sql = "SELECT MessageID,zDate,mailfrom,subject,mailto FROM quarantine WHERE 1 {$q_zdate} {$q_mailfrom} ORDER BY zDate DESC {$limit}";
    $sql = str_replace('%%', '%', $sql);
    $q = new mysql();
    writelogs("{$sql}", __FUNCTION__, __FILE__, __LINE__);
    $html = "\n\t<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:99%'>\n\t<thead class='thead'>\n\t\t<tr>\n\t\t<th>&nbsp;</th>\n\t\t<th>{date}</th>\n\t\t<th>{from}</th>\n\t\t<th>{recipient}</th>\n\t\t<th>{subject}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody class='tbody'>\t";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    $array_selected = unserialize(base64_decode($_GET["MessagesSelected"]));
    $classtr = null;
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        if ($del) {
            DeleteOrgMail($ligne["MessageID"]);
            $ligne["subject"] = "{deleted}";
        }
        $year = date('Y');
        $today = date('m-d');
        if (strlen($ligne["subject"]) > 50) {
            $ligne["subject"] = texttooltip(substr($ligne["subject"], 0, 47) . '...', $ligne["subject"]);
        }
        $js = "AdminQuarantine('{$ligne["MessageID"]}')";
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        if (strlen($ligne["mailfrom"]) > 23) {
            $ligne["mailfrom"] = texttooltip(substr($ligne["mailfrom"], 0, 20) . "...", $ligne["mailfrom"], $js, null, 0, "font-size:13px");
        }
        if (strlen($ligne["mailto"]) > 23) {
            $ligne["mailto"] = texttooltip(substr($ligne["mailto"], 0, 20) . "...", $ligne["mailto"], $js, null, 0, "font-size:13px");
        }
        $ligne["zDate"] = str_replace("{$year}-", '', $ligne["zDate"]);
        $ligne["zDate"] = str_replace("{$today}", '{today}', $ligne["zDate"]);
        $checkbox_md = md5($ligne["MessageID"]);
        $checkbox_md_value = 0;
        if ($array_selected[$ligne["MessageID"]]) {
            $checkbox_md_value = 1;
        }
        $html = $html . "<tr class={$classtr}>\n\t\t\t<td width=1%>" . Field_checkbox($checkbox_md, 1, $checkbox_md_value, "LiberLigne('{$ligne["MessageID"]}','{$checkbox_md}')") . "</td>\n\t\t\t<td nowrap><a href='#' OnClick=\"javascript:{$js}\" style='font-size:13px;'>{$ligne["zDate"]}</a></td>\n\t\t\t<td nowrap><a href='#' OnClick=\"javascript:{$js}\" style='font-size:13px;text-decoration:underline'>{$ligne["mailfrom"]}</a></td>\n\t\t\t<td nowrap><a href='#' OnClick=\"javascript:{$js}\" style='font-size:13px;text-decoration:underline'>{$ligne["mailto"]}</a></td>\n\t\t\t<td><a href='#' OnClick=\"javascript:{$js}\" style='font-size:13px;text-decoration:underline'>{$ligne["subject"]}</a></td>\n\t\t</tr>\n\t\t\t\n\t\t";
    }
    $tpl = new templates();
    $libere_text = "{confirm} {release}";
    $html = $html . "</tbody></table>\n\t\n\t\n\t<script>\n\t\n\tfunction x_LiberLigneText(obj){\n\t\tvar tempvalue=obj.responseText;\n\t\tdocument.getElementById('queue-quar-text').innerHTML=tempvalue;\n\t}\t\t\n\t\n\tfunction LiberLigneText(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('LiberLigneText',document.getElementById('liberequeue').value);\n\t\tXHR.sendAndLoad('{$page}', 'GET',x_LiberLigneText);\n\t}\n\t\n\tfunction x_LiberLignePerform(obj){\n\t\tvar tempvalue=obj.responseText;\n\t\tdocument.getElementById('liberequeue').value=tempvalue;\n\t\tLiberLigneText();\n\t}\t\t\t\n\t\t\t\n\tfunction LiberLignePerform(msgid,add){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('LiberLignePerform',msgid);\n\t\tXHR.appendData('action',add);\n\t\tXHR.appendData('liste',document.getElementById('liberequeue').value);\n\t\tXHR.sendAndLoad('{$page}', 'GET',x_LiberLignePerform);\t\n\t}\n\t\n\tfunction x_LiberQueue(obj){\n\t\tvar tempvalue=obj.responseText;\n\t\talert(tempvalue);\n\t}\t\t\n\n\tfunction LiberQueue(num){\n\t\tif(confirm('{$libere_text} '+num+' mails')){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('LiberLigneQueue',document.getElementById('liberequeue').value);\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_LiberQueue);\n\t\t}\n\t}\n\t\n\t\n\tfunction LiberLigne(messageid,id){\n\t\tif(document.getElementById(id).checked){LiberLignePerform(messageid,1);}else{LiberLignePerform(messageid,0);}\n\t}\n\t</script>";
    echo $tpl->_ENGINE_parse_body($html);
}