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