本文整理汇总了PHP中getUserByID函数的典型用法代码示例。如果您正苦于以下问题:PHP getUserByID函数的具体用法?PHP getUserByID怎么用?PHP getUserByID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getUserByID函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setSessionUserFromDatabase
public function setSessionUserFromDatabase($user_id){
$user = mysql_fetch_assoc(getUserByID($user_id));
$this->setSessionUser($user['user_id'], $user['user_level']);
}
示例2: printPost
/**
*
* @param unknown $user - Current User
* @param unknown $postUser - Person who posted the post.
* @return string
*/
public function printPost($user, $postUser)
{
global $permission;
if ($user->hasPermission($permission["signature_edit"], $this)) {
$editSignature = "\r\n\t\t\t<div class='forum_signature quick_edit' name='{$postUser->id}' data-type='signature' contenteditable='true'>\r\n\t\t\t\t{$postUser->signature}\r\n\t\t\t</div>";
} else {
$editSignature = "<div class='forum_signature'>{$postUser->signature}</div>";
}
$lastEdit = "";
if ($this->fields["LastEditTime"] > 0 && !empty($this->fields["LastEditUser"])) {
$editUser = getUserByID($this->fields["LastEditUser"]);
if ($editUser != null) {
$lastEdit = "Last edit: <b>" . $editUser->username . "</b>, " . date("F j, Y, g:i a", $this->fields["LastEditTime"]);
}
}
if ($user->hasPermission($permission["post_edit"], $this)) {
$editPost = "<a href=\"javascript:void(0);\" data-forum-target=\"" . $this->getID() . "\" class=\"post_edit btn_small btn_white btn_flat\">Edit</a>";
}
if ($user->hasPermission($permission["post_delete"], $this)) {
$removePost = "<a href=\"javascript:if(confirm('Delete Post?')) {window.location='{$_SERVER['PHP_SELF']}?p=t{$this->fields["Parent"]}&d=p{$this->getID()}';}\" class=\"btn_small btn_white btn_flat\">Delete</a>";
}
if ($user->hasPermission($permission["post_create"], $this)) {
$quotePost = "<a href=\"javascript: postEditor.insertHtml('<blockquote>'+\$('#post_content_" . $this->getID() . "').html()+'<cite>Quoted from {$postUser->username}</cite>\r\n </blockquote><p></p>');\" class=\"btn_small btn_white btn_flat\">Quote</a>";
}
return "\r\n <div class='post'>\r\n <a id='" . $this->getID() . "'></a>\r\n " . $postUser->printProfile() . "\r\n <div class='comment_box'>\r\n <div class='comment_inner'>\r\n <div class='forum_menu'>\r\n {$quotePost}\r\n {$editPost}\r\n {$removePost}\r\n </div>\r\n <div class='clear'></div>\r\n <div id='post_content_" . $this->getID() . "'>{$this->fields["Content"]}</div>\r\n <div class='hrline_silver'></div>\r\n {$editSignature}\r\n <span class='last_edit'>{$lastEdit}</span>\r\n <span class='date'>{$this->getDate()}</span>\r\n </div>\r\n </div>\r\n </div>\r\n <div class='clear'></div>";
}
示例3: xml_user_get
function xml_user_get($id)
{
if (!is_numeric($id)) {
#soap_fault('Client','',"Ung�ltiger Parameter: '$id'")
return null;
}
return getUserByID($id);
}
示例4: getUserByUsername
function getUserByUsername($username)
{
$user = fetchUserDetails($username);
if ($user != null) {
return getUserByID($user["id"]);
return getUserByID($user["id"]);
}
}
示例5: sendWarningNotice
function sendWarningNotice($userid, $reason, $type)
{
$subject = "Reservation System Warning";
$message = "You have been given a(n) " . getWarningType($type) . ". The reason given was: " . $reason;
$headers = 'From: ' . getConfigVar('smtp_email') . "\r\n" . 'Reply-To: ' . getConfigVar('smtp_email') . "\r\n" . 'X-Mailer: PHP/' . phpversion();
$user = mysql_fetch_assoc(getUserByID($userid));
//sendMail(getConfigVar('smtp_email'), $user['email'], $subject, $message);
mail($row['email'], $subject, $message);
}
示例6: attendingEventBox
function attendingEventBox($userID)
{
$userattendance = getEventsUserAttends($userID);
if (!empty($userattendance)) {
foreach ($userattendance as $row) {
$creator = getUserByID($row['user_id']);
$link = '"event.php?id=' . $row['id'] . '"';
$linkToCreator = '"profile.php?id=' . $row['user_id'] . '"';
$alt = '"image_' . $row['event_id'] . '"';
$imgPath = '"Images/Event/' . $row['image_path'] . '.jpg"';
$value = '"' . $row['id'] . '"';
?>
<div class="event_box">
<a class="event_id" href=<?php
echo $link;
?>
><?php
echo $row['event_id'];
?>
</a>
<span class="event_type"><?php
echo getEventsByTypeID($row['type'])['type'];
?>
</span>
<span class="event_user">Created by: <a href=<?php
echo $linkToCreator;
?>
><?php
echo $creator['user_name'];
?>
</a></span>
<span class="event_date"><?php
echo $row['date'];
?>
</span>
<img class="event_img" src=<?php
echo $imgPath;
?>
alt=<?php
echo $alt;
?>
>
</div>
<?php
}
} else {
?>
<span class="no-results">This user is currently not attending any events.</span> <?php
}
}
示例7: getNews
function getNews($last = 6) {
include_once("functions.php");
$sql = "SELECT *
FROM " . DB_PREFIX . "news
ORDER BY date DESC LIMIT 0, $last";
$result = db_result($sql);
$return_str = '<div class="news-block">';
while($row = mysql_fetch_object($result)) {
$return_str .= "\t\t\t<div class=\"news\">
<span class=\"news-title\">
" . $row->title . "
<span class=\"news-date\">" . date('d.m.Y H:i:s', $row->date) . "</span>
</span>
" . nl2br($row->text) . "
<span class=\"news-author\">" . getUserByID($row->userid) . "</span>
</div>\r\n";
}
$return_str .= "</div>";
return $return_str;
}
示例8: articlesPreview
function articlesPreview($count = 5)
{
$sql = "SELECT *\r\n\t\t\tFROM " . DB_PREFIX . "articles\r\n\t\t\tORDER BY article_date DESC\r\n\t\t\tLIMIT 0, {$count}";
$result = db_result($sql);
$out = '<div class="articles-block">';
while ($data = mysql_fetch_object($result)) {
$out .= "\t\t\t<div class=\"article\">\r\n\t\t\t\t<span class=\"article-title\">" . $data->article_title . "\r\n\t\t\t\t\t<span class=\"article-date\">" . date('d.m.Y H:i:s', $data->article_date) . "</span>\r\n\t\t\t\t</span>\r\n\t\t\t\t" . nl2br($data->article_description) . " <a href=\"article.php?page_id={$data->article_id}\">mehr...</a>\r\n\t\t\t\t<span class=\"article-author\">" . getUserByID($data->article_creator) . "</span>\r\n\t\t\t</div>\r\n";
}
$out .= '</div>';
return $out;
}
示例9: user_fleets_update
function user_fleets_update($uid, $fleets)
{
Assert::isId($uid);
$user = getUserByID($uid);
if (!$user) {
trigger_error("user not found", E_USER_ERROR);
return false;
}
$userfleets = user_fleet_list_byuser($uid);
if (!$userfleets || !is_array($userfleets)) {
trigger_error("user fleets for user {$uid} not found", E_USER_ERROR);
return false;
}
#fleetstatus_delete_bykoords($user['gala'],$user['pos']);
foreach ($userfleets as $fleet) {
if (isset($fleets[$fleet['fleetnum']])) {
fleet_update($fleet['fid'], $fleets[$fleet['fleetnum']]);
#$fleets[$fleet['fleetnum']]['fleetnum'] = $fleet['fleetnum'];
#fleetstatus_add($fleets[$fleet['fleetnum']]);
}
}
query("update user set fleetupdate = unix_timestamp() where uid = {$uid}");
}
示例10: clean
$category->edit($currentUser, $title, $con);
$successes[] = "Changed category name to: " . $title;
}
} else {
if ($request_type == "post_edit") {
$post = Post::getByID(intval($edit));
$data = clean($data);
if ($post != null && !empty($data)) {
$post->edit($data, $currentUser, time());
$post->save($con);
$successes[] = "Edited Post!";
}
} else {
if ($request_type == "signature") {
$data = clean($data);
$user = getUserByID($edit);
if ($user != null && $user instanceof ForumUser && !empty($data)) {
if ($currentUser->hasPermission($permission["signature_edit"]) || $currentUser->id == $user->id) {
$user->editSignature($data, $con);
$successes[] = "Changed signature to: " . $data;
}
}
}
}
}
}
}
if (count($successes) > 0) {
echo json_encode($successes);
} else {
echo json_encode(array("Invalid " . $request_type . " Request: " . $edit . ", " . strip_tags($data)));
示例11: getWarningsForUser
$warnings = getWarningsForUser($_GET['user_id']);
$user = mysql_fetch_assoc(getUserByID($_GET['user_id']));
$options = "";
while ($row = mysql_fetch_assoc($warnings)) {
$options = $options . "<option value=\"" . $row['warn_id'] . "\">" . $row['time'] . " - " . getWarningType($row['type']) . "</option>";
}
echo "<center><h3>View Warnings For " . $user['name'] . "</h3>";
if ($options != "") {
echo "<form action=\"index.php\" method=\"GET\">\r\n\t\t\t<input type=\"hidden\" name=\"pageid\" value=\"editwarning\">\r\n\t\t\t<select name=\"warn_id\">" . $options . "</select><input type=\"submit\" value=\"View\"></form></center>";
} else {
echo "<h4>User has no warnings.</h4>";
}
}
} else {
if ($pageid == "editwarning" || $pageid == "savewarning") {
$message = "";
if ($pageid == "savewarning") {
saveWarning($_POST['warn_id'], $_POST['reason'], $_POST['type']);
$warning = mysql_fetch_assoc(getWarningByID($_POST['warn_id']));
$message = "<font color=\"#008800\"><b>Warning Saved</b></font><br><br>";
} else {
$warning = mysql_fetch_assoc(getWarningByID($_GET['warn_id']));
}
$user = mysql_fetch_assoc(getUserByID($warning['user_id']));
$selected = array(RES_WARNING_ACTIVE => "", RES_WARNING_NOTE => "", RES_WARNING_INACTIVE => "");
$selected[$warning['type']] = "SELECTED";
echo "<center><h3>Edit Warning For " . $user['name'] . "</h3>" . $message . "</center>\r\n\t<form action=\"./index.php?pageid=savewarning\" method=\"POST\">\r\n\t\t<input type=\"hidden\" name=\"warn_id\" value=\"" . $warning['warn_id'] . "\">\r\n\t\t\t<table class=\"warning\">\r\n\t\t\t\r\n\t\t\t\t<tr>\r\n\t\t\t\t\r\n\t\t\t\t\t<td colspan=2 class=\"centeredcellbold\">Warn Reason</th>\r\n\t\t\t\t\t\r\n\t\t\t\t</tr>\r\n\t\t\t\t\r\n\t\t\t\t<tr>\r\n\t\t\t\t\r\n\t\t\t\t\t<td colspan=2 class=\"centeredcell\"><textarea cols=\"55\" rows=\"7\" name=\"reason\">" . $warning['reason'] . "</textarea></td>\r\n\t\t\t\t\r\n\t\t\t\t</tr>\r\n\t\t\t\t\r\n\t\t\t\t<tr>\r\n\t\t\t\t\r\n\t\t\t\t\t<td class=\"centeredcell\"><select name=\"type\"><option value=\"" . RES_WARNING_ACTIVE . "\" {$selected['1']}>Active</option><option value=\"" . RES_WARNING_NOTE . "\" {$selected['2']}>Notification</option><option value=\"" . RES_WARNING_INACTIVE . "\" {$selected['3']}>Inactive</option></select></td>\r\n\t\t\t\t\t<td class=\"centeredcell\"><input type=\"submit\" value=\"Save\"></textarea></td>\r\n\t\t\t\t\r\n\t\t\t\t</tr>\r\n\t\t\t\r\n\t\t\t</table>\r\n\t\t\r\n\t\t</form>\r\n\t</center>";
}
}
}
}
示例12: session_start
</head>
<?php
session_start();
include_once 'database/connect.php';
include_once 'database/access_db.php';
if (!isset($_SESSION['user'])) {
header("Location: index.html");
}
$idUser = $_SESSION;
if (!isset($_GET['id'])) {
$profileUserID = $_SESSION['user'];
} else {
$profileUserID = $_GET['id'];
}
$user = getUserByID($profileUserID);
$profile = getUserProfileByID($profileUserID);
?>
<body>
<?php
include 'templates/topbar.php';
include 'templates/leftbar.php';
?>
<div id="profile">
<h1>User Profile</h1>
<div id="conteudo">
<section id="profile_header">
<img id="userphoto" src ="<?php
echo $profile['image'];
?>
示例13: printBoard
/**
* Prints out the board as a forum block.
* @param ForumUser $user - The current user.
* @return string To be printed.
*/
public function printBoard($user)
{
global $posts_per_page, $permission;
/**
* Display the stats.
*/
$stats = count($this->getPosts()) . " post(s) " . $this->getViews() . " view(s)";
$printLatestPost = "No posts.";
$latestPost = $this->getLatestPost();
if ($latestPost != null) {
$latestPostUser = getUserByID($latestPost->fields["User"]);
$thread = Thread::getByID($latestPost->fields["Parent"]);
if ($latestPostUser != null && $thread != null) {
$printLatestPost = "Lastest: <a href='{$_SERVER['PHP_SELF']}?p=t" . $thread->getID() . "&page=" . ceil(count($thread->getPosts()) / $posts_per_page) . "#" . $latestPost->getID() . "'>" . limitString($latestPost->name) . "</a><br /> By: <b>" . limitString($latestPostUser->username, 20) . "</b>, " . $latestPost->getDate() . ".";
}
}
$subBoards = "";
foreach ($this->getChildren() as $child) {
if ($child instanceof Board) {
$subBoards .= "<li><a href='{$_SERVER['PHP_SELF']}?p=b{$child->getID()}'>{$child->name}</a></li>";
}
}
if (!empty($subBoards)) {
$subBoards = "<ul>Sub-Boards: " . $subBoards . "</ul>";
}
if ($user->hasPermission($permission['board_edit'], $this->getParent())) {
$orderHTML = "<a href=\"{$_SERVER['PHP_SELF']}?&o=b{$this->getID()}\" class='btn_small btn_silver btn_flat'>↓</a>";
}
return "\r\n\t \t<div class='board_box forum_element'>\r\n\t \t\t<div class='two_third'>\r\n\t \t\t\t<span class='" . ($this->isUnread($user) ? "icon_on" : "icon_off") . "'></span>\r\n\t \t\t\t<div class='board_content'>\r\n\t \t\t\t\t<h3 class='element_title'><a href='{$_SERVER['PHP_SELF']}?p=b{$this->getID()}'>{$this->name}</a> {$orderHTML}</h3>\r\n\t \t\t\t\t<div class='element_text'>\r\n\t \t\t\t\t\t<span>{$this->fields["Description"]}</span>\r\n\t \t\t\t\t\t<div class='forum_element_info'>{$stats}</div>\r\n\t \t\t\t\t</div>\r\n\t \t\t\t</div>\r\n\t \t\t</div>\r\n\t \t\t<div class='board_info forum_element_info one_third column-last'>\r\n\t \t\t\t<p>{$printLatestPost}</p>\r\n\t \t\t\t<div class='sub_boards'>\r\n\t \t\t\t\t{$subBoards}\r\n\t \t\t\t\t<div class='clear'></div>\r\n\t \t\t\t</div>\r\n\t \t\t</div>\r\n <div class='clear'></div>\r\n\t \t</div>\r\n\t\t\t<div class='hrline_silver'></div>";
}
示例14: join
$uid = $uid->id;
} else {
$uid = 0;
}
$la[] = "`uid` = {$uid}";
}
if ($la) {
$limit = "WHERE " . join(" AND ", $la);
}
if (isset($_GET['offset'])) {
$offset = "OFFSET " . (int) $_GET['offset'];
}
$res = mysql_query("SELECT * FROM `submit` {$limit} ORDER BY `id` DESC LIMIT 50 {$offset}");
while ($r = mysql_fetch_object($res)) {
unset($r->code);
$r->uname = getUserByID($r->uid)->name;
$r->pname = getProblemByID($r->pid)->name;
$list[] = $r;
}
mysql_free_result($res);
if ($offset == '') {
$offset = "OFFSET 50";
} else {
$offset = "OFFSET " . ((int) $_GET['offset'] + 50);
}
$msg = new stdClass();
$res = mysql_query("SELECT * FROM `submit` {$limit} ORDER BY `id` DESC LIMIT 1 {$offset}");
if (mysql_fetch_object($res)) {
$msg->more = true;
} else {
$msg->more = false;
示例15: confirmReservation
function confirmReservation($resid, $admincomment, $status)
{
$resid = makeStringSafe($resid);
$admincomment = makeStringSafe($admincomment);
$status = makeStringSafe($status);
doQuery("UPDATE " . getDBPrefix() . "_reservations SET admin_comment = '" . $admincomment . "', mod_status = '" . $status . "' WHERE res_id = '" . $resid . "'");
$res = mysql_fetch_assoc(getReservationByID($resid));
$user = mysql_fetch_assoc(getUserByID($res['user_id']));
sendReservationNoticeToUser($user['email'], $resid, $status, $admincomment);
logAdminConfirmReservation(getSessionVariable('user_id'), $resid);
}