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


PHP loadUser函数代码示例

本文整理汇总了PHP中loadUser函数的典型用法代码示例。如果您正苦于以下问题:PHP loadUser函数的具体用法?PHP loadUser怎么用?PHP loadUser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: __construct

 public function __construct($userId = null)
 {
     if ($userId == null) {
         loadUser();
     } else {
         $this->userId = $userId;
         $this->userName = "default";
     }
 }
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:9,代码来源:User.class.php

示例2: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     if (empty(loadGuideByTitleOrId($id))) {
         flash()->error('That guide does not exist.')->important();
         return redirect('guides');
     }
     $guide = loadGuideByTitleOrId($id)[0];
     $author = loadUser($guide->writerId)[0];
     return view('guides.show', compact('guide', 'author'));
 }
开发者ID:arminnh,项目名称:website-learn-to-program,代码行数:16,代码来源:GuidesController.php

示例3: isLoggedIn

function isLoggedIn() {
	global $User, $_COOKIE;

	if (isset($User)) return true;

	if (isset($_COOKIE['auth'])) {
		$r = redisLink();
		$authCookie = $_COOKIE['auth'];
		if ($uid = $r->hget("auths", $authCookie)) {
			if ($r->hget("user:$uid", "auth") != $authCookie) return false;
			loadUser($uid);
			return true;
		}
	}

	return false;
}
开发者ID:natashad,项目名称:saidis,代码行数:17,代码来源:saidis.php

示例4: buildUserNotifcations

 private static function buildUserNotifcations($notification)
 {
     $string = "";
     $user = loadUser($notification->generator_user_id)[0];
     $username = '<a href=/users/' . $notification->generator_user_id . '>' . $user->username . '</a>';
     switch ($notification->type) {
         case "friend request":
             $string = (object) array_merge((array) $notification, array('message' => $username . ' has sent you a friend request.'));
             break;
         case "friend request accepted":
             $string = (object) array_merge((array) $notification, array('message' => $username . ' has accepted your friend request.'));
             break;
         case "friend request declined":
             $string = (object) array_merge((array) $notification, array('message' => $username . ' has declined your friend request.'));
             break;
         case "join group request":
             $groupname = loadGroup($notification->object_id)[0]->name;
             $group = '<a href=/groups/' . $notification->object_id . '/manageMembers>' . $groupname . '</a>';
             $string = (object) array_merge((array) $notification, array('message' => $username . ' has requested to join your group \'' . $group . '\'.'));
             break;
         case "series completed":
             $seriesTitle = loadSerieWithId($notification->object_id)[0]->title;
             $series = '<a href=/series/' . $notification->object_id . '>\'' . $seriesTitle . '\'</a>.';
             $string = (object) array_merge((array) $notification, array('message' => $username . ' has completed your series ' . $series));
             break;
         case "exercise completed":
             $exercise = '<a href=/exercises/' . $notification->object_id . '>exercise</a>.';
             $string = (object) array_merge((array) $notification, array('message' => $username . ' has accomplished an ' . $exercise));
             break;
         case "answer shared":
             $string = (object) array_merge((array) $notification, array('message' => $username . ' has shared <a href=/sreies/>an answer</a> with you.'));
             break;
         case "challenged":
             $string = (object) array_merge((array) $notification, array('message' => $username . ' has <a href=/challenges/>challenged</a> you.'));
             break;
         case "challenge beaten":
             $string = (object) array_merge((array) $notification, array('message' => $username . ' has beaten your <a href=/challenges/>challenge</a>!'));
             break;
     }
     return $string;
 }
开发者ID:arminnh,项目名称:website-learn-to-program,代码行数:41,代码来源:NotificationsController.php

示例5: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store($userId, $exId)
 {
     $user = loadUser($userId)[0];
     if (loadChallengeByUsersExercise(\Auth::id(), $user->id, $exId) == []) {
         storeChallenge(\Auth::id(), $user->id, $exId);
         $challengeId = loadChallengeByUsersExercise(\Auth::id(), $user->id, $exId)[0]->id;
         setWinner($challengeId, \Auth::id());
         $newScore = loadUser(\Auth::id())[0]->score + 1;
         setUserScore(\Auth::id(), $newScore);
         flash()->success("{$user->username} was challenged succefully");
         storeNotification($user->id, "challenged", \Auth::id(), $challengeId);
     } else {
         flash()->error("This challenge already exists");
     }
     $sId = \Session::get('currentSerie');
     $nextEx = nextExerciseofSerie($exId, $sId);
     if ($nextEx == []) {
         return redirect('series/');
     }
     return redirect('exercises/' . $nextEx[0]->id);
 }
开发者ID:arminnh,项目名称:website-learn-to-program,代码行数:26,代码来源:ChallengesController.php

示例6: loadUser

} else {
    $populate_fields = false;
    $button_submit_text = "Create user";
    $target = "create_user.php";
    $box_title = "New User";
    $username_disable_str = "";
}
$user_name = "";
$display_name = "";
$email = "";
$user_title = "";
$user_active = "0";
$user_enabled = "0";
// If we're in update mode, load user data
if ($populate_fields) {
    $user = loadUser($user_id);
    $user_name = $user['user_name'];
    $display_name = $user['display_name'];
    $email = $user['email'];
    $user_title = $user['title'];
    $user_active = $user['active'];
    $user_enabled = $user['enabled'];
    $primary_group_id = $user['primary_group_id'];
    if ($user['last_sign_in_stamp'] == '0') {
        $last_sign_in_date = "Brand new!";
    } else {
        $last_sign_in_date_obj = new DateTime();
        $last_sign_in_date_obj->setTimestamp($user['last_sign_in_stamp']);
        $last_sign_in_date = $last_sign_in_date_obj->format('l, F j Y');
    }
    $sign_up_date_obj = new DateTime();
开发者ID:webcoderu,项目名称:php-reports,代码行数:31,代码来源:form_user.php

示例7: loadUserList

function loadUserList()
{
    global $MAIN_TABLE, $DAY_TABLE, $db;
    $sql = "SELECT name, SUM(time) AS total, SUM(CASE WHEN YEAR(date)=YEAR(CURDATE()) THEN time ELSE 0 END) as season FROM robonauts_day GROUP BY name ORDER BY season DESC;";
    $result = $db->query($sql);
    $data = array();
    while ($row = $result->fetch_array()) {
        $row[] = loadUser($row[0]);
        $data[] = $row;
    }
    $result->free();
    echo json_encode($data);
}
开发者ID:Huntrr,项目名称:RoboticsSignIn,代码行数:13,代码来源:db.php

示例8: modifySiteAdminUser

function modifySiteAdminUser($userId, $siteAdmin)
{
    if (!isSiteAdmin()) {
        return FALSE;
    }
    if ($userId == $_SESSION['user']['user_id']) {
        return FALSE;
    }
    $userObj = loadUser($userId);
    if (!$userObj) {
        return FALSE;
    }
    if (!userIsActive($userId)) {
        return FALSE;
    }
    $userRoleId = getRoleId('user');
    $adminRoleId = getRoleId('admin');
    if ($userObj['role_id'] != $userRoleId && $userObj['role_id'] != $adminRoleId) {
        return FALSE;
    }
    $newRoleId = $userRoleId;
    if ($siteAdmin) {
        $newRoleId = $adminRoleId;
    }
    $updates = array('role_id' => $newRoleId);
    $conditions = array('user_id' => $userId);
    return db_update('virtual_users', $updates, $conditions);
}
开发者ID:rubixconsulting,项目名称:postfixweb,代码行数:28,代码来源:user.inc.php

示例9: elseif

     } elseif (empty($_POST['password'])) {
         $msg = $strEnterPassword;
     } else {
         if (ENCRYPTPASSWORD) {
             $encP = encryptPass($_POST['password']);
             $canlogin = false;
             $canlogin = !empty($encP) && !empty($_POST['password']) && !empty($emailcheck) && $encP == $userpassword && $_POST['email'] == $emailcheck;
             #      print $_POST['password'].' '.$encP.' '.$userpassword.' '.$canlogin; exit;
         } else {
             $canlogin = $_POST['password'] == $userpassword && $_POST['email'] == $emailcheck;
         }
     }
     if (!$canlogin) {
         $msg = '<p class="error">' . $strInvalidPassword . '</p>';
     } else {
         loadUser($emailcheck);
         $_SESSION['userloggedin'] = $_SERVER['REMOTE_ADDR'];
     }
 } elseif (!empty($_POST['forgotpassword'])) {
     # forgot password button pushed
     if (!empty($_POST['email']) && $_POST['email'] == $emailcheck) {
         sendMail($emailcheck, $GLOBALS['strPasswordRemindSubject'], $GLOBALS['strPasswordRemindMessage'] . ' ' . $userpassword, system_messageheaders());
         $msg = $GLOBALS['strPasswordSent'];
     } else {
         $msg = $strPasswordRemindInfo;
     }
 } elseif (isset($_SESSION['userdata']['email']['value']) && $_SESSION['userdata']['email']['value'] == $emailcheck) {
     # Entry without any button pushed (first time) test and, if needed, ask for password
     $canlogin = $_SESSION['userloggedin'];
     $msg = $strEnterPassword;
 }
开发者ID:gillima,项目名称:phplist3,代码行数:31,代码来源:index.php

示例10: show

 /**
  * Display a list of messages between the logged in user and user $id.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $userr = loadUser($id);
     if (empty($userr)) {
         flash()->error('That user does not exist');
         return redirect('/messages');
     }
     if ($userr[0]->id == \Auth::id()) {
         return $this->index();
     }
     if (!empty(loadConversation($id))) {
         $conversationId = loadConversation($id)[0]->conversationId;
         //Load all messages with in conversation $id
         //dd($conversationId);
         $messages = loadAllMessages($conversationId);
         //dd($messages);
         //Then get user with $id to show him
         $user = $userr[0];
         updateMessagesToSeen($conversationId);
         //Then get all conversations for the logged in user to show those in the sidebar
         $conversations = loadLastNConversationsWithMessage(999);
         //Find the last message that has been read by user $id
         $lastRead = "";
         if (!empty(loadLastReadMessage($id))) {
             $lastRead = loadLastReadMessage($id)[0]->message;
         }
         //Add a Carbon time object to each message
         foreach ($messages as &$message) {
             $carbon = Carbon::createFromFormat('Y-n-j G:i:s', $message->date);
             $message = (object) array_merge((array) $message, array('carbon' => $carbon));
             //Give seen status only to the last seen message, not all of them
             if ($message->message == $lastRead) {
                 $message = (object) array_merge((array) $message, array('seen' => 1));
             } else {
                 $message = (object) array_merge((array) $message, array('seen' => 0));
             }
         }
         //Add a Carbon time object to each $conversation
         foreach ($conversations as &$conversation) {
             $carbon = Carbon::createFromFormat('Y-n-j G:i:s', $conversation->date);
             $conversation = (object) array_merge((array) $conversation, array('carbon' => $carbon));
         }
         return view('pages.messages', compact('messages', 'user', 'conversations'));
     } else {
         //create a new conversation between the logged in user and $id
         $toId2 = loadUser($id)[0]->id;
         storeConversation($toId2);
         return $this->show($id);
     }
 }
开发者ID:arminnh,项目名称:website-learn-to-program,代码行数:56,代码来源:MessagesController.php

示例11: User

if (!isset($_GET['action']) && isset($_GET['id'])) {
    $user = new User(loadUser($db, $_GET['id']));
    //$user->display();
    $userHtml = $user->display();
} elseif ($_GET['action'] == 'create') {
    //create a new user if url specifies create action
    //get new user info from post
    //TODO sanitize user information and make sure it is complete
    //TODO check that email is valid
    $newUser = $_POST;
    //add file info for user profile picture
    $newUser['userimage'] = $_FILES['userimage']['name'];
    createUser($newUser, $_FILES['userimage'], $db);
} elseif ($_GET['action'] == 'edit') {
    $user = new User($_SESSION['userData']);
    $viewedUser = new User(loadUser($db, $_GET['id']));
    echo $user->isAdmin();
    echo $user->getID();
    if ($_GET['id'] == $user->getID()) {
        echo 'can edit this entry';
        $userHtml = $viewedUser->displayEditable();
    } else {
        echo 'cannot edit this entry';
        $userHtml = $viewedUser->display();
    }
} elseif ($_GET['action'] == 'update') {
}
function createUser($user, $userImage, $db)
{
    $query = 'INSERT INTO users VALUES (null, :email , :password , :fName, :lName, :imageName, :admin) ';
    try {
开发者ID:tmachin,项目名称:SimplePHPBlog,代码行数:31,代码来源:users.php

示例12: hamed_pdate1

			</tr>
		</table>
			<table style="border-style: solid; border-collapse: collapse; font-size: 12px; direction: rtl; width:90%; height: 10cm;" border="2">
		<tbody>
		<tr>
			<td rowspan="3" colspan="3" style="width:4cm;height:3cm;" >
			<b>   <?php 
    echo $customer->name;
    ?>
</b>
			<br>
			<?php 
    echo hamed_pdate1($ticket->regtime);
    ?>
			<br> <?php 
    echo loadUser($ticket->user_id);
    ?>
			</td>
			<td colspan="2" style="height:0.8cm;font-size: 7px;"  >
			<b>
			<br />
		کوپن مدیریت
			</b>
			</td>
			<td style="text-align: left;height:0.8cm;" colspan="8">
				<table style="font-size: 6px;width:100%;">
					<tr>
						<td>
								<img src='../img/arm_gcom.png' width="20px" >
									<br/>گستره‌ارتباطات‌شرق
						</td>
开发者ID:hscomp2002,项目名称:superp,代码行数:31,代码来源:eticket_moghim.php

示例13: forwardExists

function forwardExists($destination, $userId = FALSE)
{
    if (!$destination) {
        return FALSE;
    }
    $user = $_SESSION['user']['user'];
    $domainId = $_SESSION['user']['domain_id'];
    if (!$userId) {
        $userId = $_SESSION['user']['user_id'];
    }
    if ($userId != $_SESSION['user']['user_id']) {
        $userObj = loadUser($userId);
        $adminDomains = getAdminDomains();
        $domain = $userObj['domain'];
        if (!in_array($domain, $adminDomains)) {
            return FALSE;
        }
        $user = $userObj['user'];
        $domainId = $userObj['domain_id'];
    }
    $sql = 'SELECT' . '  COUNT(*)' . '  FROM virtual_aliases' . '  WHERE username = ?' . '    AND domain_id = ?' . '    AND destination = ?';
    $numForwards = db_getval($sql, array($user, $domainId, $destination));
    if ($numForwards > 0) {
        return TRUE;
    } else {
        return FALSE;
    }
}
开发者ID:rubixconsulting,项目名称:postfixweb,代码行数:28,代码来源:forwards.inc.php

示例14: initUser

function initUser()
{
    return loadUser(42);
}
开发者ID:k001,项目名称:ACCOUNT--MANAGEMENT-PANEL,代码行数:4,代码来源:error.php

示例15: loadUser

@extends('master')

@section('title')
<?php 
$userA = loadUser($challenge->userA)[0];
$userB = loadUser($challenge->userB)[0];
$winner = [];
$loser = [];
if ($challenge->winner == $userA->id) {
    $winner = $userA;
    $loser = $userB;
} else {
    if ($challenge->winner == $userB->id) {
        $winner = $userB;
        $loser = $userA;
    }
}
?>
Exercise: <a href="/exercises/{{$challenge->exId}}" style="font-style: italic; color: #ffffff">{{ firstChars(strip_tags(loadExercise($challenge->exId)[0]->question), 50) }}</a> <br/>
<a href="/users/{{ $userA->username }}"  style="color: #ffffff">{{ $userA->username }}</a>
<i>vs</i>
<a href="/users/{{ $userB->username }}"  style="color: #ffffff">{{ $userB->username }}</a>
@stop

@section('content')
<div>
    @if ($winner == [])
        <h2> Tie </h2>

    @else
    <div>
开发者ID:arminnh,项目名称:website-learn-to-program,代码行数:31,代码来源:show.blade.php


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