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


PHP BoincUser::lookup方法代码示例

本文整理汇总了PHP中BoincUser::lookup方法的典型用法代码示例。如果您正苦于以下问题:PHP BoincUser::lookup方法的具体用法?PHP BoincUser::lookup怎么用?PHP BoincUser::lookup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BoincUser的用法示例。


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

示例1: add_admin

function add_admin($team)
{
    $email_addr = get_str('email_addr');
    $user = BoincUser::lookup("email_addr='{$email_addr}'");
    if (!$user) {
        error_page(tra("no such user"));
    }
    if ($user->teamid != $team->id) {
        error_page(tra("User is not member of team"));
    }
    if (is_team_admin($user, $team)) {
        error_page(tra("%1 is already an admin of %2", $email_addr, $team->name));
    }
    $now = time();
    $ret = BoincTeamAdmin::insert("(teamid, userid, create_time) values ({$team->id}, {$user->id}, {$now})");
    if (!$ret) {
        error_page(tra("Couldn't add admin"));
    }
}
开发者ID:nicolas17,项目名称:boincgit-test,代码行数:19,代码来源:team_admins.php

示例2: authenticate_user

function authenticate_user($r, $app)
{
    $auth = (string) $r->authenticator;
    if (!$auth) {
        error("no authenticator");
    }
    $user = BoincUser::lookup("authenticator='{$auth}'");
    if (!$user) {
        error("bad authenticator");
    }
    $user_submit = BoincUserSubmit::lookup_userid($user->id);
    if (!$user_submit) {
        error("no submit access");
    }
    if ($app && !$user_submit->submit_all) {
        $usa = BoincUserSubmitApp::lookup("user_id={$user->id} and app_id={$app->id}");
        if (!$usa) {
            error("no submit access");
        }
    }
    return array($user, $user_submit);
}
开发者ID:nicolas17,项目名称:boincgit-test,代码行数:22,代码来源:submit_rpc_handler.php

示例3: check_get_args

// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
// Show results with pending credit for a user
require_once "../inc/util.inc";
require_once "../inc/boinc_db.inc";
require_once "../inc/xml.inc";
check_get_args(array("format", "authenticator"));
BoincDb::get(true);
$config = get_config();
if (!parse_bool($config, "show_results")) {
    error_page("This feature is turned off temporarily");
}
$format = get_str("format", true);
if ($format == "xml") {
    xml_header();
    $auth = BoincDb::escape_string(get_str('authenticator'));
    $user = BoincUser::lookup("authenticator='{$auth}'");
    if (!$user) {
        echo "<error>" . xml_error(-136) . "</error>\n";
        exit;
    }
    $sum = 0;
    echo "<pending_credit>\n";
    $results = BoincResult::enum("userid={$user->id} AND (validate_state=0 OR validate_state=4) AND claimed_credit > 0");
    foreach ($results as $result) {
        echo "<result>\n";
        echo "    <resultid>" . $result->id . "</resultid>\n";
        echo "    <workunitid>" . $result->workunitid . "</workunitid>\n";
        echo "    <hostid>" . $result->hostid . "</hostid>\n";
        echo "    <claimed_credit>" . $result->claimed_credit . "</claimed_credit>\n";
        echo "    <received_time>" . $result->received_time . "</received_time>\n";
        echo "</result>\n";
开发者ID:nicolas17,项目名称:boincgit-test,代码行数:31,代码来源:pending.php

示例4: xml_header

//
// This file was modified by contributors of "BOINC Web Tweak" project.
// RPC handler for account lookup
require_once "../inc/boinc_db.inc";
require_once "../inc/util.inc";
require_once "../inc/email.inc";
require_once "../inc/xml.inc";
xml_header();
$retval = db_init_xml();
if ($retval) {
    xml_error($retval);
}
$email_addr = get_str("email_addr");
$passwd_hash = get_str("passwd_hash", true);
$email_addr = BoincDb::escape_string($email_addr);
$user = BoincUser::lookup("email_addr='{$email_addr}'");
if (!$user) {
    xml_error(-136);
}
if (!$passwd_hash) {
    echo "<account_out>\r\n\t<success/>\r\n</account_out>\r\n";
    exit;
}
$auth_hash = md5($user->authenticator . $user->email_addr);
// if no password set, set password to account key
//
if (!strlen($user->passwd_hash)) {
    $user->passwd_hash = $auth_hash;
    $user->update("passwd_hash='{$user->passwd_hash}'");
}
// if the given password hash matches (auth+email), accept it
开发者ID:Turante,项目名称:boincweb,代码行数:31,代码来源:lookup_account.php


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