本文整理匯總了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";
}