Merge branch '2.1.x' into devel
Conflicts: airtime_mvc/application/models/ServiceRegister.php
This commit is contained in:
commit
1bd07eeaca
2 changed files with 23 additions and 5 deletions
|
@ -1,11 +1,25 @@
|
|||
<?php
|
||||
class Application_Model_ServiceRegister
|
||||
class Application_Model_ServiceRegister
|
||||
{
|
||||
public static function GetRemoteIpAddr()
|
||||
{
|
||||
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
||||
//check ip from share internet
|
||||
$ip=$_SERVER['HTTP_CLIENT_IP'];
|
||||
} else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||
//to check ip is pass from proxy
|
||||
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
} else {
|
||||
$ip=$_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
return $ip;
|
||||
}
|
||||
|
||||
public static function Register($p_componentName, $p_ipAddress)
|
||||
{
|
||||
$component = CcServiceRegisterQuery::create()->findOneByDbName($p_componentName);
|
||||
|
||||
if ($component == NULL) {
|
||||
if (is_null($component)) {
|
||||
$component = new CcServiceRegister();
|
||||
$component->setDbName($p_componentName);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue