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


PHP Util::hasNoErrors方法代码示例

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


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

示例1: indexAction

 public function indexAction(Request $request, SessionInterface $session)
 {
     Util::checkUserIsLoggedInAndRedirect();
     $menuSelectedCategory = 'svn';
     $userId = $request->query->get('id', $request->request->get('id'));
     $repoId = $request->query->get('repo_id', $request->request->get('repo_id'));
     $user = $this->getRepository(UbirimiUser::class)->getById($userId);
     $svnRepo = $this->getRepository(SvnRepository::class)->getById($repoId);
     $errors = array('empty_password' => false, 'password_mismatch' => false);
     if ($request->request->has('password') || $request->request->has('password_again')) {
         $password = Util::cleanRegularInputField($request->request->get('password'));
         $passwordAgain = Util::cleanRegularInputField($request->request->get('password_again'));
         if (empty($password)) {
             $errors['empty_password'] = true;
         }
         if ($password != $passwordAgain) {
             $errors['password_mismatch'] = true;
         }
         if (Util::hasNoErrors($errors)) {
             $this->getRepository(SvnRepository::class)->updateUserPassword($session->get('selected_svn_repo_id'), $userId, $password);
             $this->getRepository(SvnRepository::class)->updateHtpasswd($session->get('selected_svn_repo_id'), $session->get('client/company_domain'));
             $this->getRepository(SvnRepository::class)->updateAuthz();
             $svnEvent = new SvnHostingEvent($svnRepo['name'], $user, array('password' => $password));
             $this->getLogger()->addInfo(sprintf('SVN Change Password for [%s]', $svnRepo['name']), $this->getLoggerContext());
             UbirimiContainer::get()['dispatcher']->dispatch(SvnHostingEvents::PASSWORD_UPDATE, $svnEvent);
             return new Response('1');
         }
     }
     $menuSelectedCategory = 'svn';
     return $this->render(__DIR__ . '/../Resources/views/ChangePassword.php', get_defined_vars());
 }
开发者ID:spiasecki,项目名称:ubirimi,代码行数:31,代码来源:ChangePasswordController.php

示例2: indexAction

 public function indexAction(Request $request, SessionInterface $session)
 {
     $httpHOST = Util::getHttpHost();
     $clientId = $this->getRepository(UbirimiClient::class)->getByBaseURL($httpHOST, 'array', 'id');
     $client = $this->getRepository(UbirimiClient::class)->getById($clientId);
     $clientSettings = $this->getRepository(UbirimiClient::class)->getSettings($clientId);
     $errors = array('empty_email' => false, 'email_not_valid' => false, 'empty_first_name' => false, 'empty_last_name' => false, 'email_already_exists' => false, 'empty_password' => false, 'password_mismatch' => false);
     if ($request->request->has('create_account')) {
         $email = Util::cleanRegularInputField($request->request->get('email_address'));
         $firstName = Util::cleanRegularInputField($request->request->get('first_name'));
         $lastName = Util::cleanRegularInputField($request->request->get('last_name'));
         $password = Util::cleanRegularInputField($request->request->get('password'));
         $passwordAgain = Util::cleanRegularInputField($request->request->get('password_repeat'));
         if (empty($email)) {
             $errors['empty_email'] = true;
         } else {
             if (!Util::isValidEmail($email)) {
                 $errors['email_not_valid'] = true;
             }
         }
         $emailData = $this->getRepository(UbirimiUser::class)->getUserByClientIdAndEmailAddress($clientId, mb_strtolower($email));
         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($password)) {
             $errors['empty_password'] = true;
         }
         if ($password != $passwordAgain) {
             $errors['password_mismatch'] = true;
         }
         if (Util::hasNoErrors($errors)) {
             $userId = UbirimiContainer::get()['user']->newUser(array('clientId' => $clientId, 'firstName' => $firstName, 'lastName' => $lastName, 'email' => $email, 'isCustomer' => true, 'password' => $password));
             return new RedirectResponse('/helpdesk/customer-portal');
         }
     }
     return $this->render(__DIR__ . '/../../Resources/views/customer_portal/SignUp.php', get_defined_vars());
 }
开发者ID:spiasecki,项目名称:ubirimi,代码行数:43,代码来源:SignUpController.php

示例3: indexAction

 public function indexAction(Request $request, SessionInterface $session)
 {
     Util::checkUserIsLoggedInAndRedirect();
     $clientDomain = $session->get('client/company_domain');
     $organizationId = $request->query->get('id');
     $errors = array('empty_email' => false, 'email_not_valid' => false, 'email_already_exists' => false);
     $organizations = $this->getRepository(Organization::class)->getByClientId($session->get('client/id'));
     if ($request->request->has('confirm_new_customer')) {
         $email = Util::cleanRegularInputField($request->request->get('email'));
         $firstName = Util::cleanRegularInputField($request->request->get('first_name'));
         $lastName = Util::cleanRegularInputField($request->request->get('last_name'));
         if (empty($email)) {
             $errors['empty_email'] = true;
         } else {
             if (!Util::isValidEmail($email)) {
                 $errors['email_not_valid'] = true;
             }
         }
         $emailData = $this->getRepository(UbirimiUser::class)->getUserByClientIdAndEmailAddress($session->get('client/id'), mb_strtolower($email));
         if ($emailData) {
             $errors['email_already_exists'] = true;
         }
         if (Util::hasNoErrors($errors)) {
             $password = Util::randomPassword(8);
             $userId = UbirimiContainer::get()['user']->newUser(array('clientId' => $session->get('client/id'), 'firstName' => $firstName, 'lastName' => $lastName, 'password' => $password, 'email' => $email, 'isCustomer' => true, 'clientDomain' => $session->get('client/company_domain')));
             if ($organizationId) {
                 $this->getRepository(Customer::class)->create($organizationId, $userId);
                 return new RedirectResponse('/helpdesk/administration/customers?id=' . $organizationId);
             }
             return new RedirectResponse('/helpdesk/administration/customers');
         }
     }
     $menuSelectedCategory = 'general_user';
     $sectionPageTitle = $session->get('client/settings/title_name') . ' / GeneralSettings Settings / Create User';
     return $this->render(__DIR__ . '/../../../Resources/views/administration/customer/Add.php', get_defined_vars());
 }
开发者ID:spiasecki,项目名称:ubirimi,代码行数:36,代码来源:AddController.php

示例4: 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());
 }
开发者ID:spiasecki,项目名称:ubirimi,代码行数:82,代码来源:EditController.php

示例5: indexAction

 public function indexAction(Request $request, SessionInterface $session)
 {
     Util::checkUserIsLoggedInAndRedirect();
     $session->set('selected_product_id', -1);
     $clientDomain = $session->get('client/company_domain');
     $groupDevelopers = $this->getRepository(UbirimiGroup::class)->getByName($session->get('client/id'), 'Developers');
     $errors = array('empty_email' => false, 'email_not_valid' => false, 'empty_first_name' => false, 'empty_last_name' => false, 'email_already_exists' => false, 'empty_username' => false, 'empty_password' => false, 'password_mismatch' => false, 'invalid_username' => false, 'duplicate_username' => false);
     $svnRepoId = $request->query->get('fsvn');
     if ($svnRepoId) {
         $svnRepo = $this->getRepository(SvnRepository::class)->getById($svnRepoId);
         if ($svnRepo['client_id'] != $session->get('client/id')) {
             return new RedirectResponse('/general-settings/bad-link-access-denied');
         }
     }
     if ($request->request->has('confirm_new_user')) {
         $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'));
         $password = Util::cleanRegularInputField($request->request->get('password'));
         $passwordAgain = Util::cleanRegularInputField($request->request->get('password_again'));
         $svnRepoId = Util::cleanRegularInputField($request->request->get('fsvn'));
         if (empty($email)) {
             $errors['empty_email'] = true;
         } else {
             if (!Util::isValidEmail($email)) {
                 $errors['email_not_valid'] = true;
             }
         }
         if (!Util::validateUsername($username)) {
             $errors['invalid_username'] = true;
         } else {
             $existingUser = $this->getRepository(UbirimiUser::class)->getByUsernameAndClientId($username, $session->get('client/id'));
             if ($existingUser) {
                 $errors['duplicate_username'] = true;
             }
         }
         $emailData = $this->getRepository(UbirimiUser::class)->getUserByClientIdAndEmailAddress($session->get('client/id'), mb_strtolower($email));
         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 (empty($password)) {
             $errors['empty_password'] = true;
         }
         if ($password != $passwordAgain) {
             $errors['password_mismatch'] = true;
         }
         if (Util::hasNoErrors($errors)) {
             $serviceData = array('clientId' => $session->get('client/id'), 'firstName' => $firstName, 'lastName' => $lastName, 'email' => $email, 'username' => $username, 'password' => $password, 'clientDomain' => $session->get('client/company_domain'));
             if ($svnRepoId) {
                 $serviceData['svnRepoId'] = $svnRepoId;
                 $serviceData['repositoryName'] = $svnRepo['name'];
             }
             UbirimiContainer::get()['user']->newUser($serviceData);
             if (!empty($svnRepoId)) {
                 return new RedirectResponse('/svn-hosting/administration/repository/users/' . $svnRepoId);
             }
             return new RedirectResponse('/general-settings/users');
         }
     }
     $menuSelectedCategory = 'general_user';
     $sectionPageTitle = $session->get('client/settings/title_name') . ' / GeneralSettings Settings / Create User';
     return $this->render(__DIR__ . '/../../Resources/views/user/Add.php', get_defined_vars());
 }
开发者ID:spiasecki,项目名称:ubirimi,代码行数:73,代码来源:AddController.php

示例6: indexAction

 public function indexAction(Request $request, SessionInterface $session)
 {
     $session->remove('user_account_created');
     $httpHOST = Util::getHttpHost();
     $clientDomain = Util::getSubdomain();
     $clientId = $this->getRepository(UbirimiClient::class)->getByBaseURL($httpHOST, 'array', 'id');
     $client = $this->getRepository(UbirimiClient::class)->getById($clientId);
     $clientSettings = $this->getRepository(UbirimiClient::class)->getSettings($clientId);
     $countries = Util::getCountries();
     $errors = array('empty_email' => false, 'email_not_valid' => false, 'empty_first_name' => false, 'empty_last_name' => false, 'email_already_exists' => false, 'empty_username' => false, 'empty_password' => false, 'password_mismatch' => false, 'duplicate_username' => false, 'invalid_username' => false);
     if ($request->request->has('cancel')) {
         return new RedirectResponse('/');
     } else {
         if ($request->request->has('create-user-account')) {
             $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'));
             $password = Util::cleanRegularInputField($request->request->get('password'));
             $passwordAgain = Util::cleanRegularInputField($request->request->get('password_again'));
             $countryId = $request->request->get('country');
             if (empty($email)) {
                 $errors['empty_email'] = true;
             } else {
                 if (!Util::isValidEmail($email)) {
                     $errors['email_not_valid'] = true;
                 }
             }
             $emailData = $this->getRepository(UbirimiUser::class)->getUserByClientIdAndEmailAddress($clientId, mb_strtolower($email));
             if (!Util::validateUsername($username)) {
                 $errors['invalid_username'] = true;
             } else {
                 $userData = $this->getRepository(UbirimiUser::class)->getByUsernameAndClientId($username, $clientId);
                 if ($userData) {
                     $errors['duplicate_username'] = true;
                 }
             }
             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 (empty($password)) {
                 $errors['empty_password'] = true;
             }
             if ($password != $passwordAgain) {
                 $errors['password_mismatch'] = true;
             }
             if (Util::hasNoErrors($errors)) {
                 $userId = UbirimiContainer::get()['user']->newUser(array('clientId' => $clientId, 'firstName' => $firstName, 'lastName' => $lastName, 'email' => $email, 'username' => $username, 'password' => $password, 'clientDomain' => $client['company_domain'], 'country' => $countryId));
                 $session->set('user_account_created', true);
                 $email = $firstName = $lastName = $username = $password = $passwordAgain = $email = null;
             }
         }
     }
     $content = 'Signup.php';
     return $this->render(__DIR__ . '/../Resources/views/_main.php', get_defined_vars());
 }
开发者ID:spiasecki,项目名称:ubirimi,代码行数:65,代码来源:SignupController.php


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