本文整理汇总了PHP中SJB_UserManager::checkBan方法的典型用法代码示例。如果您正苦于以下问题:PHP SJB_UserManager::checkBan方法的具体用法?PHP SJB_UserManager::checkBan怎么用?PHP SJB_UserManager::checkBan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SJB_UserManager
的用法示例。
在下文中一共展示了SJB_UserManager::checkBan方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
public static function login($username, $password, $keep_signed, &$errors, $login_as_user = false, $autoriseByUsername = false)
{
$login = SJB_UserManager::login($username, $password, $errors, $autoriseByUsername, $login_as_user);
if ($login) {
if (SJB_UserManager::checkBan($errors)) {
return false;
}
$userInfo = SJB_UserManager::getUserInfoByUserName($username);
if (!$userInfo['active']) {
$errors['USER_NOT_ACTIVE'] = 1;
return false;
}
// if "Approve Users by Admin" option is turned on
$userGroupInfo = SJB_UserGroupManager::getUserGroupInfoBySID($userInfo['user_group_sid']);
if (!empty($userGroupInfo['approve_user_by_admin']) && 'Approved' != $userInfo['approval']) {
$errors['USER_NOT_APPROVED'] = 1;
return false;
}
$loginParams = array('username' => $username, 'password' => $password);
SJB_Event::dispatch('Login', $loginParams);
if ($keep_signed) {
SJB_Authorization::keepUserSignedIn($userInfo);
}
SJB_DB::query('update `users` set `ip` = ?s where `sid` = ?n', $_SERVER['REMOTE_ADDR'], $userInfo['sid']);
if (!empty($userInfo['parent_sid'])) {
$subuserInfo = $userInfo;
$userInfo = SJB_UserManager::getUserInfoBySID($userInfo['parent_sid']);
$userInfo['subuser'] = $subuserInfo;
}
SJB_Authorization::setSessionForUser($userInfo);
return true;
}
return false;
}
示例2: execute
//.........这里部分代码省略.........
$contract = new SJB_Contract(array('product_sid' => $productToChange, 'numberOfListings' => $listingNumber, 'is_recurring' => 0));
$contract->setUserSID($user_sid);
$contract->saveInDB();
if ($contract->isFeaturedProfile()) {
SJB_UserManager::makeFeaturedBySID($user_sid);
}
}
}
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . SJB_Navigator::getURI());
break;
case 'ban_ip':
$cantBanUsers = array();
foreach ($users_sids as $user_sid => $value) {
$user = SJB_UserManager::getUserInfoBySID($user_sid);
if ($user['ip'] && !SJB_IPManager::getBannedIPByValue($user['ip'])) {
SJB_IPManager::makeIPBanned($user['ip']);
} else {
$cantBanUsers[] = $user['username'];
}
}
if ($cantBanUsers) {
$tp->assign('cantBanUsers', $cantBanUsers);
} else {
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . SJB_Navigator::getURI());
}
break;
case 'unban_ip':
$cantUnbanIPs = array();
foreach ($users_sids as $user_sid => $value) {
$user = SJB_UserManager::getUserInfoBySID($user_sid);
if ($user['ip'] !== '') {
if (SJB_IPManager::getBannedIPByValue($user['ip'])) {
SJB_IPManager::makeIPEnabledByValue($user['ip']);
} elseif (SJB_UserManager::checkBan($errors, $user['ip'])) {
$cantUnbanIPs[] = $user['ip'];
}
}
}
if ($cantUnbanIPs) {
$tp->assign('rangeIPs', $cantUnbanIPs);
} else {
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . SJB_Navigator::getURI());
}
break;
default:
unset($_REQUEST['restore']);
break;
}
if (empty($errors)) {
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . SJB_Navigator::getURI());
}
}
/***************************************************************/
$_REQUEST['action'] = 'search';
$user = new SJB_User(array(), $userGroupSID);
$user->addProperty(array('id' => 'user_group', 'type' => 'list', 'value' => '', 'is_system' => true, 'list_values' => SJB_UserGroupManager::getAllUserGroupsIDsAndCaptions()));
$user->addProperty(array('id' => 'registration_date', 'type' => 'date', 'value' => '', 'is_system' => true));
$user->addProperty(array('id' => 'approval', 'caption' => 'Approval', 'type' => 'list', 'list_values' => array(array('id' => 'Pending', 'caption' => 'Pending'), array('id' => 'Approved', 'caption' => 'Approved'), array('id' => 'Rejected', 'caption' => 'Rejected')), 'length' => '10', 'is_required' => false, 'is_system' => true));
// get array of accessible products
$productsSIDs = SJB_ProductsManager::getProductsIDsByUserGroupSID($userGroupSID);
$products = array();
foreach ($productsSIDs as $key => $productSID) {
$product = SJB_ProductsManager::getProductInfoBySID($productSID);
$products[$key] = $product;
if (!empty($product['pricing_type']) && $product['pricing_type'] == 'volume_based' && !empty($product['volume_based_pricing'])) {
$volumeBasedPricing = $product['volume_based_pricing'];
示例3: __construct
private function __construct($uri = null)
{
// fill request properties
if (isset($_SERVER['REQUEST_METHOD'])) {
self::$method = self::getVar('REQUEST_METHOD', '', 'SERVER');
}
// $_SERVER['REQUEST_METHOD'];
if (isset($_SERVER['REMOTE_ADDR'])) {
self::$remoteAddr = self::getVar('REMOTE_ADDR', '', 'SERVER');
}
// $_SERVER['REMOTE_ADDR'];
if (isset($_SERVER['HTTP_USER_AGENT'])) {
self::$userAgent = self::getVar('HTTP_USER_AGENT', '', 'SERVER');
}
// default header
$this->headers['Content-type'] = 'text/html;charset=utf-8';
$this->uri = $uri;
if ($uri === null || empty($uri)) {
$this->uri = SJB_Navigator::getUri();
}
$errors = array();
if (SJB_UserManager::checkBan($errors) && SJB_System::getSystemSettings('SYSTEM_ACCESS_TYPE') != SJB_System::getSystemSettings('ADMIN_ACCESS_TYPE')) {
$this->uri = "/user-banned/";
}
// maintenance mode
if (SJB_System::getSystemSettings('SYSTEM_ACCESS_TYPE') != SJB_System::getSystemSettings('ADMIN_ACCESS_TYPE')) {
$oMaintenance = new SJB_MaintenanceMode(self::$remoteAddr);
if (!$oMaintenance->getAllowed()) {
$this->uri = '/maintenance-mode/';
}
}
$this->page_config = SJB_PageConfig::getPageConfig($this->uri);
}
示例4: execute
//.........这里部分代码省略.........
$user->deleteProperty('password');
}
SJB_UserManager::saveUser($user);
// >>> SJB-1197
// needs to check session for ajax-uploaded files, and set it to user profile
$tmpUploadsStorage = SJB_Session::getValue('tmp_uploads_storage');
$formToken = SJB_Request::getVar('form_token');
if (!empty($formToken)) {
$tmpUploadedFields = SJB_Array::getPath($tmpUploadsStorage, $formToken);
if (!is_null($tmpUploadsStorage) && is_array($tmpUploadedFields)) {
// prepare user profile fields array
$userProfileFieldsInfo = SJB_UserProfileFieldManager::getAllFieldsInfo();
$userProfileFields = array();
foreach ($userProfileFieldsInfo as $field) {
$userProfileFields[$field['id']] = $field;
}
// look for temporary values
foreach ($tmpUploadedFields as $fieldId => $fieldInfo) {
// check field ID for valid ID in user profile fields
if (!array_key_exists($fieldId, $userProfileFields) || empty($fieldInfo)) {
continue;
}
$fieldType = $userProfileFields[$fieldId]['type'];
$profilePropertyId = $fieldId . '_' . $user->getSID();
switch (strtolower($fieldType)) {
case 'video':
case 'file':
// change temporary file ID
SJB_DB::query("UPDATE `uploaded_files` SET `id` = ?s WHERE `id` = ?s", $profilePropertyId, $fieldInfo['file_id']);
// set value of user property to new uploaded file
$user->setPropertyValue($fieldId, $profilePropertyId);
break;
case 'logo':
// change temporary file ID and thumb ID
SJB_DB::query("UPDATE `uploaded_files` SET `id` = ?s WHERE `id` = ?s", $profilePropertyId, $fieldInfo['file_id']);
SJB_DB::query("UPDATE `uploaded_files` SET `id` = ?s WHERE `id` = ?s", $profilePropertyId . '_thumb', $fieldInfo['file_id'] . '_thumb');
// set value of user property to new uploaded file
$user->setPropertyValue($fieldId, $profilePropertyId);
break;
default:
break;
}
$tmpUploadsStorage = SJB_Array::unsetValueByPath($tmpUploadsStorage, "{$formToken}/{$fieldId}");
}
// and save user with new fields data
SJB_UserManager::saveUser($user);
SJB_Authorization::updateCurrentUserSession();
// clean temporary storage
$tmpUploadsStorage = SJB_Array::unsetValueByPath($tmpUploadsStorage, "{$formToken}");
// CLEAR TEMPORARY SESSION STORAGE
SJB_Session::setValue('tmp_uploads_storage', $tmpUploadsStorage);
}
}
// <<< SJB-1197
if (SJB_Request::isAjax()) {
echo "<p class=\"green\">User Saved</p>";
exit;
}
if ($form_submitted == 'save_info') {
$userGroupInfo = SJB_UserGroupManager::getUserGroupInfoBySID($user_info['user_group_sid']);
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/manage-users/" . mb_strtolower($userGroupInfo['id'], 'utf8'));
}
if (!empty($properties)) {
$user->details->properties = $properties;
}
}
if (SJB_UserGroupManager::isUserEmailAsUsernameInUserGroup($user_info['user_group_sid'])) {
$user->deleteProperty("username");
}
$listingTypes = SJB_ListingTypeManager::getAllListingTypesInfo();
$products = SJB_ProductsManager::getProductsInfoByUserGroupSID($user_info['user_group_sid']);
$allowedListingTypes = array();
foreach ($products as $product) {
if (!empty($product['listing_type_sid']) && empty($allowedListingTypes[$product['listing_type_sid']])) {
foreach ($listingTypes as $listingType) {
if ($product['listing_type_sid'] == $listingType['sid']) {
$allowedListingTypes[$product['listing_type_sid']] = $listingType;
}
}
}
}
$edit_user_form = SJB_ObjectMother::createForm($user);
$edit_user_form->registerTags($tp);
$userGroupInfo = SJB_UserGroupManager::getUserGroupInfoBySID($user_info['user_group_sid']);
if (SJB_UserManager::checkBan($errors, $user_info['ip'])) {
$user_info['ip_is_banned'] = 1;
}
$tp->assign("form_fields", $edit_user_form->getFormFieldsInfo());
$tp->assign("uploadMaxFilesize", SJB_UploadFileManager::getIniUploadMaxFilesize());
$tp->assign("errors", $errors);
$tp->assign("listingTypes", $allowedListingTypes);
$tp->assign("user_info", $user_info);
$tp->assign("user_group_info", $userGroupInfo);
$tp->assign('userTree', true);
$tp->assign("parent_name", $parent_name);
$tp->assign("restore", preg_match('/manage-(jobseekers)|(employers)|([a-z0-9\\_]-users)/', SJB_Request::getVar('HTTP_REFERER', '', 'SERVER')));
SJB_System::setGlobalTemplateVariable('wikiExtraParam', $userGroupInfo['id']);
$tp->display("edit_user.tpl");
}
}