本文整理汇总了PHP中eZDebug::isIPInNet方法的典型用法代码示例。如果您正苦于以下问题:PHP eZDebug::isIPInNet方法的具体用法?PHP eZDebug::isIPInNet怎么用?PHP eZDebug::isIPInNet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZDebug
的用法示例。
在下文中一共展示了eZDebug::isIPInNet方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateSettings
static function updateSettings($settings)
{
// Make sure errors are handled by PHP when we read, including our own debug output.
$oldHandleType = eZDebug::setHandleType(self::HANDLE_TO_PHP);
if (isset($settings['debug-log-files-enabled'])) {
$GLOBALS['eZDebugLogFileEnabled'] = $settings['debug-log-files-enabled'];
if (isset($GLOBALS["eZDebugGlobalInstance"])) {
$GLOBALS["eZDebugGlobalInstance"]->GlobalLogFileEnabled = $settings['debug-log-files-enabled'];
}
}
if (isset($settings['debug-styles'])) {
$GLOBALS['eZDebugStyles'] = $settings['debug-styles'];
}
if (isset($settings['always-log']) and is_array($settings['always-log'])) {
$GLOBALS['eZDebugAlwaysLog'] = $settings['always-log'];
}
if (isset($settings['log-only'])) {
$GLOBALS['eZDebugLogOnly'] = $settings['log-only'] == 'enabled';
}
$notDebugByIP = true;
$debugEnabled = $settings['debug-enabled'];
if ($settings['debug-enabled'] and $settings['debug-by-ip']) {
$ipAddress = eZSys::serverVariable('REMOTE_ADDR', true);
if ($ipAddress) {
$debugEnabled = false;
foreach ($settings['debug-ip-list'] as $itemToMatch) {
if (preg_match("/^(([0-9]+)\\.([0-9]+)\\.([0-9]+)\\.([0-9]+))(\\/([0-9]+)\$|\$)/", $itemToMatch, $matches)) {
if ($matches[6]) {
if (eZDebug::isIPInNet($ipAddress, $matches[1], $matches[7])) {
$debugEnabled = true;
$notDebugByIP = false;
break;
}
} else {
if ($matches[1] == $ipAddress) {
$debugEnabled = true;
$notDebugByIP = false;
break;
}
}
}
}
} else {
$debugEnabled = in_array('commandline', $settings['debug-ip-list']) && php_sapi_name() == 'cli';
}
}
if ($settings['debug-enabled'] and isset($settings['debug-by-user']) and $settings['debug-by-user'] and $notDebugByIP) {
$debugUserIDList = $settings['debug-user-list'] ? $settings['debug-user-list'] : array();
$GLOBALS['eZDebugUserIDList'] = $debugUserIDList;
// We enable the debug temporarily.
// In checkDebugByUser() will be last(final) check for debug by user id.
$debugEnabled = true;
}
$GLOBALS['eZDebugEnabled'] = $debugEnabled;
eZDebug::setHandleType($oldHandleType);
}
示例2: isUserIPInList
static function isUserIPInList($ipList)
{
$ipAddress = eZSys::clientIP();
if ($ipAddress) {
$result = false;
foreach ($ipList as $itemToMatch) {
if (preg_match("/^(([0-9]+)\\.([0-9]+)\\.([0-9]+)\\.([0-9]+))(\\/([0-9]+)\$|\$)/", $itemToMatch, $matches)) {
if ($matches[6]) {
if (eZDebug::isIPInNet($ipAddress, $matches[1], $matches[7])) {
$result = true;
break;
}
} else {
if ($matches[1] == $ipAddress) {
$result = true;
break;
}
}
}
}
} else {
$result = in_array('commandline', $ipList) && php_sapi_name() == 'cli';
}
return $result;
}
示例3: debugbyip
static function debugbyip()
{
//If DebugByIP is enabled, then we only want output going to the valid IPs
$moduleINI = eZINI::instance('site.ini');
if ($moduleINI->variable('DebugSettings', 'DebugByIP') == "enabled") {
$ipAddress = eZSys::serverVariable('REMOTE_ADDR', true);
if ($ipAddress) {
foreach ($moduleINI->variable('DebugSettings', 'DebugIPList') as $itemToMatch) {
if (preg_match("/^(([0-9]+)\\.([0-9]+)\\.([0-9]+)\\.([0-9]+))(\\/([0-9]+)\$|\$)/", $itemToMatch, $matches)) {
if ($matches[6]) {
if (eZDebug::isIPInNet($ipAddress, $matches[1], $matches[7])) {
return TRUE;
}
} else {
if ($matches[1] == $ipAddress) {
return TRUE;
break;
}
}
}
}
//IP is not in list if we get here
}
//Enabled but no IP address returned by REMOTE_ADDR
return FALSE;
} else {
//Not enabled
return TRUE;
}
}