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


PHP identity::lookup_user方法代码示例

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


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

示例1: resolve

 static function resolve($id)
 {
     $user = identity::lookup_user($id);
     if (!self::_can_view_profile_pages($user)) {
         throw new Kohana_404_Exception();
     }
     return $user;
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:8,代码来源:user_rest.php

示例2: send

 public function send($id)
 {
     access::verify_csrf();
     $user = identity::lookup_user($id);
     $form = user_profile::get_contact_form($user);
     if ($form->validate()) {
         Sendmail::factory()->to($user->email)->subject(html::clean($form->message->subject->value))->header("Mime-Version", "1.0")->header("Content-type", "text/html; charset=iso-8859-1")->reply_to($form->message->reply_to->value)->message(html::purify($form->message->message->value))->send();
         message::success(t("Sent message to %user_name", array("user_name" => $user->display_name())));
         print json_encode(array("result" => "success"));
     } else {
         print json_encode(array("result" => "error", "form" => (string) $form));
     }
 }
开发者ID:andyst,项目名称:gallery3,代码行数:13,代码来源:user_profile.php

示例3: __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 identity::lookup_user($this->user_id);
         } catch (Exception $e) {
             Kohana_Log::add("alert", "Unable to load user with id {$this->user_id}");
             return null;
         }
     } else {
         return parent::__get($column);
     }
 }
开发者ID:JasonWiki,项目名称:docs,代码行数:18,代码来源:log.php

示例4: send

 public function send($id)
 {
     access::verify_csrf();
     $user = identity::lookup_user($id);
     if (!$this->_can_view_profile_pages($user)) {
         throw new Kohana_404_Exception();
     }
     $form = user_profile::get_contact_form($user);
     if ($form->validate()) {
         Sendmail::factory()->to($user->email)->subject(html::clean($form->message->subject->value))->header("Mime-Version", "1.0")->header("Content-type", "text/html; charset=UTF-8")->reply_to($form->message->reply_to->value)->message(html::purify($form->message->message->value))->send();
         message::success(t("Sent message to %user_name", array("user_name" => $user->display_name())));
         json::reply(array("result" => "success"));
     } else {
         json::reply(array("result" => "error", "html" => (string) $form));
     }
 }
开发者ID:kandsten,项目名称:gallery3,代码行数:16,代码来源:user_profile.php

示例5: set_active_user

 static function set_active_user($access_token)
 {
     if (empty($access_token)) {
         identity::set_active_user(identity::guest());
         return;
     }
     $key = ORM::factory("user_access_token")->where("access_key", "=", $access_token)->find();
     if (!$key->loaded()) {
         throw new Rest_Exception("Forbidden", 403);
     }
     $user = identity::lookup_user($key->user_id);
     if (empty($user)) {
         throw new Rest_Exception("Forbidden", 403);
     }
     identity::set_active_user($user);
 }
开发者ID:andyst,项目名称:gallery3,代码行数:16,代码来源:rest.php

示例6: set_active_user

 static function set_active_user($access_key)
 {
     if (empty($access_key)) {
         if (module::get_var("rest", "allow_guest_access")) {
             identity::set_active_user(identity::guest());
             return;
         } else {
             throw new Rest_Exception("Forbidden", 403);
         }
     }
     $key = ORM::factory("user_access_key")->where("access_key", "=", $access_key)->find();
     if (!$key->loaded()) {
         throw new Rest_Exception("Forbidden", 403);
     }
     $user = identity::lookup_user($key->user_id);
     if (empty($user)) {
         throw new Rest_Exception("Forbidden", 403);
     }
     identity::set_active_user($user);
 }
开发者ID:kandsten,项目名称:gallery3,代码行数:20,代码来源:rest.php

示例7: thumb_info

 static function thumb_info($theme, $item)
 {
     $results = "";
     if ($item->view_count) {
         $results .= "<li>";
         $results .= t("Views: %view_count", array("view_count" => $item->view_count));
         $results .= "</li>";
     }
     // rWatcher Edit:  Display Tags on Thumbnails
     if (module::is_active("tag")) {
         $tags = ORM::factory("tag")->join("items_tags", "tags.id", "items_tags.tag_id")->where("items_tags.item_id", "=", $item->id)->find_all();
         if (count($tags) > 0) {
             $results .= "<li>";
             $results .= t("Tags:") . " ";
             $anchors = array();
             foreach ($tags as $tag) {
                 $anchors[] = "<a href=" . $tag->url() . ">" . html::clean($tag->name) . "</a>";
             }
             $results .= join(", ", $anchors) . "</li>";
         }
     }
     // rWatcher End Edit
     if ($item->owner) {
         // rWatcher Edit:  Display profile instead of web site, if viewable.
         $str_owner_url = $item->owner->url;
         if (rwinfo_theme_Core::_can_view_profile_pages(identity::lookup_user($item->owner->id))) {
             $str_owner_url = user_profile::url($item->owner->id);
         }
         // rWatcher End Edit
         $results .= "<li>";
         if ($str_owner_url) {
             //rW Edit str_owner_url
             $results .= t("By: <a href=\"%owner_url\">%owner_name</a>", array("owner_name" => $item->owner->display_name(), "owner_url" => $str_owner_url));
             // rW Edit str_owner_url
         } else {
             $results .= t("By: %owner_name", array("owner_name" => $item->owner->display_name()));
         }
         $results .= "</li>";
     }
     return $results;
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:41,代码来源:rwinfo_theme.php

示例8: __get

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

示例9: i_can_edit_test

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

示例10: owner

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

示例11: author

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

示例12: get

 static function get($block_id, $theme)
 {
     $block = "";
     switch ($block_id) {
         case "rwinfo":
             if ($theme->item()) {
                 // rWatcher Edit: Don't display on root album.
                 if ($theme->item->id == 1) {
                     return "";
                 }
                 // End rWatcher Edit
                 $block = new Block();
                 $block->css_id = "g-metadata";
                 $block->title = $theme->item()->is_album() ? t("Album info") : ($theme->item()->is_movie() ? t("Movie info") : t("Photo info"));
                 // rWatcher Edit:  File Name change.
                 $block->content = new View("rwinfo_block.html");
                 if ($theme->item->title && module::get_var("rwinfo", "show_title")) {
                     //rWatcher Edit:  rwinfo
                     $info["title"] = array("label" => t("Title:"), "value" => html::purify($theme->item->title));
                 }
                 if ($theme->item->description && module::get_var("rwinfo", "show_description")) {
                     //rWatcher Edit:  rwinfo
                     $info["description"] = array("label" => t("Description:"), "value" => nl2br(html::purify($theme->item->description)));
                 }
                 if (!$theme->item->is_album() && module::get_var("rwinfo", "show_name")) {
                     //rWatcher Edit:  rwinfo
                     $info["file_name"] = array("label" => t("File name:"), "value" => html::clean($theme->item->name));
                 }
                 // rWatcher Edit:  Display file size
                 if (!$theme->item->is_album()) {
                     // Calculate file size.
                     $filesize_unit = array("B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB");
                     $item_filesize = filesize($theme->item->file_path());
                     $unit_counter = 0;
                     while ($item_filesize >= 1024) {
                         $item_filesize = $item_filesize / 1024;
                         $unit_counter++;
                     }
                     $item_filesize = number_format($item_filesize, 2) . " " . $filesize_unit[$unit_counter];
                     $info["file_size"] = array("label" => t("File size:"), "value" => $item_filesize);
                 }
                 // End rWatcher Edit
                 // rWatcher Edit:  Remove Show Captured for everything -- Show created DATE for album, captured DATE/TIME for everything else.
                 //if ($theme->item->captured && module::get_var("info", "show_captured")) {
                 //  $info["captured"] = array(
                 //    "label" => t("Captured:"),
                 //    "value" => gallery::date_time($theme->item->captured)
                 //  );
                 //}
                 if ($theme->item->is_album() && $theme->item->created && module::get_var("rwinfo", "show_captured")) {
                     $info["captured"] = array("label" => t("Date:"), "value" => gallery::date($theme->item->created));
                 }
                 if (!$theme->item->is_album() && $theme->item->created && module::get_var("rwinfo", "show_captured")) {
                     $info["captured"] = array("label" => t("Date:"), "value" => gallery::date_time($theme->item->captured));
                 }
                 // End rWatcher Edit
                 if ($theme->item->owner && module::get_var("info", "show_owner")) {
                     $display_name = $theme->item->owner->display_name();
                     // rWatcher Edit:  Display profile instead of web site, if viewable.
                     $str_owner_url = $theme->item->owner->url;
                     if (rwinfo_block_Core::_can_view_profile_pages(identity::lookup_user($theme->item->owner->id))) {
                         $str_owner_url = user_profile::url($theme->item->owner->id);
                     }
                     // rWatcher End Edit
                     if ($str_owner_url) {
                         //rW Edit $str_owner_url.
                         $info["owner"] = array("label" => t("Owner:"), "value" => html::anchor(html::clean($str_owner_url), html::clean($display_name)));
                     } else {
                         $info["owner"] = array("label" => t("Owner:"), "value" => html::clean($display_name));
                     }
                 }
                 if ($theme->item->width && $theme->item->height && module::get_var("info", "show_dimensions")) {
                     $info["size"] = array("label" => t("Dimensions:"), "value" => t("%width x %height px", array("width" => $theme->item->width, "height" => $theme->item->height)));
                 }
                 $block->content->metadata = $info;
                 module::event("info_block_get_metadata", $block, $theme->item);
             }
             break;
     }
     return $block;
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:81,代码来源:rwinfo_block.php


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