本文整理匯總了PHP中models\User::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::get方法的具體用法?PHP User::get怎麽用?PHP User::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models\User
的用法示例。
在下文中一共展示了User::get方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: changePasswordSucceded
/**
* Processing of change user password form
*
* @param \Nette\Application\UI\Form $form
*
* @Privilege("default")
*/
public function changePasswordSucceded(\Nette\Application\UI\Form $form)
{
$values = $form->getValues(TRUE);
$row = $this->users->get($this->user->id);
if (!\Nette\Security\Passwords::verify($values['oldpassword'], $row->password)) {
$form->addError('Nesprávné heslo.');
} else {
$this->users->updatePassword($row->id, $values['password']);
$this->flashMessage('Heslo bylo změněno');
}
$this->redirect('this');
}
示例2: comment
public function comment($section, $newsId)
{
$comment = Input::get('comment');
$user = User::get();
Comment::Insert(array('newsId' => $newsId, 'userId' => $user->id, 'comment' => $comment));
Response::redirect('/' . $section . '/' . $newsId);
}
示例3: seedImage
public function seedImage(User $user)
{
$file = $this->faker->imageUrl(600, 400, 'people');
Debugger::debug($file, 'image url');
$image = new Image($file);
Debugger::debug($image, 'image class');
$filename = md5($file . $user->get('id')) . '.jpg';
$imageDir = 'assets/images/profile-pics/original/';
$imageDir .= substr($filename, 0, 1) . '/';
$imageDir .= substr($filename, 1, 1) . '/';
$imageDir .= substr($filename, 2, 1) . '/';
if (!is_dir(PUBLIC_ROOT . $imageDir)) {
mkdir(PUBLIC_ROOT . $imageDir, 0777, true);
}
$saveName = PUBLIC_ROOT . $imageDir . $filename;
Debugger::debug($saveName, 'save name');
$image->save($imageDir . $filename);
$thumbnail = $this->seedThumbnail($image, $imageDir, $user);
// update the database
$userImage = new UserImage();
$userImage->set('user_id', $user->get('id'));
$userImage->set('image_url', '/' . $imageDir . $filename);
$userImage->set('thumbnail', '/' . $thumbnail);
$userImage->set('main_image', 1);
$userImage->save();
}
示例4: seedEmail
public function seedEmail(User $user)
{
Debugger::debug('Seeding email');
$userEmail = new Email();
$userEmail->set('user_id', $user->get('id'));
$userEmail->set('email', $this->faker->freeEmail);
$userEmail->set('primary', 1);
$userEmail->save();
}
示例5: signup
public function signup($slug = null)
{
$this->data['title'] = 'Join Us';
// $module_slug = $slug[0];
$role = new \models\userrole();
$user = new User();
$this->data['user_role'] = $role->all();
//PULL DATA FROM SITESETTINGS
$document = new \Helpers\Document();
$details = $document->siteSettings();
//GET NEW USER STATUS ID
$this->model->table('user_status');
$user_status = $this->model->get_row(array("title" => "inactive"));
$this->data['reg_form'] = $details['reg_form'];
if (isset($_POST) && !empty($_POST)) {
if ($_POST['password'] == $_POST['password2']) {
$encrypted = md5($_POST['password']);
$row_count = $user->get(array("email" => $_POST['email']));
if (count($row_count) >= 1) {
$this->data['error'] = 'Email exists in our records, please use a different email';
} else {
$insert_array = array('firstname' => $_POST['fname'], 'lastname' => $_POST['lname'], 'email' => $_POST['email'], 'password' => $encrypted, 'role' => $_POST['role'], 'status' => $user_status->id);
$hash = $user->register($insert_array);
if ($hash != '') {
//SEND ACCOUNT DETAILS TO USER
$fullname = $_POST['fname'] . ' ' . $_POST['lname'];
$subject = 'New Account';
$mail = new \helpers\phpmailer\mail();
$mail->template('welcome');
$mail->generalEmail($_POST['email'], $subject, $fullname, $hash);
$this->data['success'] = 'A link has been sent to your email, please click to activate your account';
} else {
$this->data['error'] = 'Operation Fails, Please contact admin';
}
}
} else {
$this->data['error'] = 'Password does not match!';
}
}
View::rendertemplate('header', $this->data);
View::render('account/signup', $this->data);
View::rendertemplate('footer', $this->data);
}
示例6: password
public function password()
{
$this->data['title'] = 'Change Password';
$userModel = new User();
$user_id = Session::get('user')->user_id;
$user_details = $userModel->get(array('user_id' => $user_id, 'user_password' => md5($_POST['old_password'])));
if (isset($_POST['password1']) && !empty($_POST['password1'])) {
if (count($user_details) > 0) {
if ($_POST['password1'] == $_POST['password2']) {
//update user db
$update_array = array('user_password' => md5($_POST['password1']));
$update_array = Gump::xss_clean($update_array);
$update_array = Gump::sanitize($update_array);
$update_id = $user_model->updateId($update_array, $user_id);
if ($update_id > 0) {
Session::set('success', 'Password Changed');
} else {
Session::set('error', 'Operation Fails!');
}
} else {
Session::set('error', 'Incorrect match, password change fails!');
}
} else {
Session::set('error', 'Incorrect match, password change fails!');
}
}
View::rendertemplate('header', $this->data);
View::render('workspace/workspace.password', $this->data);
View::rendertemplate('footer', $this->data);
}
示例7: base
public function base($template, $data = array())
{
return View::build($template, array_merge($data, array('user' => User::get())));
}
示例8: createSecret
public static function createSecret(User $user)
{
$keystring = $user->get('username') . $user->get('created_ts') . self::$salt;
return self::encode($keystring);
}