function __construct($extraWatch) { parent::__construct($extraWatch); $this->extraWatch = $extraWatch; $this->visitHistory = new ExtraWatchVisitHistory($extraWatch); }
/** * goals */ function checkGoals($title, $username, $ip, $came_from, $liveSite = "", $clickedXpath = "") { $query = sprintf("select * from #__extrawatch_goals"); $rows = $this->database->objectListQuery($query); if (@$rows) { foreach ($rows as $row) { $achieved = array(); if ($row->disabled) { continue; } if (@trim(@$row->clicked_element_xpath_condition)) { @($achieved[clicked_element_xpath_condition] = FALSE); if (@$this->helper->wildcardSearch(trim(@$row->clicked_element_xpath_condition), $clickedXpath)) { @($achieved[clicked_element_xpath_condition] = TRUE); } } else { if (@trim($row->uri_inversed) == "on") { if (@trim($row->uri_condition)) { @($achieved[uri_condition] = FALSE); if (@$this->helper->wildcardSearch($row->uri_condition, trim($this->helper->getURI()))) { } else { @($achieved[uri_condition] = TRUE); } } } else { if (@trim($row->uri_condition)) { @($achieved[uri_condition] = FALSE); if (@$this->helper->wildcardSearch($row->uri_condition, trim($this->helper->getURI()))) { @($achieved[uri_condition] = TRUE); } } } if (@trim($row->get_inversed) == "on") { if (@trim($row->get_condition)) { @($achieved[get_condition] = FALSE); if (@$this->helper->wildcardSearch($row->get_condition, trim(ExtraWatchInput::validate(_EW_INPUT_ONE_STRING, ExtraWatchHelper::requestGet($row->get_var))))) { /// } else { if ($row->get_var == "*") { $found = FALSE; foreach (ExtraWatchHelper::requestGet() as $get) { /// if ($this->helper->wildcardSearch($row->get_condition, trim($get))) { $found = TRUE; } } if ($found) { @($achieved[uri_condition] = FALSE); } } else { @($achieved[uri_condition] = TRUE); } } } } else { if (@trim($row->get_condition)) { @($achieved[get_condition] = FALSE); if (@$this->helper->wildcardSearch($row->get_condition, trim(ExtraWatchInput::validate(_EW_INPUT_ONE_STRING, ExtraWatchHelper::requestGet($row->get_var))))) { /// @($achieved[get_condition] = TRUE); } else { if ($row->get_var == "*") { foreach (ExtraWatchHelper::requestGet() as $get) { /// if ($this->helper->wildcardSearch($row->get_condition, trim($get))) { @($achieved[get_condition] = TRUE); } } } } } } if (@trim($row->post_inversed) == "on") { if (@trim($row->post_condition)) { @($achieved[post_condition] = FALSE); if (@$this->helper->wildcardSearch($row->post_condition, trim(ExtraWatchInput::validate(_EW_INPUT_ONE_STRING, ExtraWatchHelper::requestPost($row->post_var))))) { /// } else { if ($row->post_var == "*") { $found = FALSE; foreach (ExtraWatchHelper::requestPost() as $post) { /// if ($this->helper->wildcardSearch($row->post_condition, trim($post))) { /// $found = TRUE; } } if ($found) { @($achieved[post_condition] = FALSE); } } else { @($achieved[post_condition] = TRUE); } } } } else { if (@trim($row->post_condition)) { @($achieved[post_condition] = FALSE); if (@$this->helper->wildcardSearch($row->post_condition, trim(ExtraWatchInput::validate(_EW_INPUT_ONE_STRING, ExtraWatchHelper::requestPost($row->post_var))))) { /// @($achieved[post_condition] = TRUE); } else { if ($row->post_var == "*") { foreach (ExtraWatchHelper::requestPost() as $post) { if ($this->helper->wildcardSearch($row->post_condition, trim($post))) { @($achieved[post_condition] = TRUE); } } } } } } if (@trim($row->title_inversed) == "on") { if (@trim($row->title_condition)) { @($achieved[title_condition] = FALSE); if (@$this->helper->wildcardSearch($row->title_condition, trim($title))) { } else { @($achieved[title_condition] = TRUE); } } } else { if (@trim($row->title_condition)) { @($achieved[title_condition] = FALSE); if (@$this->helper->wildcardSearch($row->title_condition, trim($title))) { @($achieved[title_condition] = TRUE); } } } if (@trim($row->username_inversed) == "on") { if (@trim($row->username_condition)) { @($achieved[username_condition] = FALSE); if (@$this->helper->wildcardSearch($row->username_condition, trim($username))) { } else { @($achieved[username_condition] = TRUE); } } } else { if (@trim($row->username_condition)) { @($achieved[username_condition] = FALSE); if (@$this->helper->wildcardSearch($row->username_condition, trim($username))) { @($achieved[username_condition] = TRUE); } } } if (@trim($row->ip_inversed) == "on") { if (@trim($row->ip_condition)) { @($achieved[ip_condition] = FALSE); if (@$this->helper->wildcardSearch($row->ip_condition, trim($ip))) { } else { @($achieved[ip_condition] = TRUE); } } } else { if (@trim($row->ip_condition)) { @($achieved[ip_condition] = FALSE); if (@$this->helper->wildcardSearch($row->ip_condition, trim($ip))) { @($achieved[ip_condition] = TRUE); } } } if (@trim($row->came_from_inversed) == "on") { if (@trim($row->came_from_condition)) { @($achieved[came_from_condition] = FALSE); if (@$this->helper->wildcardSearch($row->came_from_condition, trim($came_from)) || $this->helper->wildcardSearch($liveSite . $row->came_from_condition, trim($came_from))) { } else { @($achieved[came_from_condition] = TRUE); } } } else { if (@trim($row->came_from_condition)) { @($achieved[came_from_condition] = FALSE); if (@$this->helper->wildcardSearch($row->came_from_condition, trim($came_from)) || $this->helper->wildcardSearch($liveSite . $row->came_from_condition, trim($came_from))) { @($achieved[came_from_condition] = TRUE); } } } if (@trim($row->country_inversed) == "on") { if (@trim($row->country_condition)) { @($achieved[came_from_condition] = FALSE); $country = $this->helper->countryByIp($ip); //performance optim. - checking country only if there is some condition if (@$this->helper->wildcardSearch($row->country_condition, trim($country))) { } else { @($achieved[came_from_condition] = TRUE); } } } else { if (@trim($row->country_condition)) { @($achieved[country_condition] = FALSE); $country = $this->helper->countryByIp($ip); //performance optim. - checking country only if there is some condition if (@$this->helper->wildcardSearch($row->country_condition, trim($country))) { @($achieved[country_condition] = TRUE); } } } } if ($this->evaluateAchievedGoals($achieved)) { $this->stat->increaseKeyValueInGroup(EW_DB_KEY_GOALS, $row->id); $this->addIp2GoalId($ip, $row->id); if ($this->config->getCheckboxBooleanValue($row->send_email)) { $totalAchievedCountToday = $this->stat->getIntValueByNameAndValue(EW_DB_KEY_GOALS, $row->id); $email = $this->config->getConfigValue("EXTRAWATCH_EMAIL_REPORTS_ADDRESS"); $env = ExtraWatchInput::validate(_EW_INPUT_ENV, ExtraWatchEnvFactory::getEnvironment()); $ip = ExtraWatchInput::validate(_EW_INPUT_IP, ExtraWatchVisit::getRemoteIPAddress()); /// $subject = sprintf(_EW_GOAL_EMAIL_SUBJECT, $row->name, $totalAchievedCountToday); require_once realpath(dirname(__FILE__)) . DS . "html" . DS . "class.extrawatch.visit.html.php"; $extraWatch = new ExtraWatchMain(); $extraWatchVisitHTML = new ExtraWatchVisitHTML($extraWatch); $visitsOutput = $extraWatchVisitHTML->renderTable(FALSE, 0, $ip, TRUE); $visitsOutput .= $extraWatchVisitHTML->renderTable(FALSE, 1, $ip, TRUE); $body = "ip: <b>{$ip}</b><br/>{$visitsOutput}"; ExtraWatchHelper::sendEmail($env, $email, $email, $subject, $body); } if (@$row->redirect) { $env = ExtraWatchInput::validate(_EW_INPUT_ENV, ExtraWatchEnvFactory::getEnvironment()); /// $env->redirect(@$row->redirect); } if (@$row->block) { $blockReason = sprintf(_EW_BLOCKED_BASED_ON_GOAL, $row->id); $this->block->blockIp($ip, $blockReason); try { $this->block->dieWithBlockingMessage($ip); } catch (ExtraWatchIPBlockedException $exception) { die($exception->getBlockingMessage()); } } } } } }
include_once JPATH_BASE2 . DS . "components" . DS . "com_extrawatch" . DS . "includes.php"; $extraWatch = new ExtraWatchMain(); $extraWatch->helper->setNoindexHttpHeaders(); //setting explicitly for ajax requests $extraWatch->block->checkBackendTokenFromUrl(); $extraWatch->config->initializeTranslations(); $uriId = (int) ExtraWatchHelper::requestGet('uriId'); /// $ip = ExtraWatchInput::validate(_EW_IP, ExtraWatchHelper::requestGet('ip')); /// $uri2titleId = (int) ExtraWatchHelper::requestGet('uri2titleId'); /// $day = (int) ExtraWatchHelper::requestGet('day'); /// $uriIdVisitRow = $extraWatch->visit->getJoinedURIRowById($uriId); $extraWatchVisitsHTML = new ExtraWatchVisitHTML($extraWatch); $extraWatchHeatmapHTML = new ExtraWatchHeatmapHTML($extraWatch->database); $output = ""; $output .= "\n <a href='javascript:extrawatch_blockIpToggle(\"{$ip}\");extrawatch_sendVisitsReq();'><img src='" . $extraWatch->config->getLiveSiteWithSuffix() . "components/com_extrawatch/img/icons/block.png' />" . _EW_VISIT_BLOCK_IP . "</a><br/> \t \t \t \t\t \t \t \t \t \t\t \t \t\t \t \t\t\t \t \t\t \t \t \t\t \t \t \t \t \t \t\t \t\t \t\t\t\t \t\t\t \t\t \t\t \t \t\t \t\t \n <a href='" . $extraWatch->config->renderLink("goals", "&action=insert&id=" . $uriId) . "' '" . _EW_VISIT_ADD_PAGE . "'><img src='" . $extraWatch->config->getLiveSiteWithSuffix() . "components/com_extrawatch/img/icons/goal-add.gif' />" . _EW_VISIT_ADD_PAGE . "</a>"; $getData = $extraWatchVisitsHTML->renderGetVars($uriId); $postData = $extraWatchVisitsHTML->renderPostVars($uriId); $output .= "<table>"; if ($getData) { $output .= "<tr><td><br/><u>" . _EW_VISIT_URL_PARAMETERS . "</u></td>" . $getData; } if ($postData) { $output .= "<tr><td><br/><u>" . _EW_VISIT_SUBMITED_FIELDS . "</u></td>" . $postData; } $clicks = $extraWatch->heatmap->getHeatmapClicksByUri2TitleId($uri2titleId, $day, $ip); $uri = $extraWatch->visit->getUriNameByUri2TitleId($uri2titleId); if ($clicks) {