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


PHP GeneralUtility::cmpIP方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP方法的典型用法代码示例。如果您正苦于以下问题:PHP GeneralUtility::cmpIP方法的具体用法?PHP GeneralUtility::cmpIP怎么用?PHP GeneralUtility::cmpIP使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Core\Utility\GeneralUtility的用法示例。


在下文中一共展示了GeneralUtility::cmpIP方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render

 /**
  * Render the debug bar
  */
 public static function render()
 {
     if (\TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE_ADDR'), $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask'])) {
         $debugbarRenderer = $GLOBALS['debugbar']->getJavascriptRenderer();
         $debugbarRenderer->setBaseUrl('typo3conf/ext/typo3profiler/Classes/Lib/DebugBar/vendor/maximebf/debugbar/src/DebugBar/Resources')->setEnableJqueryNoConflict(false);
         self::renderPhp();
         self::renderPage();
         self::renderTyposcript();
         //self::renderContents();
         $GLOBALS['TSFE']->content = str_replace('</head>', $debugbarRenderer->renderHead() . '</head>', $GLOBALS['TSFE']->content);
         $GLOBALS['TSFE']->content = str_replace('</body>', $debugbarRenderer->render() . '</body>', $GLOBALS['TSFE']->content);
     }
 }
开发者ID:Apen,项目名称:typo3profiler,代码行数:16,代码来源:Debugbar.php

示例2: findUserByIp

 /**
  * Find user which matches provided ip
  *
  * @param $userIp
  * @return array|bool
  */
 protected function findUserByIp($userIp)
 {
     $user = FALSE;
     foreach ($this->ipConfigurations as $ipConfiguration) {
         $userId = $ipConfiguration['feusers'];
         // Check if ip address matches && user ID is valid
         if ($userId > 0 && GeneralUtility::cmpIP($userIp, $ipConfiguration['ip'])) {
             // Get user from database
             $user = $this->pObj->getRawUserByUid($userId);
             break;
         }
     }
     return $user;
 }
开发者ID:senders,项目名称:sfpipauth,代码行数:20,代码来源:IpAuthenticationService.php

示例3: getGroups

 /**
  * Find usergroup records, currently only for frontend
  *
  * @param array $user Data of user.
  * @param array $knownGroups Group data array of already known groups. This is handy if you want select other related groups. Keys in this array are unique IDs of those groups.
  * @return mixed Groups array, keys = uid which must be unique
  */
 public function getGroups($user, $knownGroups)
 {
     /*
      * Attention: $knownGroups is not used within this method, but other services can use it.
      * This parameter should not be removed!
      * The FrontendUserAuthentication call getGroups and handover the previous detected groups.
      */
     $groupDataArr = array();
     if ($this->mode === 'getGroupsFE') {
         $groups = array();
         if (is_array($user) && $user[$this->db_user['usergroup_column']]) {
             $groupList = $user[$this->db_user['usergroup_column']];
             $groups = array();
             $this->getSubGroups($groupList, '', $groups);
         }
         // ADD group-numbers if the IPmask matches.
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['FE']['IPmaskMountGroups'])) {
             foreach ($GLOBALS['TYPO3_CONF_VARS']['FE']['IPmaskMountGroups'] as $IPel) {
                 if ($this->authInfo['REMOTE_ADDR'] && $IPel[0] && GeneralUtility::cmpIP($this->authInfo['REMOTE_ADDR'], $IPel[0])) {
                     $groups[] = (int) $IPel[1];
                 }
             }
         }
         $groups = array_unique($groups);
         if (!empty($groups)) {
             $list = implode(',', $groups);
             if ($this->writeDevLog) {
                 GeneralUtility::devLog('Get usergroups with id: ' . $list, __CLASS__);
             }
             $lockToDomain_SQL = ' AND (lockToDomain=\'\' OR lockToDomain IS NULL OR lockToDomain=\'' . $this->authInfo['HTTP_HOST'] . '\')';
             $hiddenP = !$this->authInfo['showHiddenRecords'] ? 'AND hidden=0 ' : '';
             $res = $this->getDatabaseConnection()->exec_SELECTquery('*', $this->db_groups['table'], 'deleted=0 ' . $hiddenP . ' AND uid IN (' . $list . ')' . $lockToDomain_SQL);
             while ($row = $this->getDatabaseConnection()->sql_fetch_assoc($res)) {
                 $groupDataArr[$row['uid']] = $row;
             }
             if ($res) {
                 $this->getDatabaseConnection()->sql_free_result($res);
             }
         } else {
             if ($this->writeDevLog) {
                 GeneralUtility::devLog('No usergroups found.', AuthenticationService::class, 2);
             }
         }
     }
     return $groupDataArr;
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:53,代码来源:AuthenticationService.php

示例4: checkLockToIP

 /**
  * If TYPO3_CONF_VARS['BE']['enabledBeUserIPLock'] is enabled and
  * an IP-list is found in the User TSconfig objString "options.lockToIP",
  * then make an IP comparison with REMOTE_ADDR and return the outcome (TRUE/FALSE)
  *
  * @return boolean TRUE, if IP address validates OK (or no check is done at all)
  * @todo Define visibility
  */
 public function checkLockToIP()
 {
     $out = 1;
     if ($GLOBALS['TYPO3_CONF_VARS']['BE']['enabledBeUserIPLock']) {
         $IPList = $this->getTSConfigVal('options.lockToIP');
         if (trim($IPList)) {
             $baseIP = GeneralUtility::getIndpEnv('REMOTE_ADDR');
             $out = GeneralUtility::cmpIP($baseIP, $IPList);
         }
     }
     return $out;
 }
开发者ID:Mr-Robota,项目名称:TYPO3.CMS,代码行数:20,代码来源:BackendUserAuthentication.php

示例5: execAndProfileQuery

 public function execAndProfileQuery($query, $type)
 {
     if (empty($GLOBALS['TYPO3_DB']->mysqlprofilerConf['excludeTables'])) {
         $this->init();
     }
     $isProfiling = $this->isProfiling($query, $type);
     if ($isProfiling) {
         $begin = microtime(true);
     }
     // exec query
     if (Typo3profiler_Utility_Compatibility::intFromVer(TYPO3_version) > 6000000) {
         if (!$this->isConnected) {
             $this->connectDB();
         }
         $res = $this->link->query($query);
     } else {
         $res = mysql_query($query, $this->link);
     }
     if ($isProfiling) {
         $deltatime = round((microtime(true) - $begin) * 1000, 8);
         if ($GLOBALS['TSFE']->id == 0) {
             $debugFunc = $this->get_caller_method(3);
         } else {
             $debugFunc = $this->get_caller_method(2);
         }
         if (TYPO3_MODE == 'BE') {
             $debugFunc = $this->get_caller_method(3);
         }
         $debug = array('type' => $type, 'query' => $query, 'time' => $deltatime, 'backtrace' => $debugFunc, 'typo3mode' => TYPO3_MODE, 'page' => $GLOBALS['TSFE']->id !== null ? $GLOBALS['TSFE']->id : '');
         if ($GLOBALS['TYPO3_DB']->mysqlprofilerConf['debugbarenabled'] == 1) {
             if (\TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE_ADDR'), $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask'])) {
                 $GLOBALS['debugbar']['queries']->info('[' . $deltatime . '] ' . $query . ' --> ' . $debugFunc['file'] . ' @ ' . $debugFunc['line'] . ' : ' . $debugFunc['function']);
             }
         }
         $this->profiledQueries[] = $debug;
         if (TYPO3_MODE == 'BE') {
             $this->cleanSqlLog();
             $this->insertSqlLog($debug);
         }
     }
     return $res;
 }
开发者ID:Apen,项目名称:typo3profiler,代码行数:42,代码来源:DatabaseConnection.php

示例6: isAllowedIp

 /**
  * Checks if the current client ip is allowed.
  *
  * @param string $whitelist
  *   The ip whitelist.
  *
  * @return bool
  *   Whether the current client ip is allowed or not.
  */
 public function isAllowedIp($whitelist)
 {
     $remote = $_SERVER['REMOTE_ADDR'];
     // Use TYPO3 v6+ cmpIP if possible.
     if (is_callable(array('TYPO3\\CMS\\Core\\Utility\\GeneralUtility', 'cmpIP'))) {
         return \TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP($remote, $whitelist);
     }
     // Use TYPO3 v6- cmpIP if possible.
     if (is_callable(array('t3lib_div', 'cmpIP'))) {
         return \t3lib_div::cmpIP($remote, $whitelist);
     }
     // Fallback to the Chin Leung implementation.
     // @author Chin Leung
     // @see https://stackoverflow.com/questions/35559119/php-ip-address-whitelist-with-wildcards
     $whitelist = explode(',', $whitelist);
     if (in_array($remote, $whitelist)) {
         // If the ip is matched, return true.
         return true;
     } else {
         // Check the wildcards.
         foreach ($whitelist as $ip) {
             $ip = trim($ip);
             $wildcardPos = strpos($ip, "*");
             # Check if the ip has a wildcard
             if ($wildcardPos !== false && substr($remote, 0, $wildcardPos) . "*" == $ip) {
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:brainworxx,项目名称:krexx,代码行数:40,代码来源:Security.php

示例7: explain

 /**
  * Explain select queries
  * If $this->explainOutput is set, SELECT queries will be explained here. Only queries with more than one possible result row will be displayed.
  * The output is either printed as raw HTML output or embedded into the TS admin panel (checkbox must be enabled!)
  *
  * @todo Feature is not DBAL-compliant
  *
  * @param string $query SQL query
  * @param string $from_table Table(s) from which to select. This is what comes right after "FROM ...". Required value.
  * @param int $row_count Number of resulting rows
  * @return bool TRUE if explain was run, FALSE otherwise
  */
 protected function explain($query, $from_table, $row_count)
 {
     $debugAllowedForIp = GeneralUtility::cmpIP(GeneralUtility::getIndpEnv('REMOTE_ADDR'), $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask']);
     if ((int) $this->explainOutput == 1 || (int) $this->explainOutput == 2 && $debugAllowedForIp) {
         // Raw HTML output
         $explainMode = 1;
     } elseif ((int) $this->explainOutput == 3 && is_object($GLOBALS['TT'])) {
         // Embed the output into the TS admin panel
         $explainMode = 2;
     } else {
         return false;
     }
     $error = $this->sql_error();
     $trail = \TYPO3\CMS\Core\Utility\DebugUtility::debugTrail();
     $explain_tables = array();
     $explain_output = array();
     $res = $this->sql_query('EXPLAIN ' . $query, $this->link);
     if (is_a($res, '\\mysqli_result')) {
         while ($tempRow = $this->sql_fetch_assoc($res)) {
             $explain_output[] = $tempRow;
             $explain_tables[] = $tempRow['table'];
         }
         $this->sql_free_result($res);
     }
     $indices_output = array();
     // Notice: Rows are skipped if there is only one result, or if no conditions are set
     if ($explain_output[0]['rows'] > 1 || GeneralUtility::inList('ALL', $explain_output[0]['type'])) {
         // Only enable output if it's really useful
         $debug = true;
         foreach ($explain_tables as $table) {
             $tableRes = $this->sql_query('SHOW TABLE STATUS LIKE \'' . $table . '\'');
             $isTable = $this->sql_num_rows($tableRes);
             if ($isTable) {
                 $res = $this->sql_query('SHOW INDEX FROM ' . $table, $this->link);
                 if (is_a($res, '\\mysqli_result')) {
                     while ($tempRow = $this->sql_fetch_assoc($res)) {
                         $indices_output[] = $tempRow;
                     }
                     $this->sql_free_result($res);
                 }
             }
             $this->sql_free_result($tableRes);
         }
     } else {
         $debug = false;
     }
     if ($debug) {
         if ($explainMode) {
             $data = array();
             $data['query'] = $query;
             $data['trail'] = $trail;
             $data['row_count'] = $row_count;
             if ($error) {
                 $data['error'] = $error;
             }
             if (!empty($explain_output)) {
                 $data['explain'] = $explain_output;
             }
             if (!empty($indices_output)) {
                 $data['indices'] = $indices_output;
             }
             if ($explainMode == 1) {
                 \TYPO3\CMS\Core\Utility\DebugUtility::debug($data, 'Tables: ' . $from_table, 'DB SQL EXPLAIN');
             } elseif ($explainMode == 2) {
                 $GLOBALS['TT']->setTSselectQuery($data);
             }
         }
         return true;
     }
     return false;
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:83,代码来源:DatabaseConnection.php

示例8: beLoginLinkIPList

 /**
  * Returns a link to the BE login screen with redirect to the front-end
  *
  * @return string HTML, a tag for a link to the backend.
  * @todo Define visibility
  */
 public function beLoginLinkIPList()
 {
     if (!empty($this->config['config']['beLoginLinkIPList'])) {
         if (\TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE_ADDR'), $this->config['config']['beLoginLinkIPList'])) {
             $label = !$this->beUserLogin ? $this->config['config']['beLoginLinkIPList_login'] : $this->config['config']['beLoginLinkIPList_logout'];
             if ($label) {
                 if (!$this->beUserLogin) {
                     $link = '<a href="' . htmlspecialchars(TYPO3_mainDir . 'index.php?redirect_url=' . rawurlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI'))) . '">' . $label . '</a>';
                 } else {
                     $link = '<a href="' . htmlspecialchars(TYPO3_mainDir . 'index.php?L=OUT&redirect_url=' . rawurlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI'))) . '">' . $label . '</a>';
                 }
                 return $link;
             }
         }
     }
 }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:22,代码来源:TypoScriptFrontendController.php

示例9: handleRequest

 /**
  * Handles a frontend request
  *
  * @param \Psr\Http\Message\ServerRequestInterface $request
  * @return NULL|\Psr\Http\Message\ResponseInterface
  */
 public function handleRequest(\Psr\Http\Message\ServerRequestInterface $request)
 {
     $response = null;
     $this->request = $request;
     $this->initializeTimeTracker();
     // Hook to preprocess the current request:
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/index_ts.php']['preprocessRequest'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/index_ts.php']['preprocessRequest'] as $hookFunction) {
             $hookParameters = array();
             GeneralUtility::callUserFunction($hookFunction, $hookParameters, $hookParameters);
         }
         unset($hookFunction);
         unset($hookParameters);
     }
     $this->initializeController();
     if ($GLOBALS['TYPO3_CONF_VARS']['FE']['pageUnavailable_force'] && !GeneralUtility::cmpIP(GeneralUtility::getIndpEnv('REMOTE_ADDR'), $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask'])) {
         $this->controller->pageUnavailableAndExit('This page is temporarily unavailable.');
     }
     $this->controller->connectToDB();
     $this->controller->sendRedirect();
     // Output compression
     // Remove any output produced until now
     $this->bootstrap->endOutputBufferingAndCleanPreviousOutput();
     $this->initializeOutputCompression();
     // Initializing the Frontend User
     $this->timeTracker->push('Front End user initialized', '');
     $this->controller->initFEuser();
     $this->timeTracker->pull();
     // Initializing a possible logged-in Backend User
     /** @var $GLOBALS['BE_USER'] \TYPO3\CMS\Backend\FrontendBackendUserAuthentication */
     $GLOBALS['BE_USER'] = $this->controller->initializeBackendUser();
     // Process the ID, type and other parameters.
     // After this point we have an array, $page in TSFE, which is the page-record
     // of the current page, $id.
     $this->timeTracker->push('Process ID', '');
     // Initialize admin panel since simulation settings are required here:
     if ($this->controller->isBackendUserLoggedIn()) {
         $GLOBALS['BE_USER']->initializeAdminPanel();
         $this->bootstrap->initializeBackendRouter()->loadExtensionTables();
     } else {
         $this->bootstrap->loadCachedTca();
     }
     $this->controller->checkAlternativeIdMethods();
     $this->controller->clear_preview();
     $this->controller->determineId();
     // Now, if there is a backend user logged in and he has NO access to this page,
     // then re-evaluate the id shown! _GP('ADMCMD_noBeUser') is placed here because
     // \TYPO3\CMS\Version\Hook\PreviewHook might need to know if a backend user is logged in.
     if ($this->controller->isBackendUserLoggedIn() && (!$GLOBALS['BE_USER']->extPageReadAccess($this->controller->page) || GeneralUtility::_GP('ADMCMD_noBeUser'))) {
         // Remove user
         unset($GLOBALS['BE_USER']);
         $this->controller->beUserLogin = false;
         // Re-evaluate the page-id.
         $this->controller->checkAlternativeIdMethods();
         $this->controller->clear_preview();
         $this->controller->determineId();
     }
     $this->controller->makeCacheHash();
     $this->timeTracker->pull();
     // Admin Panel & Frontend editing
     if ($this->controller->isBackendUserLoggedIn()) {
         $GLOBALS['BE_USER']->initializeFrontendEdit();
         if ($GLOBALS['BE_USER']->adminPanel instanceof AdminPanelView) {
             $this->bootstrap->initializeLanguageObject();
         }
         if ($GLOBALS['BE_USER']->frontendEdit instanceof FrontendEditingController) {
             $GLOBALS['BE_USER']->frontendEdit->initConfigOptions();
         }
     }
     // Starts the template
     $this->timeTracker->push('Start Template', '');
     $this->controller->initTemplate();
     $this->timeTracker->pull();
     // Get from cache
     $this->timeTracker->push('Get Page from cache', '');
     $this->controller->getFromCache();
     $this->timeTracker->pull();
     // Get config if not already gotten
     // After this, we should have a valid config-array ready
     $this->controller->getConfigArray();
     // Setting language and locale
     $this->timeTracker->push('Setting language and locale', '');
     $this->controller->settingLanguage();
     $this->controller->settingLocale();
     $this->timeTracker->pull();
     // Convert POST data to utf-8 for internal processing if metaCharset is different
     $this->controller->convPOSTCharset();
     $this->controller->initializeRedirectUrlHandlers();
     $this->controller->handleDataSubmission();
     // Check for shortcut page and redirect
     $this->controller->checkPageForShortcutRedirect();
     $this->controller->checkPageForMountpointRedirect();
     // Generate page
     $this->controller->setUrlIdToken();
//.........这里部分代码省略.........
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:101,代码来源:RequestHandler.php

示例10: getGroups

 /**
  * Find usergroup records, currently only for frontend
  *
  * @param array $user Data of user.
  * @param array $knownGroups Group data array of already known groups. This is handy if you want select other related groups. Keys in this array are unique IDs of those groups.
  * @return mixed Groups array, keys = uid which must be unique
  * @todo Define visibility
  */
 public function getGroups($user, $knownGroups)
 {
     global $TYPO3_CONF_VARS;
     $groupDataArr = array();
     if ($this->mode == 'getGroupsFE') {
         $groups = array();
         if (is_array($user) && $user[$this->db_user['usergroup_column']]) {
             $groupList = $user[$this->db_user['usergroup_column']];
             $groups = array();
             $this->getSubGroups($groupList, '', $groups);
         }
         // ADD group-numbers if the IPmask matches.
         if (is_array($TYPO3_CONF_VARS['FE']['IPmaskMountGroups'])) {
             foreach ($TYPO3_CONF_VARS['FE']['IPmaskMountGroups'] as $IPel) {
                 if ($this->authInfo['REMOTE_ADDR'] && $IPel[0] && \TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP($this->authInfo['REMOTE_ADDR'], $IPel[0])) {
                     $groups[] = (int) $IPel[1];
                 }
             }
         }
         $groups = array_unique($groups);
         if (count($groups)) {
             $list = implode(',', $groups);
             if ($this->writeDevLog) {
                 \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('Get usergroups with id: ' . $list, 'TYPO3\\CMS\\Sv\\AuthenticationService');
             }
             $lockToDomain_SQL = ' AND (lockToDomain=\'\' OR lockToDomain IS NULL OR lockToDomain=\'' . $this->authInfo['HTTP_HOST'] . '\')';
             if (!$this->authInfo['showHiddenRecords']) {
                 $hiddenP = 'AND hidden=0 ';
             }
             $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $this->db_groups['table'], 'deleted=0 ' . $hiddenP . ' AND uid IN (' . $list . ')' . $lockToDomain_SQL);
             while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                 $groupDataArr[$row['uid']] = $row;
             }
             if ($res) {
                 $GLOBALS['TYPO3_DB']->sql_free_result($res);
             }
         } else {
             if ($this->writeDevLog) {
                 \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('No usergroups found.', 'TYPO3\\CMS\\Sv\\AuthenticationService', 2);
             }
         }
     } elseif ($this->mode == 'getGroupsBE') {
     }
     return $groupDataArr;
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:53,代码来源:AuthenticationService.php

示例11: authUser

 /**
  * Authenticate a user
  * Return 200 if the IP is right. This means that no more checks are needed. Otherwise authentication may fail because we may don't have a password.
  *
  * @param    array     Data of user.
  * @return    boolean
  */
 function authUser($user)
 {
     $ret = self::STATUS_AUTHENTICATION_SUCCESS_CONTINUE;
     // any auto option set?
     if ($user['tx_pxipauth_mode'] > 0) {
         $IPList = trim($user['tx_pxipauth_ip_list']);
         // auto IP login only
         if ($user['tx_pxipauth_mode'] == self::LOGIN_MODE_AUTO_ONLY) {
             // we check always - also without an given IP
             $ret = \TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP($this->getClientIp(), $IPList);
             $ret = $ret ? self::STATUS_AUTHENTICATION_SUCCESS_BREAK : self::STATUS_AUTHENTICATION_FAILURE_BREAK;
             // this option is checked with an given IP only
         } elseif ($IPList) {
             $ret = \TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP($this->getClientIp(), $IPList);
             $ret = $ret ? self::STATUS_AUTHENTICATION_SUCCESS_BREAK : self::STATUS_AUTHENTICATION_SUCCESS_CONTINUE;
         }
     }
     // Checking the domain (lockToDomain)
     if ($ret && $user['lockToDomain'] && $user['lockToDomain'] != $this->authInfo['HTTP_HOST']) {
         // Lock domain didn't match, so error:
         if ($this->writeAttemptLog) {
             $this->writelog(255, 3, 3, 1, 'Login-attempt from %s (%s), username \'%s\', locked domain \'%s\' did not match \'%s\'!', array($this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $user[$this->db_user['username_column']], $user['lockToDomain'], $this->authInfo['HTTP_HOST']));
             \TYPO3\CMS\Core\Utility\GeneralUtility::sysLog(sprintf('Login-attempt from %s (%s), username \'%s\', locked domain \'%s\' did not match \'%s\'!', $this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $user[$this->db_user['username_column']], $user['lockToDomain'], $this->authInfo['HTTP_HOST']), 'Core', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_WARNING);
         }
         $ret = self::STATUS_AUTHENTICATION_FAILURE_BREAK;
     }
     return $ret;
 }
开发者ID:portrino,项目名称:px_ipauth,代码行数:35,代码来源:IpAuthenticationService.php

示例12: handleRequest

 /**
  * Handles a frontend request
  *
  * @return void
  */
 public function handleRequest()
 {
     \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->loadTypo3LoadedExtAndExtLocalconf(TRUE)->applyAdditionalConfigurationSettings();
     // Timetracking started
     $configuredCookieName = trim($GLOBALS['TYPO3_CONF_VARS']['BE']['cookieName']);
     if (empty($configuredCookieName)) {
         $configuredCookieName = 'be_typo_user';
     }
     if ($_COOKIE[$configuredCookieName]) {
         $GLOBALS['TT'] = new \TYPO3\CMS\Core\TimeTracker\TimeTracker();
     } else {
         $GLOBALS['TT'] = new \TYPO3\CMS\Core\TimeTracker\NullTimeTracker();
     }
     $GLOBALS['TT']->start();
     \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->initializeTypo3DbGlobal();
     // Hook to preprocess the current request:
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/index_ts.php']['preprocessRequest'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/index_ts.php']['preprocessRequest'] as $hookFunction) {
             $hookParameters = array();
             \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hookFunction, $hookParameters, $hookParameters);
         }
         unset($hookFunction);
         unset($hookParameters);
     }
     // Look for extension ID which will launch alternative output engine
     if ($temp_extId = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('eID')) {
         if ($classPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include'][$temp_extId])) {
             // Remove any output produced until now
             ob_clean();
             require $classPath;
         }
         die;
     }
     /** @var $GLOBALS['TSFE'] \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController */
     $GLOBALS['TSFE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('type'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('no_cache'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('cHash'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('jumpurl'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('MP'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('RDCT'));
     if ($GLOBALS['TYPO3_CONF_VARS']['FE']['pageUnavailable_force'] && !\TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE_ADDR'), $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask'])) {
         $GLOBALS['TSFE']->pageUnavailableAndExit('This page is temporarily unavailable.');
     }
     $GLOBALS['TSFE']->connectToDB();
     $GLOBALS['TSFE']->sendRedirect();
     // Output compression
     // Remove any output produced until now
     ob_clean();
     if ($GLOBALS['TYPO3_CONF_VARS']['FE']['compressionLevel'] && extension_loaded('zlib')) {
         if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($GLOBALS['TYPO3_CONF_VARS']['FE']['compressionLevel'])) {
             // Prevent errors if ini_set() is unavailable (safe mode)
             @ini_set('zlib.output_compression_level', $GLOBALS['TYPO3_CONF_VARS']['FE']['compressionLevel']);
         }
         ob_start(array(\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Utility\\CompressionUtility'), 'compressionOutputHandler'));
     }
     // FE_USER
     $GLOBALS['TT']->push('Front End user initialized', '');
     /** @var $GLOBALS['TSFE'] \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController */
     $GLOBALS['TSFE']->initFEuser();
     $GLOBALS['TT']->pull();
     // BE_USER
     /** @var $GLOBALS['BE_USER'] \TYPO3\CMS\Backend\FrontendBackendUserAuthentication */
     $GLOBALS['BE_USER'] = $GLOBALS['TSFE']->initializeBackendUser();
     // Process the ID, type and other parameters.
     // After this point we have an array, $page in TSFE, which is the page-record
     // of the current page, $id.
     $GLOBALS['TT']->push('Process ID', '');
     // Initialize admin panel since simulation settings are required here:
     if ($GLOBALS['TSFE']->isBackendUserLoggedIn()) {
         $GLOBALS['BE_USER']->initializeAdminPanel();
         \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->loadExtensionTables(TRUE);
     } else {
         \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->loadCachedTca();
     }
     $GLOBALS['TSFE']->checkAlternativeIdMethods();
     $GLOBALS['TSFE']->clear_preview();
     $GLOBALS['TSFE']->determineId();
     // Now, if there is a backend user logged in and he has NO access to this page,
     // then re-evaluate the id shown! _GP('ADMCMD_noBeUser') is placed here because
     // \TYPO3\CMS\Version\Hook\PreviewHook might need to know if a backend user is logged in.
     if ($GLOBALS['TSFE']->isBackendUserLoggedIn() && (!$GLOBALS['BE_USER']->extPageReadAccess($GLOBALS['TSFE']->page) || \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('ADMCMD_noBeUser'))) {
         // Remove user
         unset($GLOBALS['BE_USER']);
         $GLOBALS['TSFE']->beUserLogin = FALSE;
         // Re-evaluate the page-id.
         $GLOBALS['TSFE']->checkAlternativeIdMethods();
         $GLOBALS['TSFE']->clear_preview();
         $GLOBALS['TSFE']->determineId();
     }
     $GLOBALS['TSFE']->makeCacheHash();
     $GLOBALS['TT']->pull();
     // Admin Panel & Frontend editing
     if ($GLOBALS['TSFE']->isBackendUserLoggedIn()) {
         $GLOBALS['BE_USER']->initializeFrontendEdit();
         if ($GLOBALS['BE_USER']->adminPanel instanceof \TYPO3\CMS\Frontend\View\AdminPanelView) {
             \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->initializeLanguageObject()->initializeSpriteManager();
         }
         if ($GLOBALS['BE_USER']->frontendEdit instanceof \TYPO3\CMS\Core\FrontendEditing\FrontendEditingController) {
             $GLOBALS['BE_USER']->frontendEdit->initConfigOptions();
         }
//.........这里部分代码省略.........
开发者ID:Mr-Robota,项目名称:TYPO3.CMS,代码行数:101,代码来源:FrontendRequestHandler.php

示例13: checkBackendAccessSettingsFromInitPhp

 /**
  * Implementing the access checks that the typo3/init.php script does before a user is ever logged in.
  * Used in the frontend.
  *
  * @return boolean Returns TRUE if access is OK
  * @see 	typo3/init.php, t3lib_beuserauth::backendCheckLogin()
  */
 public function checkBackendAccessSettingsFromInitPhp()
 {
     // Check Hardcoded lock on BE
     if ($GLOBALS['TYPO3_CONF_VARS']['BE']['adminOnly'] < 0) {
         return FALSE;
     }
     // Check IP
     if (trim($GLOBALS['TYPO3_CONF_VARS']['BE']['IPmaskList'])) {
         if (!\TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE_ADDR'), $GLOBALS['TYPO3_CONF_VARS']['BE']['IPmaskList'])) {
             return FALSE;
         }
     }
     // Check SSL (https)
     if (intval($GLOBALS['TYPO3_CONF_VARS']['BE']['lockSSL']) && $GLOBALS['TYPO3_CONF_VARS']['BE']['lockSSL'] != 3) {
         if (!\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SSL')) {
             return FALSE;
         }
     }
     // Finally a check from t3lib_beuserauth::backendCheckLogin()
     if ($this->isUserAllowedToLogin()) {
         return TRUE;
     } else {
         return FALSE;
     }
 }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:32,代码来源:FrontendBackendUserAuthentication.php

示例14: main

    /**
     * The main method of the backend module
     *
     * @return	void
     */
    public function main()
    {
        // Include the LL file for phpMyAdmin
        $GLOBALS['LANG']->includeLLFile('EXT:phpmyadmin/Resources/Private/Language/locallang.xlf');
        // Set the path to phpMyAdmin
        $extPath = ExtensionManagementUtility::extPath('phpmyadmin');
        $typo3DocumentRoot = GeneralUtility::getIndpEnv('TYPO3_DOCUMENT_ROOT');
        // Set class config for module
        $this->MCONF = $GLOBALS['MCONF'];
        // Get config
        $extensionConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['phpmyadmin']);
        // IP-based Access restrictions
        $devIPmask = trim($GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask']);
        $remoteAddress = GeneralUtility::getIndpEnv('REMOTE_ADDR');
        // Check for IP restriction (devIpMask), and die if not allowed
        $useDevIpMask = (bool) $extensionConfiguration['useDevIpMask'];
        if ($useDevIpMask === TRUE) {
            // Abort if devIPmask is wildcarded
            if ($devIPmask != '*') {
                $message = '<h1>' . $GLOBALS['LANG']->getLL('module.headline.accessDenied') . '</h1>
							<p>' . sprintf($GLOBALS['LANG']->getLL('module.message.accessDenied.devIpMask'), $remoteAddress, $devIPmask) . '</p>';
                if (!GeneralUtility::cmpIP($remoteAddress, $devIPmask)) {
                    die($message);
                }
            }
        }
        // Check for ip restriction, and die if not allowed
        $allowedIps = trim($extensionConfiguration['allowedIps']);
        if (!empty($allowedIps)) {
            $message = '<h1>' . $GLOBALS['LANG']->getLL('module.headline.accessDenied') . '</h1>
						<p>' . sprintf($GLOBALS['LANG']->getLL('module.message.accessDenied.allowedIps'), $remoteAddress, $allowedIps) . '</p>';
            if (!GeneralUtility::cmpIP($remoteAddress, $allowedIps)) {
                die($message);
            }
        }
        // Path to install dir
        $this->MCONF['PMA_absolute_path'] = $extPath . $this->MCONF['PMA_subdir'];
        // PMA uses relative file inclusion, so we need to ensure a proper include_path
        @set_include_path($this->MCONF['PMA_absolute_path'] . PATH_SEPARATOR . get_include_path());
        // Path to web dir
        $this->MCONF['PMA_relative_path'] = ExtensionManagementUtility::extRelPath('phpmyadmin') . $this->MCONF['PMA_subdir'];
        // If phpMyAdmin is configured in the conf.php script, we continue to load it...
        if ($this->MCONF['PMA_absolute_path'] && @is_dir($this->MCONF['PMA_absolute_path'])) {
            // Need to have cookie visible from parent directory
            session_set_cookie_params(0, '/', '', 0);
            // Create signon session
            $session_name = 'tx_phpmyadmin';
            session_name($session_name);
            session_start();
            // Store the credentials in the session
            $_SESSION['PMA_single_signon_user'] = TYPO3_db_username;
            $_SESSION['PMA_single_signon_password'] = TYPO3_db_password;
            $_SESSION['PMA_single_signon_host'] = TYPO3_db_host;
            $_SESSION['PMA_single_signon_port'] = $GLOBALS['TYPO3_CONF_VARS']['DB']['port'];
            $_SESSION['PMA_single_signon_only_db'] = TYPO3_db;
            // If a socket connection is configured, use this for mysqli
            if (isset($GLOBALS['TYPO3_CONF_VARS']['DB']['socket'])) {
                $_SESSION['PMA_typo3_socket'] = $GLOBALS['TYPO3_CONF_VARS']['DB']['socket'];
            }
            // Configure some other parameters
            $_SESSION['PMA_extConf'] = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['phpmyadmin'];
            $_SESSION['PMA_hideOtherDBs'] = $extensionConfiguration['hideOtherDBs'];
            // Get signon uri for redirect
            $path_ext = substr($extPath, strlen($typo3DocumentRoot), strlen($extPath));
            $path_ext = substr($path_ext, 0, 1) != '/' ? '/' . $path_ext : $path_ext;
            $path_pma = $path_ext . $this->MCONF['PMA_subdir'];
            $_SESSION['PMA_SignonURL'] = $path_pma . 'index.php';
            // Try to get the TYPO3 backend uri even if it's installed in a subdirectory
            // Compile logout path and add a slash if the returned string does not start with
            $path_typo3 = substr(PATH_typo3, strlen($typo3DocumentRoot), strlen(PATH_typo3));
            $path_typo3 = substr($path_typo3, 0, 1) != '/' ? '/' . $path_typo3 : $path_typo3;
            $_SESSION['PMA_LogoutURL'] = $path_typo3 . 'logout.php';
            // Prepend document root if uploadDir does not start with a slash "/"
            $extensionConfiguration['uploadDir'] = trim($extensionConfiguration['uploadDir']);
            if (strpos($extensionConfiguration['uploadDir'], '/') !== 0) {
                $_SESSION['PMA_uploadDir'] = $typo3DocumentRoot . '/' . $extensionConfiguration['uploadDir'];
            } else {
                $_SESSION['PMA_uploadDir'] = $extensionConfiguration['uploadDir'];
            }
            $_SESSION['PMA_typo3_db'] = TYPO3_db;
            // Get current session id
            $currentSessionId = session_id();
            // Force to set the cookie according to issue #8884
            // http://bugs.typo3.org/view.php?id=8884#c23323
            setcookie($session_name, $currentSessionId, 0, '/', '');
            // Close that session
            session_write_close();
            // Mapping language keys for phpMyAdmin
            $languageKeyMapping = array('default' => 'en', 'dk' => 'da', 'de' => 'de', 'no' => 'no', 'it' => 'it', 'fr' => 'fr', 'es' => 'es', 'nl' => 'nl', 'cz' => 'cs-iso', 'pl' => 'pl', 'si' => 'sk');
            $languageKey = $languageKeyMapping[$GLOBALS['LANG']->lang];
            if (!$languageKey) {
                $languageKey = 'en';
            }
            // Redirect to phpMyAdmin (should use absolute URL here!), setting default database
            $redirectUri = GeneralUtility::locationHeaderUrl($_SESSION['PMA_SignonURL'] . '?lang=' . $languageKey . '&db=' . urlencode(TYPO3_db));
//.........这里部分代码省略.........
开发者ID:portrino,项目名称:TYPO3-phpMyAdmin,代码行数:101,代码来源:index.php

示例15: unset

    }
    unset($hookFunction);
    unset($hookParameters);
}
// Look for extension ID which will launch alternative output engine
if ($temp_extId = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('eID')) {
    if ($classPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($TYPO3_CONF_VARS['FE']['eID_include'][$temp_extId])) {
        // Remove any output produced until now
        ob_clean();
        require $classPath;
    }
    die;
}
/** @var $TSFE \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController */
$TSFE = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $TYPO3_CONF_VARS, \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('type'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('no_cache'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('cHash'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('jumpurl'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('MP'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('RDCT'));
if ($TYPO3_CONF_VARS['FE']['pageUnavailable_force'] && !\TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE_ADDR'), $TYPO3_CONF_VARS['SYS']['devIPmask'])) {
    $TSFE->pageUnavailableAndExit('This page is temporarily unavailable.');
}
$TSFE->connectToDB();
$TSFE->sendRedirect();
// Output compression
// Remove any output produced until now
ob_clean();
if ($TYPO3_CONF_VARS['FE']['compressionLevel'] && extension_loaded('zlib')) {
    if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($TYPO3_CONF_VARS['FE']['compressionLevel'])) {
        // Prevent errors if ini_set() is unavailable (safe mode)
        @ini_set('zlib.output_compression_level', $TYPO3_CONF_VARS['FE']['compressionLevel']);
    }
    ob_start(array(\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Utility\\CompressionUtility'), 'compressionOutputHandler'));
}
// FE_USER
开发者ID:khanhdeux,项目名称:typo3test,代码行数:31,代码来源:index_ts.php


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