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


PHP user::lookup方法代码示例

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


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

示例1: create_comment_for_user_test

 public function create_comment_for_user_test()
 {
     $rand = rand();
     $root = ORM::factory("item", 1);
     $admin = user::lookup(2);
     $comment = comment::create($root, $admin, "text_{$rand}", "name_{$rand}", "email_{$rand}", "url_{$rand}");
     $this->assert_equal($admin->full_name, $comment->author_name());
     $this->assert_equal($admin->email, $comment->author_email());
     $this->assert_equal($admin->url, $comment->author_url());
     $this->assert_equal("text_{$rand}", $comment->text);
     $this->assert_equal(1, $comment->item_id);
     $this->assert_equal("REMOTE_ADDR", $comment->server_remote_addr);
     $this->assert_equal("HTTP_USER_AGENT", $comment->server_http_user_agent);
     $this->assert_equal("HTTP_ACCEPT", $comment->server_http_accept);
     $this->assert_equal("HTTP_ACCEPT_CHARSET", $comment->server_http_accept_charset);
     $this->assert_equal("HTTP_ACCEPT_ENCODING", $comment->server_http_accept_encoding);
     $this->assert_equal("HTTP_ACCEPT_LANGUAGE", $comment->server_http_accept_language);
     $this->assert_equal("HTTP_CONNECTION", $comment->server_http_connection);
     $this->assert_equal("HTTP_HOST", $comment->server_http_host);
     $this->assert_equal("HTTP_REFERER", $comment->server_http_referer);
     $this->assert_equal("HTTP_USER_AGENT", $comment->server_http_user_agent);
     $this->assert_equal("QUERY_STRING", $comment->server_query_string);
     $this->assert_equal("REMOTE_ADDR", $comment->server_remote_addr);
     $this->assert_equal("REMOTE_HOST", $comment->server_remote_host);
     $this->assert_equal("REMOTE_PORT", $comment->server_remote_port);
     $this->assert_true(!empty($comment->created));
 }
开发者ID:xafr,项目名称:gallery3,代码行数:27,代码来源:Comment_Helper_Test.php

示例2: form_edit

 public function form_edit($id)
 {
     $user = user::lookup($id);
     if ($user->guest || $user->id != user::active()->id) {
         access::forbidden();
     }
     print $this->_get_edit_form($user);
 }
开发者ID:CardinS2U,项目名称:gallery3,代码行数:8,代码来源:users.php

示例3: form_edit

 public function form_edit($id)
 {
     $user = user::lookup($id);
     if ($user->guest || $user->id != identity::active_user()->id) {
         access::forbidden();
     }
     $v = new View("user_form.html");
     $v->form = $this->_get_edit_form($user);
     print $v;
 }
开发者ID:joericochuyt,项目名称:gallery3,代码行数:10,代码来源:users.php

示例4: __get

 /**
  * @see ORM::__get()
  */
 public function __get($column)
 {
     if ($column == "user") {
         // This relationship depends on an outside module, which may not be present so handle
         // failures gracefully.
         try {
             return user::lookup($this->user_id);
         } catch (Exception $e) {
             return null;
         }
     } else {
         return parent::__get($column);
     }
 }
开发者ID:CardinS2U,项目名称:gallery3,代码行数:17,代码来源:log.php

示例5: remove_user_from_group

 public function remove_user_from_group($user_id, $group_id)
 {
     access::verify_csrf();
     $group = group::lookup($group_id);
     $user = user::lookup($user_id);
     $group->remove($user);
     $group->save();
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:8,代码来源:admin_users.php

示例6: evidence_get_assoc

function evidence_get_assoc($snap, $variant_id)
{
    $rows =& evidence_get_report($snap, $variant_id);
    global $gWantKeysForAssoc;
    if (!is_array($gWantKeysForAssoc["variant"])) {
        foreach ($gWantKeysForAssoc as $k => &$v) {
            if ($k == "all") {
                continue;
            }
            $v = explode(" ", $gWantKeysForAssoc["all"] . " " . $v);
        }
    }
    $variant = array("genomes" => array(), "articles" => array(), "diseases" => array());
    for ($i = 0; $i < sizeof($rows); $i++) {
        $row =& $rows[$i];
        $editor = user::lookup($row["edit_oid"]);
        $row["editor_name"] = $editor->get("fullname");
        if (strlen($row["summary_long"]) == 0) {
            $row["summary_long"] = $row["summary_short"];
        }
        if ($row["article_pmid"] > 0) {
            $section =& $variant["articles"]["" . $row["article_pmid"]];
            $want_keys =& $gWantKeysForAssoc["article"];
        } else {
            if ($row["genome_id"] > 0) {
                $section =& $variant["genomes"]["" . $row["genome_id"]];
                $want_keys =& $gWantKeysForAssoc["genome"];
            } else {
                $section =& $variant;
                $want_keys =& $gWantKeysForAssoc["variant"];
                $row["aa_change"] = $row["variant_aa_from"] . $row["variant_aa_pos"] . $row["variant_aa_to"];
                $row["aa_change_short"] = aa_short_form($row["aa_change"]);
                // TODO: combine these into one array and add labels
                $row["quality_scores"] = str_split(str_pad($row["variant_quality"], 6, "-"));
                $row["quality_comments"] = $row["variant_quality_text"] ? json_decode($row["variant_quality_text"], true) : array();
                $diseases = evidence_get_all_oddsratios($rows);
                unset($max_or_id);
                foreach ($diseases as $id => &$d) {
                    if (!isset($max_or_id) || $diseases[$max_or_id]["figs"]["or"] < $d["figs"]["or"]) {
                        $max_or_id = $id;
                    }
                }
                if (isset($max_or_id)) {
                    $row["disease_max_or"] = $diseases[$max_or_id];
                }
            }
        }
        if ($row["disease_id"] > 0) {
            $section =& $section["diseases"]["" . $row["disease_id"]];
            if (ereg('^\\[', $row["summary_short"])) {
                $row = array_merge(json_decode($row["summary_short"], true), $row);
            }
            $want_keys =& $gWantKeysForAssoc["disease"];
        }
        foreach ($want_keys as $k) {
            list($inkey, $outkey) = explode(":", $k);
            if (!$outkey) {
                $outkey = $inkey;
            }
            $section[$outkey] = $row[$inkey];
        }
        unset($section);
    }
    foreach (array("articles", "genomes") as $section) {
        $variant[$section] = array_values($variant[$section]);
        foreach ($variant[$section] as &$x) {
            if (is_array($x["diseases"])) {
                $x["diseases"] = array_values($x["diseases"]);
            }
        }
    }
    return $variant;
}
开发者ID:jwssb90,项目名称:get-evidence,代码行数:73,代码来源:evidence.php

示例7: form_change_email

 public function form_change_email($id)
 {
     $user = user::lookup($id);
     if (!$user || $user->guest || $user->id != identity::active_user()->id) {
         access::forbidden();
     }
     print $this->_get_change_email_form($user);
 }
开发者ID:kandsten,项目名称:gallery3,代码行数:8,代码来源:users.php

示例8: lookup_user

 /**
  * @see IdentityProvider_Driver::lookup_user.
  */
 public function lookup_user($id)
 {
     return user::lookup($id);
 }
开发者ID:kandsten,项目名称:gallery3,代码行数:7,代码来源:Gallery.php

示例9: change_password

 public function change_password($id, $password)
 {
     $user = user::lookup($id);
     print $this->_get_change_password_form($user, $password);
 }
开发者ID:Glooper,项目名称:gallery3-contrib,代码行数:5,代码来源:register.php

示例10:

        echo $layout;
        ?>
" data-width="180" data-show-faces="<?php 
        echo $show_faces;
        ?>
" data-action="<?php 
        echo $action;
        ?>
"></div>

<?php 
    }
}
?>
</div>
<?php 
/**
 * Only show the like button, css and JS if the item is vewable by the guest user 
 * as facebook is a guest user to get the thumb of the item.  If this is a dynamic 
 * album then use the root album to check to see if the guest has permissions.
 */
$guest = user::lookup("1");
$item = "";
if ($theme->item()) {
    $item = $theme->item();
} else {
    $item = ORM::factory("item", 1);
}
if (access::user_can($guest, "view", $item)) {
    $show_like_code = true;
}
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:31,代码来源:facebook_like.html.php

示例11: author

 function author()
 {
     return user::lookup($this->author_id);
 }
开发者ID:jhilden,项目名称:gallery3,代码行数:4,代码来源:comment.php

示例12: owner

 public function owner()
 {
     return user::lookup($this->owner_id);
 }
开发者ID:hiwilson,项目名称:gallery3,代码行数:4,代码来源:task.php

示例13: i_can_edit_test

 public function i_can_edit_test()
 {
     // Create a new user that belongs to no groups
     $user = user::create("access_test", "Access Test", "");
     foreach ($user->groups as $group) {
         $user->remove($group);
     }
     $user->save();
     user::set_active($user);
     // This user can't edit anything
     $root = ORM::factory("item", 1);
     $this->assert_false(access::can("edit", $root));
     // Now add them to a group that has edit permission
     $group = group::create("access_test");
     $group->add($user);
     $group->save();
     access::allow($group, "edit", $root);
     $user = user::lookup($user->id);
     // reload() does not flush related columns
     user::set_active($user);
     // And verify that the user can edit.
     $this->assert_true(access::can("edit", $root));
 }
开发者ID:CardinS2U,项目名称:gallery3,代码行数:23,代码来源:Access_Helper_Test.php


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