コード例 #1
0
ファイル: mainpage.php プロジェクト: DarneoStudio/bitrix
 function GetSiteByAcceptLanguage($compare_site_id = false)
 {
     $site_id = false;
     $arUserLang = explode(",", $_SERVER["HTTP_ACCEPT_LANGUAGE"]);
     $rsSites = CSite::GetDefList();
     while ($arSite = $rsSites->Fetch()) {
         $last_site_id = $arSite["ID"];
         if ($arSite["DEF"] == "Y") {
             $site_id = $arSite["ID"];
         }
         $arSites[] = $arSite;
     }
     if (is_array($arUserLang)) {
         foreach ($arUserLang as $user_lid) {
             $user_lid = strtolower(substr($user_lid, 0, 2));
             foreach ($arSites as $arSite) {
                 $sid = $compare_site_id ? strtolower($arSite["ID"]) : strtolower($arSite["LANGUAGE_ID"]);
                 if ($user_lid == $sid) {
                     return $arSite["ID"];
                 }
             }
         }
     }
     if (strlen($site_id) <= 0) {
         return $last_site_id;
     }
     return $site_id;
 }
コード例 #2
0
ファイル: wizard.php プロジェクト: Satariall/izurit
 function InitStep()
 {
     $this->SetTitle(GetMessage("WW_STEP1"));
     $this->SetNextStep("step2");
     $this->SetStepID("step1");
     $this->SetFinishStep("install");
     $this->SetCancelStep("cancel");
     $dbSite = CSite::GetDefList();
     if ($arSite = $dbSite->Fetch()) {
         CModule::IncludeModule("sale");
         $arCurr = CSaleLang::GetByID($arSite["LID"]);
         $wizard =& $this->GetWizard();
         $wizard->SetDefaultVars(array("siteID" => $arSite["ID"], "orderEmail" => "order@" . $arSite["SERVER_NAME"], "saveBasket" => 30, "currencyID" => $arCurr["CURRENCY"]));
     }
 }
コード例 #3
0
ファイル: main.php プロジェクト: k-kalashnikov/geekcon_new
 function GetDefSite($LID = false)
 {
     if (strlen($LID) > 0) {
         $dbSite = CSite::GetByID($LID);
         if ($dbSite->Fetch()) {
             return $LID;
         }
     }
     $dbDefSites = CSite::GetDefList();
     if ($arDefSite = $dbDefSites->Fetch()) {
         return $arDefSite["LID"];
     }
     return false;
 }
コード例 #4
0
ファイル: statistic.php プロジェクト: ASDAFF/bxApiDocs
	public static function BlockVisitorActivity()
	{
		global $USER;
		if(is_object($USER) && $USER->IsAdmin())
			return false;
		if(defined("STATISTIC_SKIP_ACTIVITY_CHECK"))
			return false;
		if(COption::GetOptionString("statistic", "DEFENCE_ON")=="Y")
		{
			$_SESSION["SESS_SEARCHER_CHECK_ACTIVITY"] = ($_SESSION["SESS_SEARCHER_CHECK_ACTIVITY"]=="N") ? "N" : "Y";
			// если это не поисковик или поисковик, но с установленным флагом "проверять лимит активности"
			if (
				intval($_SESSION["SESS_SEARCHER_ID"]) <= 0
				|| $_SESSION["SESS_SEARCHER_CHECK_ACTIVITY"] == "Y"
			)
			{
				// если установлен максимальный интервал времени для стэка защиты то
				$DEFENCE_DELAY = intval(COption::GetOptionString("statistic", "DEFENCE_DELAY"));
				$STACK_TIME = COption::GetOptionString("statistic", "DEFENCE_STACK_TIME");
				$MAX_STACK_HITS = COption::GetOptionString("statistic", "DEFENCE_MAX_STACK_HITS");
				if (intval($STACK_TIME)>0)
				{
					// если лимит активности уже превышался то
					if (strlen($_SESSION["SESS_GRABBER_STOP_TIME"])>0)
					{
						// если время задержки еще не истекло то
						if ((time()-$_SESSION["SESS_GRABBER_STOP_TIME"])<=$DEFENCE_DELAY)
						{
							// держим дальше
							$_SESSION["SESS_GRABBER_DEFENCE_STACK"] = array();
							return true;
						}
						else // иначе
						{
							// обнуляем время блокирования
							$_SESSION["SESS_GRABBER_STOP_TIME"] = "";
						}
					}
					// запомним время текущего хита в стэке
					$_SESSION["SESS_GRABBER_DEFENCE_STACK"][] = time();
					// почистим стэк до заданного максимального интервала времени
					$first_element = reset($_SESSION["SESS_GRABBER_DEFENCE_STACK"]);
					$stmp = time();
					$current_stack_length = $stmp-$first_element;
					while(is_array($_SESSION["SESS_GRABBER_DEFENCE_STACK"]) && $current_stack_length>$STACK_TIME && count($_SESSION["SESS_GRABBER_DEFENCE_STACK"])>0)
					{
						$first_element = array_shift($_SESSION["SESS_GRABBER_DEFENCE_STACK"]);
						$current_stack_length = $stmp-$first_element;
					}
					$STACK_HITS = count($_SESSION["SESS_GRABBER_DEFENCE_STACK"]);
					// проверим стэк на превышение максимального кол-ва хитов
					if (intval($STACK_HITS)>$MAX_STACK_HITS)
					{
						// инициализируем превышение активности
						$stmp = time();
						$_SESSION["SESS_GRABBER_STOP_TIME"] = $stmp;

						if(COption::GetOptionString("statistic", "DEFENCE_LOG") === "Y")
							CEventLog::Log("WARNING", "STAT_ACTIVITY_LIMIT", "statistic", "", GetMessage("STAT_DEFENCE_LOG_MESSAGE", array(
								"#ACTIVITY_TIME_LIMIT#" => intval($STACK_TIME),
								"#ACTIVITY_HITS#" => intval($STACK_HITS),
								"#ACTIVITY_EXCEEDING#" => (intval($STACK_HITS) - intval($MAX_STACK_HITS)),
							)));

						// если в этой сессии письмо еще не отсылали то
						if ($_SESSION["ACTIVITY_EXCEEDING_NOTIFIED"]!="Y")
						{
							if (intval($_SESSION["SESS_SESSION_ID"])>0)
								$SESSION_LINK = "/bitrix/admin/session_list.php?lang=". $arSite["LANGUAGE_ID"]."&find_id=".$_SESSION["SESS_SESSION_ID"]."&find_id_exact_match=Y&set_filter=Y";

							if (intval($_SESSION["SESS_GUEST_ID"])>0)
								$VISITOR_LINK = "/bitrix/admin/guest_list.php?lang=". $arSite["LANGUAGE_ID"]."&find_id=".$_SESSION["SESS_GUEST_ID"]."&find_id_exact_match=Y&set_filter=Y";

							$arr = explode(".",$_SERVER["REMOTE_ADDR"]);
							$STOPLIST_LINK = "/bitrix/admin/stoplist_edit.php?lang=". $arSite["LANGUAGE_ID"]."&net1=".intval($arr[0])."&net2=".intval($arr[1])."&net3=". intval($arr[2])."&net4=".intval($arr[3])."&user_agent=".urlencode($_SERVER["HTTP_USER_AGENT"]);

							if (intval($_SESSION["SESS_SEARCHER_ID"])>0)
								$SEARCHER_LINK = "/bitrix/admin/hit_searcher_list.php?lang=". $arSite["LANGUAGE_ID"]."&find_searcher_id=".$_SESSION["SESS_SEARCHER_ID"]."&set_filter=Y";

							$arEventFields = array(
								"ACTIVITY_TIME_LIMIT"	=> intval($STACK_TIME),
								"ACTIVITY_HITS"			=> intval($STACK_HITS),
								"ACTIVITY_HITS_LIMIT"	=> intval($MAX_STACK_HITS),
								"ACTIVITY_EXCEEDING"	=> (intval($STACK_HITS) - intval($MAX_STACK_HITS)),
								"CURRENT_TIME"			=> GetTime($stmp,"FULL",$arSite["ID"]),
								"DELAY_TIME"			=> $DEFENCE_DELAY,
								"USER_AGENT"			=> $_SERVER["HTTP_USER_AGENT"],
								"SESSION_ID"			=> $_SESSION["SESS_SESSION_ID"],
								"SESSION_LINK"			=> $SESSION_LINK,
								"SERACHER_ID"			=> $_SESSION["SESS_SEARCHER_ID"],
								"SEARCHER_NAME"			=> $_SESSION["SESS_SEARCHER_NAME"],
								"SEARCHER_LINK"			=> $SEARCHER_LINK,
								"VISITOR_ID"			=> $_SESSION["SESS_GUEST_ID"],
								"VISITOR_LINK"			=> $VISITOR_LINK,
								"STOPLIST_LINK"			=> $STOPLIST_LINK,
								"EMAIL_TO"			=> COption::GetOptionString("main", "email_from", ""),
							);
							if (defined("SITE_ID") && strlen(SITE_ID)>0) $site_id = SITE_ID;
							else
							{
								$rsSite = CSite::GetDefList();
								$arSite = $rsSite->Fetch();
								$site_id = $arSite["ID"];
							}
							CEvent::Send("STATISTIC_ACTIVITY_EXCEEDING", $site_id, $arEventFields);

							$_SESSION["ACTIVITY_EXCEEDING_NOTIFIED"] = "Y";
						}
					}
				}
			}
		}
		return false;
	}
コード例 #5
0
ファイル: stat_tools.php プロジェクト: rasuldev/torino
function SendDailyStatistics()
{
    __SetNoKeepStatistics();
    if ($_SESSION["SESS_NO_AGENT_STATISTIC"] != "Y" && !defined("NO_AGENT_STATISTIC")) {
        global $MESS;
        $rsSite = CSite::GetDefList();
        $arSite = $rsSite->Fetch();
        $charset = $arSite["CHARSET"];
        $now_full_date = GetTime(time(), "FULL", $arSite["ID"], true);
        $now_date = GetTime(time(), "SHORT", $arSite["ID"], true);
        $yesterday_date = GetTime(time() - 86400, "SHORT", $arSite["ID"], true);
        $bef_yesterday_date = GetTime(time() - 172800, "SHORT", $arSite["ID"], true);
        $arComm = CTraffic::GetCommonValues();
        $adv = CAdv::GetList($a_by, $a_order, array(), $is_filtered, "", $arrGROUP_DAYS, $v);
        $events = CStatEventType::GetList($e_by = "s_stat", $e_order = "desc", array(), $is_filtered);
        $referers = CTraffic::GetRefererList($by, $order, array(), $is_filtered);
        $phrases = CTraffic::GetPhraseList($s_by, $s_order, array(), $is_filtered);
        $searchers = CSearcher::GetList($f_by = "s_stat", $f_order = "desc", array(), $is_filtered);
        $OLD_MESS = $MESS;
        $MESS = array();
        IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/statistic/include.php", $arSite["LANGUAGE_ID"]);
        IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/statistic/admin/stat_list.php", $arSite["LANGUAGE_ID"]);
        $HTML_HEADER = '
			<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
			<html>
			<head>
			<meta http-equiv="Content-Type" content="text/html; charset=' . $charset . '">
			<style>
			.tablehead1 {background-color:#C2DBED; padding:2px; border-top: 1px solid #A8C2D7; border-bottom: 1px solid #A8C2D7; border-left: 1px solid #A8C2D7;}
			.tablehead2 {background-color:#C2DBED; padding:2px; border-top: 1px solid #A8C2D7; border-bottom: 1px solid #A8C2D7;}
			.tablehead3 {background-color:#C2DBED; padding:2px; border-top: 1px solid #A8C2D7; border-bottom: 1px solid #A8C2D7; border-right: 1px solid #A8C2D7;}
			.tablebody1 {background-color:#F0F1F2; padding:2px; border-left:#B9D3E6 solid 1px; border-bottom:#B9D3E6 solid 1px;}
			.tablebody2 {background-color:#F0F1F2; padding:2px; border-bottom:#B9D3E6 solid 1px;}
			.tablebody3 {background-color:#F0F1F2; padding:2px; border-right:#B9D3E6 solid 1px; border-bottom:#B9D3E6 solid 1px;}
			.tablebodytext {font-family: Arial, Helvetica, sans-serif; font-size:12px; color:#000000;}
			.tableheadtext {font-family: Arial, Helvetica, sans-serif; font-size:12px; color:#000000;}
			.tablelinebottom {border-bottom:1pt solid #D1D1D1}
			.notesmall {font-family: Arial, Helvetica, sans-serif; font-size:11px; color:#008400; font-weight:normal;}
			.tablebody1_sel {background-color:#E0EBF1; padding:2px; border-left:#B9D3E6 solid 1px; border-bottom:#B9D3E6 solid 1px;}
			.tablebody2_sel {background-color:#E0EBF1; padding:2px; border-bottom:#B9D3E6 solid 1px;}
			.tablebody3_sel {background-color:#E0EBF1; padding:2px; border-right:#B9D3E6 solid 1px; border-bottom:#B9D3E6 solid 1px;}
			</style>
			</head>
			<body bgcolor="FFFFFF" leftmargin="2" topmargin="2" marginwidth="2" marginheight="2">
			';
        $HTML_COMMON = '
					<table border="0" cellspacing="1" cellpadding="3" width="100%">
						<tr>
							<td valign="top" align="center" class="tablehead1" width="48%" nowrap><font class="tableheadtext">' . GetMessage("STAT_VISIT") . '</font></td>
							<td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tableheadtext">' . GetMessage("STAT_TODAY") . '</font><br><font class="notesmall">' . $now_date . '</font></td>
							<td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tableheadtext">' . GetMessage("STAT_YESTERDAY") . '</font><br><font class="notesmall">' . $yesterday_date . '</font></td>
							<td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tableheadtext">' . GetMessage("STAT_BEFORE_YESTERDAY") . '</font><br><font class="notesmall">' . $bef_yesterday_date . '</font></td>
							<td valign="top" align="center" class="tablehead3" width="13%" nowrap><font class="tableheadtext">' . GetMessage("STAT_TOTAL_1") . '</font></td>
						</tr>
						<tr valign="top">
							<td valign="top" class="tablebody1" width="48%" nowrap><font class="tablebodytext">' . GetMessage("STAT_HITS") . '</font></td>
							<td valign="top" align="right" class="tablebody2" width="13%" nowrap><font class="tablebodytext">' . $arComm["TODAY_HITS"] . '</font></td>
							<td valign="top" align="right" class="tablebody2" width="13%" nowrap><font class="tablebodytext">' . $arComm["YESTERDAY_HITS"] . '</font></td>
							<td valign="top" align="right" class="tablebody2" width="13%" nowrap><font class="tablebodytext">' . $arComm["B_YESTERDAY_HITS"] . '</font></td>
							<td valign="top" align="right" class="tablebody3" width="13%" nowrap><font class="tablebodytext">' . $arComm["TOTAL_HITS"] . '&nbsp;&nbsp;</font></td>
						</tr>
						<tr valign="top">
							<td valign="top" class="tablebody1" width="48%" nowrap><font class="tablebodytext">' . GetMessage("STAT_HOSTS") . '</font></td>
							<td valign="top" align="right" class="tablebody2" width="13%" nowrap><font class="tablebodytext">' . $arComm["TODAY_HOSTS"] . '</font></td>
							<td valign="top" align="right" class="tablebody2" width="13%" nowrap><font class="tablebodytext">' . $arComm["YESTERDAY_HOSTS"] . '</font></td>
							<td valign="top" align="right" class="tablebody2" width="13%" nowrap><font class="tablebodytext">' . $arComm["B_YESTERDAY_HOSTS"] . '</font></td>
							<td valign="top" align="right" class="tablebody3" width="13%" nowrap><font class="tablebodytext">' . $arComm["TOTAL_HOSTS"] . '&nbsp;&nbsp;</font></td>
						</tr>
						<tr valign="top">
							<td valign="top" class="tablebody1" width="48%" nowrap><font class="tablebodytext">' . GetMessage("STAT_SESSIONS") . '</font></td>
							<td valign="top" align="right" class="tablebody2" width="13%" nowrap><font class="tablebodytext">' . $arComm["TODAY_SESSIONS"] . '</font></td>
							<td valign="top" align="right" class="tablebody2" width="13%" nowrap><font class="tablebodytext">' . $arComm["YESTERDAY_SESSIONS"] . '</font></td>
							<td valign="top" align="right" class="tablebody2" width="13%" nowrap><font class="tablebodytext">' . $arComm["B_YESTERDAY_SESSIONS"] . '</font></td>
							<td valign="top" align="right" class="tablebody3" width="13%" nowrap><font class="tablebodytext">' . $arComm["TOTAL_SESSIONS"] . '&nbsp;&nbsp;</font></td>
						</tr>
						<tr valign="top">
							<td valign="top" class="tablebody1" width="48%" nowrap><font class="tablebodytext">' . GetMessage("STAT_C_EVENTS") . '</font></td>
							<td valign="top" align="right" class="tablebody2" width="13%" nowrap><font class="tablebodytext">' . $arComm["TODAY_EVENTS"] . '</font></td>
							<td valign="top" align="right" class="tablebody2" width="13%" nowrap><font class="tablebodytext">' . $arComm["YESTERDAY_EVENTS"] . '</font></td>
							<td valign="top" align="right" class="tablebody2" width="13%" nowrap><font class="tablebodytext">' . $arComm["B_YESTERDAY_EVENTS"] . '</font></td>
							<td valign="top" align="right" class="tablebody3" width="13%" nowrap><font class="tablebodytext">' . $arComm["TOTAL_EVENTS"] . '&nbsp;&nbsp;</font></td>
						</tr>
						<tr valign="top">
							<td valign="top" class="tablebody1" width="48%" nowrap>
								<table border="0" cellspacing="0" cellpadding="0" width="100%">
									<tr>
										<td width="100%"><font class="tablebodytext">' . GetMessage("STAT_GUESTS") . '</font></td>
										<td width="0%" align="right" class="tablelinebottom" nowrap><font class="tablebodytext">' . GetMessage("STAT_TOTAL") . '</font></td>
									</tr>
									<tr>
										<td></td>
										<td class="tablelinebottom" align="right" nowrap><font class="tablebodytext">' . GetMessage("STAT_NEW") . '</font></td>
									</tr>
									<tr>
										<td></td>
										<td align="right" nowrap><font class="tablebodytext">' . GetMessage("STAT_ONLINE") . '</font></td>
									</tr>
								</table></td>
							<td valign="top" align="right" class="tablebody2" width="13%" nowrap>
								<table cellspacing=0 cellpadding=0 width="100%">
									<tr><td class="tablelinebottom" align="right" width="100%"><font class="tablebodytext">' . $arComm["TODAY_GUESTS"] . '</font></td></tr>
									<tr><td class="tablelinebottom" align="right"><font class="tablebodytext">' . $arComm["TODAY_NEW_GUESTS"] . '</font></td></tr>
									<tr><td align="right"><font class="tablebodytext">' . $arComm["ONLINE_GUESTS"] . '</font></td></tr>
								</table></td>
							<td valign="top" align="right" class="tablebody2" width="13%" nowrap>
								<table cellspacing=0 cellpadding=0 width="100%">
									<tr><td class="tablelinebottom" align="right" width="100%"><font class="tablebodytext">' . $arComm["YESTERDAY_GUESTS"] . '</font></td></tr>
									<tr><td class="tablelinebottom" align="right"><font class="tablebodytext">' . $arComm["YESTERDAY_NEW_GUESTS"] . '</font></td></tr>
								</table></td>
							<td valign="top" align="right" class="tablebody2" width="13%" nowrap>
								<table cellspacing=0 cellpadding=0 width="100%">
									<tr><td align="right" class="tablelinebottom" width="100%"><font class="tablebodytext">' . $arComm["B_YESTERDAY_GUESTS"] . '</font></td></tr>
									<tr><td class="tablelinebottom" align="right"><font class="tablebodytext">' . $arComm["B_YESTERDAY_NEW_GUESTS"] . '</font></td></tr>
								</table></td>
							<td valign="top" align="right" class="tablebody3" width="13%" nowrap>
								<table cellspacing=0 cellpadding=0 width="100%">
									<tr><td class="tablelinebottom" align="right" width="100%"><font class="tablebodytext">' . $arComm["TOTAL_GUESTS"] . '&nbsp;&nbsp;</font></td></tr>
									<tr><td class="tablelinebottom" align="right"><font class="tablebodytext">&nbsp;</font></td></tr>
								</table></td>
						</tr>
					</table>
				</td>
			</tr>
			</table>
			';
        $HTML_ADV = '
			<font class="tablebodytext">' . GetMessage("STAT_ADV") . ' (' . GetMessage("STAT_DIRECT_SESSIONS") . ') (Top 10):</font><br>
			<table border="0" cellspacing="1" cellpadding="3" width="100%">
				<tr>
					<td valign="top" align="center" class="tablehead1" width="48%" nowrap><font class="tableheadtext">' . GetMessage("STAT_ADV_NAME") . '</font></td>
					<td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tableheadtext">' . GetMessage("STAT_TODAY") . '</font><br><font class="notesmall">' . $now_date . '</font></td>
					<td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tableheadtext">' . GetMessage("STAT_YESTERDAY") . '</font><br><font class="notesmall">' . $yesterday_date . '</font></td>
					<td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tableheadtext">' . GetMessage("STAT_BEFORE_YESTERDAY") . '</font><br><font class="notesmall">' . $bef_yesterday_date . '</font></td>
					<td valign="top" align="center" class="tablehead3" width="13%" nowrap><font class="tableheadtext">' . GetMessage("STAT_TOTAL_1") . '</font></td>
				</tr>
			';
        $i = 0;
        $total_SESSIONS_TODAY = 0;
        $total_SESSIONS_YESTERDAY = 0;
        $total_SESSIONS_BEF_YESTERDAY = 0;
        $total_SESSIONS = 0;
        while ($ar = $adv->Fetch()) {
            $i++;
            $total_SESSIONS_TODAY += $ar["SESSIONS_TODAY"];
            $total_SESSIONS_YESTERDAY += $ar["SESSIONS_YESTERDAY"];
            $total_SESSIONS_BEF_YESTERDAY += $ar["SESSIONS_BEF_YESTERDAY"];
            $total_SESSIONS += $ar["SESSIONS"];
            if ($i <= 10) {
                $HTML_ADV .= '
				<tr>
					<td valign="top" class="tablebody1"><font class="tablebodytext">[' . $ar["ID"] . ']&nbsp;' . $ar["REFERER1"] . '&nbsp;/&nbsp;' . $ar["REFERER2"] . '</font></td>
					<td valign="top" align="right" class="tablebody2"><font class="tablebodytext">&nbsp;' . ($ar["SESSIONS_TODAY"] > 0 ? $ar["SESSIONS_TODAY"] : "&nbsp;") . '</font></td>
					<td valign="top" align="right" class="tablebody2"><font class="tablebodytext">&nbsp;' . ($ar["SESSIONS_YESTERDAY"] > 0 ? $ar["SESSIONS_YESTERDAY"] : "&nbsp;") . '</font></td>
					<td valign="top" align="right" class="tablebody2"><font class="tablebodytext">&nbsp;' . ($ar["SESSIONS_BEF_YESTERDAY"] > 0 ? $ar["SESSIONS_BEF_YESTERDAY"] : "&nbsp;") . '</font></td>
					<td valign="top" align="right" class="tablebody3"><font class="tablebodytext">&nbsp;' . ($ar["SESSIONS"] > 0 ? $ar["SESSIONS"] : "&nbsp;") . '</font></td>
				</tr>
				';
            }
        }
        $HTML_ADV .= '
				<tr>
					<td valign="top" align="right" class="tablebody1_sel" style="padding:3px"><font class="tablebodytext">' . GetMessage("STAT_TOTAL") . '</font></td>
					<td valign="top" align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">&nbsp;' . ($total_SESSIONS_TODAY > 0 ? $total_SESSIONS_TODAY : "&nbsp;") . '</font></td>
					<td valign="top" align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">&nbsp;' . ($total_SESSIONS_YESTERDAY > 0 ? $total_SESSIONS_YESTERDAY : "&nbsp;") . '</font></td>
					<td valign="top" align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">&nbsp;' . ($total_SESSIONS_BEF_YESTERDAY > 0 ? $total_SESSIONS_BEF_YESTERDAY : "&nbsp;") . '</font></td>
					<td valign="top" align="right" class="tablebody3_sel" style="padding:3px"><font class="tablebodytext">&nbsp;' . ($total_SESSIONS > 0 ? $total_SESSIONS : "&nbsp;") . '</font></td>
			</table>
			';
        $HTML_EVENTS = '
			<font class="tablebodytext">' . GetMessage("STAT_EVENTS_2") . ' (Top 10):</font><br>
			<table border="0" cellspacing="1" cellpadding="3" width="100%">
				<tr>
					<td valign="top" align="center" class="tablehead1" width="48%" nowrap><font class="tableheadtext">' . GetMessage("STAT_EVENT") . '</font></td>
					<td valign="top" align="center" class="tablehead2" width="13%" nowrap>
						<font class="tablebodytext">' . GetMessage("STAT_TODAY") . '</font><br><font class="notesmall">' . $now_date . '</font></td>
					<td valign="top" align="center" class="tablehead2" width="13%" nowrap>
						<font class="tablebodytext">' . GetMessage("STAT_YESTERDAY") . '</font><br><font class="notesmall">' . $yesterday_date . '</font></td>
					<td valign="top" align="center" class="tablehead2" width="13%" nowrap>
						<font class="tablebodytext">' . GetMessage("STAT_BEFORE_YESTERDAY") . '</font><br><font class="notesmall">' . $bef_yesterday_date . '</font></td>
					<td valign="top" align="center" class="tablehead3" width="13%" nowrap>
						<font class="tablebodytext">' . GetMessage("STAT_TOTAL_1") . '</font></td>
				</tr>
			';
        $i = 0;
        $total_TODAY_COUNTER = 0;
        $total_YESTERDAY_COUNTER = 0;
        $total_B_YESTERDAY_COUNTER = 0;
        $total_TOTAL_COUNTER = 0;
        while ($er = $events->Fetch()) {
            $i++;
            $total_TODAY_COUNTER += intval($er["TODAY_COUNTER"]);
            $total_YESTERDAY_COUNTER += intval($er["YESTERDAY_COUNTER"]);
            $total_B_YESTERDAY_COUNTER += intval($er["B_YESTERDAY_COUNTER"]);
            $total_TOTAL_COUNTER += intval($er["TOTAL_COUNTER"]);
            if ($i <= 10) {
                $HTML_EVENTS .= '
				<tr valign="top">
					<td valign="top" class="tablebody1" width="0%" nowrap><font class="tablebodytext">' . $er["EVENT"] . '</font></td>
					<td valign="top" align="right" class="tablebody2" width="0%" nowrap><font class="tablebodytext">' . ($er["TODAY_COUNTER"] > 0 ? $er["TODAY_COUNTER"] : "&nbsp;") . '</font></td>
					<td valign="top" align="right" class="tablebody2" width="0%" nowrap><font class="tablebodytext">' . ($er["YESTERDAY_COUNTER"] > 0 ? $er["YESTERDAY_COUNTER"] : "&nbsp;") . '</font></td>
					<td valign="top" align="right" class="tablebody2" width="0%" nowrap><font class="tablebodytext">' . ($er["B_YESTERDAY_COUNTER"] > 0 ? $er["B_YESTERDAY_COUNTER"] : "&nbsp;") . '</font></td>
					<td valign="top" align="right" class="tablebody3" width="0%" nowrap><font class="tablebodytext">' . ($er["TOTAL_COUNTER"] > 0 ? $er["TOTAL_COUNTER"] : "&nbsp;") . '</font></td>
				</tr>
				';
            }
        }
        $HTML_EVENTS .= '
				<tr valign="top">
					<td align="right" class="tablebody1_sel" style="padding:3px"><font class="tablebodytext">' . GetMessage("STAT_TOTAL") . '</font></td>
					<td align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">' . ($total_TODAY_COUNTER > 0 ? $total_TODAY_COUNTER : "&nbsp;") . '</font></td>
					<td align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">' . ($total_YESTERDAY_COUNTER > 0 ? $total_YESTERDAY_COUNTER : "&nbsp;") . '</font></td>
					<td align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">' . ($total_B_YESTERDAY_COUNTER > 0 ? $total_B_YESTERDAY_COUNTER : "&nbsp;") . '</font></td>
					<td align="right" class="tablebody3_sel" style="padding:3px"><font class="tablebodytext">' . ($total_TOTAL_COUNTER > 0 ? $total_TOTAL_COUNTER : "&nbsp;") . '</font></td>
			</table>
			';
        $HTML_REFERERS = '
			<font class="tablebodytext">' . GetMessage("STAT_REFERERS") . ' (Top 10):</font><br>
			<table border="0" cellspacing="1" cellpadding="3" width="100%">
				<tr>
					<td valign="top" align="center" class="tablehead1" width="48%" nowrap><font class="tableheadtext">' . GetMessage("STAT_SERVER") . '</font></td>
					<td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tablebodytext">' . GetMessage("STAT_TODAY") . '</font><br><font class="notesmall">' . $now_date . '</font></td>
					<td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tablebodytext">' . GetMessage("STAT_YESTERDAY") . '</font><br><font class="notesmall">' . $yesterday_date . '</font></td>
					<td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tablebodytext">' . GetMessage("STAT_BEFORE_YESTERDAY") . '</font><br><font class="notesmall">' . $bef_yesterday_date . '</font></td>
					<td valign="top" align="center" class="tablehead3" width="13%" nowrap><font class="tablebodytext">' . GetMessage("STAT_TOTAL_1") . '</font></td>
				</tr>
			';
        $i = 0;
        $total_TODAY_REFERERS = 0;
        $total_YESTERDAY_REFERERS = 0;
        $total_B_YESTERDAY_REFERERS = 0;
        $total_TOTAL_REFERERS = 0;
        while ($rr = $referers->Fetch()) {
            $i++;
            $total_TODAY_REFERERS += $rr["TODAY_REFERERS"];
            $total_YESTERDAY_REFERERS += $rr["YESTERDAY_REFERERS"];
            $total_B_YESTERDAY_REFERERS += $rr["B_YESTERDAY_REFERERS"];
            $total_TOTAL_REFERERS += $rr["TOTAL_REFERERS"];
            if ($i <= 10) {
                $HTML_REFERERS .= '
				<tr>
					<td valign="top" class="tablebody1" nowrap><font class="tablebodytext">' . $rr["SITE_NAME"] . '</font></td>
					<td align="right" class="tablebody2"><font class="tablebodytext">' . ($rr["TODAY_REFERERS"] > 0 ? $rr["TODAY_REFERERS"] : "&nbsp;") . '</font></td>
					<td align="right" class="tablebody2"><font class="tablebodytext">' . ($rr["YESTERDAY_REFERERS"] > 0 ? $rr["YESTERDAY_REFERERS"] : "&nbsp;") . '</font></td>
					<td align="right" class="tablebody2"><font class="tablebodytext">' . ($rr["B_YESTERDAY_REFERERS"] > 0 ? $rr["B_YESTERDAY_REFERERS"] : "&nbsp;") . '</font></td>
					<td align="right" class="tablebody3"><font class="tablebodytext">' . ($rr["TOTAL_REFERERS"] > 0 ? $rr["TOTAL_REFERERS"] : "&nbsp;") . '</font></td>
				</tr>
				';
            }
        }
        $HTML_REFERERS .= '
				<tr valign="top">
					<td align="right" class="tablebody1_sel" style="padding:3px"><font class="tablebodytext">' . GetMessage("STAT_TOTAL") . '</font></td>
					<td align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">' . ($total_TODAY_REFERERS > 0 ? $total_TODAY_REFERERS : "&nbsp;") . '</font></td>
					<td align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">' . ($total_YESTERDAY_REFERERS > 0 ? $total_YESTERDAY_REFERERS : "&nbsp;") . '</font></td>
					<td align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">' . ($total_B_YESTERDAY_REFERERS > 0 ? $total_B_YESTERDAY_REFERERS : "&nbsp;") . '</font></td>
					<td align="right" class="tablebody3_sel" style="padding:3px"><font class="tablebodytext">' . ($total_TOTAL_REFERERS > 0 ? $total_TOTAL_REFERERS : "&nbsp;") . '</font></td>
			</table>
			';
        $HTML_PHRASES = '
			<font class="tablebodytext">' . GetMessage("STAT_PHRASES") . ' (Top 10):</font><br>
			<table border="0" cellspacing="1" cellpadding="3" width="100%">
				<tr>
					<td valign="top" align="center" class="tablehead1" width="48%" nowrap><font class="tableheadtext">' . GetMessage("STAT_PHRASE") . '</td>
					<td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tablebodytext">' . GetMessage("STAT_TODAY") . '</font><br><font class="notesmall">' . $now_date . '</font></td>
					<td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tablebodytext">' . GetMessage("STAT_YESTERDAY") . '</font><br><font class="notesmall">' . $yesterday_date . '</font></td>
					<td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tablebodytext">' . GetMessage("STAT_BEFORE_YESTERDAY") . '</font><br><font class="notesmall">' . $bef_yesterday_date . '</font></td>
					<td valign="top" align="center" class="tablehead3" width="13%" nowrap><font class="tablebodytext">' . GetMessage("STAT_TOTAL_1") . '</font></td>
				</tr>
			';
        $i = 0;
        $total_TODAY_PHRASES = 0;
        $total_YESTERDAY_PHRASES = 0;
        $total_B_YESTERDAY_PHRASES = 0;
        $total_TOTAL_PHRASES = 0;
        while ($pr = $phrases->GetNext()) {
            $i++;
            $total_TODAY_PHRASES += $pr["TODAY_PHRASES"];
            $total_YESTERDAY_PHRASES += $pr["YESTERDAY_PHRASES"];
            $total_B_YESTERDAY_PHRASES += $pr["B_YESTERDAY_PHRASES"];
            $total_TOTAL_PHRASES += $pr["TOTAL_PHRASES"];
            if ($i <= 10) {
                $HTML_PHRASES .= '
				<tr valign="top">
					<td valign="top" class="tablebody1" width="0%" nowrap><font class="tablebodytext">' . TruncateText($pr["PHRASE"], 50) . '</font></td>
					<td align="right" class="tablebody2"><font class="tablebodytext">' . ($pr["TODAY_PHRASES"] > 0 ? $pr["TODAY_PHRASES"] : "&nbsp;") . '</font></td>
					<td align="right" class="tablebody2"><font class="tablebodytext">' . ($pr["YESTERDAY_PHRASES"] > 0 ? $pr["YESTERDAY_PHRASES"] : "&nbsp;") . '</font></td>
					<td align="right" class="tablebody2"><font class="tablebodytext">' . ($pr["B_YESTERDAY_PHRASES"] > 0 ? $pr["B_YESTERDAY_PHRASES"] : "&nbsp;") . '</font></td>
					<td align="right" class="tablebody3"><font class="tablebodytext">' . ($pr["TOTAL_PHRASES"] > 0 ? $pr["TOTAL_PHRASES"] : "&nbsp;") . '</font></td>
				</tr>
				';
            }
        }
        $HTML_PHRASES .= '
				<tr valign="top">
					<td align="right" class="tablebody1_sel" style="padding:3px"><font class="tablebodytext">' . GetMessage("STAT_TOTAL") . '</font></td>
					<td align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">' . ($total_TODAY_PHRASES > 0 ? $total_TODAY_PHRASES : "&nbsp;") . '</font></td>
					<td align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">' . ($total_YESTERDAY_PHRASES > 0 ? $total_YESTERDAY_PHRASES : "&nbsp;") . '</font></td>
					<td align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">' . ($total_B_YESTERDAY_PHRASES > 0 ? $total_B_YESTERDAY_PHRASES : "&nbsp;") . '</font></td>
					<td align="right" class="tablebody3_sel" style="padding:3px"><font class="tablebodytext">' . ($total_TOTAL_PHRASES > 0 ? $total_TOTAL_PHRASES : "&nbsp;") . '</font></td>
			</table>
			';
        $HTML_SEARCHERS = '
			<font class="tablebodytext">' . GetMessage("STAT_SITE_INDEXING") . ' (Top 10):</font><br>
			<table border="0" cellspacing="1" cellpadding="3" width="100%">
				<tr>
					<td valign="top" align="center" class="tablehead1" width="48%" nowrap><font class="tableheadtext">' . GetMessage("STAT_SEARCHER") . '</font></td>
					<td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tablebodytext">' . GetMessage("STAT_TODAY") . '</font><br><font class="notesmall">' . $now_date . '</font></td>
					<td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tablebodytext">' . GetMessage("STAT_YESTERDAY") . '</font><br><font class="notesmall">' . $yesterday_date . '</font></td>
					<td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tablebodytext">' . GetMessage("STAT_BEFORE_YESTERDAY") . '</font><br><font class="notesmall">' . $bef_yesterday_date . '</font></td>
					<td valign="top" align="center" class="tablehead3" width="13%" nowrap><font class="tablebodytext">' . GetMessage("STAT_TOTAL_1") . '</font></td>
				</tr>
			';
        $i = 0;
        $total_TODAY_HITS = 0;
        $total_YESTERDAY_HITS = 0;
        $total_B_YESTERDAY_HITS = 0;
        $total_TOTAL_HITS = 0;
        while ($fr = $searchers->Fetch()) {
            $i++;
            $total_TODAY_HITS += $fr["TODAY_HITS"];
            $total_YESTERDAY_HITS += $fr["YESTERDAY_HITS"];
            $total_B_YESTERDAY_HITS += $fr["B_YESTERDAY_HITS"];
            $total_TOTAL_HITS += $fr["TOTAL_HITS"];
            if ($i <= 10) {
                $HTML_SEARCHERS .= '
				<tr valign="top">
					<td valign="top" class="tablebody1" width="0%" nowrap><font class="tablebodytext">' . $fr["NAME"] . '</font></td>
					<td align="right" class="tablebody2"><font class="tablebodytext">' . ($fr["TODAY_HITS"] > 0 ? $fr["TODAY_HITS"] : "&nbsp;") . '</font></td>
					<td align="right" class="tablebody2"><font class="tablebodytext">' . ($fr["YESTERDAY_HITS"] > 0 ? $fr["YESTERDAY_HITS"] : "&nbsp;") . '</font></td>
					<td align="right" class="tablebody2"><font class="tablebodytext">' . ($fr["B_YESTERDAY_HITS"] > 0 ? $fr["B_YESTERDAY_HITS"] : "&nbsp;") . '</font></td>
					<td align="right" class="tablebody3"><font class="tablebodytext">' . ($fr["TOTAL_HITS"] > 0 ? $fr["TOTAL_HITS"] : "&nbsp;") . '</font></td>
				</tr>
				';
            }
        }
        $HTML_SEARCHERS .= '
				<tr valign="top">
					<td align="right" class="tablebody1_sel" style="padding:3px"><font class="tablebodytext">' . GetMessage("STAT_TOTAL") . '</font></td>
					<td align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">' . ($total_TODAY_HITS > 0 ? $total_TODAY_HITS : "&nbsp;") . '</font></td>
					<td align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">' . ($total_YESTERDAY_HITS > 0 ? $total_YESTERDAY_HITS : "&nbsp;") . '</font></td>
					<td align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">' . ($total_B_YESTERDAY_HITS > 0 ? $total_B_YESTERDAY_HITS : "&nbsp;") . '</font></td>
					<td align="right" class="tablebody3_sel" style="padding:3px"><font class="tablebodytext">' . ($total_TOTAL_HITS > 0 ? $total_TOTAL_HITS : "&nbsp;") . '</font></td>
			</table>
			';
        $HTML_FOOTER = '
			</body>
			</html>
			';
        $arEventFields = array("SERVER_TIME" => $now_full_date, "HTML_HEADER" => $HTML_HEADER, "HTML_FOOTER" => $HTML_FOOTER, "HTML_COMMON" => $HTML_COMMON, "HTML_ADV" => $HTML_ADV, "HTML_EVENTS" => $HTML_EVENTS, "HTML_REFERERS" => $HTML_REFERERS, "HTML_PHRASES" => $HTML_PHRASES, "HTML_SEARCHERS" => $HTML_SEARCHERS, "EMAIL_TO" => COption::GetOptionString("main", "email_from", ""));
        /*
        echo $HTML_HEADER."<br>";
        echo $HTML_FOOTER."<br>";
        echo $HTML_COMMON."<br>";
        echo $HTML_ADV."<br>";
        echo $HTML_EVENTS."<br>";
        echo $HTML_REFERERS."<br>";
        echo $HTML_PHRASES."<br>";
        echo $HTML_SEARCHERS."<br>";
        die();
        */
        CEvent::Send("STATISTIC_DAILY_REPORT", $arSite["ID"], $arEventFields);
        $MESS = $OLD_MESS;
    }
    return "SendDailyStatistics();";
}