本文整理汇总了PHP中get_logged_in_user函数的典型用法代码示例。如果您正苦于以下问题:PHP get_logged_in_user函数的具体用法?PHP get_logged_in_user怎么用?PHP get_logged_in_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_logged_in_user函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: concierge_url
function concierge_url($user, $download)
{
$master_url = parse_config(get_config(), "<master_url>");
$project_name = parse_config(get_config(), "<long_name>");
$project_desc = parse_config(get_config(), "<project_desc>");
$project_inst = parse_config(get_config(), "<project_inst>");
$user = get_logged_in_user(false);
$x = "http://boinc.berkeley.edu/concierge.php";
$x .= "?master_url=" . urlencode($master_url);
$x .= "&project_name=" . urlencode($project_name);
if ($project_desc) {
$x .= "&project_desc=" . urlencode($project_desc);
}
if ($project_inst) {
$x .= "&project_inst=" . urlencode($project_inst);
}
if ($user) {
$x .= "&auth=" . urlencode($user->authenticator);
$x .= "&user_name=" . urlencode($user->name);
}
if ($download) {
$x .= "&download=1";
if (parse_bool(get_config(), "need_vbox")) {
$x .= "&need_vbox=1";
}
}
return $x;
}
示例2: ic_get_user_membership_role
function ic_get_user_membership_role()
{
$user = get_logged_in_user();
if (!empty($user->community_membership) && !empty($user->community_membership->meta)) {
return $user->community_membership->meta->community_role[0];
}
return false;
}
示例3: send_validate_email
function send_validate_email()
{
global $master_url;
$user = get_logged_in_user();
$x2 = uniqid(rand(), true);
$user->update("signature='{$x2}'");
send_email($user, tra("Validate BOINC email address"), tra("Please visit the following link to validate the email address of your %1 account:", PROJECT) . "\n" . $master_url . "validate_email_addr.php?validate=1&u={$user->id}&x={$x2}");
page_head(tra("Validate email sent"));
echo tra("An email has been sent to %1. Visit the link it contains to validate your email address.", $user->email_addr);
page_tail();
}
示例4: send_validate_email
function send_validate_email()
{
global $master_url;
$user = get_logged_in_user();
$x2 = uniqid(rand(), true);
$user->update("signature='{$x2}'");
send_email($user, "Validate BOINC email address", "Please visit the following link to validate the email address\n" . "of your " . PROJECT . " account:\n" . $master_url . "validate_email_addr.php?validate=1&u={$user->id}&x={$x2}");
page_head("Validate email sent");
echo "\n\t\tAn email has been sent to {$user->email_addr}.\n\t\tVisit the link it contains to validate your email address.\n\t";
page_tail();
}
示例5: show_nav
function show_nav()
{
$config = get_config();
$master_url = parse_config($config, "<master_url>");
$no_computing = parse_config($config, "<no_computing>");
$no_web_account_creation = parse_bool($config, "no_web_account_creation");
$user = get_logged_in_user(false);
echo "<div class=\"mainnav\">\n <h2 class=headline>About " . PROJECT . "</h2>\n ";
echo "\n The Quake Catcher Network (QCN) is a research project that uses Internet-connected\n computers to do research, education, and outreach in seismology.\n You can participate by downloading and running a free program\n on your computer. Currently only certain Mac (OS X) PPC and Intel laptops are supported --\n recent ones which have a built-in accelerometer. You can also buy an external USB accelerometer.\n <p>\n QCN is based at the Stanford University School of Earth Sciences.\n <ul>\n <li> <A HREF=\"" . BASEURL . "/index.php\">Quake Catcher Network Home Page</A>\n <li> <A HREF=\"" . BASEURL . "/about-qcn/contact-us\">Project Personnel</A>\n </ul>\n ";
if ($no_computing) {
echo "\n <li> <a href=\"create_account_form.php\">Create an account</a>\n ";
} else {
echo "\n <li><a href=\"info.php\">" . tra("Read our rules and policies") . "</a>\n <li> This project uses BOINC.\n If you're already running BOINC, select Add Project.\n If not, <a target=\"_new\" href=\"http://boinc.berkeley.edu/download.php\">download BOINC</a>.\n <li> When prompted, enter <br><b>" . $master_url . "</b>\n ";
if (!$no_web_account_creation) {
echo "\n <li> If you're running a command-line version of BOINC,\n <a href=\"create_account_form.php\">create an account</a> first.\n ";
}
echo "\n <li> If you have any problems,\n <a target=\"_new\" href=\"http://boinc.berkeley.edu/wiki/BOINC_Help\">get help here</a>.\n ";
}
echo "\n </ul><BR><p>\n\n <h2 class=headline>Returning participants</h2>\n <ul>\n ";
if ($no_computing) {
echo "\n <li><a href=\"bossa_apps.php\">Do work</a>\n <li><a href=\"home.php\">Your account</a> - view stats, modify preferences\n <li><a href=\"team.php\">Teams</a> - create or join a team\n ";
} else {
echo "\n <li><a href=\"home.php\">Your account</a> - view stats, modify preferences\n <li><a href=server_status.php>Server status</a>\n <li><a href=\"team.php\">Teams</a> - create or join a team\n <li><a href=\"cert1.php\">Certificate</a>\n <li><a href=\"apps.php\">" . tra("Applications") . "</a>\n ";
}
echo "\n </ul>\n <h2 class=headline>" . tra("Community") . "</h2>\n <ul>\n <li><a href=\"user_search.php\">User search</a>\n <li><a href=\"forum_index.php\">" . tra("Message boards") . "</a>\n <li><a href=\"stats.php\">Statistics</a>\n <li><a href=language_select.php>Languages</a>\n </ul>\n ";
// CMC changed to forum prefs 4th bit
if (qcn_admin_user_auth($user)) {
// defined in project/project.inc
echo "\n <h2>" . tra("Extra Links") . "</h2>\n <ul>\n <li><a href=\"trdl.php\">" . tra("Trigger Search/Upload/Download Page") . "</a>\n <li><a href=\"ramp.php\">" . tra("View RAMP Signups") . "</a>\n <li><a href=\"" . BASEURL . "/sensor/todo\">" . tra("To-Do List") . "</a></ul>";
//if ($user->id == 15) {
// check for db replication timestamp
#$kewfile = BASEPATH . "/boinc/sensor/html/user/max.txt";
#if (file_exists($kewfile) && ($handle = fopen($kewfile, 'r'))) {
# $output = fgets($handle); // skip first line
# $output = fgets($handle); fclose($handle);
# echo " <li>Kew Sync Diff (seconds): " . $output . "<BR>(should be a small number else server is down) <BR>";
# } else {
# echo " <li>No Replication Sync File on Kew - Better Check!";
# }
}
qcn_show_map();
echo " </div>";
}
示例6: fail
require_once "../inc/host.inc";
function fail($msg)
{
echo "Error: {$msg}";
page_tail();
exit;
}
function get_host($hostid, $user)
{
$host = BoincHost::lookup_id($hostid);
if (!$host || $host->userid != $user->id) {
fail("We have no record of that computer");
}
return $host;
}
$user = get_logged_in_user();
page_head("Merge computer records");
$nhosts = get_int("nhosts");
$hostid = get_int("id_0");
$latest_host = get_host($hostid, $user);
for ($i = 1; $i < $nhosts; $i++) {
$var = "id_{$i}";
$hostid = get_int($var, true);
if (!$hostid) {
continue;
}
$host = get_host($hostid, $user);
if ($host->create_time > $latest_host->create_time) {
$error = merge_hosts($latest_host, $host);
if ($error) {
echo "<br />{$error}\n";
示例7: check_get_args
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
require_once "../inc/cache.inc";
require_once "../inc/util.inc";
require_once "../inc/boinc_db.inc";
require_once "../inc/team.inc";
check_get_args(array("teamid"));
$teamid = get_int("teamid");
$team = BoincTeam::lookup_id($teamid);
$get_from_db = false;
$user = get_logged_in_user(false);
// always show fresh copy to admins; they might be editing info
//
if (is_team_admin($user, $team)) {
$get_from_db = true;
}
if ($user->id == $team->ping_user) {
$get_from_db = true;
}
// Cache the team record, its forum record, its new members,
// its admins, and its member counts
$cache_args = "teamid={$teamid}";
if (!$get_from_db) {
$cached_data = get_cached_data(TEAM_PAGE_TTL, $cache_args);
if ($cached_data) {
// We found some old but non-stale data, let's use it
示例8: add_comment
function add_comment()
{
$user = get_logged_in_user();
$scen = get_str("scen");
$sim = get_str("sim");
$dir = "scenarios/{$scen}/simulations/{$sim}";
if (!is_dir($dir)) {
error_page("No such simulation");
}
$cdir = "{$dir}/comments";
@mkdir($cdir);
$c = create_dir_seqno($cdir);
$p = "{$cdir}/{$c}";
file_put_contents("{$p}/userid", "{$user->id}");
file_put_contents("{$p}/comment", get_str("comment"));
header("Location: sim_web.php?action=show_simulation?scen={$scen}&sim={$sim}");
}
示例9: check_get_args
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
require_once "../inc/boinc_db.inc";
require_once "../inc/util.inc";
require_once "../inc/team.inc";
check_get_args(array("tnow", "ttok"));
$user = get_logged_in_user(true);
check_tokens($user->authenticator);
$teamid = post_int("teamid");
$team = BoincTeam::lookup_id($teamid);
require_team($team);
if (!$team->joinable) {
error_page(tra("The team %1 is not joinable.", $team->name));
}
if ($user->teamid == $team->id) {
page_head(tra("Already a member"));
echo tra("You are already a member of %1.", $team->name);
} else {
$success = user_join_team($team, $user);
if ($success) {
page_head(tra("Joined %1", $team->name));
echo tra("You have joined %1.", "<a href=team_display.php?teamid={$team->id}>{$team->name}</a>");
示例10: ic_action_handlers
function ic_action_handlers()
{
if (!empty($_REQUEST['ic_action'])) {
switch ($_REQUEST['ic_action']) {
case 'create_community':
// print_r($_POST);exit;
$resp = null;
if (!empty($_POST['community_url']) && !empty($_POST['title']) && !empty($_POST['pass']) && $_POST['pass'] === '!@adEF#$%&123' && !empty($_POST['community_id']) && !empty($_POST['oauth_consumer_key']) && !empty($_POST['oauth_consumer_secret'])) {
$admin_userid = 1;
$meta = array('public' => 1, 'community_id' => $_POST['community_id'], 'oauth_consumer_key' => $_POST['oauth_consumer_key'], 'oauth_consumer_secret' => $_POST['oauth_consumer_secret']);
$com_site_id = wpmu_create_blog($_POST['community_url'], "/", $_POST['title'], $admin_userid, $meta);
if (is_wp_error($com_site_id)) {
$resp = array('success' => false, 'error' => $com_site_id);
}
// copy pages from blog id 1
global $wpdb;
$table_prefix_main = $wpdb->get_blog_prefix(1);
$table_prefix_new = $wpdb->get_blog_prefix($com_site_id);
$query = "INSERT INTO {$table_prefix_new}posts \r\n\t\t\t\t\t\t\t\tSELECT p.* \r\n\t\t\t\t\t\t\t\tFROM {$table_prefix_main}posts p \r\n\t\t\t\t\t\t\t\tWHERE p.post_name IN ( 'suspended-user', 'join-error', 'error' )";
$wpdb->query($query);
//created
$resp = array('success' => true, 'com_site_id' => $com_site_id);
} else {
$resp = array('success' => false, 'error' => new WP_Error('INVALID_PARAMS', 'Missing or Invalid Params'));
}
die(json_encode($resp));
break;
case 'verify_email':
if (!empty($_GET['user']) && !empty($_GET['key'])) {
$resp = file_get_contents(IC_API_BASEURL . "/wp-json/users/{$_GET['user']}/verifyemail?key={$_GET['key']}&community=" . IC_COMMUNITY_ID);
if ($resp === 'true') {
wp_redirect("/?verified=1");
exit;
} else {
wp_redirect("/?verified=failed");
exit;
}
}
break;
case 'link_provider':
$user = get_logged_in_user();
if (!empty($user) && !empty($_GET['provider']) && !empty($_GET['redirect_to'])) {
$code = md5($user->ID . $_GET['provider'] . "ad@#45LJWE^%\$^&*");
$redirect_back_url = urlencode($_GET['redirect_to']);
$redirect_url = IC_API_BASEURL . "?link_provider={$_GET['provider']}&userid={$user->ID}&code={$code}&redirect_to={$redirect_back_url}";
wp_redirect($redirect_url);
exit;
}
case 'login_gateway':
if (!empty($_GET['community_id'])) {
$community_id = (int) $_GET['community_id'];
//fetch community config
$icapi = ICApi();
$rsp = $icapi->auth_get_request("/communities/{$community_id}/access-token");
if ($rsp && !is_wp_error($rsp)) {
$token = $rsp->tokendata;
$community_url = $rsp->community_url;
include locate_template("templates/login_gateway.php");
exit;
}
wp_redirect("/404");
exit;
}
case 'incoming_gateway_login':
if (!empty($_POST['oauth_token']) && !empty($_POST['oauth_token_secret'])) {
$access_token = array('oauth_token' => $_POST['oauth_token'], 'oauth_token_secret' => $_POST['oauth_token_secret']);
save_token_in_session($access_token);
}
wp_redirect("/");
exit;
break;
default:
break;
}
}
}
示例11: check_get_args
// Copyright (C) 2008 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
require_once "../inc/util.inc";
require_once "../inc/uotd.inc";
require_once "../inc/profile.inc";
check_get_args(array());
db_init();
$profile = get_current_uotd();
if (!$profile) {
echo tra("No user of the day has been chosen.");
} else {
$d = gmdate("d F Y", time());
$user = lookup_user_id($profile->userid);
page_head(tra("User of the Day for %1: %2", $d, $user->name));
start_table();
show_profile($user, get_logged_in_user(false));
end_table();
}
page_tail();
示例12: get_int
//
// This file was modified by contributors of "BOINC Web Tweak" project.
require_once '../inc/util.inc';
require_once '../inc/time.inc';
require_once '../inc/forum.inc';
require_once '../inc/user.inc';
$userid = get_int("userid");
$offset = get_int("offset", true);
if (!$offset) {
$offset = 0;
}
$hide = true;
$count = 10;
$user = lookup_user_id($userid);
$logged_in_user = get_logged_in_user(false);
if ($logged_in_user = get_logged_in_user(false)) {
BoincForumPrefs::lookup($logged_in_user);
if ($user->id == $logged_in_user->id || $logged_in_user->prefs->privilege(0)) {
$hide = false;
}
}
page_head("Posts by {$user->name}");
if ($hide) {
$posts = BoincPost::enum("user={$userid} and hidden=0 order by id desc limit {$offset},{$count}");
} else {
$posts = BoincPost::enum("user={$userid} order by id desc limit {$offset},{$count}");
}
$n = 0;
start_table();
$options = get_output_options($logged_in_user);
foreach ($posts as $post) {