From 30cb4ed2be258755d75dd5ed268bca5a7f99db73 Mon Sep 17 00:00:00 2001
From: Ingo Renner <ingo@typo3.org>
Date: Mon, 14 Oct 2013 14:41:12 -0700
Subject: [PATCH] [FEATURE] Add devIP as keyword for IP condition
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

When using an IP condition, support using keyword "devIP" to compare
the current Request IP against the devIpMask setting.

Usage:
[IP = devIP]
page.20 = TEXT
page.20.value = Hello Developer!
[end]

Fixes: #50092
Documentation: #52827
Releases: 6.2
Change-Id: I6b9128a9ac23b8d24ec1874dbe477503b20b58b8
Reviewed-on: https://review.typo3.org/24754
Reviewed-by: Ernesto Baschny
Reviewed-by: Gaëtan MARMASSE
Tested-by: Gaëtan MARMASSE
Reviewed-by: Paul Rohrbeck
Tested-by: Paul Rohrbeck
Reviewed-by: Dmitry Dulepov
Tested-by: Dmitry Dulepov
Reviewed-by: Oliver Hader
---
 .../TypoScript/ConditionMatching/AbstractConditionMatcher.php | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/typo3/sysext/core/Classes/Configuration/TypoScript/ConditionMatching/AbstractConditionMatcher.php b/typo3/sysext/core/Classes/Configuration/TypoScript/ConditionMatching/AbstractConditionMatcher.php
index 32f0a4c65f8d..425b485f88f3 100644
--- a/typo3/sysext/core/Classes/Configuration/TypoScript/ConditionMatching/AbstractConditionMatcher.php
+++ b/typo3/sysext/core/Classes/Configuration/TypoScript/ConditionMatching/AbstractConditionMatcher.php
@@ -305,6 +305,10 @@ abstract class AbstractConditionMatcher {
 				}
 				break;
 			case 'IP':
+				if ($value === 'devIP') {
+					$value = trim($GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask']);
+				}
+
 				if (GeneralUtility::cmpIP(GeneralUtility::getIndpEnv('REMOTE_ADDR'), $value)) {
 					return TRUE;
 				}
-- 
GitLab