<td class="adm-detail-valign-top"><?echo GetMessage("MAIL_MSG_VIEW_SPAM_LEARN")?></td> <td> <input type="radio" name="MARK_SPAM" value="?" id="MARK_SPAM_1" checked><label for="MARK_SPAM_1"><?echo GetMessage("MAIL_MSG_VIEW_SPAM_NOTLEARN")?></label><br> <input type="radio" name="MARK_SPAM" value="Y" id="MARK_SPAM_2"><label for="MARK_SPAM_2"><?echo GetMessage("MAIL_MSG_VIEW_ACT_MARK_AS_SPAM")?></label><br> <input type="radio" name="MARK_SPAM" value="N" id="MARK_SPAM_3"><label for="MARK_SPAM_3"><?echo GetMessage("MAIL_MSG_VIEW_ACT_MARK_AS_NOTSPAM")?></label><br> </td> </tr> <?endif?> <tr> <td><?echo GetMessage("MAIL_MSG_VIEW_ACT_RULE")?></td> <td> <select name="MANUAL_FILTER"> <option value=""><?echo GetMessage("MAIL_MSG_VIEW_ACT_RULE_NOT")?></option> <option value="all"><?echo GetMessage("MAIL_MSG_VIEW_ACT_RULE_ALL")?></option> <? $res = CMailFilter::GetList(Array("NAME"=>"ASC"), Array("ACTIVE"=>"Y", "WHEN_MANUALLY_RUN"=>"Y", "MAILBOX_ID"=>$dbr_arr["MAILBOX_ID"])); while($flt_arr = $res->Fetch()): ?><option value="<?=$flt_arr["ID"]?>"><?=htmlspecialcharsbx($flt_arr["NAME"])?> [<?=htmlspecialcharsbx($flt_arr["ID"])?>]</option><? endwhile?> </select> </td> </tr> <tr> <td><?echo GetMessage("MAIL_MSG_VIEW_ACT_RULE_DELETE")?></td> <td><input type="checkbox" name="DELETE_MESSAGE" value="Y"></td> </tr> <tr class="heading"><td colspan="2"><?=GetMessage("MAIL_MSG_VIEW_LOG")?></td></tr> <tr> <td colspan="2" align="center">
function SpamAction($message, $bIsSPAM, $bDelete = false) { global $DB; global $BX_MAIL_SPAM_CNT; if(!is_set($BX_MAIL_SPAM_CNT, "G")) { $strSql = "SELECT MAX(GOOD_CNT) as G, MAX(BAD_CNT) as B FROM b_mail_spam_weight"; if($res = $DB->Query($strSql)) $BX_MAIL_SPAM_CNT = $res->Fetch(); if(intval($BX_MAIL_SPAM_CNT["G"])<=0) $BX_MAIL_SPAM_CNT["G"] = 1; if(intval($BX_MAIL_SPAM_CNT["B"])<=0) $BX_MAIL_SPAM_CNT["B"] = 1; } if($bDelete && $bIsSPAM) $BX_MAIL_SPAM_CNT["B"]--; elseif($bDelete && !$bIsSPAM) $BX_MAIL_SPAM_CNT["G"]--; elseif(!$bDelete && $bIsSPAM) $BX_MAIL_SPAM_CNT["B"]++; elseif(!$bDelete && !$bIsSPAM) $BX_MAIL_SPAM_CNT["G"]++; @set_time_limit(30); // split to words $arWords = CMailFilter::getWords($message, 1000); // for every word find Si $strWords = "''"; foreach($arWords as $word) { $word_md5 = md5($word); // change weight $strSql = "INSERT INTO b_mail_spam_weight(WORD_ID, WORD_REAL, GOOD_CNT, BAD_CNT, TOTAL_CNT) ". "VALUES('".$word_md5."', '".$DB->ForSql($word, 40)."', ".($bIsSPAM?0:1).", ".($bIsSPAM?1:0).", 1)"; if($bDelete || (!$DB->Query($strSql, true))) { if($bDelete) { $strSql = "UPDATE b_mail_spam_weight SET ". " GOOD_CNT = GOOD_CNT - ".($bIsSPAM?0:1).", ". " BAD_CNT = BAD_CNT - ".($bIsSPAM?1:0).", ". " TOTAL_CNT = TOTAL_CNT - 1 ". "WHERE WORD_ID = '".$word_md5."' ". " AND ".($bIsSPAM?"BAD_CNT>0":"GOOD_CNT>0");// AND WORD_REAL = '".$DB->ForSql($word, 40)."'"; } else { $strSql = "UPDATE b_mail_spam_weight SET ". " GOOD_CNT = GOOD_CNT + ".($bIsSPAM?0:1).", ". " BAD_CNT = BAD_CNT + ".($bIsSPAM?1:0).", ". " TOTAL_CNT = TOTAL_CNT + 1 ". "WHERE WORD_ID='".$word_md5."'";// AND WORD_REAL = '".$DB->ForSql($word, 40)."'"; } $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__); } } if(COption::GetOptionString("mail", "reset_all_spam_result", "N") == "Y") $DB->Query("UPDATE b_mail_message SET SPAM_LAST_RESULT='N'"); }
$arHeaders[] = array("id" => "SERVER", "content" => GetMessage("MAIL_MBOX_ADR"), "default" => true, "sort" => "server"); $arHeaders[] = array("id" => "SERVER_TYPE", "content" => GetMessage("MAIL_MBOX_ADM_TYPE"), "default" => true, "sort" => "server_type"); $arHeaders[] = array("id" => "LID", "content" => GetMessage("MAIL_MBOX_ADM_LANG"), "default" => true, "sort" => "lang"); $arHeaders[] = array("id" => "TIMESTAMP_X", "content" => GetMessage("MAIL_MBOX_ADM_DATECH"), "default" => true, "sort" => "timestamp_x"); $arHeaders[] = array("id" => "ID", "content" => "ID", "default" => true, "sort" => "id"); $lAdmin->AddHeaders($arHeaders); // построение списка while ($arRes = $rsData->NavNext(true, "f_")) { $row =& $lAdmin->AddRow($f_ID, $arRes); $str = "mail_filter_admin.php?lang=" . LANG . "&find_mailbox_id=" . $f_ID . "&set_filter=Y"; $row->AddViewField("MAILBOX_NAME", $str); $row->AddCheckField("ACTIVE"); $row->AddInputField("NAME", array("size" => "35")); $row->AddInputField("SERVER", array("size" => "35")); $arActions = array(); $rules = CMailFilter::GetList(array(), array("MAILBOX_ID" => $f_ID), true); $res = $rules->Fetch(); if ($arRes['USER_ID'] == 0) { $arActions[] = array("ICON" => "list", "TEXT" => GetMessage("MAIL_MBOX_ADM_RULES_LINK") . " (" . intval($res["CNT"]) . ")", "ACTION" => $lAdmin->ActionRedirect("mail_filter_admin.php?set_filter=Y&find_mailbox_id=" . $f_ID . "&lang=" . LANG)); $arActions[] = array("ICON" => "add", "TEXT" => GetMessage("MAIL_MBOX_ADM_NEWRULE"), "ACTION" => $lAdmin->ActionRedirect("mail_filter_edit.php?MAILBOX_ID=" . $f_ID . "&lang=" . LANG)); $arActions[] = array("SEPARATOR" => true); $arActions[] = array("ICON" => "list", "TEXT" => GetMessage("MAIL_MBOX_ADM_LOG"), "ACTION" => $lAdmin->ActionRedirect("mail_log.php?set_filter=Y&find_mailbox_id=" . $f_ID . "&lang=" . LANG)); $msgs = CMailMessage::GetList(array(), array("MAILBOX_ID" => $f_ID), true); $res = $msgs->Fetch(); $arActions[] = array("ICON" => "list", "TEXT" => GetMessage("MAIL_MBOX_ADM_MESSAGES") . " (" . intval($res["CNT_NEW"]) . " / " . intval($res["CNT"]) . ")", "ACTION" => $lAdmin->ActionRedirect("mail_message_admin.php?set_filter=Y&find_mailbox_id=" . $f_ID . "&lang=" . LANG)); $arActions[] = array("SEPARATOR" => true); } $arActions[] = array("ICON" => "edit", "DEFAULT" => "Y", "TEXT" => GetMessage("MAIL_MBOX_ADM_CHANGE2"), "ACTION" => $lAdmin->ActionRedirect("mail_mailbox_edit.php?ID=" . $f_ID . "&lang=" . LANG)); if ($MOD_RIGHT == "W") { $arActions[] = array("SEPARATOR" => true); $arActions[] = array("ICON" => "delete", "TEXT" => GetMessage("MAIL_MBOX_ADM_DELETE"), "ACTION" => "if(confirm('" . GetMessage('MAIL_MBOX_ADM_DEL_CONFIRM') . "')) " . $lAdmin->ActionDoGroup($f_ID, "delete"));
//{ if (strlen($save) > 0) { LocalRedirect("mail_filter_admin.php?lang=" . LANG); } else { LocalRedirect($APPLICATION->GetCurPage() . "?lang=" . LANG . "&ID=" . $ID . "&tabControl_active_tab=" . urlencode($tabControl_active_tab)); } //} } } $mf = CMailFilter::GetByID($ID); if (!($ar_res = $mf->ExtractFields("str_"))) { $ID = 0; } else { $filter_type = $ar_res["ACTION_TYPE"]; if (strlen($filter_type) > 0) { $res = CMailFilter::GetFilterList($filter_type); $arModFilter = $res->Fetch(); } } if (!$message) { if (!isset($ACTIVE)) { $ACTIVE = "Y"; } if (!isset($PORT)) { $PORT = "110"; } if (!isset($SORT)) { $SORT = "500"; } if (!isset($MAILBOX_ID)) { $MAILBOX_ID = $find_mailbox_id;
<tr id="pop6"> <td><?echo GetMessage("MAIL_MBOX_EDT_PERIOD")?></td> <td><input type="text" name="PERIOD_CHECK" size="5" maxlength="18" value="<?echo $str_PERIOD_CHECK?>"> <?echo GetMessage("MAIL_MBOX_EDT_PERIOD_MIN")?></td> </tr> <?if($ID<=0):?> <tr class="heading"> <td align="center" colspan="2"><?echo GetMessage("MAIL_MBOX_EDT_ADD_NEW_RULE")?></td> </tr> <tr> <td align="center" colspan="2" class="adm-detail-valign-top"> <select name="filter_type"> <option value="manual"<?if($filter_type==$a_ID)echo ' manual'?>><?echo GetMessage("MAIL_MBOX_EDT_ADD_NEW_RULE_MANUAL")?></option> <? $res = CMailFilter::GetFilterList(); while($ar = $res->ExtractFields("a_")) { ?><option value="<?php echo $a_ID; ?> "<?if($filter_type==$a_ID)echo ' selected'?>><?php echo $a_NAME; ?> </option><? } ?> </select> <input type="submit" <?if ($MOD_RIGHT<"W") echo "disabled" ?> name="save_ext" value="<?echo GetMessage("MAIL_MBOX_EDT_ADD")?>"> </td> </tr>
$arActions[] = array("TEXT" => GetMessage("MAIL_MSG_ADM_PROC_ACT_NOTREAD"), "ACTION" => $lAdmin->ActionAjaxReload($APPLICATION->GetCurPage() . "?action=mark_as_unread&ID=" . $f_ID . "&lang=" . LANG . "&" . bitrix_sessid_get())); } $arActions[] = array("SEPARATOR" => true); $arActions[] = array("ICON" => "delete", "TEXT" => GetMessage("MAIL_MSG_ADM_PROC_ACT_DELETE"), "ACTION" => "if(confirm('" . GetMessage('MAIL_MSG_ADM_FILTER_CONFIRM10') . "')) " . $lAdmin->ActionDoGroup($f_ID, "delete")); } $row->AddActions($arActions); } $lAdmin->AddFooter(array(array("title" => GetMessage("MAIN_ADMIN_LIST_SELECTED"), "value" => $rsData->SelectedRowsCount()), array("counter" => true, "title" => GetMessage("MAIN_ADMIN_LIST_CHECKED"), "value" => "0"))); $arActions = array(); $arActions["mark_as_spam"] = GetMessage("MAIL_MSG_ADM_PROC_ACT_SPAM"); $arActions["mark_as_notspam"] = GetMessage("MAIL_MSG_ADM_PROC_ACT_NOTSPAM"); $arActions["mark_as_read"] = GetMessage("MAIL_MSG_ADM_PROC_ACT_READ"); $arActions["mark_as_unread"] = GetMessage("MAIL_MSG_ADM_PROC_ACT_NOTREAD"); $arActions["delete"] = GetMessage("MAIL_MSG_ADM_PROC_ACT_DELETE"); $arActions["refilter"] = GetMessage("MAIL_MSG_ADM_PROC_ACT_RULES"); $res = CMailFilter::GetList(array("NAME" => "ASC"), array("ACTIVE" => "Y", "WHEN_MANUALLY_RUN" => "Y")); while ($flt_arr = $res->Fetch()) { $arActions["refilter_num_" . $flt_arr["ID"]] = GetMessage("MAIL_MSG_ADM_PROC_ACT_RULE") . " " . htmlspecialcharsbx(substr($flt_arr["NAME"], 0, 30)); } if ($MOD_RIGHT == "W") { $lAdmin->AddGroupActionTable($arActions); } ob_start(); ?> <form action="mail_check_new_messages.php" method="get"> <table cellspacing="0"> <tr> <td style="padding-left:5px;"><?php echo GetMessage("MAIL_MSG_ADM_GETMAIL"); ?> </td>
$dbMBF = CMailFilter::GetById($arResult["EMAIL_INTEGRATION"]["MAIL_FILTER_ID"]); $arResult["EMAIL_INTEGRATION"]["MAIL_FILTER"] = $dbMBF->Fetch(); $arFields = array("USER_ID" => $USER->GetID(), "FORUM_ID" => $arParams["FID"], "TOPIC_ID" => 0, "SITE_ID" => SITE_ID, "SOCNET_GROUP_ID" => $arParams["SOCNET_GROUP_ID"]); $db_res = CForumSubscribe::GetList(array(), $arFields); if ($db_res && ($res = $db_res->Fetch())) { $arResult["USER"]["SUBSCRIBE"] = "Y"; } } // если пользователь имеет право на модуль почты: if ($arParams["PERMISSION"] >= "Y" && $APPLICATION->GetGroupRight("mail") > "R") { $arResult["MAILBOXES"] = array(); $dbrMailF = CMailFilter::GetList(array(), array("SERVER_TYPE" => "smtp", "EMPTY" => "Y")); while ($arMailF = $dbrMailF->GetNext()) { $arResult["MAILBOXES"][] = $arMailF; } $dbrMailF = CMailFilter::GetList(array(), array("SERVER_TYPE" => "pop3", "ACTION_TYPE" => "forumsocnet")); while ($arMailF = $dbrMailF->GetNext()) { $arResult["MAILBOXES"][] = $arMailF; } } } /******************************************************************** /Data ********************************************************************/ $this->IncludeComponentTemplate(); /******************************************************************** Standart Action ********************************************************************/ if ($arParams["SET_TITLE"] != "N") { $APPLICATION->AddChainItem(GetMessage("FL_FORUM_CHAIN")); $APPLICATION->SetTitle(GetMessage("FL_FORUM_CHAIN"));
echo GetMessage("MAIL_LOG_FILT_RULE"); ?> :</td> <td nowrap> <select name="find_filter_id"> <option value=""><?php echo GetMessage("MAIL_LOG_FILT_ANY"); ?> </option> <?php ClearVars("mf_"); $arF = array(); if ($find_mailbox_id > 0) { $arF["MAILBOX_ID"] = $find_mailbox_id; } $l = CMailFilter::GetList(array("NAME" => "ASC", "ID" => "ASC"), $arF); while ($l->ExtractFields("mf_")) { ?> <option value="<?php echo $mf_ID; ?> "<?php if ($find_filter_id == $mf_ID) { echo " selected"; } ?> ><?php echo $mf_NAME; ?> </option><?php }
function MarkAsSpam($message, $bIsSPAM = true) { return CMailFilter::SpamAction($message, $bIsSPAM); }
if (isset($arRegexpData['DEAL'])) { $arCurrentMailBox['REGEXP_DEAL'] = $arSettings['REGEXP_DEAL'] = $arRegexpData['DEAL']; } } // Allow creation of new pop3 mail box only if it is not found if (!$pop3MailBoxExist) { if (count($arResult['MAILBOXES_LIST']) == 1) { // Remove 'Select mail box' item if there are no mail boxes unset($arResult['MAILBOXES_LIST']['-1']); } $arResult['MAILBOXES_LIST']['0'] = GetMessage('CRM_EMAIL_MAILBOX_NEW'); } // Mail filter ID $mailFilterID = intval(COption::GetOptionString('crm', 'mail_filter', 0)); if ($mailFilterID > 0) { $rsMailFilter = CMailFilter::GetById($mailFilterID); $arMailFilter = $rsMailFilter->Fetch(); if (is_array($arMailFilter)) { $mailBoxID = $arMailFilter['MAILBOX_ID']; // Putting saved filter settings in associated mail box if (isset($arSettings['MAILBOXES'][$mailBoxID])) { $mailBox =& $arSettings['MAILBOXES'][$mailBoxID]; $arActions = explode('&', $arMailFilter['ACTION_VARS']); for ($i = count($arActions) - 1; $i >= 0; $i--) { $arExp = explode('=', $arActions[$i]); if (!isset($arExp[1])) { continue; } $expName = ''; if ($i == 0) { $expName = 'REGEXP_LEAD';