Exemple #1
0
            if (count($arSearchers) <= 0) {
                ?>
<table width="100%">
	<tr>
		<td><?php 
                echo BeginNote(), GetMessage('SEO_PAGE_ERROR_NO_SEARCHERS'), EndNote();
                ?>
</td>
	</tr>
</table>
<?php 
            } else {
                $arFilter = array('SEARCHER_ID' => implode('|', array_keys($arSearchers)), 'DATE1' => ConvertTimeStamp(strtotime('-3 month'), false, $site_id), 'DATE2' => ConvertTimeStamp(time(), false, $site_id), 'URL' => 'http://' . $server_name . $back_url, 'URL_EXACT_MATCH' => 'Y', 'SITE_ID' => $site);
                $last_ts = strtotime('-' . COption::GetOptionInt('statistic', 'SEARCHER_HIT_DAYS', 3) . ' days');
                $total = 0;
                $dbRes = CSearcherHit::GetList($by = 's_searcher_id', $order = "asc", $arFilter, $is_filtered);
                while ($arRes = $dbRes->Fetch()) {
                    $ts = MakeTimeStamp($arRes['DATE_HIT']);
                    $total++;
                    if ($ts < $last_ts) {
                        $last_ts = $ts;
                    }
                    $arSearcherHits[$arRes['SEARCHER_ID']]++;
                }
                $days_count = floor((time() - $last_ts) / 86400);
                ?>
<table width="100%">
	<tr class="heading">
		<td colspan="2"><?php 
                echo str_replace('#COUNT#', $days_count, GetMessage('SEO_PAGE_STATS_INDEX'));
                ?>
$rs = CSite::GetList($v1 = "sort", $v2 = "asc");
while ($ar = $rs->Fetch()) {
    $ref[] = $ar["ID"];
    $ref_id[] = $ar["ID"];
    $arSites[$ar["ID"]] = "[<a href=\"/bitrix/admin/site_edit.php?LID=" . $ar["ID"] . "&lang=" . LANGUAGE_ID . "\">" . $ar["ID"] . "</a>]&nbsp;";
}
$arSiteDropdown = array("reference" => $ref, "reference_id" => $ref_id);
$arrExactMatch = array("ID_EXACT_MATCH" => "find_id_exact_match", "SEARCHER_EXACT_MATCH" => "find_searcher_exact_match", "URL_EXACT_MATCH" => "find_url_exact_match", "USER_AGENT_EXACT_MATCH" => "find_user_agent_exact_match", "IP_EXACT_MATCH" => "find_ip_exact_match");
$FilterArr = array("find_id", "find_url", "find_url_404", "find_site_id", "find_searcher", "find_searcher_id", "find_date1", "find_date2", "find_ip", "find_user_agent");
$arFilterFields = array_merge($FilterArr, array_values($arrExactMatch));
$lAdmin->InitFilter($arFilterFields);
InitBVarFromArr($arrExactMatch);
AdminListCheckDate($lAdmin, array("find_date1" => $find_date1, "find_date2" => $find_date2));
$arFilter = array("ID" => $find_id, "URL" => $find_url, "SITE_ID" => $find_site_id, "URL_404" => $find_url_404, "SEARCHER" => $find_searcher, "SEARCHER_ID" => $find_searcher_id, "DATE1" => $find_date1, "DATE2" => $find_date2, "IP" => $find_ip, "USER_AGENT" => $find_user_agent);
$arFilter = array_merge($arFilter, array_convert_name_2_value($arrExactMatch));
$rsData = CSearcherHit::GetList($by, $order, $arFilter, $is_filtered);
$rsData = new CAdminResult($rsData, $sTableID);
$rsData->NavStart();
$lAdmin->NavText($rsData->GetNavPrint(GetMessage("STAT_HIT_PAGES")));
$lAdmin->AddHeaders(array(array("id" => "ID", "content" => "ID", "sort" => "s_id", "default" => true), array("id" => "DATE_HIT", "content" => GetMessage("STAT_DATE"), "sort" => "s_date_hit", "default" => true), array("id" => "SEARCHER_ID", "content" => GetMessage("STAT_SEARCHER"), "sort" => "s_searcher_id", "default" => true), array("id" => "USER_AGENT", "content" => GetMessage("STAT_USER_AGENT"), "sort" => "s_user_agent", "default" => true), array("id" => "IP", "content" => GetMessage("STAT_IP"), "sort" => "s_ip", "default" => true), array("id" => "SITE_ID", "content" => GetMessage("STAT_PAGE"), "sort" => "s_url", "default" => true)));
while ($arRes = $rsData->NavNext(true, "f_")) {
    $row =& $lAdmin->AddRow($f_ID, $arRes);
    $txt = "[<a title=\"" . GetMessage("STAT_SRCH_LIST") . "\" href=\"searcher_list.php?lang=" . LANGUAGE_ID . "&amp;find_id={$f_SEARCHER_ID}&amp;find_id_exact_match=Y&amp;set_filter=Y\">{$f_SEARCHER_ID}</a>]&nbsp;{$f_SEARCHER_NAME}";
    $row->AddViewField("SEARCHER_ID", $txt);
    $row->AddViewField("USER_AGENT", TxtToHTML($f_USER_AGENT));
    $arr = explode(".", $f_IP);
    $txt = GetWhoisLink($f_IP) . " [<a title=\"" . GetMessage("STAT_ADD_TO_STOPLIST_TITLE") . "\" href=\"stoplist_edit.php?lang=" . LANGUAGE_ID . "&amp;net1={$arr['0']}&amp;net2={$arr['1']}&amp;net3={$arr['2']}&amp;net4={$arr['3']}\">" . GetMessage("STAT_STOP") . "</a>]";
    $row->AddViewField("IP", $txt);
    $row->AddViewField("SITE_ID", '[' . $arSites[$f_SITE_ID] . '] ' . StatAdminListFormatURL($arRes["URL"], array("title" => GetMessage("STAT_LINK_OPEN"), "new_window" => false, "max_display_chars" => "default", "chars_per_line" => "default", "kill_sessid" => $STAT_RIGHT < "W")));
}
$lAdmin->AddFooter(array(array("title" => GetMessage("MAIN_ADMIN_LIST_SELECTED"), "value" => $rsData->SelectedRowsCount())));