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:
authorbenakamoorthi <benaka.moorthi@gmail.com>2012-10-12 23:08:01 +0400
committerbenakamoorthi <benaka.moorthi@gmail.com>2012-10-12 23:08:01 +0400
commit0811792fc05491a6a8a95934e7d062dfc9803134 (patch)
treeb28f749f31d28a17865b7292a073d0d669b9c97f /plugins/UserCountry
parent4f9e039dec3799a57e3c976f092658fa746011e0 (diff)
Refs #1823, more admin UI tweaks.
git-svn-id: http://dev.piwik.org/svn/trunk@7167 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'plugins/UserCountry')
-rw-r--r--plugins/UserCountry/Controller.php1
-rwxr-xr-xplugins/UserCountry/LocationProvider.php10
-rwxr-xr-xplugins/UserCountry/LocationProvider/Default.php2
-rwxr-xr-xplugins/UserCountry/LocationProvider/GeoIp.php21
-rwxr-xr-xplugins/UserCountry/LocationProvider/GeoIp/Pecl.php11
-rwxr-xr-xplugins/UserCountry/LocationProvider/GeoIp/Php.php2
-rwxr-xr-xplugins/UserCountry/LocationProvider/GeoIp/ServerBased.php2
-rwxr-xr-xplugins/UserCountry/templates/adminIndex.tpl6
8 files changed, 38 insertions, 17 deletions
diff --git a/plugins/UserCountry/Controller.php b/plugins/UserCountry/Controller.php
index 72e6860bb0..5953ccbd9e 100644
--- a/plugins/UserCountry/Controller.php
+++ b/plugins/UserCountry/Controller.php
@@ -39,6 +39,7 @@ class Piwik_UserCountry_Controller extends Piwik_Controller
$view->locationProviders = Piwik_UserCountry_LocationProvider::getAllProviderInfo(
$newline = '<br/>', $includeExtra = true);
$view->currentProviderId = Piwik_UserCountry_LocationProvider::getCurrentProviderId();
+ $view->thisIP = Piwik_IP::getIpFromHeader();
$this->setBasicVariablesView($view);
$view->menu = Piwik_GetAdminMenu();
diff --git a/plugins/UserCountry/LocationProvider.php b/plugins/UserCountry/LocationProvider.php
index bbbe8fe9da..8ead0e9f5c 100755
--- a/plugins/UserCountry/LocationProvider.php
+++ b/plugins/UserCountry/LocationProvider.php
@@ -202,7 +202,7 @@ abstract class Piwik_UserCountry_LocationProvider
*/
public static function getAllProviderInfo( $newline = "\n", $includeExtra = false )
{
- $result = array();
+ $allInfo = array();
foreach (self::getAllProviders() as $provider)
{
$info = $provider->getInfo();
@@ -238,6 +238,14 @@ abstract class Piwik_UserCountry_LocationProvider
$info['statusMessage'] = $statusMessage;
$info['location'] = $location;
+ $allInfo[$info['order']] = $info;
+ }
+
+ ksort($allInfo);
+
+ $result = array();
+ foreach ($allInfo as $info)
+ {
$result[$info['id']] = $info;
}
return $result;
diff --git a/plugins/UserCountry/LocationProvider/Default.php b/plugins/UserCountry/LocationProvider/Default.php
index 8f560717f7..dcf99dec3a 100755
--- a/plugins/UserCountry/LocationProvider/Default.php
+++ b/plugins/UserCountry/LocationProvider/Default.php
@@ -99,7 +99,7 @@ class Piwik_UserCountry_LocationProvider_Default extends Piwik_UserCountry_Locat
$desc = Piwik_Translate('UserCountry_DefaultLocationProviderDesc1') . ' '
. Piwik_Translate('UserCountry_DefaultLocationProviderDesc2',
array('<strong>', '<em>', '</em>', '</strong>'));
- return array('id' => self::ID, 'title' => self::TITLE, 'description' => $desc);
+ return array('id' => self::ID, 'title' => self::TITLE, 'description' => $desc, 'order' => 1);
}
}
diff --git a/plugins/UserCountry/LocationProvider/GeoIp.php b/plugins/UserCountry/LocationProvider/GeoIp.php
index 7a639a7da6..c08e463510 100755
--- a/plugins/UserCountry/LocationProvider/GeoIp.php
+++ b/plugins/UserCountry/LocationProvider/GeoIp.php
@@ -103,15 +103,20 @@ abstract class Piwik_UserCountry_LocationProvider_GeoIp extends Piwik_UserCountr
{
$unknown = Piwik_Translate('General_Unknown');
- $bind = array($testIp,
+ $location = "'"
+ . (empty($location[self::CITY_NAME_KEY]) ? $unknown : $location[self::CITY_NAME_KEY])
+ . ", "
+ . (empty($location[self::REGION_CODE_KEY]) ? $unknown : $location[self::REGION_CODE_KEY])
+ . ", "
+ . (empty($location[self::COUNTRY_CODE_KEY]) ? $unknown : $location[self::COUNTRY_CODE_KEY])
+ . "'"
+ ;
- empty($location[self::CITY_NAME_KEY]) ? $unknown : $location[self::CITY_NAME_KEY],
- empty($location[self::REGION_CODE_KEY]) ? $unknown : $location[self::REGION_CODE_KEY],
- empty($location[self::COUNTRY_CODE_KEY]) ? $unknown : $location[self::COUNTRY_CODE_KEY],
-
- $expectedResult[self::CITY_NAME_KEY],
- $expectedResult[self::REGION_CODE_KEY],
- $expectedResult[self::COUNTRY_CODE_KEY]);
+ $expectedLocation = "'".$expectedResult[self::CITY_NAME_KEY].", "
+ . $expectedResult[self::REGION_CODE_KEY].", "
+ . $expectedResult[self::COUNTRY_CODE_KEY]."'";
+
+ $bind = array($testIp, $location, $expectedLocation);
return Piwik_Translate('UserCountry_TestIPLocatorFailed', $bind);
}
diff --git a/plugins/UserCountry/LocationProvider/GeoIp/Pecl.php b/plugins/UserCountry/LocationProvider/GeoIp/Pecl.php
index 772bd739f4..3fbbb52625 100755
--- a/plugins/UserCountry/LocationProvider/GeoIp/Pecl.php
+++ b/plugins/UserCountry/LocationProvider/GeoIp/Pecl.php
@@ -131,20 +131,23 @@ class Piwik_UserCountry_LocationProvider_GeoIp_Pecl extends Piwik_UserCountry_Lo
if (!self::isLocationDatabaseAvailable())
{
$dbDir = dirname(geoip_db_filename(GEOIP_COUNTRY_EDITION)).'/';
+ $quotedDir = "'$dbDir'";
// check if the directory the PECL module is looking for exists
if (!is_dir($dbDir))
{
- return Piwik_Translate('UserCountry_PeclGeoIPNoDBDir', $dbDir);
+ return Piwik_Translate('UserCountry_PeclGeoIPNoDBDir', array($quotedDir, "'geoip.custom_directory'"));
}
// check if the user named the city database GeoLiteCity.dat
if (file_exists($dbDir.'GeoLiteCity.dat'))
{
- return Piwik_Translate('UserCountry_PeclGeoLiteError', $dbDir);
+ return Piwik_Translate('UserCountry_PeclGeoLiteError',
+ array($quotedDir, "'GeoLiteCity.dat'", "'GeoIPCity.dat'"));
}
- return Piwik_Translate('UserCountry_CannotFindPeclGeoIPDb', $dbDir);
+ return Piwik_Translate('UserCountry_CannotFindPeclGeoIPDb',
+ array($quotedDir, "'GeoIP.dat'", "'GeoIPCity.dat'"));
}
return parent::isWorking();
@@ -228,7 +231,7 @@ class Piwik_UserCountry_LocationProvider_GeoIp_Pecl extends Piwik_UserCountry_Lo
{
$desc = Piwik_Translate('UserCountry_GeoIpLocationProviderDesc_Pecl1') . '<br/><br/>'
. Piwik_Translate('UserCountry_GeoIpLocationProviderDesc_Pecl2');
- return array('id' => self::ID, 'title' => self::TITLE, 'description' => $desc);
+ return array('id' => self::ID, 'title' => self::TITLE, 'description' => $desc, 'order' => 2);
}
/**
diff --git a/plugins/UserCountry/LocationProvider/GeoIp/Php.php b/plugins/UserCountry/LocationProvider/GeoIp/Php.php
index 249a25baf1..459998bc67 100755
--- a/plugins/UserCountry/LocationProvider/GeoIp/Php.php
+++ b/plugins/UserCountry/LocationProvider/GeoIp/Php.php
@@ -234,7 +234,7 @@ class Piwik_UserCountry_LocationProvider_GeoIp_Php extends Piwik_UserCountry_Loc
. Piwik_Translate('UserCountry_GeoIpLocationProviderDesc_Php2',
array('<strong>', '</strong>', '<strong><em>', '</em></strong>',
'<strong><em>', '</em></strong>'));
- return array('id' => self::ID, 'title' => self::TITLE, 'description' => $desc);
+ return array('id' => self::ID, 'title' => self::TITLE, 'description' => $desc, 'order' => 4);
}
/**
diff --git a/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php b/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php
index 4d63ee0e65..9464f78429 100755
--- a/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php
+++ b/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php
@@ -197,6 +197,6 @@ class Piwik_UserCountry_LocationProvider_GeoIp_ServerBased extends Piwik_UserCou
. Piwik_Translate('UserCountry_GeoIpLocationProviderDesc_ServerBased2',
array('<strong><em>', '</em></strong>', '<strong><em>', '</em></strong>'));
- return array('id' => self::ID, 'title' => $title, 'description' => $desc);
+ return array('id' => self::ID, 'title' => $title, 'description' => $desc, 'order' => 3);
}
}
diff --git a/plugins/UserCountry/templates/adminIndex.tpl b/plugins/UserCountry/templates/adminIndex.tpl
index dc8b1a76f9..ba7edcd7b9 100755
--- a/plugins/UserCountry/templates/adminIndex.tpl
+++ b/plugins/UserCountry/templates/adminIndex.tpl
@@ -12,7 +12,7 @@
<tr>
<th>{'UserCountry_LocationProvider'|translate}</th>
<th>{'General_Description'|translate}</th>
- <th>{'General_Info'|translate}</th>
+ <th>{'General_InfoFor'|translate:$thisIP}</th>
</tr>
{foreach from=$locationProviders key=id item=provider}
<tr>
@@ -40,6 +40,7 @@
<td width="164">
{if $provider.status eq 1}
{capture assign=currentLocation}
+ {if $thisIP neq '127.0.0.1'}
{'UserCountry_CurrentLocationIntro'|translate}:
<div style="text-align:left;">
<br/>
@@ -49,6 +50,9 @@
<div style="text-align:right;">
<a href="#" class="refresh-loc" data-impl-id="{$id}"><em>{'Dashboard_Refresh_js'|translate}</em></a>
</div>
+ {else}
+ {'UserCountry_CannotLocalizeLocalIP'|translate:$thisIP}
+ {/if}
{/capture}
{$currentLocation|inlineHelp}
{elseif $provider.status eq 2}