本文整理汇总了PHP中UserModel::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP UserModel::getUser方法的具体用法?PHP UserModel::getUser怎么用?PHP UserModel::getUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserModel
的用法示例。
在下文中一共展示了UserModel::getUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: publishAction
/**
* 发表评论
* curl -d "course_id=1&comment_id=1&video_id=0&content=helloaaaaaaaaaa" http://182.92.110.119/comment/publish
*/
function publishAction()
{
$courseId = (int) $this->post("course_id", 0);
$commentId = (int) $this->post("comment_id", 0);
$videoId = (int) $this->post("video_id", 0);
$content = $this->post("content", "");
$time = time();
$comment = array("uid" => $this->uid, "comment_id" => $commentId, "course_id" => $courseId, "video_id" => $videoId, "content" => $content, "create_time" => $time);
$commentModel = new CommentModel();
$id = $commentModel->insertComment($comment);
if ($id) {
$userModel = new UserModel();
$videoModel = new VideoModel();
$courseModel = new CourseModel();
$author = $userModel->getUser($comment['uid']);
$comment['create_time_fmt'] = Common_Time::flow($comment['create_time']);
$comment['author_uid'] = $author['stuff_id'];
$comment['author_name'] = $author['stuff_name'];
$comment['author_avator'] = $author['avator'];
if ($comment['comment_id']) {
$parentComment = $commentModel->getComment($comment['comment_id']);
$beReplyAuthor = $userModel->getUser($parentComment['uid']);
$parentComment['author_uid'] = $beReplyAuthor['stuff_id'];
$parentComment['author_name'] = $beReplyAuthor['stuff_name'];
$parentComment['author_avator'] = $beReplyAuthor['avator'];
$parentComment['create_time_fmt'] = Common_Time::flow($parentComment['create_time']);
$comment['parent_comment'] = $parentComment;
}
if ($comment['video_id']) {
$section = $videoModel->getVideoBelongSection($comment['video_id']);
if (!$section) {
$practiseModel = new PractiseModel();
$practise = $practiseModel->getVideoBelongPractise($comment['video_id'], $courseId);
$comment['practise_seq'] = $practise['seq'];
$section = $courseModel->getSection($practise['section_id']);
}
$chapter = $courseModel->getSection($section["parent_id"]);
$comment["chapter_id"] = $chapter["id"];
$comment["chapter_name"] = $chapter["name"];
$comment["chapter_seq"] = $chapter["seq"];
$comment["section_id"] = $section["id"];
$comment["section_name"] = $section["name"];
$comment["section_seq"] = $section["seq"];
$userVideo = $videoModel->getUserVideoVote($comment['uid'], $comment['video_id']);
$comment["video_like"] = isset($userVideo['like_type']) ? $userVideo['like_type'] : 0;
}
$this->displayJson(Common_Error::ERROR_SUCCESS, array($comment));
}
$this->displayJson(Common_Error::ERROR_MYSQL_EXECUTE);
}
示例2: ActionProfile
public static function ActionProfile()
{
$user = UserModel::getUser(UserModel::getUserId());
if (UserModel::isUserLoggedIn()) {
$variables = ['template' => 'profile.php', 'links' => ['profile.css'], 'scripts' => ['fileUploader.js'], 'themes' => AdminModel::getThemes(), 'profile' => ['id' => UserModel::getUserId(), 'email' => $user['email'], 'about' => $user['about']]];
$variables = array_replace_recursive(PageController::getMainVariables(), $variables);
Template::render('template.php', $variables);
} else {
header("Location: " . $_SERVER['HTTP_REFERER']);
}
}
示例3: userControl
public function userControl()
{
$userModel = new UserModel($this->_db);
$userId = $userModel->getActiveUserId();
if ($userId) {
$user = $userModel->getUser($userId);
return $user;
} else {
header('location: login.php');
}
}
示例4: header
/**
* 加载头部
* @return [type] [description]
*/
private function header()
{
// 头部样式
$strStyle = "<link href='Public/style/base.css' rel='stylesheet'>";
$strStyle .= "<link href='Public/style/media.css' rel='stylesheet'>";
// 首页面样式
if (empty($_REQUEST['a'])) {
$strStyle .= "<link href='Public/style/index.css' rel='stylesheet'>";
}
// 关于我页面样式
if (isset($_REQUEST['a']) && $_REQUEST['a'] == 'about') {
$strStyle .= "<link href='Public/style/about.css' rel='stylesheet'>";
}
// 慢生活
if (isset($_REQUEST['a']) && $_REQUEST['a'] == 'newlist') {
$strStyle .= "<link href='Public/style/style.css' rel='stylesheet'>";
}
// 模版分享
if (isset($_REQUEST['a']) && $_REQUEST['a'] == 'share') {
$strStyle .= "<link href='Public/style/style.css' rel='stylesheet'>";
}
// 模版分享
if (isset($_REQUEST['a']) && $_REQUEST['a'] == 'show') {
$strStyle .= "<link href='Public/style/style.css' rel='stylesheet'>";
}
// 留言
if (isset($_REQUEST['a']) && $_REQUEST['a'] == 'message') {
$strStyle .= "<link href='Public/style/about.css' rel='stylesheet'>";
}
$this->view->assgin('style', $strStyle);
$init = new InitModel();
$inits = $init->getOne();
$this->view->assgin('title', $inits['i_name']);
$this->view->assgin('WebName', $inits['i_name']);
$this->view->assgin('WebIntro', $inits['i_intro']);
// 头像文件
$abouts = new UserModel();
$contente = $abouts->getUser();
$this->view->assgin('head_image', $contente['u_head_image']);
$this->view->display('temp/header.html');
// 内容样式
$this->view->assgin('rolling_text', $inits['i_rolling_text']);
}
示例5: loginAction
public function loginAction(Request $request)
{
if (Session::has('user')) {
header('Location: /index.php');
}
$form = new LoginForm($request);
if ($request->isPost()) {
if ($form->isValid()) {
$password = new Password($form->password);
$model = new UserModel();
try {
$user = $model->getUser($form->username, $password);
Session::set('user', $user);
header('Location: /');
} catch (Exception $e) {
Session::setFlash($e->getMessage());
}
} else {
Session::setFlash('Fill the fields');
}
}
$args = array('form' => $form);
return $this->render('login', $args);
}
示例6: message
/**
* 留言
*/
public function message()
{
// 头部样式
$this->header();
//实例化操作留言表的model
$message = new MessageModel();
//使用getMessage方法获取留言表中的所有记录
$lists = $message->getMessage();
// 内容样式
include_once VIEW_DIR . '/temp/message.html';
// 右边样式
$abouts = new UserModel();
$contente = $abouts->getUser();
$this->view->assgin('autograph', $contente['u_autograph']);
$this->view->assgin('name', $contente['u_name']);
$this->view->assgin('profession', $contente['u_profession']);
$this->view->assgin('native', $contente['u_native']);
$this->view->assgin('phone', $contente['u_phone']);
$this->view->assgin('email', $contente['u_email']);
$this->view->display('temp/about2.html');
}
示例7: isset
<?php
$session = System::getSession();
if ($session->isConnected()) {
include_once APPS_DIR . 'user' . DS . 'model.php';
$userModel = new UserModel();
$user = $userModel->getUser($_SESSION['userid']);
}
?>
<div class="app-contact">
<h2>Contact</h2>
<div class="form">
<form method="post" action="<?php
echo Config::get('config.base');
?>
/contact/contactconfirm">
<div>
<label for="subject">Sujet <span class="required">*</span></label> <input type="text" name="subject" id="subject" required />
<p id="errorS">Votre sujet doit contenir entre 2 et 200 lettres! </p>
<label for="message">Message <span class="required">*</span></label> <textarea name="message" id="message" required ></textarea>
<p id="errorM">Votre message doit contenir entre 2 et 5000 lettres! </p>
<label for="lastname">Nom <span class="required">*</span></label> <input type="text" name="lastname" id="lastname" value="<?php
echo isset($user) ? $user['lastname'] : '';
?>
" required />
<p id="errorL">Votre nom doit contenir entre 1 et 40 lettres! </p>
<label for="firstname">Prénom <span class="required">*</span></label> <input type="text" name="firstname" id="firstname" value="<?php
echo isset($user) ? $user['firstname'] : '';
?>
" required />
示例8: LikeModel
include_once '../model/diary_model.php';
include_once '../model/user_model.php';
include_once '../model/notify_model.php';
include_once '../model/friend_model.php';
include_once '../model/like_model.php';
$l = new LikeModel();
$t = new DiaryModel();
$c = new CommentModel();
$u = new UserModel();
$n = new NotifyModel();
$m = new NotifyModel();
$f = new FriendModel();
$button = '';
$p = 0;
$onclick1 = '';
$user_page = $u->getUser($_GET['user_id']);
if ($f->checkUserId($_SESSION['id'], $user_page['id'])) {
$a = $f->getFlagFriend($_SESSION['id'], $user_page['id']);
$flag['flag'] = $a['flag'];
}
if ($f->checkUserId($user_page['id'], $_SESSION['id'])) {
$b = $f->getFlagFriend($user_page['id'], $_SESSION['id']);
if ($b['flag'] == 2) {
$flag['flag'] = 3;
}
}
if (!$f->checkUserId($_SESSION['id'], $user_page['id']) && !$f->checkUserId($user_page['id'], $_SESSION['id'])) {
$flag['flag'] = 0;
}
if ($_GET['friend'] != $flag['flag']) {
header('Location: ../404.php');
示例9: addMember
public function addMember($user_id, $accepted = null, $consider_contingent = null, $cmd = 'add_user')
{
global $perm, $SEM_CLASS, $SEM_TYPE;
$user = UserModel::getUser($user_id);
$messaging = new messaging();
$status = 'autor';
// insert
$copy_course = $accepted || $consider_contingent ? TRUE : FALSE;
$admission_user = insert_seminar_user($this->course_id, $user_id, $status, $copy_course, $consider_contingent, true);
// create fullname of user of given user informations
$fullname = $user['Vorname'] . ' ' . $user['Nachname'];
if ($admission_user) {
setTempLanguage($user_id);
if ($cmd == 'add_user') {
$message = sprintf(_('Sie wurden vom einem/einer %s oder Admin
in die Veranstaltung **%s** eingetragen.'), get_title_for_status('dozent', 1), $this->course_title);
} else {
if (!$accepted) {
$message = sprintf(_('Sie wurden vom einem/einer %s oder Admin
aus der Warteliste in die Veranstaltung **%s** aufgenommen und sind damit zugelassen.'), get_title_for_status('dozent', 1), $this->course_title);
} else {
$message = sprintf(_('Sie wurden von einem/einer %s oder Admin vom Status
**vorläufig akzeptiert** auf "**teilnehmend** in der Veranstaltung **%s**
hochgestuft und sind damit zugelassen.'), get_title_for_status('dozent', 1), $this->course_title);
}
}
restoreLanguage();
$messaging->insert_message($message, $user['username'], '____%system%____', FALSE, FALSE, '1', FALSE, sprintf('%s %s', _('Systemnachricht:'), _('Eintragung in Veranstaltung')), TRUE);
}
//Warteliste neu sortieren
renumber_admission($this->course_id);
if ($admission_user) {
if ($cmd == "add_user") {
$msg = MessageBox::success(sprintf(_('%s wurde in die Veranstaltung mit dem Status
<b>%s</b> eingetragen.'), $fullname, $status));
} else {
if (!$accepted) {
$msg = MessageBox::success(sprintf(_('%s wurde aus der Anmelde bzw. Warteliste
mit dem Status <b>%s</b> in die Veranstaltung eingetragen.'), $fullname, $status));
} else {
$msg = MessageBox::success(sprintf(_('%s wurde mit dem Status <b>%s</b>
endg?ltig akzeptiert und damit in die Veranstaltung aufgenommen.'), $fullname, $status));
}
}
} else {
if ($consider_contingent) {
$msg = MessageBox::error(_('Es stehen keine weiteren Plätze mehr im Teilnehmerkontingent zur Verfügung.'));
} else {
$msg = MessageBox::error(_('Beim Eintragen ist ein Fehler aufgetreten.
Bitte versuchen Sie es erneut oder wenden Sie sich an einen Systemadministrator'));
}
}
return $msg;
}
示例10: delete_action
function delete_action($user_id = NULL)
{
//deleting one user
if (!is_null($user_id)) {
$user = UserModel::getUser($user_id);
//check user
if (!Request::getArray('user_ids') && empty($user)) {
PageLayout::postMessage(MessageBox::error(_('Fehler! Der zu löschende Benutzer ist nicht vorhanden oder Sie haben keinen Nutzer ausgewählt.')));
//antwort ja
} elseif (!empty($user)) {
//CSRFProtection::verifyUnsafeRequest();
//if deleting user, go back to mainpage
$parent = '';
//deactivate message
if (!Request::int('mail')) {
$dev_null = new blackhole_message_class();
$default_mailer = StudipMail::getDefaultTransporter();
StudipMail::setDefaultTransporter($dev_null);
}
//preparing delete
$umanager = new UserManagement();
$umanager->getFromDatabase($user_id);
//delete
if ($umanager->deleteUser(Request::option('documents', false))) {
$details = explode('§', str_replace(array('msg§', 'info§', 'error§'), '', substr($umanager->msg, 0, -1)));
PageLayout::postMessage(MessageBox::success(htmlReady(sprintf(_('Der Benutzer "%s %s (%s)" wurde erfolgreich gelöscht.'), $user['Vorname'], $user['Nachname'], $user['username'])), $details));
} else {
$details = explode('§', str_replace(array('msg§', 'info§', 'error§'), '', substr($umanager->msg, 0, -1)));
PageLayout::postMessage(MessageBox::error(htmlReady(sprintf(_('Fehler! Der Benutzer "%s %s (%s)" konnte nicht gelöscht werden.'), $user['Vorname'], $user['Nachname'], $user['username'])), $details));
}
//reavtivate messages
if (!Request::int('mail')) {
StudipMail::setDefaultTransporter($default_mailer);
}
//sicherheitsabfrage
} else {
$user_ids = Request::getArray('user_ids');
if (count($user_ids) == 0) {
PageLayout::postMessage(MessageBox::error(_('Bitte wählen Sie mindestens einen Benutzer zum Löschen aus.')));
$this->redirect('show' . $parent);
return;
}
//CSRFProtection::verifyUnsafeRequest();
//deactivate message
if (!Request::int('mail')) {
$dev_null = new blackhole_message_class();
$default_mailer = StudipMail::getDefaultTransporter();
StudipMail::setDefaultTransporter($dev_null);
}
foreach ($user_ids as $i => $user_id) {
$users[$i] = UserModel::getUser($user_id);
//preparing delete
$umanager = new UserManagement();
$umanager->getFromDatabase($user_id);
//delete
if ($umanager->deleteUser(Request::option('documents', false))) {
$details = explode('§', str_replace(array('msg§', 'info§', 'error§'), '', substr($umanager->msg, 0, -1)));
PageLayout::postMessage(MessageBox::success(htmlReady(sprintf(_('Der Benutzer "%s %s (%s)" wurde erfolgreich gelöscht'), $users[$i]['Vorname'], $users[$i]['Nachname'], $users[$i]['username'])), $details));
} else {
$details = explode('§', str_replace(array('msg§', 'info§', 'error§'), '', substr($umanager->msg, 0, -1)));
PageLayout::postMessage(MessageBox::error(htmlReady(sprintf(_('Fehler! Der Benutzer "%s %s (%s)" konnte nicht gelöscht werden'), $users[$i]['Vorname'], $users[$i]['Nachname'], $users[$i]['username'])), $details));
}
}
//reactivate messages
if (!Request::int('mail')) {
StudipMail::setDefaultTransporter($default_mailer);
}
}
}
}
示例11: LikeModel
include '../model/diary_model.php';
include '../model/comment_model.php';
include '../model/notify_model.php';
include '../model/user_model.php';
include_once '../model/friend_model.php';
include_once '../model/like_model.php';
$l = new LikeModel();
$t = new DiaryModel();
$u2 = new UserModel();
$c = new CommentModel();
$n = new NotifyModel();
$m = new NotifyModel();
$f = new FriendModel();
$diary = $t->getDiaryOfUser($_SESSION['id']);
$userid = $_SESSION['id'];
$user2 = $u2->getUser($userid);
if (isset($_POST['submit'])) {
if (isset($_POST['subject'])) {
$temp['subject'] = $_POST['subject'];
}
if ($_POST['content']) {
$temp['content'] = $_POST['content'];
}
if ($_POST['sharewith']) {
$temp['type'] = $_POST['sharewith'];
}
$temp['user_id'] = $userid;
$t->create($temp);
header('Location: trangcanhan.php');
}
?>
示例12: index
function index(array $params)
{
$data = $this->model->getEvents(0, 5, 'date_debut', true, 'WHERE `banniere` != "" AND `date_fin` > NOW()');
$slideshow = array();
foreach ($data as $event) {
if (!empty($event['date_debut']) && $event['date_debut'] != '0000-00-00 00:00:00') {
$date_debut_timestamp = strtotime($event['date_debut']);
$event['date_debut'] = strftime('%d %b %Y', $date_debut_timestamp);
$event['heure_debut'] = strftime('%H:%M', $date_debut_timestamp);
} else {
$event['date_debut'] = null;
$event['heure_debut'] = null;
}
if (!empty($event['date_fin']) && $event['date_fin'] != '0000-00-00 00:00:00') {
$date_fin_timestamp = strtotime($event['date_fin']);
$event['date_fin'] = strftime('%d %b %Y', $date_fin_timestamp);
$event['heure_fin'] = strftime('%H:%M', $date_fin_timestamp);
} else {
$event['date_fin'] = null;
$event['heure_fin'] = null;
}
$slideshow[] = $event;
}
$where_clause = 'WHERE `date_fin` > NOW()';
$session = System::getSession();
$user_region = '';
if ($session->isConnected()) {
include_once APPS_DIR . 'user' . DS . 'model.php';
$userModel = new UserModel();
$data = $userModel->getUser($_SESSION['userid']);
$user_region = $data['id_region'];
if (!empty($user_region)) {
$where_clause .= ' AND `region` = ' . intval($user_region);
}
}
$n = 10;
// Number of events per page
$page = 1;
// Current page
// Get the current page from URL
if (isset($params[0]) && $params[0] == 'page' && isset($params[1])) {
$page = intval($params[1]);
}
$data = $this->model->getEvents(($page - 1) * $n, $n, 'date_debut', true, $where_clause);
$events = array();
foreach ($data as $event) {
if (!empty($event['date_debut']) && $event['date_debut'] != '0000-00-00 00:00:00') {
$date_debut_timestamp = strtotime($event['date_debut']);
$event['date_debut'] = strftime('%d %b %Y', $date_debut_timestamp);
$event['heure_debut'] = strftime('%H:%M', $date_debut_timestamp);
} else {
$event['date_debut'] = null;
$event['heure_debut'] = null;
}
if (!empty($event['date_fin']) && $event['date_fin'] != '0000-00-00 00:00:00') {
$date_fin_timestamp = strtotime($event['date_fin']);
$event['date_fin'] = strftime('%d %b %Y', $date_fin_timestamp);
$event['heure_fin'] = strftime('%H:%M', $date_fin_timestamp);
} else {
$event['date_fin'] = null;
$event['heure_fin'] = null;
}
$events[] = $event;
}
$themetest = $this->model->getThemes();
$regiontest = $this->model->getRegions();
$regionsok = array();
$themesok = array();
foreach ($regiontest as $index => $value) {
if ($value['afficher'] == 1) {
$regionsok[$value['id']] = $value;
}
}
foreach ($themetest as $index => $value) {
if ($value['afficher'] == 1) {
$themesok[$value['id']] = $value;
}
}
return array('slideshow' => $slideshow, 'events' => $events, 'total' => $this->model->countEvents(), 'current_page' => $page, 'per_page' => $n, 'regions' => $regionsok, 'themes' => $themesok, 'user_region' => $user_region);
}
示例13: reloadSession
/**
* Reloads a user based on cookies
*
* @param string $userid current user id
* @param string $cookie_hash cookie hash for security checking
* @return boolean true if successfully reloaded, false otherwise
*/
public function reloadSession($userid)
{
if (!empty($_COOKIE['hash'])) {
include_once APPS_DIR . 'user' . DS . 'model.php';
$userModel = new UserModel();
$data = $userModel->getUser($userid);
if (!empty($data)) {
// Check hash
if ($_COOKIE['hash'] == $this->generate_hash($data['nickname'], $data['password'])) {
$this->setupSession($userid, $data);
return true;
}
}
}
$this->closeSession();
return false;
}
示例14: login
public function login()
{
$login = new UserModel();
$this->_user = $login->getUser();
$this->_authorized = false;
if (isset($_COOKIE['login']) and isset($_COOKIE['pass']) and file_exists(DB_PATH . "user.db")) {
//БД создана и доступны куки
$password = $this->_user[0]['password'];
$sault = $this->_user[0]['sault'];
$login = $this->_user[0]['login'];
if ($_COOKIE['pass'] == $password and $_COOKIE['login'] == $login) {
$this->_authorized = true;
}
} elseif (isset($_POST['login']) and isset($_POST['pass'])) {
$hashpass = $login->passConvert($_POST['pass']);
$postLogin = $login->checkLogin($_POST['login']);
/*БД создана ранее*/
if (file_exists(DB_PATH . "user.db")) {
$this->accessData = $login->getUser();
$password = $this->_user[0]['password'];
$sault = $this->_user[0]['sault'];
$login = $this->_user[0]['login'];
if ($postLogin == $login and $password == md5("{$hashpass}.{$sault}")) {
if (isset($_POST['remember'])) {
$this->_remember = $_POST['remember'];
}
switch ($this->_remember) {
case 0:
setcookie('login', $postLogin, time() + 1800, '/');
setcookie('pass', $password, time() + 1800, '/');
break;
case 1:
setcookie('login', $login, time() + 10800, '/');
setcookie('pass', $password, time() + 10800, '/');
break;
default:
setcookie('login', $login, time() - 300, '/');
setcookie('pass', $password, time() - 300, '/');
break;
}
$this->_authorized = true;
/*Логин и пароль не найдены*/
} elseif (!isset($this->_user[0]['password']) and !isset($this->_user[0]['login'])) {
if ($login->addUser($postLogin, $hashpass)) {
$this->status = "Пользователь успешно добавлен!";
} else {
$this->status = "Error: Ошибка добавления нового пользователя!";
}
} elseif ($postLogin != $login or $password != md5("{$hashpass}.{$sault}")) {
$this->status = "Error: Не верно введен логин или пароль. Попробуйте снова.";
}
/*БД не найдена*/
} elseif (!file_exists(DB_PATH . "user.db") and $hashpass and $postLogin) {
if ($login->addUser($postLogin, $hashpass)) {
$this->status = "Пользователь успешно добавлен!";
} else {
$this->status = "Error: Ошибка добавления нового пользователя!";
}
unset($login);
} else {
$this->status = "Error: Не верная пара логин-пароль, либо недопустимый формат ввода \n\t\t\t\t(Логин > 3 символов, пароль > 5 символов латинскими буквами и цифрами 0-9).";
}
} elseif (empty($this->_user)) {
$this->status = "Это Ваш первый вход. Введите желаемые имя пользователя и пароль. Они будут использоваться для доступа в дальнейшем.";
$this->_authorized = false;
}
}
示例15: NotifyModel
<?php
session_start();
include_once '../model/notify_model.php';
$n = new NotifyModel();
$m = new NotifyModel();
include '../model/user_model.php';
$u = new UserModel();
$error = 4;
$part = 'dsds';
$user = $u->getUser($_SESSION['id']);
if (isset($_POST['submit'])) {
include '../controler/upload_image.php';
if (isset($_POST['name'])) {
$new['name'] = $_POST['name'];
} else {
$new['name'] = $user['name'];
}
if (isset($_POST['job'])) {
$new['job'] = $_POST['job'];
} else {
$new['job'] = $user['job'];
}
if (isset($_POST['sothich'])) {
$new['sothich'] = $_POST['sothich'];
} else {
$new['sothich'] = $user['sothich'];
}
if (isset($_POST['addr'])) {
$new['addr'] = $_POST['addr'];
} else {