本文整理汇总了PHP中UserAccount::isInIpRange方法的典型用法代码示例。如果您正苦于以下问题:PHP UserAccount::isInIpRange方法的具体用法?PHP UserAccount::isInIpRange怎么用?PHP UserAccount::isInIpRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserAccount
的用法示例。
在下文中一共展示了UserAccount::isInIpRange方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_modifier_proxify
function smarty_modifier_proxify($str)
{
// @codingStandardsIgnoreEnd
global $configArray;
if (!isset($configArray['EZproxy']['host']) || !$configArray['EZproxy']['host']) {
return $str;
}
if (isset($configArray['EZproxy']['proxy_known_ip_addresses']) && !$configArray['EZproxy']['proxy_known_ip_addresses'] && UserAccount::isInIpRange()) {
return $str;
}
if (isset($configArray['EZproxy']['include_url']) || isset($configArray['EZproxy']['include_url_re'])) {
if (isset($configArray['EZproxy']['include_url'])) {
$pass = false;
foreach ($configArray['EZproxy']['include_url'] as $mask) {
if (strstr($str, $mask)) {
$pass = true;
break;
}
}
}
if (!$pass && isset($configArray['EZproxy']['include_url_re'])) {
$pass = false;
foreach ($configArray['EZproxy']['include_url_re'] as $mask) {
if (preg_match($mask, $str)) {
$pass = true;
break;
}
}
}
if (!$pass) {
return $str;
}
}
if (isset($configArray['EZproxy']['exclude_url'])) {
foreach ($configArray['EZproxy']['exclude_url'] as $mask) {
if (strstr($str, $mask)) {
return $str;
}
}
}
if (isset($configArray['EZproxy']['exclude_url_re'])) {
foreach ($configArray['EZproxy']['exclude_url_re'] as $mask) {
if (preg_match($mask, $str)) {
return $str;
}
}
}
return $configArray['EZproxy']['host'] . '/login?qurl=' . urlencode($str);
}
示例2: isAuthorized
/**
* Checks whether the user is authorized to access
* restricted resources.
*
* @return bool Is the user authorized
* @access public
*/
public static function isAuthorized()
{
global $configArray;
if (isset($_SESSION['userAuthorized']) && $_SESSION['userAuthorized']) {
return true;
}
if (isset($configArray['Authorization']['ip']) && $configArray['Authorization']['ip']) {
if (UserAccount::isInIpRange()) {
return true;
}
}
if (isset($_SESSION['authMethod']) && isset($configArray['Authorization']['authentication_methods'])) {
if (in_array($_SESSION['authMethod'], $configArray['Authorization']['authentication_methods'])) {
if ($_SESSION['authMethod'] == 'ILS') {
if (!isset($_SESSION['userAuthorized'])) {
// Check ILS-based authorization
$patron = UserAccount::catalogLogin();
if ($patron !== false && !PEAR::isError($patron)) {
$catalog = ConnectionManager::connectToCatalog();
if ($catalog->checkFunction('getPatronAuthorizationStatus')) {
$status = $catalog->getPatronAuthorizationStatus($patron);
if (!PEAR::isError($status)) {
$_SESSION['userAuthorized'] = $status;
if ($status) {
return true;
}
}
}
}
}
} else {
return true;
}
}
}
return false;
}