function renderExtraWatchAgent() { $output = ""; $extraWatch = new ExtraWatchMain(); require_once JPATH_BASE . DS . "components" . DS . "com_extrawatch" . DS . "lang" . DS . $extraWatch->config->getLanguage() . ".php"; if (EXTRAWATCH_DEBUG) { $output .= "<span style='color: #ff3333'>" . _EW_DESC_DEBUG . "</span><br/>"; } $extraWatch->block->checkPostRequestForSpam(ExtraWatchHelper::requestGet()); /// $extraWatch->block->checkPostRequestForSpam(ExtraWatchHelper::requestPost()); /// try { $extraWatch->visit->insertVisit(); } catch (ExtraWatchIPBlockedException $e) { die($this->config->getConfigValue('EXTRAWATCH_BLOCKING_MESSAGE')); } /* * The following piece of code identifies the userAgent and inserts the backlink to extrawatch.com * I would really appreciate, that you would keep the this unchanged. * It took me some time to create and maintain this component and to share it with everyone. * This is the least you could kindly do. Thank you. * * CodeGravity.com */ $output = ""; // reset output; $title = ""; if (!_EW_CLOUD_MODE) { $title = "Heatmap, Real-time analytics, Conversion tracking and anti-spam for Joomla, Wordpress, Drupal, Magento and Prestashop"; } $output .= $extraWatch->helper->renderHTMLCodeSnippet(_EW_PROJECT_ID); return $output; }
function getRootSiteAbsolute() { $hostname = ExtraWatchHelper::getProtocol() . "://" . $_SERVER['HTTP_HOST']; $scriptName = $_SERVER['SCRIPT_NAME']; $scriptNameExploded = explode("wp-content/", $scriptName); if (sizeof($scriptNameExploded) > 1) { $subdir = @$scriptNameExploded[0]; } else { $subdir = str_replace("wp-admin/admin.php", "", $scriptName); } $rootSite = $hostname . $subdir; return $rootSite; }
/** * visitor */ function getJoinedURIRows($bots, $inactive, $ipFilter = FALSE) { if ($bots) { $browserCondition = "is NULL"; $limit = $this->config->getConfigValue("EXTRAWATCH_LIMIT_BOTS"); } else { $browserCondition = "is not NULL"; $limit = $this->config->getConfigValue("EXTRAWATCH_LIMIT_VISITORS"); } $count = $this->config->getConfigValue('EXTRAWATCH_HISTORY_MAX_VALUES'); $actualPage = (int) ExtraWatchHelper::requestGet('pageNum'); /// $actualRecord = $actualPage * $count; $limit = $actualRecord . "," . $count; $query = sprintf("SELECT *, #__extrawatch_history.id as visitId FROM #__extrawatch_history LEFT JOIN #__extrawatch_uri_history ON #__extrawatch_history.id = #__extrawatch_uri_history.fk WHERE #__extrawatch_history.browser %s order by #__extrawatch_history.id desc, #__extrawatch_uri_history.timestamp desc limit %s", $this->database->getEscaped($browserCondition), $this->database->getEscaped($limit)); $rows = $this->database->objectListQuery($query); return $rows; }
function renderHistoryNavigation() { $pageNumFromRequest = (int) @ExtraWatchHelper::requestGet('pageNum'); $increment = $this->extraWatch->config->getConfigValue('EXTRAWATCH_HISTORY_MAX_VALUES'); $count = $this->visitHistory->getHistoryCount(); $maxPageCount = 0; if ((int) $increment) { $maxPageCount = floor($count / $increment); } $maxPages = 20; if (!$pageNumFromRequest) { $pageNumFromRequest = 0; } $output = ""; $output .= "<table width='100%'><tr><td>"; if (isset($pageNumFromRequest) && $pageNumFromRequest > 0) { $pageNumPrev = $pageNumFromRequest - 1; } $output .= $this->renderPageLink(@$pageNumPrev, "<<" . _EW_HISTORY_PREVIOUS, @$pageNumFromRequest); $output .= $this->renderPageLink(0, 0, $pageNumFromRequest) . " ... "; $j = 0; for ($i = $pageNumFromRequest - floor($maxPages / 2); $i < $maxPageCount; $i++) { if ($i > 0 && $i < $maxPageCount) { $pageNum = $i; $output .= $this->renderPageLink($pageNum, $pageNum, $pageNumFromRequest); if ($j > $maxPages) { break; } $j++; } } $output .= "... " . $this->renderPageLink($maxPageCount, $maxPageCount, $pageNumFromRequest); if (isset($pageNumFromRequest) && $pageNumFromRequest < $maxPageCount) { $pageNumNext = $pageNumFromRequest + 1; } $output .= $this->renderPageLink(@$pageNumNext, _EW_HISTORY_NEXT . ">>", $pageNumFromRequest); $output .= "</td></tr></table>"; echo $output; }
static function getAjax() { if (@$_REQUEST["env"] == "ExtraWatchJoomlaEnv") { /// defined('_JEXEC') or die('Restricted access'); } if (!defined("_JEXEC")) { define("_JEXEC", 1); } if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } $modulePath = realpath(dirname(__FILE__) . DS . '..' . DS . '..'); if (!defined("JPATH_BASE2")) { define("JPATH_BASE2", $modulePath); } if (@EXTRAWATCH_PROFILING_ENABLED) { $t1 = round(microtime(true) * 1000); } require_once $modulePath . DS . 'administrator' . DS . 'components' . DS . 'com_extrawatch' . DS . 'admin.extrawatch.php'; if (@_EW_CLOUD_MODE) { $queryParams = ExtraWatchHelper::getUrlQueryParams(); if (@(!$task)) { $task = @$queryParams['task']; /// } echo @extrawatch_mainController(@$task); } if (@EXTRAWATCH_PROFILING_ENABLED) { $time = round(microtime(true) * 1000) - $t1; } if (@EXTRAWATCH_PROFILING_ENABLED) { ExtraWatchLog::debug("({$time} ms) controller call "); } die; }
/** * @return string */ public function getTokenFromRequestUrl() { $queryParams = ExtraWatchHelper::getUrlQueryParams(); $token = ExtraWatchInput::validate(_EW_INPUT_ONE_STRING, @$queryParams[ExtraWatchConfig::_EW_TOKEN_PARAM_NAME]); /// return $token; }
</tr> <tr> <td valign='top'><?php echo $values; ?> </td> </tr> <tr> <td colspan='4'> </td> </tr> <?php } ?> </table> <table> <?php echo $extraWatchBlockHTML->renderBlockedIPs($day, @ExtraWatchHelper::requestGet('ip_blocking_title')); ?> </table> <br/> <hr size='1' width='100%'/> <?php echo $extraWatchHTML->renderDateControl(); ?>
$week = (int) @ExtraWatchHelper::requestGet('week'); /// } else { $week = $extraWatch->date->getWeekSince1970($extraWatch->date->getUserTimestamp()); } $prevWeek = $week - 1; $nextWeek = $week + 1; ExtraWatchLog::debug("day: {$day}"); $t1 = time() + microtime(); ?> <table border='0' cellpadding='1' cellspacing='0' width='100%'> <?php require_once JPATH_BASE2 . DS . "components" . DS . "com_extrawatch" . DS . "view" . DS . "stats-header.php"; if (@ExtraWatchHelper::requestGet('tab') == "1") { require_once JPATH_BASE2 . DS . "components" . DS . "com_extrawatch" . DS . "view" . DS . "stats-total.php"; } else { require_once JPATH_BASE2 . DS . "components" . DS . "com_extrawatch" . DS . "view" . DS . "stats-today.php"; } require_once JPATH_BASE2 . DS . "components" . DS . "com_extrawatch" . DS . "view" . DS . "stats-footer.php"; ?> </table> <br/><br/> <span style='color: #ddd'><?php echo _EW_RENDERED_IN; ?> <?php echo sprintf("%.2f", time() + microtime() - $t1);
public static function validate($type, $input = "") { switch ($type) { case _EW_INPUT_IP: $inputModified = $input; if (@strstr($inputModified, _EW_IP_SEPARATOR)) { //has multiple entries splitted by "," ? self::splitAndValidateMultipleIp($inputModified); return $inputModified; } else { $inputModified = self::replaceWildcardWithRealNumber($inputModified); if (!(filter_var($inputModified, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) || filter_var($inputModified, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))) { throw new ExtraWatchInputException(_EW_INPUT_IP, $input); } } return $input; case _EW_INPUT_URL: if (!filter_var($input, FILTER_VALIDATE_URL)) { throw new ExtraWatchInputException(_EW_INPUT_URL, $input); } return $input; case _EW_INPUT_ONE_STRING: if (@$input && !filter_var($input, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH)) { throw new ExtraWatchInputException(_EW_INPUT_ONE_STRING, $input); } return $input; case _EW_INPUT_FILE_PATH: $dir = realpath(dirname(__FILE__) . DS . ".."); if (!ExtraWatchHelper::startsWith($input, $dir)) { throw new ExtraWatchInputException(_EW_INPUT_FILE_PATH, $input); } return $input; case _EW_INPUT_FILE_PATH_TMP: $dir = self::getUploadTmpDir(); if (!ExtraWatchHelper::startsWith($input, $dir)) { throw new ExtraWatchInputException(_EW_INPUT_FILE_PATH_TMP, $input); } return $input; case _EW_INPUT_FILE_ROOT_PATH_HTACCESS: $env = ExtraWatchEnvFactory::getEnvironment(); $rootPath = $env->getRootPath(); $dir = $rootPath . DS . ".htaccess"; if (!ExtraWatchHelper::startsWith($input, $dir)) { throw new ExtraWatchInputException(_EW_INPUT_FILE_ROOT_PATH_HTACCESS, $input); } return $input; case _EW_INPUT_EXTRACT: if (@$input && $input != "getParams=") { $object = @$input['params']; if ($object) { if ($object && $object != "getParams=") { $getParams = ExtraWatchHelper::convertUrlQuery($object); if ($getParams) { foreach ($getParams as $getParam => $getParamValue) { if ($getParam && !array_search($getParam, unserialize(_EW_ALLOWED_PARAMS_TO_EXTRACT))) { throw new ExtraWatchInputException(_EW_INPUT_EXTRACT, $getParam); } } } else { $reflector = new ReflectionClass(get_class($object)); $classFileName = dirname($reflector->getFileName()); if (!self::validate(_EW_INPUT_FILE_PATH, $classFileName)) { throw new ExtraWatchInputException(_EW_INPUT_EXTRACT, $classFileName); } } } } } return $input; break; case _EW_INPUT_EMAIL: if (filter_var($input, FILTER_VALIDATE_EMAIL) === false) { throw new ExtraWatchInputException(_EW_INPUT_EMAIL, $input); } return $input; break; case _EW_INPUT_FILE_NAME: $tmpUploadDir = self::getUploadTmpDir(); $tmpUploadDir = str_replace("/", DS, $tmpUploadDir); if (!ExtraWatchHelper::startsWith($input['file']['tmp_name'], $tmpUploadDir)) { throw new ExtraWatchInputException(_EW_INPUT_FILE_NAME, $input); } return $input; case _EW_INPUT_FILE_EXTERNAL_PATH: case _EW_INPUT_DIR: $env = ExtraWatchEnvFactory::getEnvironment(); if (!ExtraWatchHelper::startsWith(realpath($input), realpath($env->getCMSFileSystemRootPath()))) { throw new ExtraWatchInputException(_EW_INPUT_FILE_EXTERNAL_PATH, $input); } return $input; case _EW_INPUT_HOST: $isIpValid = filter_var($input, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) || filter_var($input, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6); $isHostValid = preg_match("/^([a-z\\d](-*[a-z\\d])*)(\\.([a-z\\d](-*[a-z\\d])*))*\$/i", $input) && preg_match("/^.{1,253}\$/", $input) && preg_match("/^[^\\.]{1,63}(\\.[^\\.]{1,63})*\$/", $input); //length of each label if (!($isIpValid || $isHostValid)) { throw new ExtraWatchInputException(_EW_INPUT_HOST, $input); } return $input; case _EW_INPUT_REFERRER_SAME_SITE: $env = ExtraWatchEnvFactory::getEnvironment(); if (!ExtraWatchHelper::startsWith($_SERVER["HTTP_REFERER"], $env->getCMSBaseURL())) { throw new ExtraWatchInputException(_EW_INPUT_REFERRER_SAME_SITE, $_SERVER["HTTP_REFERER"]); } return $input; case _EW_INPUT_LANGUAGE: $input = ExtraWatchInput::validate(_EW_INPUT_ONE_STRING, $input); //prevent from using anything else than single string ! $langDir = realpath(dirname(__FILE__) . DS . ".." . DS . "lang" . DS . $input . ".php"); if (!file_exists($langDir)) { throw new ExtraWatchInputException(_EW_INPUT_LANGUAGE, $langDir); } return $input; default: return $input; } }
$uri = ExtraWatchInput::validate(_EW_INPUT_URI, ExtraWatchHelper::requestGet("uri")); /// $queryString = ExtraWatchHelper::requestGet("referringQuery"); /// if ($queryString) { $uri .= "?" . $queryString; } $params = ExtraWatchHelper::requestGet("getParams"); /// $uri = ExtraWatchInput::validate(_EW_INPUT_URI, ExtraWatchHelper::unescapeSlash($uri)); /// $title = ExtraWatchHelper::unescapeSlash($title); /// $referer = ExtraWatchInput::validate(_EW_INPUT_REFERRER, ExtraWatchHelper::unescapeSlash($referer)); /// $params = ExtraWatchHelper::unescapeSlash($params); /// $uri = $uri . $params; //adding params to uri $env = ExtraWatchEnvFactory::getEnvironment(); $modulePath = realpath(dirname(__FILE__) . DS . ".." . DS . ".." . DS . ".." . DS); ExtraWatchLog::debug("img.php - referer: {$referer} title: {$title} uri: {$uri} prams: " . print_r($params, true)); if (@_EW_CLOUD_MODE) { $projectId = (int) @$_REQUEST['projectId']; /// $projectInitialized = $extraWatch->visit->isProjectInitialized($projectId); if ($projectInitialized) { $extraWatch->visit->updateVisitByBrowser($uri, $referer, $title, $params); } else { $extraWatch->setup->initializeDB(TRUE); }
</td> <td align="center" valign="top"> <img src="<?php echo $extraWatch->config->getLiveSiteWithSuffix(); ?> components/com_extrawatch/img/icons/hsv.png" alt=""/><br/> </td> </tr> <tr> <td colspan="5"> <canvas id="trafficflow" width="1024" height="400"/> </td> </tr> <tr> <td colspan="5"> <?php echo $extraWatchFlowHTML->renderFlowTable(@ExtraWatchHelper::requestPost('uriId'), $outgoingLinksCount, $nestingLevel); ?> </td> </tr> </table> <input name='form_key' type='hidden' value="<?php echo $extraWatch->env->getFormKey(); ?> " /> </form>
<?php /** * @file * ExtraWatch - A real-time ajax monitor and live stats * @package ExtraWatch * @version 2.3 * @revision 2572 * @license http://www.gnu.org/licenses/gpl-3.0.txt GNU General Public License v3 * @copyright (C) 2015 by CodeGravity.com - All rights reserved! * @website http://www.codegravity.com */ defined('_JEXEC') or die('Restricted access'); ?> <iframe width="<?php echo $extraWatch->config->getConfigValue('EXTRAWATCH_TOOLTIP_WIDTH'); ?> " height="<?php echo $extraWatch->config->getConfigValue('EXTRAWATCH_TOOLTIP_HEIGHT'); ?> " frameborder="0" marginwidth="0" marginheight="0" src="<?php echo $extraWatch->helper->getIP2LocationURL(@ExtraWatchHelper::requestGet('ip')); ?> "/>
/** * date * @return mixed|string|void */ static function getUserTimezone() { $env = ExtraWatchEnvFactory::getEnvironment(); // if we have an anonymous user, then use global config, instead of the user params if ($env->getUsersCustomTimezoneOffset()) { $userTimezone = $env->getTimezoneOffset(); } else { $userTimezone = $env->getTimezoneOffset(); } /* if the user has no timezone defined, use the timezone from server configuratio */ if (!isset($userTimezone)) { $config = new JConfig(); $userTimezone = $config->offset; } if ($userTimezone && !is_numeric($userTimezone)) { $userTimezone = ExtraWatchHelper::getTimezoneOffsetByTimezoneName($userTimezone); } return $userTimezone; }
*/ defined('_JEXEC') or die('Restricted access'); /*define('DS', DIRECTORY_SEPARATOR); $jBasePath = realpath(dirname(__FILE__) . DS . ".." . DS . ".." . DS . "..". DS); define('JPATH_BASE2', $jBasePath);*/ $env = @$_REQUEST['env']; 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(); ExtraWatchInput::validate(_EW_INPUT_DIR, realpath(realpath(dirname(__FILE__)) . DS . ExtraWatchHelper::requestPost('dir'))); $dir = ExtraWatchHelper::requestPost('dir'); /// $group = ExtraWatchInput::validate(_EW_INPUT_ONE_STRING, ExtraWatchHelper::requestPost('mod')); /// if (!$extraWatch->sizes->isAllowed($dir)) { die(_EW_SIZEQUERY_BAD_REQUEST); } $dir = realpath(realpath(dirname(__FILE__)) . DS . $dir); if (is_dir($dir)) { $sizeNow = $extraWatch->sizes->getDirectorySize($dir, $group, TRUE, $extraWatch->date->jwDateToday()); $sizePrev = $extraWatch->sizes->getDirectorySize($dir, $group, FALSE, $extraWatch->sizes->findLatestCheckDayByComOrModGroup()); if ($sizePrev == $sizeNow) { $size = "<span style='color: gray;'>" . $extraWatch->sizes->sizeFormat($sizeNow) . "</span>"; } elseif ($sizeNow <= $sizePrev) { $size = "<span style='color: green;'>" . $extraWatch->sizes->sizeFormat($sizeNow); if ($sizeNow) { $size .= " (-" . round(($sizePrev - $sizeNow) / $sizeNow * 100) . "%)"; }
/** * @param $uri * @param $title * @param $params * @param $uriId * @param $time * @return string */ public function savePostParams($uri) { $uriId = $this->getUriIdByUri($uri); foreach (ExtraWatchHelper::requestPost() as $key => $value) { $query = sprintf("insert into #__extrawatch_uri_post (`uriid`, `key`, `value`, `type`) values ('%d', '%s', '%s', 1) ", $uriId, $this->database->getEscaped($key), $this->database->getEscaped($value)); $this->database->executeQuery($query); } }
function renderGraphsForGroup($group = 0) { require_once JPATH_BASE2 . DS . "components" . DS . "com_extrawatch" . DS . "view" . DS . "trendtooltip.php"; return; $output = "<table border='0' width='80%'><tr><td>"; if (!$group) { $group = 10; //referers as first value in graphs } $date = $this->extraWatch->date->jwDateToday(); $rows = $this->findLatestGraphDataRecursively($group, $date, FALSE); $output .= $this->renderGraphSelectionForm($group); if (!$rows) { $output .= "<br/><br/><br/><br/><div style='text-align: center'>" . ExtraWatchHelper::renderNoData() . "</div><br/><br/><br/><br/>"; } foreach ($rows as $row) { $output .= "<br/><br/>"; $output .= $this->renderDayTrends($group, $row->name, $date); $output .= "<br/><br/>"; $output .= $this->renderWeekTrends($group, $row->name, $date); $output .= "<hr/><br/>"; } $output .= $this->renderGraphSelectionForm($group); $output .= "</td></tr></table>"; return $output; }
include_once JPATH_BASE2 . DS . "components" . DS . "com_extrawatch" . DS . "includes.php"; $extraWatch = new ExtraWatchMain(); $extraWatch->helper->setNoindexHttpHeaders(); //setting explicitly for ajax requests $extraWatchHTML = new ExtraWatchHTML(); $extraWatchTrendHTML = new ExtraWatchTrendHTML($extraWatch); $extraWatch->block->checkBackendTokenFromUrl(); $extraWatch->config->initializeTranslations(); //echo $extraWatchHTML->renderAdminStyles(); echo $extraWatchHTML->renderPrint(); echo $extraWatchHTML->renderCloseWindow(); $group = (int) @ExtraWatchHelper::requestGet('group'); /// $name = ExtraWatchInput::validate(_EW_INPUT_ONE_STRING, urldecode(@ExtraWatchHelper::requestGet('name'))); /// $date = (int) @ExtraWatchHelper::requestGet('date'); /// ?> <center> <h2><?php echo htmlentities($name); ?> </h2> </center> <br/><br/> <table> <tr> <td> <div id='trendChartDaily' style='width:100%; margin-top:50px; height: 35%;'></div> </td> </tr>
function renderVisitors() { $this->lastDate = ""; $activeVisitorsOutput = $this->getVisitorsCached(FALSE); $inactiveVisitorsOutput = $this->getVisitorsCached(TRUE); $output = $activeVisitorsOutput . $inactiveVisitorsOutput; if (!$output) { $output = ExtraWatchHelper::renderNoData(); } return $output; }
?> var xpathElements = []; var xpathElementClicks = []; var xpathElementColors = []; <?php if (@$xpath == "all") { $totalClicksOfUri2TitleId = $extraWatch->heatmap->getTotalMostClickedHTMLElementsByUri2TitleId($uri2titleId); $xpathElements = $extraWatch->heatmap->getAllMostClickedHTMLElementsByUri2TitleId($uri2titleId, $totalClicksOfUri2TitleId); foreach ($xpathElements as $xpathElement) { echo "xpathElements.push('" . urldecode(urldecode($xpathElement->xpath)) . "');\n"; echo "xpathElementClicks.push('" . $xpathElement->xpathCount . "');\n"; echo "xpathElementColors.push('" . ExtraWatchHelper::rgbColorFromRatio($xpathElement->ratio) . "');\n"; } ?> window.addEventListener('load', ew_Heatmap.highlightElementsByXPath(xpathElements, document)); <?php } else { ?> window.addEventListener('load',function(){ var xpath = '<?php echo urldecode(urldecode($xpath));
function renderAvailableInFullVersion($featureName) { if (!$this->extraWatch->config->isAdFree()) { $output = ExtraWatchHelper::get_include_contents("view" . DS . "fullversion.php", array("extraWatch" => $this->extraWatch, "featureName" => $featureName)); return $output; } }
/** * block */ function saveImportAntiSpamIp($post) { ExtraWatchInput::validate(_EW_INPUT_FILE_NAME, $_FILES); if ($_FILES["file"]["type"] == "application/octet-stream") { /// if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; return; } } if (!ExtraWatchHelper::endsWith($_FILES["file"]["name"], ".csv")) { echo _EW_ANTISPAM_INVALID_EXTENSION; return; } $uploadedFilePath = JPATH_BASE . "/" . $_FILES["file"]["name"]; /// move_uploaded_file($_FILES["file"]["tmp_name"], $uploadedFilePath); /// set_time_limit(0); $handle = fopen($uploadedFilePath, "r"); if (!$handle) { return "Error: it was not possible to open uploaded file from: " . $uploadedFilePath; } $errorMessages = array(); $i = 0; while (($data = stream_get_line($handle, 1024, ",")) !== FALSE) { $ip = $data; if ($ip != 'ip') { if (!ExtraWatchHelper::isValidIPv4($ip)) { $errorMessages[] = "{$ip} is not a valid IP address!"; continue; } $ipArray[] = $ip; } if ($i % self::IP_BULK_IMPORT_SIZE == self::IP_BULK_IMPORT_SIZE - 1) { //flushing array when it has particular size to DB $this->flushIPBulkFromArray($ipArray); $ipArray = array(); } $i++; } $this->flushIPBulkFromArray($ipArray); fclose($handle); unlink($uploadedFilePath); return implode("\n", $errorMessages); }
/** * 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()); } } } } } }
function isHeatmapLoaded() { foreach (ExtraWatchHelper::requestGet() as $key => $value) { if (stristr($key, ExtraWatchHeatmap::HEATMAP_PARAM_NAME)) { return TRUE; } } return FALSE; }
$extraWatch = new ExtraWatchMain(); $extraWatch->helper->setNoindexHttpHeaders(); //setting explicitly for ajax requests $extraWatch->block->checkBackendTokenFromUrl(); $extraWatch->config->initializeTranslations(); $group = ExtraWatchInput::validate(_EW_INPUT_ONE_STRING, ExtraWatchHelper::requestPost('mod')); /// $prevSum = (int) ExtraWatchHelper::requestPost('prev'); /// $suffix = ExtraWatchInput::validate(_EW_INPUT_ONE_STRING, ExtraWatchHelper::requestPost('suffix')); /// ExtraWatchInput::validate(_EW_INPUT_DIR, realpath(dirname(__FILE__) . DS . ExtraWatchHelper::requestPost('dir1'))); $realDirectoryMain = ExtraWatchHelper::requestPost('dir1'); ///** ExtraWatchInput::validate(_EW_INPUT_DIR, realpath(dirname(__FILE__) . DS . ExtraWatchHelper::requestPost('dir2'))); $realDirectoryAdmin = ExtraWatchHelper::requestPost('dir2'); ///** if (!$extraWatch->sizes->isAllowed($realDirectoryMain) || !$extraWatch->sizes->isAllowed($realDirectoryAdmin)) { die(_JW_SIZEQUERY_BAD_REQUEST); } $extraWatch->sizes->renderFileList($group, $realDirectoryMain, $realDirectoryAdmin, $realDirectoryMain, $realDirectoryAdmin, $suffix); $result = $extraWatch->sizes->renderPageTotal; if ($extraWatch->sizes->renderPageTotalRaw == $prevSum) { $result = ""; if ($extraWatch->sizes->renderPageTotalRaw) { $result .= " (" . sprintf("+%.2f", ($extraWatch->sizes->renderPageTotalRaw - $prevSum) / $extraWatch->sizes->renderPageTotalRaw * 100) . "%)"; } } else { if ($extraWatch->sizes->renderPageTotalRaw > $prevSum) { if ($extraWatch->sizes->renderPageTotalRaw) { $result = $result . "<span style='color: #e74c3c;'> (+" . sprintf("%.2f", ($extraWatch->sizes->renderPageTotalRaw - $prevSum) / $extraWatch->sizes->renderPageTotalRaw * 100) . "%)</span>";
style='<?php echo $style; ?> '><?php echo $extraWatchGoalHTML->renderEnabled($row->id, $row->disabled); ?> </td> <td class='ewCentered' style='<?php echo $style; ?> '><?php echo @$extraWatchGoalHTML->renderActionButtons($row->id); ?> </td> </tr> <?php } } ?> </tbody> </table> <br/><br/> <?php if (!$rows) { echo ExtraWatchHelper::renderNoData(); } ?> <br/><br/><br/><br/>
<td colspan='4'> <table width='100%'> <tr> <td class='ewCentered' class='<?php echo $extraWatchStatHTML->renderTabClass("0", @ExtraWatchHelper::requestGet('tab')); ?> '> <?php echo $extraWatchStatHTML->renderSwitched("0", _EW_STATS_DAILY, @ExtraWatchHelper::requestGet('tab')); ?> </td> <td class='ewCentered' class='<?php echo $extraWatchStatHTML->renderTabClass("1", @ExtraWatchHelper::requestGet('tab')); ?> '> <?php echo $extraWatchStatHTML->renderSwitched("1", _EW_STATS_ALL_TIME, @ExtraWatchHelper::requestGet('tab')); ?> </td> <td class='ewCentered' class='tab_none'> </td> </tr> </table> </table>
?> > <tr> <td rowspan="2" id="heatmapElementClick" valign='top' align='left' width='80%'> <?php echo _EW_HEATMAP_LOADING; ?> <br/><br/> </td> </tr> </table> <?php $day = ExtraWatchHelper::requestGet('day'); if (!$day) { $day = $extraWatch->date->jwDateToday(); // yesterday by default, because it contains } ?> <h2><?php echo _EW_CLICK_AREAS_FOR; echo $extraWatch->date->getDateByDay($day); ?> </h2> <i>This section allows you navigate between days and see the differences in percents, charts of most popular clicks by hovering on the blue charts icon</i> <table width='700px' border="0"> <tr> <td colspan="5"> <?php
/** * Returns url like: http://www.thisweburl.com/directory * @return string */ static function getAbsoluteWebURL() { $hostname = ExtraWatchHelper::getProtocol() . "://" . ExtraWatchInput::validate(_EW_INPUT_HOST, $_SERVER['HTTP_HOST']); /// $scriptName = ExtraWatchInput::validate(_EW_INPUT_SCRIPT_NAME, $_SERVER['SCRIPT_NAME']); /// $subdir = str_replace("/index.php", "", $scriptName); $env = ExtraWatchInput::validate(_EW_INPUT_ENV, ExtraWatchEnvFactory::getEnvironment()); /// $adminDirName = $env->getAdminDir(); $subdir = str_replace("/" . $adminDirName, "", $subdir); return $hostname . $subdir; }
function renderImportGoals($result = "") { $output = ExtraWatchHelper::get_include_contents("view" . DS . "importxml.php", array("extraWatch" => $this->extraWatch)); return $output; }
function renderSEOReport($day, $fromEmail = FALSE, $renderAlsoNotChanged = FALSE) { $allTimeReport = $this->extraWatch->config->getCheckboxValue("EXTRAWATCH_SEO_SHOW_ALL_TIME_REPORT"); $showEncryptedKeywords = $this->extraWatch->config->getCheckboxValue('EXTRAWATCH_SEO_LIST_ENCRYPTED_KEYWORDS'); if ($allTimeReport) { $day = FALSE; // if all-time report is checked, day value won't be passed to query } $loadsPerDay = $this->extraWatch->stat->getKeyValueInGroupByDate(EW_DB_KEY_LOADS, EW_DB_KEY_LOADS, $day); if (!$loadsPerDay && !$allTimeReport) { return ExtraWatchHelper::renderNoData(); } $searchEngineHits = $this->extraWatch->seo->getTotalVisitsByKeyphrasesByDay($day); if ($loadsPerDay) { $percent = sprintf("%.2f", $searchEngineHits / $loadsPerDay * 100); } if ($day) { $day = $day - 1; } $output = ""; if (!_EW_CLOUD_MODE) { $output .= $this->renderMostDynamicKeyphrases($renderAlsoNotChanged, $day); } $output .= "<table border='0' class='table'>"; $output .= "<tr><td></td><td align='right'><b>" . _EW_SEO_TOTAL_VISITS_FROM_SEARCH_ENGINES . ": " . $searchEngineHits . " (" . @$percent . "%)</b></td></tr>"; $rows = $this->extraWatch->seo->getUri2KeyphrasePosUris($day); if ($rows) { foreach ($rows as $row) { $isChange = FALSE; $total = $row->valueTotal; $percent = 0; if ($loadsPerDay) { $percent = sprintf("%.2f", $total / $loadsPerDay * 100); } $outputBlock = "<tr><td><h3><a href='" . $row->uri . "'>" . $row->title . "</a></h3><td align='right'><b>" . _EW_STATS_TOTAL . ": " . $total . " ({$percent}%)</b></td></tr><tr><td colspan='2'>"; $rows2 = $this->extraWatch->seo->getUri2KeyphrasePosById($day, $row->uri2titleId); if ($rows2) { $outputBlock .= "<table width='100%' class='tablesorter table table-striped'><thead><tr><th>" . _EW_URI . "</th><th>" . _EW_POSITION . "</th><th>" . _EW_COUNT . "</th><th>" . _EW_EMAIL_REPORTS_PERCENT . "</th><th>" . _EW_EMAIL_REPORTS_1DAY_CHANGE . "</th><th>" . _EW_EMAIL_REPORTS_7DAY_CHANGE . "</th><th>" . _EW_EMAIL_REPORTS_28DAY_CHANGE . "</th><th></th></tr></thead><tbody>"; $i = 0; foreach ($rows2 as $row2) { if (@(!$showEncryptedKeywords) && $row2->keyphrase == ExtraWatchHelper::_EW_ENCRYPTED) { continue; } if ($loadsPerDay) { $percent = sprintf("%.2f", $row2->value / $loadsPerDay * 100); } $isChangeForRow = $this->extraWatchStatHTML->isChange(EW_DB_KEY_SEARCH_RESULT_NUM, $row2->uri2keyphrasePosId, $day); if ($renderAlsoNotChanged || $isChangeForRow) { $outputBlock .= "<tr class='tableRow" . $i++ % 2 . "'><td width='100%'>" . $this->renderKeyphraseLink($row2->keyphrase) . "</td>" . "<td width='5%' align='right'>" . $row2->position . "<td width='5%' align='right'>" . $row2->value . "</td>" . "<td width='5%' align='right' style='color: #555'>(" . $percent . "%)</td>"; if ($day == FALSE) { $dayChanged = ExtraWatchDate::jwDateToday() - 1; } else { $dayChanged = $day; } $outputBlock .= $this->extraWatchStatHTML->renderDiffTableCellsAndIcon(EW_DB_KEY_SEARCH_RESULT_NUM, $row2->uri2keyphrasePosId, $dayChanged, $fromEmail); $outputBlock .= "</tr>\r\n"; $isChange = TRUE; } } $outputBlock .= "</tbody></table><br/>"; } if ($renderAlsoNotChanged || $isChange) { $output .= $outputBlock; } $output .= "</td></tr>\r\n"; } } $output .= "</table>"; return $output; }