当前位置: 首页>>代码示例>>PHP>>正文


PHP eZDebug::isIPInNet方法代码示例

本文整理汇总了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);
 }
开发者ID:BGCX067,项目名称:ezfire-svn-to-git,代码行数:56,代码来源:ezdebug.php

示例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;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:25,代码来源:ezuser.php

示例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;
     }
 }
开发者ID:BGCX067,项目名称:ezfire-svn-to-git,代码行数:30,代码来源:ezfire.php


注:本文中的eZDebug::isIPInNet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。