$reportId = $engine->createWordstatReport($phraseList, $geoList); $_SESSION["SEO_REPORTS"][$phraseHash] = array("REPORT_ID" => intval($reportId), "PHRASE" => $phraseList, "GEO" => $geoList, "TS" => time()); $res = $_SESSION["SEO_REPORTS"][$phraseHash]; } else { $reportId = $_SESSION["SEO_REPORTS"][$phraseHash]["REPORT_ID"]; $res = $engine->getWordstatReport($reportId); } } break; case 'forecast_report_clear': case 'forecast_report': if ($_REQUEST['action'] == 'forecast_report_clear') { $reportList = $engine->getForecastReportList(); if (count($reportList) >= Engine\YandexDirect::MAX_FORECAST_REPORTS) { foreach ($reportList as $firstReport) { $engine->deleteForecastReport($firstReport["ForecastID"]); break; } } } $phraseList = $_REQUEST['phrase']; $geo = trim($_REQUEST['geo']); if (is_array($phraseList)) { $phraseList = array_values(array_unique($phraseList)); $geoList = strlen($geo) > 0 ? preg_split("/[^0-9\\-]+\\s*/", $geo) : array(); $phraseHash = md5(implode('|', $phraseList) . '|||' . $geo); if (!isset($_SESSION["SEO_FORECASTS"])) { $_SESSION["SEO_FORECASTS"] = array(); } sortByColumn($_SESSION["SEO_FORECASTS"], "TS"); foreach ($_SESSION["SEO_FORECASTS"] as $k => $report) {