* finish task #7296.

This commit is contained in:
z
2020-09-07 11:39:54 +08:00
parent 6b28649bdd
commit 310e44b472
4 changed files with 58 additions and 4 deletions
+9 -4
View File
@@ -597,15 +597,20 @@ class baseHelper
* 获取远程IP。
* Get remote ip.
*
* @param bool $proxy
* @access public
* @return string
*/
public static function getRemoteIp()
public static function getRemoteIp($proxy = false)
{
$ip = '';
if(!empty($_SERVER["REMOTE_ADDR"])) $ip = $_SERVER["REMOTE_ADDR"];
if(!empty($_SERVER["HTTP_X_FORWARDED_FOR"])) $ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
if(!empty($_SERVER['HTTP_CLIENT_IP'])) $ip = $_SERVER['HTTP_CLIENT_IP'];
if(!empty($_SERVER["REMOTE_ADDR"])) $ip = $_SERVER["REMOTE_ADDR"];
if($proxy)
{
if(!empty($_SERVER["HTTP_X_FORWARDED_FOR"])) $ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
if(!empty($_SERVER['HTTP_CLIENT_IP'])) $ip = $_SERVER['HTTP_CLIENT_IP'];
}
return $ip;
}
@@ -0,0 +1,17 @@
<?php
include '../../control.php';
class myClient extends client
{
public function create()
{
$statusFile = $this->loadModel('common')->checkSafeFile();
if($statusFile)
{
$this->app->loadLang('extension');
$this->view->error = sprintf($this->lang->extension->noticeOkFile, str_replace('\\', '/', $statusFile));
die($this->display('client', 'safe'));
}
parent::create();
}
}
@@ -0,0 +1,17 @@
<?php
include '../../control.php';
class myClient extends client
{
public function edit($clientID)
{
$statusFile = $this->loadModel('common')->checkSafeFile();
if($statusFile)
{
$this->app->loadLang('extension');
$this->view->error = sprintf($this->lang->extension->noticeOkFile, str_replace('\\', '/', $statusFile));
die($this->display('client', 'safe'));
}
parent::edit($clientID);
}
}
@@ -0,0 +1,15 @@
<?php
/**
* The safe view file of client module of ZentaoPMS.
*
* @copyright Copyright 2009-2017 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Yidong Wang<yidong@cnezsoft.com>
* @package client
* @version $Id$
* @link http://xuan.im
*/
?>
<?php include '../../../common/view/header.lite.html.php';?>
<div id='mainContent' class='main-content'><?php echo $error;?></div>
<?php include '../../../common/view/footer.lite.html.php';?>