diff options
-rw-r--r-- | core/Controller.php | 5 | ||||
-rw-r--r-- | plugins/Live/templates/visitorLog.tpl | 2 | ||||
-rw-r--r-- | plugins/Overlay/Controller.php | 2 | ||||
-rw-r--r-- | plugins/UserCountry/Controller.php | 26 | ||||
-rwxr-xr-x | plugins/UserCountry/GeoIPAutoUpdater.php | 6 |
5 files changed, 26 insertions, 15 deletions
diff --git a/core/Controller.php b/core/Controller.php index 4375330498..c364e3ad14 100644 --- a/core/Controller.php +++ b/core/Controller.php @@ -333,7 +333,10 @@ abstract class Piwik_Controller { $requestString = 'method='.$methodToCall.'&format=original'; $request = new Piwik_API_Request($requestString); - return $request->process(); + $return = $request->process(); + $columns = $return->getFirstRow()->getColumns(); + $values = array_values($columns); + return $values[0]; } /** diff --git a/plugins/Live/templates/visitorLog.tpl b/plugins/Live/templates/visitorLog.tpl index e1b8b76820..1adfc02f5f 100644 --- a/plugins/Live/templates/visitorLog.tpl +++ b/plugins/Live/templates/visitorLog.tpl @@ -81,7 +81,7 @@ {if $isWidget}<br/>{else}-{/if} {$visitor.columns.serverTimePrettyFirstAction}</strong> {if !empty($visitor.columns.visitIp)} <br/><span title="{if !empty($visitor.columns.visitorId)}{'General_VisitorID'|translate}: {$visitor.columns.visitorId}{/if}{if $visitor.columns.latitude || $visitor.columns.longitude} - GPS (lat/long): {$visitor.columns.latitude},{$visitor.columns.longitude}{/if}">IP: {$visitor.columns.visitIp}</span>{/if} + GPS (lat/long): {$visitor.columns.latitude|escape:'html'},{$visitor.columns.longitude|escape:'html'}{/if}">IP: {$visitor.columns.visitIp}</span>{/if} {if (isset($visitor.columns.provider)&&$visitor.columns.provider!='IP')} <br /> diff --git a/plugins/Overlay/Controller.php b/plugins/Overlay/Controller.php index 5281096a06..c5b1633149 100644 --- a/plugins/Overlay/Controller.php +++ b/plugins/Overlay/Controller.php @@ -154,7 +154,7 @@ class Piwik_Overlay_Controller extends Piwik_Controller var urlToRedirect = window.location.hash.substr(1); var urlToRedirectWithoutPrefix = removeUrlPrefix(urlToRedirect); - var knownUrls = '.json_encode($urls).'; + var knownUrls = '.Piwik_Common::json_encode($urls).'; for (var i = 0; i < knownUrls.length; i++) { var testUrl = removeUrlPrefix(knownUrls[i]); if (urlToRedirectWithoutPrefix.substr(0, testUrl.length) == testUrl) { diff --git a/plugins/UserCountry/Controller.php b/plugins/UserCountry/Controller.php index 1df06697c8..8d62f7e473 100644 --- a/plugins/UserCountry/Controller.php +++ b/plugins/UserCountry/Controller.php @@ -41,8 +41,9 @@ class Piwik_UserCountry_Controller extends Piwik_Controller_Admin $view->locationProviders = $allProviderInfo; $view->currentProviderId = Piwik_UserCountry_LocationProvider::getCurrentProviderId(); $view->thisIP = Piwik_IP::getIpFromHeader(); - $view->geoIPDatabasesInstalled = Piwik_UserCountry_LocationProvider_GeoIp::isDatabaseInstalled(); - + $geoIPDatabasesInstalled = Piwik_UserCountry_LocationProvider_GeoIp::isDatabaseInstalled(); + $view->geoIPDatabasesInstalled = $geoIPDatabasesInstalled; + // check if there is a working provider (that isn't the default one) $isThereWorkingProvider = false; foreach ($allProviderInfo as $id => $provider) @@ -60,7 +61,7 @@ class Piwik_UserCountry_Controller extends Piwik_Controller_Admin // in misc, then the databases are located outside of Piwik, so we cannot update them $view->showGeoIPUpdateSection = true; $currentProviderId = Piwik_UserCountry_LocationProvider::getCurrentProviderId(); - if (!$view->geoIPDatabasesInstalled + if (!$geoIPDatabasesInstalled && ($currentProviderId == Piwik_UserCountry_LocationProvider_GeoIp_ServerBased::ID || $currentProviderId == Piwik_UserCountry_LocationProvider_GeoIp_Pecl::ID) && $allProviderInfo[$currentProviderId]['status'] == Piwik_UserCountry_LocationProvider::INSTALLED) @@ -99,7 +100,7 @@ class Piwik_UserCountry_Controller extends Piwik_Controller_Admin if ($_SERVER["REQUEST_METHOD"] == "POST") { $this->checkTokenInUrl(); - + Piwik_DataTable_Renderer_Json::sendHeaderJSON(); $outputPath = Piwik_UserCountry_LocationProvider_GeoIp::getPathForGeoIpDatabase('GeoIPCity.dat').'.gz'; try { @@ -124,11 +125,11 @@ class Piwik_UserCountry_Controller extends Piwik_Controller_Admin $result['next_screen'] = $this->getGeoIpUpdaterManageScreen(); } - echo json_encode($result); + echo Piwik_Common::json_encode($result); } catch (Exception $ex) { - echo json_encode(array('error' => $ex->getMessage())); + echo Piwik_Common::json_encode(array('error' => $ex->getMessage())); } } } @@ -179,6 +180,7 @@ class Piwik_UserCountry_Controller extends Piwik_Controller_Admin Piwik::checkUserIsSuperUser(); if ($_SERVER["REQUEST_METHOD"] == "POST") { + Piwik_DataTable_Renderer_Json::sendHeaderJSON(); try { $this->checkTokenInUrl(); @@ -190,13 +192,13 @@ class Piwik_UserCountry_Controller extends Piwik_Controller_Admin $info = $this->getNextMissingDbUrlInfo(); if ($info !== false) { - echo json_encode($info); + echo Piwik_Common::json_encode($info); return; } } catch (Exception $ex) { - echo json_encode(array('error' => $ex->getMessage())); + echo Piwik_Common::json_encode(array('error' => $ex->getMessage())); } } } @@ -226,6 +228,8 @@ class Piwik_UserCountry_Controller extends Piwik_Controller_Admin try { $this->checkTokenInUrl(); + + Piwik_DataTable_Renderer_Json::sendHeaderJSON(); // based on the database type (provided by the 'key' query param) determine the // url & output file name @@ -253,16 +257,16 @@ class Piwik_UserCountry_Controller extends Piwik_Controller_Admin $info = $this->getNextMissingDbUrlInfo(); if ($info !== false) { - echo json_encode($info); + echo Piwik_Common::json_encode($info); return; } } - echo json_encode($result); + echo Piwik_Common::json_encode($result); } catch (Exception $ex) { - echo json_encode(array('error' => $ex->getMessage())); + echo Piwik_Common::json_encode(array('error' => $ex->getMessage())); } } } diff --git a/plugins/UserCountry/GeoIPAutoUpdater.php b/plugins/UserCountry/GeoIPAutoUpdater.php index 391a226937..1d87cd6436 100755 --- a/plugins/UserCountry/GeoIPAutoUpdater.php +++ b/plugins/UserCountry/GeoIPAutoUpdater.php @@ -317,7 +317,11 @@ class Piwik_UserCountry_GeoIPAutoUpdater */ public static function getConfiguredUrl( $key ) { - return Piwik_GetOption(self::$urlOptions[$key]); + if(!empty(self::$urlOptions[$key])) { + throw new Exception("Invalid key $key"); + } + $url = Piwik_GetOption(self::$urlOptions[$key]); + return $url; } /** |