cd {$global['systemRootPath']}plugin/User_Location/install && unzip install.zip";
if(!ObjectYPT::isTableInstalled("ip2location_db1_ipv6")){
$ret .= "cd {$global['systemRootPath']}plugin/User_Location/install && unzip ip2location_db1_ipv6.zip && mysql -u root -p {$mysqlDatabase} < {$global['systemRootPath']}plugin/User_Location/install/ip2location_db1_ipv6.sql ";
}
return $ret;
}
public function getName() {
return "User_Location";
}
public function getUUID() {
return "45432a78-d0c6-47f3-8ac4-8fd05f507386";
}
public function getPluginVersion() {
return "1.0";
}
public function getEmptyDataObject() {
$obj = new stdClass();
$obj->autoChangeLanguage = true;
return $obj;
}
static function getSessionLocation(){
$ip = getRealIpAddr();
if(!empty($_SESSION['User_Location'][$ip]['country_name'])){
if ($_SESSION['User_Location'][$ip]['country_name'] == "United States of America") {
$_SESSION['User_Location'][$ip]['country_name'] = "United States";
}
return $_SESSION['User_Location'][$ip];
}
return false;
}
static function setSessionLocation($value){
$ip = getRealIpAddr();
$_SESSION['User_Location'][$ip] = $value;
//_error_log("User_Location: $ip ". json_encode($_SESSION['User_Location'][$ip]));
}
static function getThisUserLocation() {
$location = self::getSessionLocation();
if(!empty($location['country_code'])){
return $location;
}
return IP2Location::getLocation(getRealIpAddr());
}
public function getStart() {
global $global, $config;
$obj = $this->getDataObject();
$User_Location = self::getThisUserLocation();
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
if($obj->autoChangeLanguage){
$location = self::getSessionLocation();
if(empty($location) && !empty($User_Location['country_code'])){
$_SESSION['language'] = strtolower($User_Location['country_code']);
$file = "{$global['systemRootPath']}locale/{$_SESSION['language']}.php";
if(file_exists($file)){
include_once $file;
}else{
$_SESSION['language'] = $config->getLanguage();
}
}
}
$global['User_Location'] = $User_Location;
self::setSessionLocation($global['User_Location']);
return false;
}
+
+ public function getPluginMenu() {
+ global $global;
+ $filename = $global['systemRootPath'] . 'plugin/User_Location/pluginMenu.html';
+ return file_get_contents($filename);
+ }
}
diff --git a/plugin/User_Location/pluginMenu.html b/plugin/User_Location/pluginMenu.html
new file mode 100644
index 000000000..d4c44cef0
--- /dev/null
+++ b/plugin/User_Location/pluginMenu.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/plugin/User_Location/testIP.php b/plugin/User_Location/testIP.php
new file mode 100644
index 000000000..40e4f6bf9
--- /dev/null
+++ b/plugin/User_Location/testIP.php
@@ -0,0 +1,72 @@
+
+
+
+
+