本文整理汇总了PHP中Current_User::getIP方法的典型用法代码示例。如果您正苦于以下问题:PHP Current_User::getIP方法的具体用法?PHP Current_User::getIP怎么用?PHP Current_User::getIP使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Current_User
的用法示例。
在下文中一共展示了Current_User::getIP方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAllowDenyList
public function getAllowDenyList()
{
$content = array();
PHPWS_Core::initModClass('access', 'Allow_Deny.php');
if (!PHPWS_Settings::get('access', 'allow_deny_enabled')) {
return "Order Allow,Deny\nAllow from all\n\n";
}
$deny_all = PHPWS_Settings::get('access', 'deny_all');
$allow_all = PHPWS_Settings::get('access', 'allow_all');
$deny_str = $allow_str = NULL;
if ($deny_all && $allow_all) {
return NULL;
} elseif ($deny_all) {
$deny_str = 'Deny from all';
} elseif ($allow_all) {
$allow_str = 'Allow from all';
}
$db = new PHPWS_DB('access_allow_deny');
$db->addWhere('active', 1);
if ($deny_all) {
$db->addWhere('allow_or_deny', 1);
} elseif ($allow_all) {
$db->addWhere('allow_or_deny', 0);
}
$result = $db->getObjects('Access_Allow_Deny');
if ($deny_all) {
$content[] = 'Order Deny,Allow';
$content[] = $deny_str;
$content[] = 'Allow from 127.0.0.1';
$content[] = 'Allow from ' . Current_User::getIP();
if (!empty($result)) {
foreach ($result as $ad) {
$content[] = 'Allow from ' . $ad->ip_address;
}
}
} elseif ($allow_all) {
$content[] = 'Order Allow,Deny';
$content[] = $allow_str;
if (!empty($result)) {
foreach ($result as $ad) {
$content[] = 'Deny from ' . $ad->ip_address;
}
}
} else {
if (!empty($result)) {
$content[] = 'Order Deny,Allow';
foreach ($result as $ad) {
if ($ad->allow_or_deny) {
$allows[] = 'Allow from ' . $ad->ip_address;
} else {
$denys[] = 'Deny from ' . $ad->ip_address;
}
}
if (!empty($denys)) {
$content[] = implode("\n", $denys);
}
if (!empty($allows)) {
$content[] = implode("\n", $allows);
}
}
}
return implode("\n", $content) . "\n\n";
}