本文整理汇总了PHP中Ubirimi\Util::checkEmailAddressExistenceWithinClient方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::checkEmailAddressExistenceWithinClient方法的具体用法?PHP Util::checkEmailAddressExistenceWithinClient怎么用?PHP Util::checkEmailAddressExistenceWithinClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ubirimi\Util
的用法示例。
在下文中一共展示了Util::checkEmailAddressExistenceWithinClient方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
Util::checkUserIsLoggedInAndRedirect();
$errors = array();
$userId = $request->request->get('id');
$issuesPerPage = $request->request->get('issues_per_page');
$notifyOwnChangesFlag = $request->request->get('notify_own_changes');
$countryId = $request->request->get('country_id');
$emailAddress = $request->request->get('email_address');
if (empty($emailAddress)) {
$errors['empty_email'] = true;
} else {
if (!Util::isValidEmail($emailAddress)) {
$errors['email_not_valid'] = true;
}
}
$emailData = Util::checkEmailAddressExistenceWithinClient(mb_strtolower($emailAddress), $userId, $session->get('client/id'));
if ($emailData) {
$errors['email_already_exists'] = true;
}
if (0 == count($errors)) {
$parameters = array(array('field' => 'issues_per_page', 'value' => $issuesPerPage, 'type' => 'i'), array('field' => 'notify_own_changes_flag', 'value' => $notifyOwnChangesFlag, 'type' => 'i'), array('field' => 'country_id', 'value' => $countryId, 'type' => 'i'), array('field' => 'email', 'value' => $emailAddress, 'type' => 's'));
$this->getRepository(UbirimiUser::class)->updatePreferences($userId, $parameters);
$session->set('user/issues_per_page', $issuesPerPage);
}
return new JsonResponse($errors);
}
示例2: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
Util::checkUserIsLoggedInAndRedirect();
$session->set('selected_product_id', -1);
$userId = $request->get('id');
$location = $request->get('location', 'user_list');
if ($userId) {
$user = $this->getRepository(UbirimiUser::class)->getById($userId);
if ($user['client_id'] != $session->get('client/id')) {
return new RedirectResponse('/general-settings/bad-link-access-denied');
}
}
$email = $user['email'];
$firstName = $user['first_name'];
$lastName = $user['last_name'];
$username = $user['username'];
$errors = array('empty_email' => false, 'email_not_valid' => false, 'empty_username' => false, 'invalid_username' => false, 'duplicate_username' => false, 'empty_first_name' => false, 'empty_last_name' => false, 'email_already_exists' => false, 'at_least_one_administrator' => false);
if ($request->request->has('confirm_update_user')) {
$userId = Util::cleanRegularInputField($request->request->get('user_id'));
$email = Util::cleanRegularInputField($request->request->get('email'));
$firstName = Util::cleanRegularInputField($request->request->get('first_name'));
$lastName = Util::cleanRegularInputField($request->request->get('last_name'));
$username = Util::cleanRegularInputField($request->request->get('username'));
$clientAdministrators = $this->getRepository(UbirimiClient::class)->getAdministrators($session->get('client/id'), $userId);
$clientAdministratorFlag = 0;
if ($request->request->has('client_administrator_flag')) {
$clientAdministratorFlag = Util::cleanRegularInputField($request->request->get('client_administrator_flag'));
}
$customerServiceDeskFlag = 0;
if ($request->request->has('customer_service_desk_flag')) {
$customerServiceDeskFlag = Util::cleanRegularInputField($request->request->get('customer_service_desk_flag'));
}
if (!$clientAdministrators && $clientAdministratorFlag == 0) {
$errors['at_least_one_administrator'] = true;
} else {
if ($clientAdministratorFlag == 0 && $clientAdministrators && $clientAdministrators->num_rows == 0) {
$errors['at_least_one_administrator'] = true;
}
}
if (empty($email)) {
$errors['empty_email'] = true;
} else {
if (!Util::isValidEmail($email)) {
$errors['email_not_valid'] = true;
}
}
$emailData = Util::checkEmailAddressExistenceWithinClient(mb_strtolower($email), $userId, $session->get('client/id'));
if ($emailData) {
$errors['email_already_exists'] = true;
}
if (empty($firstName)) {
$errors['empty_first_name'] = true;
}
if (empty($lastName)) {
$errors['empty_last_name'] = true;
}
if (empty($username)) {
$errors['empty_username'] = true;
}
if (!Util::validateUsername($username)) {
$errors['invalid_username'] = true;
} else {
$existingUser = $this->getRepository(UbirimiUser::class)->getByUsernameAndClientId($username, $session->get('client/id'), null, $userId);
if ($existingUser) {
$errors['duplicate_username'] = true;
}
}
if (Util::hasNoErrors($errors)) {
$currentDate = Util::getServerCurrentDateTime();
$this->getRepository(UbirimiUser::class)->updateById($userId, $firstName, $lastName, $email, $username, null, $clientAdministratorFlag, $customerServiceDeskFlag, $currentDate);
$userUpdated = $this->getRepository(UbirimiUser::class)->getById($userId);
$this->getLogger()->addInfo('UPDATE User ' . $userUpdated['username'], $this->getLoggerContext());
if ($location == 'user_list') {
return new RedirectResponse('/general-settings/users');
}
return new RedirectResponse('/user/profile/' . $userId);
}
}
$sectionPageTitle = $session->get('client/settings/title_name') . ' / GeneralSettings Settings / Update User';
$menuSelectedCategory = 'general_user';
return $this->render(__DIR__ . '/../../Resources/views/user/Edit.php', get_defined_vars());
}