當前位置: 首頁>>代碼示例>>PHP>>正文


PHP maincf_multi::mime_header_checks方法代碼示例

本文整理匯總了PHP中maincf_multi::mime_header_checks方法的典型用法代碼示例。如果您正苦於以下問題:PHP maincf_multi::mime_header_checks方法的具體用法?PHP maincf_multi::mime_header_checks怎麽用?PHP maincf_multi::mime_header_checks使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在maincf_multi的用法示例。


在下文中一共展示了maincf_multi::mime_header_checks方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: mime_header_checks

function mime_header_checks()
{
    $f = array();
    $main = new maincf_multi("master", "master");
    $enable_attachment_blocking_postfix = $main->GET("enable_attachment_blocking_postfix");
    if (!is_numeric($enable_attachment_blocking_postfix)) {
        $enable_attachment_blocking_postfix = 0;
    }
    $extmime = $main->mime_header_checks();
    $extmime = trim(str_replace("mime_header_checks =", "", $extmime));
    if ($enable_attachment_blocking_postfix == 1) {
        $sql = new mysql();
        $sql = "SELECT * FROM smtp_attachments_blocking WHERE ou='_Global' ORDER BY IncludeByName";
        writelogs("{$sql}", __FUNCTION__, __FILE__, __LINE__);
        $q = new mysql();
        writelogs("-> Qyery", __FUNCTION__, __FILE__, __LINE__);
        $results = $q->QUERY_SQL($sql, "artica_backup");
        if (!$q->ok) {
            writelogs("Error mysql {$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__);
            return null;
        }
        writelogs("-> loop", __FUNCTION__, __FILE__, __LINE__);
        while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
            if ($ligne["IncludeByName"] == null) {
                continue;
            }
            $f[] = $ligne["IncludeByName"];
        }
    } else {
        echo "Starting......: " . date("H:i:s") . " Blocking extensions trough postfix is disabled\n";
    }
    if (count($f) == 0) {
        echo "Starting......: " . date("H:i:s") . " No extensions blocked\n";
        if ($extmime != null) {
            postconf("mime_header_checks", $extmime);
        }
        postconf("mime_header_checks", null);
        return;
    }
    $strings = implode("|", $f);
    echo "Starting......: " . date("H:i:s") . " " . count($f) . " extensions blocked\n";
    $pattern[] = "/^\\s*Content-(Disposition|Type).*name\\s*=\\s*\"?(.+\\.({$strings}))\"?\\s*\$/\tREJECT file attachment types is not allowed. File \"\$2\" has the unacceptable extension \"\$3\"";
    $pattern[] = "";
    @file_put_contents("/etc/postfix/mime_header_checks", implode("\n", $pattern));
    if ($extmime != null) {
        $extmime = ",{$extmime}";
    }
    postconf("mime_header_checks", "regexp:/etc/postfix/mime_header_checks{$extmime}");
    echo "Starting......: " . date("H:i:s") . " mime_header_checks() done\n";
}
開發者ID:articatech,項目名稱:artica,代碼行數:50,代碼來源:exec.postfix.maincf.php


注:本文中的maincf_multi::mime_header_checks方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。