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;
 }
 static function request($key = null)
 {
     $value = ExtraWatchHelper::requestGet($key);
     if (!$value) {
         $value = ExtraWatchHelper::requestPost($key);
     }
     return $value;
 }
 /**
  * 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());
                     }
                 }
             }
         }
     }
 }
$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>";
예제 #5
0
      </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>

예제 #6
0
 */
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 extrawatch_mainController($task = "")
{
    $current_error_reporting = error_reporting();
    error_reporting(E_ALL & ~(E_STRICT | E_NOTICE));
    $extraWatch = new ExtraWatchMain();
    $extraWatchHTML = new ExtraWatchHTML();
    $extraWatchGoalHTML = new ExtraWatchGoalHTML($extraWatch);
    $extraWatchTrendHTML = new ExtraWatchTrendHTML($extraWatch);
    $env = ExtraWatchEnvFactory::getEnvironment();
    $queryParams = ExtraWatchHelper::getUrlQueryParams();
    $action = ExtraWatchInput::validate(_EW_INPUT_ONE_STRING, @$queryParams['action']);
    ///
    if (!$task) {
        $task = ExtraWatchInput::validate(_EW_INPUT_ONE_STRING, @$queryParams['task']);
        ///
    }
    ExtraWatchHelper::checkIfRequestPathAllowed($extraWatch, $env, $task);
    $taskFromNavigation = ExtraWatchInput::validate(_EW_INPUT_ONE_STRING, @ExtraWatchHelper::request('task'));
    ///
    if ($taskFromNavigation) {
        $task = $taskFromNavigation;
    }
    $option = ExtraWatchInput::validate(_EW_INPUT_ONE_STRING, @ExtraWatchHelper::requestGet('option'));
    ///
    $result = ExtraWatchInput::validate(_EW_INPUT_ONE_STRING, @ExtraWatchHelper::requestGet('result'));
    ///
    $params = @$queryParams['params'];
    ///
    $output = "";
    if (!$extraWatch->config->getLiveSite()) {
        $extraWatch->config->setLiveSite($env->getRootSite());
        if ($env->getRootSite() != $extraWatch->config->getLiveSite()) {
            die("<span style='color: red; font-weight: bold;'>Error: It was not possible to write data to the database! Check your database permissions</span>");
        }
    }
    $extraWatch->setup->runAdditionalSQLScripts();
    $extraWatch->config->saveRandValue();
    switch ($task) {
        case "ajax":
            $includePath = JPATH_BASE2 . DS . "components" . DS . "com_extrawatch" . DS . "ajax";
            ExtraWatchHelper::checkIfFileExistsInDir($includePath, $action . ".php");
            if ($action == "download") {
                if (ExtraWatchInput::validate(_EW_INPUT_FILE_PATH, $includePath . DS . $action . ".php")) {
                    include_once $includePath . DS . $action . ".php";
                }
                die;
            } else {
                $extraWatch->config->validateRequestToken($queryParams);
                $output = ExtraWatchHelper::get_include_contents("ajax" . DS . $action . ".php", array("params" => $params));
                die($output);
            }
            break;
        case "js":
            $extraWatch->config->validateRequestToken($queryParams);
            $includePath = "js";
            ExtraWatchHelper::checkIfFileExistsInDir(JPATH_BASE2 . DS . "components" . DS . "com_extrawatch" . DS . $includePath, $action . ".php");
            $output = ExtraWatchHelper::get_include_contents($includePath . DS . $action . ".php", array());
            die($output);
            break;
        case "useFreeVersion":
            $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
            $extraWatch->config->useFreeVersion();
            $extraWatch->config->saveVersionIntoDatabase();
            $extraWatch->config->setLiveSite($env->getRootSite());
            break;
        case "activate":
            $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
            if ($action == "codecanyon") {
                $extraWatch->config->saveConfigValue("EXTRAWATCH_MARKETPLACE", $action);
            }
            $extraWatch->config->activate(ExtraWatchInput::validate(_EW_INPUT_ONE_STRING, ExtraWatchHelper::requestGet('key')));
            ///
            $extraWatch->config->saveVersionIntoDatabase();
            $extraWatch->config->setLiveSite($env->getRootSite());
            break;
        case "licenseAccepted":
            $extraWatch->config->setLiveSite($env->getRootSite());
            $extraWatch->config->setLicenseAccepted();
            $extraWatch->config->setHtAccessPermissions();
            $extraWatch->config->saveVersionIntoDatabase();
            break;
        case "resetLiveSite":
            $extraWatch->block->checkPermissions();
            $extraWatch->config->setLiveSite($env->getRootSite());
            break;
    }
    if (!_EW_CLOUD_MODE && !$extraWatch->config->checkLicenseAccepted()) {
        //remove check license accepted if cloud mode
        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
        $output .= $extraWatchHTML->renderHeader($extraWatch);
        $output .= $extraWatchHTML->renderAcceptLicense();
        return $output;
    } else {
        if (!_EW_CLOUD_MODE && (!$extraWatch->config->isFree() && !$extraWatch->config->isAdFree() && !$extraWatch->config->isUnregistered())) {
            $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
            $output .= $extraWatchHTML->renderHeader($extraWatch);
            $output .= $extraWatchHTML->renderAdFreeLicense();
            return $output;
        }
        switch ($task) {
            case "storeIpInfoDbKey":
                $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                $output .= $extraWatchHTML->renderHeader($extraWatch);
                $keyValue = ExtraWatchInput::validate(_EW_INPUT_ONE_STRING, ExtraWatchHelper::requestPost('storeIpInfoDbKey'));
                ///
                if ($keyValue) {
                    $extraWatch->config->saveConfigValue("EXTRAWATCH_IPINFODB_KEY", $keyValue);
                } else {
                    $output = "<br/><div style='border: 1px solid red; width: 50%; padding: 10px;'>" . _EW_STATS_MAP_INVALID_KEY . "</div>";
                }
                $output .= $extraWatchHTML->renderLocation();
                $output .= $extraWatchHTML->renderFooter();
                break;
            case "users":
                switch ($action) {
                    case "save":
                        $result = $extraWatch->helper->saveUserSettings(ExtraWatchHelper::requestPost());
                        ///
                    default:
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $output .= $extraWatchHTML->renderUsers($extraWatch);
                        $output .= $extraWatchHTML->renderFooter();
                        break;
                }
                break;
            case "update":
                $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                $output .= $extraWatchHTML->renderHeader($extraWatch);
                $output .= $extraWatchHTML->renderUpdate();
                $output .= $extraWatchHTML->renderFooter();
                break;
            case "sizes":
                if (!$extraWatch->config->isFree()) {
                    $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                    $output .= $extraWatchHTML->renderHeader($extraWatch);
                    $output .= $extraWatchHTML->renderSizes();
                    $output .= $extraWatchHTML->renderFooter();
                }
                break;
            case "seo":
                switch ($action) {
                    case "save":
                        $result = $extraWatch->helper->saveSEOSettings(ExtraWatchHelper::requestPost());
                        ///
                    default:
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $output .= $extraWatchHTML->renderSEO();
                        $output .= $extraWatchHTML->renderFooter();
                        break;
                }
                break;
            case "graphs":
                $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                $output .= $extraWatchHTML->renderHeader($extraWatch);
                $extraWatchTrendHTML = new ExtraWatchTrendHTML($extraWatch);
                $output .= $extraWatchHTML->renderGraphs($extraWatchTrendHTML);
                $output .= $extraWatchHTML->renderFooter();
                break;
            case "trends":
                $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                $output .= $extraWatchHTML->renderHeader($extraWatch);
                $extraWatchTrendHTML->renderTrends();
                $output .= $extraWatchHTML->renderFooter();
                break;
            case "credits":
                $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                $output .= $extraWatchHTML->renderHeader($extraWatch);
                $output .= $extraWatchHTML->renderCredits();
                $output .= $extraWatchHTML->renderFooter();
                break;
            case "goals":
                switch ($action) {
                    case "insert":
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $output .= $extraWatchGoalHTML->renderBackToGoals();
                        $output .= $extraWatchGoalHTML->renderGoalsInsert((int) @ExtraWatchHelper::requestGet('id'), (int) @ExtraWatchHelper::requestGet('postid'));
                        ///
                        $output .= $extraWatchHTML->renderFooter();
                        break;
                    case "save":
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $extraWatch->goal->saveGoal(ExtraWatchHelper::requestPost());
                        ///
                        $output .= $extraWatchGoalHTML->renderGoals(@$result);
                        $output .= $extraWatchHTML->renderFooter();
                        break;
                    case "edit":
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $output .= $extraWatchGoalHTML->renderBackToGoals();
                        $output .= $extraWatchGoalHTML->renderGoalEdit(@ExtraWatchHelper::requestGet('goalId'));
                        ///
                        $output .= $extraWatchHTML->renderFooter();
                        break;
                    case "delete":
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $result = $extraWatch->goal->deleteGoal(@ExtraWatchHelper::requestGet('goalId'));
                        ///
                        $output .= $extraWatchGoalHTML->renderGoals(@$result);
                        $output .= $extraWatchHTML->renderFooter();
                        break;
                    case "enable":
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $result = $extraWatch->goal->enableGoal(@ExtraWatchHelper::requestGet('goalId'));
                        ///
                        $output .= $extraWatchGoalHTML->renderGoals(@$result);
                        $output .= $extraWatchHTML->renderFooter();
                        break;
                    case "disable":
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $result = $extraWatch->goal->disableGoal(@ExtraWatchHelper::requestGet('goalId'));
                        ///
                        $output .= $extraWatchGoalHTML->renderGoals(@$result);
                        $output .= $extraWatchHTML->renderFooter();
                        break;
                    case "export":
                        //$output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        //$output .= $extraWatchHTML->renderHeader($extraWatch);
                        $extraWatch->goal->exportGoals(ExtraWatchHelper::requestPost());
                        ///
                        $extraWatchGoalHTML->renderExportGoals(@$result);
                        $output .= $extraWatchHTML->renderFooter();
                        break;
                    case "import":
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $output .= $extraWatchGoalHTML->renderImportGoals();
                        $output .= $extraWatchHTML->renderFooter();
                        break;
                    case "saveImportGoal":
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $extraWatch->goal->saveImportGoal(ExtraWatchHelper::requestPost());
                        ///
                        $output .= $extraWatchGoalHTML->renderGoals(@$result);
                        $output .= $extraWatchHTML->renderFooter();
                    default:
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $output .= $extraWatchGoalHTML->renderGoals(@$result);
                        $output .= $extraWatchHTML->renderFooter();
                        break;
                }
                break;
            case "settings":
                $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                $output .= $extraWatchHTML->renderHeader($extraWatch);
                $output .= $extraWatchHTML->renderSettings(@$result);
                $output .= $extraWatchHTML->renderFooter();
                break;
            case "settingsSave":
                $result = $extraWatch->helper->saveSettings(ExtraWatchHelper::requestPost());
                ///
                $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                $output .= $extraWatchHTML->renderHeader($extraWatch);
                $output .= $extraWatchHTML->renderSettings(@$result);
                $output .= $extraWatchHTML->renderFooter();
                break;
            case "resetData":
                $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                $output .= $extraWatchHTML->renderHeader($extraWatch);
                $result = $extraWatch->helper->resetData(ExtraWatchHelper::requestPost());
                ///
                $output .= $extraWatchHTML->renderResetData($result);
                $output .= $extraWatchHTML->renderFooter();
                break;
            case "antiSpam":
                switch ($action) {
                    case "toggleBlocking":
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $ip = @ExtraWatchHelper::requestGet('ip');
                        ///
                        $extraWatch->block->extrawatch_blockIpToggle($ip);
                        $output .= $extraWatchHTML->renderAntiSpam();
                        $output .= $extraWatchHTML->renderFooter();
                        break;
                    case "save":
                        $numRecordsImported = $extraWatch->block->saveBadWordsList(ExtraWatchHelper::requestPost());
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $output .= $extraWatchHTML->renderAntiSpam();
                        $output .= $extraWatchHTML->renderFooter();
                        break;
                    case "antiSpamSave":
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $output .= nl2br($extraWatch->block->saveImportAntiSpamIp(ExtraWatchHelper::requestPost()));
                        $output .= $extraWatchHTML->renderAntiSpam();
                        $output .= $extraWatchHTML->renderFooter();
                        break;
                    default:
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $output .= $extraWatchHTML->renderAntiSpam();
                        $output .= $extraWatchHTML->renderFooter();
                        break;
                }
                break;
            case "status":
                if (!$extraWatch->config->isFree()) {
                    $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                    $output .= $extraWatchHTML->renderHeader($extraWatch);
                    $output .= $extraWatchHTML->renderStatus();
                    $output .= $extraWatchHTML->renderFooter();
                }
                break;
                /*			case "upgrade" :  	 	    	    		  	 	  	 	  		 	 		    	 			 	   		  	 	 		 	 	   	      	  	 		 		 				 			 		  		    	 		 		  
                     {
                         $output .= $extraWatchHTML->renderAdminStyles($extraWatch);  	 	    	    		  	 	  	 	  		 	 		    	 			 	   		  	 	 		 	 	   	      	  	 		 		 				 			 		  		    	 		 		  
                         $output .= $extraWatchHTML->renderHeader($extraWatch);  	 	    	    		  	 	  	 	  		 	 		    	 			 	   		  	 	 		 	 	   	      	  	 		 		 				 			 		  		    	 		 		  
                         $output .= $extraWatchHTML->renderUpgrade();  	 	    	    		  	 	  	 	  		 	 		    	 			 	   		  	 	 		 	 	   	      	  	 		 		 				 			 		  		    	 		 		  
                         break;  	 	    	    		  	 	  	 	  		 	 		    	 			 	   		  	 	 		 	 	   	      	  	 		 		 				 			 		  		    	 		 		  
                     }*/
            /*			case "upgrade" :  	 	    	    		  	 	  	 	  		 	 		    	 			 	   		  	 	 		 	 	   	      	  	 		 		 				 			 		  		    	 		 		  
                 {
                     $output .= $extraWatchHTML->renderAdminStyles($extraWatch);  	 	    	    		  	 	  	 	  		 	 		    	 			 	   		  	 	 		 	 	   	      	  	 		 		 				 			 		  		    	 		 		  
                     $output .= $extraWatchHTML->renderHeader($extraWatch);  	 	    	    		  	 	  	 	  		 	 		    	 			 	   		  	 	 		 	 	   	      	  	 		 		 				 			 		  		    	 		 		  
                     $output .= $extraWatchHTML->renderUpgrade();  	 	    	    		  	 	  	 	  		 	 		    	 			 	   		  	 	 		 	 	   	      	  	 		 		 				 			 		  		    	 		 		  
                     break;  	 	    	    		  	 	  	 	  		 	 		    	 			 	   		  	 	 		 	 	   	      	  	 		 		 				 			 		  		    	 		 		  
                 }*/
            case "license":
                $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                $output .= $extraWatchHTML->renderHeader($extraWatch);
                $output .= $extraWatchHTML->renderAdFreeLicense();
                $output .= $extraWatchHTML->renderFooter();
                break;
            case "history":
                $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                $output .= $extraWatchHTML->renderHeader($extraWatch);
                $output .= $extraWatchHTML->renderVisitsHistory();
                $output .= $extraWatchHTML->renderFooter();
                break;
            case "flow":
                if (!$extraWatch->config->isFree()) {
                    $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                    $output .= $extraWatchHTML->renderHeader($extraWatch);
                    $output .= $extraWatchHTML->renderFlow();
                    $output .= $extraWatchHTML->renderFooter();
                }
                break;
            case "emails":
                switch ($action) {
                    case "save":
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $result = $extraWatch->helper->saveEmailSettings(ExtraWatchHelper::requestPost());
                        ///
                        $output .= $extraWatchHTML->renderEmails();
                        $output .= $extraWatchHTML->renderFooter();
                        break;
                    case "send":
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $extraWatch->visit->sendNightlyEmails();
                        $output .= $extraWatchHTML->renderEmails();
                        $output .= $extraWatchHTML->renderFooter();
                        break;
                    default:
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $output .= $extraWatchHTML->renderEmails();
                        $output .= $extraWatchHTML->renderFooter();
                        break;
                }
                break;
            case "heatmap":
                $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                $output .= $extraWatchHTML->renderHeader($extraWatch);
                $output .= $extraWatchHTML->renderHeatMap();
                $output .= $extraWatchHTML->renderFooter();
                return $output;
                break;
            case "clicks":
                $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                $output .= $extraWatchHTML->renderHeader($extraWatch);
                $output .= $extraWatchHTML->renderClicks();
                $output .= $extraWatchHTML->renderFooter();
                return $output;
                break;
            case "downloads":
                $extraWatchDownloads = new ExtraWatchDownloads($extraWatch->database);
                $extraWatchDownloadsHTML = new ExtraWatchDownloadsHTML($extraWatch->database);
                switch ($action) {
                    case "addExtension":
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $output .= $extraWatchDownloadsHTML->renderAddExtension();
                        $output .= $extraWatchHTML->renderDownloads();
                        $output .= $extraWatchHTML->renderFooter();
                        break;
                    case "saveAddExtension":
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $output .= $extraWatchDownloads->addExtension(ExtraWatchHelper::requestPost('extname'));
                        ///
                        $output .= $extraWatchHTML->renderDownloads();
                        $output .= $extraWatchHTML->renderFooter();
                        return $output;
                        break;
                    case "editExtension":
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $output .= $extraWatchDownloadsHTML->renderEditExtension(ExtraWatchHelper::requestGet('eid'));
                        ///
                        $output .= $extraWatchHTML->renderDownloads();
                        $output .= $extraWatchHTML->renderFooter();
                        break;
                    case "saveEditExtension":
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $output .= $extraWatchDownloads->updateExtension(ExtraWatchHelper::requestPost('eid'), ExtraWatchHelper::requestPost('extname'));
                        ///
                        $output .= $extraWatchHTML->renderDownloads();
                        $output .= $extraWatchHTML->renderFooter();
                        return $output;
                        break;
                    case "deleteExtension":
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $output .= $extraWatchDownloads->deleteExtension(ExtraWatchHelper::requestGet('co'));
                        ///
                        $output .= $extraWatchHTML->renderDownloads();
                        $output .= $extraWatchHTML->renderFooter();
                        break;
                    case "addFile":
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $output .= $extraWatchDownloadsHTML->renderAddFile();
                        $output .= $extraWatchHTML->renderDownloads();
                        $output .= $extraWatchHTML->renderFooter();
                        break;
                    case "editFile":
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $output .= $extraWatchDownloadsHTML->renderEditFile(ExtraWatchHelper::requestGet('did'));
                        ///
                        $output .= $extraWatchHTML->renderDownloads();
                        $output .= $extraWatchHTML->renderFooter();
                        break;
                    case "saveEditFile":
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $output .= $extraWatchDownloads->updateFilePath(ExtraWatchHelper::requestPost('did'), ExtraWatchHelper::requestPost('filepathname'));
                        ///
                        $output .= $extraWatchHTML->renderDownloads();
                        $output .= $extraWatchHTML->renderFooter();
                        return $output;
                        break;
                    case "saveAddFile":
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $output .= $extraWatchDownloads->addFilePath(ExtraWatchHelper::requestPost('filepathname'));
                        ///
                        $output .= $extraWatchHTML->renderDownloads();
                        $output .= $extraWatchHTML->renderFooter();
                        return $output;
                        break;
                    case "deleteFile":
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $output .= $extraWatchDownloads->deleteFilePath(ExtraWatchHelper::requestGet('co'));
                        ///
                        $output .= $extraWatchHTML->renderDownloads();
                        $output .= $extraWatchHTML->renderFooter();
                        break;
                    default:
                        $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                        $output .= $extraWatchHTML->renderHeader($extraWatch);
                        $output .= $extraWatchHTML->renderDownloads();
                        $output .= $extraWatchHTML->renderFooter();
                        return $output;
                        break;
                }
                break;
            case "location":
                $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                $output .= $extraWatchHTML->renderHeader($extraWatch);
                $output .= $extraWatchHTML->renderLocation();
                $output .= $extraWatchHTML->renderFooter();
                break;
            case "stats":
                $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                $output .= $extraWatchHTML->renderHeader($extraWatch);
                $output .= $extraWatchHTML->renderStats();
                $output .= $extraWatchHTML->renderFooter();
                break;
            default:
                $output .= $extraWatchHTML->renderAdminStyles($extraWatch);
                $output .= $extraWatchHTML->renderHeader($extraWatch);
                $output .= $extraWatchHTML->renderBody($option);
                $output .= $extraWatchHTML->renderFooter();
                return $output;
                break;
        }
    }
    error_reporting($current_error_reporting);
    return $output;
}
예제 #9
0
 * @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');
?>


<h2><?php 
echo _EW_ADMINHEADER_GRAPHS;
?>
</h2>
<?php 
$group = ExtraWatchHelper::requestPost('group');
if (!$group) {
    $group = EW_DB_KEY_REFERERS;
}
$date = ExtraWatchDate::jwDateToday();
//$name = EW_DB_KEY_REFERERS;
echo $extraWatchTrendHTML->renderGraphSelectionForm($group);
$rows = $extraWatchTrendHTML->findLatestGraphDataRecursively($group, $date, FALSE);
$i = 0;
if (@$rows) {
    foreach ($rows as $row) {
        switch ($group) {
            case EW_DB_KEY_OS:
                $osDecoded = @json_decode($row->name);
                $rowName = $osDecoded->name;
                break;