本文整理汇总了PHP中Registration类的典型用法代码示例。如果您正苦于以下问题:PHP Registration类的具体用法?PHP Registration怎么用?PHP Registration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Registration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$number = $input->getOption('number');
$debug = true;
try {
// Create a instance of Registration class.
$r = new \Registration($number, $debug);
$r->codeRequest('sms');
// could be 'voice' too
} catch (\Exception $e) {
$output->writeln('<error>the number is invalid ' . $number . '</error>');
return false;
}
$helper = $this->getHelper('question');
$question = new Question('Digite seu código de confirmação recebido por SMS (sem hífen "-"): ', false);
$question->setValidator(function ($value) use($output, $r) {
try {
$response = $r->codeRegister($value);
$output->writeln('<fg=green>Your password is: ' . $response->pw . ' and your login: ' . $response->login . '</>');
} catch (\Exception $e) {
$output->writeln("<error>Código inválido, tente novamente mais tarde!</error>");
return false;
}
return true;
});
$codigo = $helper->ask($input, $output, $question);
$output->writeln('<fg=green>Your number is ' . $number . ' and your code: ' . $codigo . '</>');
}
示例2: registration
/**
* To register new user
* Subject for validations (e.g username length)
**/
public function registration()
{
$username = Param::get('username');
$password = Param::get('pword');
$password_match = Param::get('pword_match');
$fname = Param::get('fname');
$lname = Param::get('lname');
$email = Param::get('email');
$registration = new Registration();
$login_info = array('username' => $username, 'user_password' => $password, 'fname' => $fname, 'lname' => $lname, 'email' => $email);
//To check if all keys are null
if (!array_filter($login_info)) {
$status = "";
} else {
try {
foreach ($login_info as $key => $value) {
if (!is_complete($value)) {
throw new ValidationException("Please fill up all fields");
}
}
if (!is_password_match($password, $password_match)) {
throw new ValidationException("Password did not match");
}
$info = $registration->userRegistration($login_info);
$status = notice("Registration Complete");
} catch (ExistingUserException $e) {
$status = notice($e->getMessage(), "error");
} catch (ValidationException $e) {
$status = notice($e->getMessage(), "error");
}
}
$this->set(get_defined_vars());
}
示例3: actionCompetitions
public function actionCompetitions()
{
$model = new Registration();
$model->unsetAttributes();
$model->user_id = $this->user->id;
$this->render('competitions', array('model' => $model));
}
示例4: actionRegister
public function actionRegister()
{
$formModel = new Registration();
//$this->performAjaxValidation($formModel);
if (isset($_POST['Registration'])) {
$formModel->email = $_POST['Registration']['email'];
$formModel->username = $_POST['Registration']['username'];
$formModel->password = $_POST['Registration']['password'];
$formModel->password_repeat = $_POST['Registration']['password_repeat'];
$formModel->verification_code = $_POST['Registration']['verification_code'];
if ($formModel->validate()) {
$model = new User();
if ($model->insert(CassandraUtil::uuid1(), array('email' => $_POST['Registration']['email'], 'username' => $_POST['Registration']['username'], 'password' => User::encryptPassword($_POST['Registration']['password']), 'active' => false, 'blocked' => false)) === true) {
echo 'Model email ' . $formModel->email . ' && username ' . $formModel->username;
if (!User::sendRegisterVerification($formModel->email, $formModel->username)) {
echo 'failed';
} else {
echo 'done';
}
die;
//$this->redirect(array('user/profile'));
}
}
}
$this->render('register', array('model' => $formModel));
}
示例5: saveRegistration
/**
* Save Registration
* @param <type> $array
*/
public static function saveRegistration($array, $lang = null)
{
$r = new Registration();
foreach ($array as $key => $value) {
$field = (string) $key;
$r->{$field} = $value;
}
ZFCore_Utils::log('Add registration: ' . var_export($array, true));
$r->save();
if (is_null($lang)) {
$subject = "Retreat with Chögyal Namkhai Norbu";
$body = "You are registered for the retreat in Merigar East. Thank you for the collaboration. See you in the Gar! \n";
} elseif ($lang == 'ro') {
$subject = "Retragerea de Invataturi Dzogchen cu Chögyal Namkhai Norbu";
$body = "Cererea Dvs. de participare la retragerea din Merigar Est a fost inregistrata.\n Va multumim pentru colaborare.\n Va asteptam cu drag la Gar.\n";
} elseif ($lang == 'ru') {
$subject = "Ретрит с Чгъялом Намкай Норбу";
$body = "Вы зарешгистрированны на ретрит в Восточном Меригаре.\n Спасибо за сотрудничество.\n До встречи в Гаре\n";
}
// to user
$options['from'] = "webmaster@dzogchen.cz";
$options['to'] = $array['email'];
$options['subject'] = $subject;
$options['body'] = $body;
ZFCore_Utils::sendEmail($options);
// to admin
$options['from'] = "webmaster@dzogchen.cz";
$options['to'] = 'martin.kourim@gmail.com';
$options['subject'] = "[RETREAT] new registration";
$options['body'] = 'Add registration: ' . var_export($array, true);
ZFCore_Utils::sendEmail($options);
}
示例6: actionRegistration
public function actionRegistration()
{
$competition = $this->getCompetition();
$user = $this->getUser();
$registration = Registration::getUserRegistration($competition->id, $user->id);
if (!$competition->isPublic() || !$competition->isRegistrationStarted()) {
Yii::app()->user->setFlash('info', Yii::t('Competition', 'The registration is not open yet.'));
$this->redirect($competition->getUrl('competitors'));
}
$showRegistration = $registration !== null && $registration->isAccepted();
if ($competition->isRegistrationEnded() && !$showRegistration) {
Yii::app()->user->setFlash('info', Yii::t('Competition', 'The registration has been closed.'));
$this->redirect($competition->getUrl('competitors'));
}
if ($competition->isRegistrationFull() && !$showRegistration) {
Yii::app()->user->setFlash('info', Yii::t('Competition', 'The limited number of competitor has been reached.'));
$this->redirect($competition->getUrl('competitors'));
}
if ($user->isUnchecked()) {
$this->render('registration403', array('competition' => $competition));
Yii::app()->end();
}
if ($registration !== null) {
$registration->formatEvents();
$this->setWeiboShareDefaultText($competition->getRegistrationDoneWeiboText(), false);
$this->render('registrationDone', array('user' => $user, 'accepted' => $registration->isAccepted(), 'competition' => $competition, 'registration' => $registration));
Yii::app()->end();
}
$model = new Registration();
$model->competition = $competition;
if ($competition->isMultiLocation()) {
$model->location_id = null;
}
if (isset($_POST['Registration'])) {
$model->attributes = $_POST['Registration'];
$model->user_id = $this->user->id;
$model->competition_id = $competition->id;
$model->total_fee = $model->getTotalFee(true);
$model->ip = Yii::app()->request->getUserHostAddress();
$model->date = time();
$model->status = Registration::STATUS_WAITING;
if ($competition->check_person == Competition::NOT_CHECK_PERSON && $competition->online_pay != Competition::ONLINE_PAY) {
$model->status = Registration::STATUS_ACCEPTED;
}
if ($model->save()) {
Yii::app()->mailer->sendRegistrationNotice($model);
$this->setWeiboShareDefaultText($competition->getRegistrationDoneWeiboText(), false);
$model->formatEvents();
$this->render('registrationDone', array('user' => $user, 'accepted' => $model->isAccepted(), 'competition' => $competition, 'registration' => $model));
Yii::app()->end();
}
}
$model->formatEvents();
$this->render('registration', array('competition' => $competition, 'model' => $model));
}
示例7: run
public function run()
{
$form = new RegistrationForm();
if (Yii::app()->request->isPostRequest && !empty($_POST['RegistrationForm'])) {
$module = Yii::app()->getModule('user');
$form->setAttributes($_POST['RegistrationForm']);
// проверка по "черным спискам"
// проверить на email
if (!$module->isAllowedEmail($form->email)) {
// перенаправить на экшн для фиксации невалидных email-адресов
$this->controller->redirect(array(Yii::app()->getModule('user')->invalidEmailAction));
}
if (!$module->isAllowedIp(Yii::app()->request->userHostAddress)) {
// перенаправить на экшн для фиксации невалидных ip-адресов
$this->controller->redirect(array(Yii::app()->getModule('user')->invalidIpAction));
}
if ($form->validate()) {
// если требуется активация по email
if ($module->emailAccountVerification) {
$registration = new Registration();
// скопируем данные формы
$registration->setAttributes($form->getAttributes());
if ($registration->save()) {
// отправка email с просьбой активировать аккаунт
$mailBody = $this->controller->renderPartial('application.modules.user.views.email.needAccountActivationEmail', array('model' => $registration), true);
Yii::app()->mail->send($module->notifyEmailFrom, $registration->email, Yii::t('user', 'Регистрация на сайте {site} !', array('{site}' => Yii::app()->name)), $mailBody);
// запись в лог о создании учетной записи
Yii::log(Yii::t('user', "Создана учетная запись {nick_name}!", array('{nick_name}' => $registration->nick_name)), CLogger::LEVEL_INFO, UserModule::$logCategory);
Yii::app()->user->setFlash(YFlashMessages::NOTICE_MESSAGE, Yii::t('user', 'Учетная запись создана! Инструкции по активации аккаунта отправлены Вам на email!'));
$this->controller->refresh();
} else {
$form->addErrors($registration->getErrors());
Yii::log(Yii::t('user', "Ошибка при создании учетной записи!"), CLogger::LEVEL_ERROR, UserModule::$logCategory);
}
} else {
// если активации не требуется - сразу создаем аккаунт
$user = new User();
$user->createAccount($form->nick_name, $form->email, $form->password);
if ($user && !$user->hasErrors()) {
Yii::log(Yii::t('user', "Создана учетная запись {nick_name} без активации!", array('{nick_name}' => $user->nick_name)), CLogger::LEVEL_INFO, UserModule::$logCategory);
// отправить email с сообщением о успешной регистрации
$emailBody = $this->controller->renderPartial('application.modules.user.views.email.accountCreatedEmail', array('model' => $user), true);
Yii::app()->mail->send($module->notifyEmailFrom, $user->email, Yii::t('user', 'Регистрация на сайте {site} !', array('{site}' => Yii::app()->name)), $emailBody);
Yii::app()->user->setFlash(YFlashMessages::NOTICE_MESSAGE, Yii::t('user', 'Учетная запись создана! Пожалуйста, авторизуйтесь!'));
$this->controller->redirect(array('/user/account/login/'));
} else {
$form->addErrors($user->getErrors());
Yii::log(Yii::t('user', "Ошибка при создании учетной записи без активации!"), CLogger::LEVEL_ERROR, UserModule::$logCategory);
}
}
}
}
$this->controller->render('registration', array('model' => $form));
}
示例8: prepareForSale
public static function prepareForSale(Vehicle $vehicle)
{
$registration = new Registration($vehicle);
$registration->allocateVehicleNumber();
$registration->allocateLicensePlate();
Documentation::printBrochure($vehicle);
$vehicle->cleanInterior();
$vehicle->cleanExteriorBody();
$vehicle->polishWindows();
$vehicle->takeForTestDrive();
return 'Vehicle prepared for sale';
}
示例9: resetpassword
function resetpassword()
{
$userId = Users::getUserIdByCode($_POST["txtCode"]);
if ($userId != -1) {
$date = Users::getCodeDate($_POST["txtCode"]);
$date = strtotime($date) + 600;
if (strtotime(date("Y-m-d H:i:s")) <= $date) {
if ($_POST["txtPassword"] == $_POST["txtPasswordConfirm"]) {
$salt = Registration::generateSalt();
$crypt = crypt($_POST["txtPassword"], $salt);
Users::updatePassword($userId, $crypt, $salt);
Users::deleteCode($userId);
header(CONNECTION_HEADER);
}
} else {
Users::deleteCode($userId);
$data = array("Forgot" => true);
$this->renderTemplate(file_get_contents(RESET_PAGE), $data);
}
} else {
Users::deleteCode($userId);
$data = array("Forgot" => true);
$this->renderTemplate(file_get_contents(RESET_PAGE), $data);
}
}
示例10: index
public function index()
{
$friday = Registration::where(DB::raw('DAYOFWEEK(registrations.created_at)'), '=', 6)->sum('tickets');
$saturday = Registration::where(DB::raw('DAYOFWEEK(registrations.created_at)'), '=', 7)->sum('tickets');
$this->layout->with('subtitle', '');
$this->layout->content = View::make('home')->with('friday_registration_count', $friday)->with('saturday_registration_count', $saturday);
}
示例11: RegisterUser
public static function RegisterUser($regData)
{
global $db;
$info = ['emptyData' => false, 'emailUse' => false, 'userUse' => false, 'falseEmail' => false, 'pwNotMatch' => false, 'success' => false];
if (empty($regData['username']) || empty($regData['email']) || empty($regData['password'])) {
$info['emptyData'] = true;
} else {
if ($regData['password'] != $regData['password2']) {
$info['pwNotMatch'] = true;
} else {
if (!Main::ValidEmail($regData['email'])) {
$info['falseEmail'] = true;
} else {
$regData['username'] = $db->SafeString($regData['username']);
$regData['email'] = $db->SafeString($regData['email']);
$regData['password'] = $db->SafeString($regData['password']);
$mailCheck = Registration::CheckEmail($regData['email']);
$userCheck = Registration::CheckUsername($regData['username']);
if (!$mailCheck && !$userCheck) {
$password = Main::HyperHash($regData['password']);
$q = "INSERT INTO `" . $db->prefix . "users` (`hbbid`, `name`, `password`, `email`, `member_group`, `register_date`, `salt`) VALUES\r\n\t\t\t\t\t('" . userHash($regData['username'], $regData['email']) . "', '" . $regData['username'] . "',\r\n\t\t\t\t\t'" . $password['password'] . "', '" . $regData['email'] . "', '3', '" . time() . "', '" . $password['salt'] . "')";
$db->Query($q);
$info['success'] = true;
} else {
if ($mailCheck) {
$info['emailUse'] = true;
} else {
$info['userUse'] = true;
}
}
}
}
}
return $info;
}
示例12: updateContact
function updateContact()
{
if (isset($_POST["contactId"])) {
$phone = Registration::normalizePhoneNumber($_POST["phone"]);
Loans::updateContact($_POST["contactId"], $_POST["name"], $_POST["mail"], $phone);
}
}
示例13: index
/**
* Displays a tabular list of registrations.
*/
public function index()
{
$this->layout->with('subtitle', 'Registrations');
$registrations = Registration::orderBy('registrations.created_at', 'desc')->join('bookings', 'registrations.booking_id', '=', 'bookings.id', 'left outer')->addSelect('registrations.*')->addSelect('bookings.first')->addSelect('bookings.last')->addSelect('bookings.email');
$filtered = false;
$filter_name = Session::get('registrations_filter_name', '');
$filter_email = Session::get('registrations_filter_email', '');
$filter_friday = Session::get('registrations_filter_friday', '');
$filter_saturday = Session::get('registrations_filter_saturday', '');
if (!empty($filter_name)) {
$registrations = $registrations->where(function ($query) use($filter_name) {
$query->where('bookings.first', 'LIKE', "%{$filter_name}%")->orWhere('bookings.last', 'LIKE', "%{$filter_name}%")->orWhere('registrations.name', 'LIKE', "%{$filter_name}%");
});
$filtered = true;
}
if (!empty($filter_email)) {
$registrations = $registrations->where(function ($query) use($filter_email) {
$query->where('bookings.email', 'LIKE', "%{$filter_email}%")->orWhere('registrations.email_address', 'LIKE', "%{$filter_email}%");
});
$filtered = true;
}
if (!empty($filter_friday)) {
$registrations = $registrations->where(DB::raw('DAYOFWEEK(registrations.created_at)'), '=', 6);
$filtered = true;
}
if (!empty($filter_saturday)) {
$registrations = $registrations->where(DB::raw('DAYOFWEEK(registrations.created_at)'), '=', 7);
$filtered = true;
}
$registrations = $registrations->paginate(25);
$this->layout->content = View::make('registrations.index')->with('registrations', $registrations)->with('filtered', $filtered)->with('filter_name', $filter_name)->with('filter_email', $filter_email)->with('filter_friday', $filter_friday)->with('filter_saturday', $filter_saturday);
}
示例14: registerNumberAction
/** REGISTER NUMBER ***/
public function registerNumberAction()
{
$request = $this->getRequest();
$debug = true;
$result = false;
$username = null;
$nickname = null;
if ($request->isPost()) {
$data = $request->getPost();
$username = $data['number'];
// Telephone number including the country code without '+' or '00'.
$nickname = $data['nickname'];
$register = new \Registration($username, $debug);
$result = $register->codeRequest('sms');
}
return new ViewModel(array('result' => $result, 'username' => $username, 'nickname' => $nickname));
}
示例15: getInstance
public static function getInstance()
{
if (self::$instance === null)
{
self::$instance = new Registration();
}
return self::$instance;
}