function CleanUpAgent() { $agentName = "CSecurityIPRule::CleanUpAgent();"; $cleanupDays = 2; $activeTo = ConvertTimeStamp(time() - $cleanupDays * 24 * 60 * 60, "FULL"); if (!$activeTo) { return $agentName; } $rs = CSecurityIPRule::GetList(array("ID"), array("=RULE_TYPE" => "A", "<=ACTIVE_TO" => $activeTo), array("ID" => "ASC")); while ($ar = $rs->Fetch()) { CSecurityIPRule::Delete($ar["ID"]); } return $agentName; }
if (($arID = $lAdmin->GroupAction()) && $RIGHT_W) { if ($_REQUEST['action_target'] == 'selected') { $cData = new CSecurityIPRule(); $rsData = $cData->GetList(array('ID'), $arFilter, array()); while ($arRes = $rsData->Fetch()) { $arID[] = $arRes['ID']; } } foreach ($arID as $ID) { if (strlen($ID) <= 0) { continue; } $ID = IntVal($ID); switch ($_REQUEST['action']) { case "delete": if (!CSecurityIPRule::Delete($ID)) { $lAdmin->AddGroupError(GetMessage("SEC_IP_LIST_DELETE_ERROR"), $ID); } break; } } } $arHeaders = array(array("id" => "ID", "content" => GetMessage("SEC_IP_LIST_ID"), "align" => "right", "sort" => "ID"), array("id" => "RULE_TYPE", "content" => GetMessage("SEC_IP_LIST_RULE_TYPE"), "align" => "left", "sort" => "RULE_TYPE"), array("id" => "ACTIVE", "content" => GetMessage("SEC_IP_LIST_ACTIVE"), "align" => "center", "default" => true), array("id" => "ADMIN_SECTION", "content" => GetMessage("SEC_IP_LIST_ADMIN_SECTION"), "align" => "center"), array("id" => "SITE_ID", "content" => GetMessage("SEC_IP_LIST_SITE_ID"), "align" => "center"), array("id" => "SORT", "content" => GetMessage("SEC_IP_LIST_SORT"), "align" => "right", "sort" => "SORT", "default" => true), array("id" => "NAME", "content" => GetMessage("SEC_IP_LIST_NAME"), "align" => "left", "sort" => "NAME", "default" => true), array("id" => "ACTIVE_FROM", "content" => GetMessage("SEC_IP_LIST_ACTIVE_FROM"), "align" => "left", "sort" => "ACTIVE_FROM"), array("id" => "ACTIVE_TO", "content" => GetMessage("SEC_IP_LIST_ACTIVE_TO"), "align" => "left", "sort" => "ACTIVE_TO"), array("id" => "INCL_PATH", "content" => GetMessage("SEC_IP_LIST_INCL_PATH"), "align" => "left", "default" => true), array("id" => "EXCL_PATH", "content" => GetMessage("SEC_IP_LIST_EXCL_PATH"), "align" => "left", "default" => true), array("id" => "INCL_IP", "content" => GetMessage("SEC_IP_LIST_INCL_IP"), "align" => "left", "default" => true), array("id" => "EXCL_IP", "content" => GetMessage("SEC_IP_LIST_EXCL_IP"), "align" => "left", "default" => true)); $lAdmin->AddHeaders($arHeaders); $arSelectedFields = $lAdmin->GetVisibleHeaderColumns(); if (!is_array($arSelectedFields) || count($arSelectedFields) < 1) { $arSelectedFields = array("ID", "RULE_TYPE", "ACTIVE", "ADMIN_SECTION", "SITE_ID", "SORT", "NAME", "ACTIVE_FROM", "ACTIVE_TO"); } $arVisibleColumnsMap = array(); foreach ($arSelectedFields as $value) { $arVisibleColumnsMap[$value] = true;
function CleanUpAgent() { $cleanup_days = 2; $rs = CSecurityIPRule::GetList(array("ID"), array("=RULE_TYPE" => "A", "<=ACTIVE_TO" => ConvertTimeStamp(time() - $cleanup_days * 24 * 60 * 60, "FULL")), array("ID" => "ASC")); while ($ar = $rs->Fetch()) { CSecurityIPRule::Delete($ar["ID"]); } return "CSecurityIPRule::CleanUpAgent();"; }