break; case 'authorize': $authResult = Service::authorize(); $res = array("result" => true, "location" => $authResult["location"]); break; case 'nullify_auth': Service::clearAuth($engine->getCode()); $res = array("result" => true); break; case 'wordstat_report_clear': case 'wordstat_report': if ($_REQUEST['action'] == 'wordstat_report_clear') { $reportList = $engine->getWordstatReportList(); if (count($reportList) >= Engine\YandexDirect::MAX_WORDSTAT_REPORTS) { foreach ($reportList as $firstReport) { $engine->deleteWordstatReport($firstReport["ReportID"]); 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_REPORTS"])) { $_SESSION["SEO_REPORTS"] = array(); } sortByColumn($_SESSION["SEO_REPORTS"], "TS"); foreach ($_SESSION["SEO_REPORTS"] as $k => $report) {