Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattpiwik <matthieu.aubry@gmail.com>2012-12-04 06:29:32 +0400
committermattpiwik <matthieu.aubry@gmail.com>2012-12-04 06:29:32 +0400
commite5f4fbb9665481e5d57738c6918ccec47977e3c4 (patch)
tree916fbfe10d54ebed437daff6a0b75aaa07f7e7ac /plugins/UserCountry
parent59ef62502baf88b66fe2d1054c56a0baba6330d6 (diff)
Various fixes when reviewing trunk
git-svn-id: http://dev.piwik.org/svn/trunk@7571 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'plugins/UserCountry')
-rw-r--r--plugins/UserCountry/Controller.php26
-rwxr-xr-xplugins/UserCountry/GeoIPAutoUpdater.php6
2 files changed, 20 insertions, 12 deletions
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;
}
/**