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


PHP url::abs_site方法代码示例

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


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

示例1: _send_reset

 private function _send_reset($form)
 {
     $user_name = $form->reset->inputs["name"]->value;
     $user = user::lookup_by_name($user_name);
     if ($user && !empty($user->email)) {
         $user->hash = random::hash();
         $user->save();
         $message = new View("reset_password.html");
         $message->confirm_url = url::abs_site("password/do_reset?key={$user->hash}");
         $message->user = $user;
         Sendmail::factory()->to($user->email)->subject(t("Password Reset Request"))->header("Mime-Version", "1.0")->header("Content-type", "text/html; charset=UTF-8")->message($message->render())->send();
         log::success("user", t("Password reset email sent for user %name", array("name" => $user->name)));
     } else {
         if (!$user) {
             // Don't include the username here until you're sure that it's XSS safe
             log::warning("user", t("Password reset email requested for user %user_name, which does not exist.", array("user_name" => $user_name)));
         } else {
             log::warning("user", t("Password reset failed for %user_name (has no email address on record).", array("user_name" => $user->name)));
         }
     }
     // Always pretend that an email has been sent to avoid leaking
     // information on what user names are actually real.
     message::success(t("Password reset email sent"));
     json::reply(array("result" => "success"));
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:25,代码来源:password.php

示例2: _send_reset

 private function _send_reset()
 {
     $form = $this->_reset_form();
     $valid = $form->validate();
     if ($valid) {
         $user = user::lookup_by_name($form->reset->inputs["name"]->value);
         if (!$user->loaded || empty($user->email)) {
             $form->reset->inputs["name"]->add_error("no_email", 1);
             $valid = false;
         }
     }
     if ($valid) {
         $user->hash = md5(rand());
         $user->save();
         $message = new View("reset_password.html");
         $message->confirm_url = url::abs_site("password/do_reset?key={$user->hash}");
         $message->user = $user;
         Sendmail::factory()->to($user->email)->subject(t("Password Reset Request"))->header("Mime-Version", "1.0")->header("Content-type", "text/html; charset=iso-8859-1")->message($message->render())->send();
         log::success("user", t("Password reset email sent for user %name", array("name" => $user->name)));
     } else {
         // Don't include the username here until you're sure that it's XSS safe
         log::warning("user", "Password reset email requested for bogus user");
     }
     message::success(t("Password reset email sent"));
     print json_encode(array("result" => "success"));
 }
开发者ID:ChrisRut,项目名称:gallery3,代码行数:26,代码来源:password.php

示例3: context_menu

 static function context_menu($menu, $theme, $item)
 {
     // Add a "Buy Prints" option to the photo's thumbnail menu.
     if ($item->type == "photo") {
         $menu->get("options_menu")->append(Menu::factory("link")->id("fotomotorw")->label(t("Buy Prints"))->url("javascript:showFotomotoDialog(100, '" . url::abs_site("fotomotorw/resize/" . md5($item->created) . "/{$item->id}") . "');")->css_class("g-print-fotomotorw-link ui-icon-print"));
     }
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:7,代码来源:fotomotorw_event.php

示例4: feed

 static function feed($feed_id, $offset, $limit, $id)
 {
     if ($feed_id != "newest" && $feed_id != "item") {
         return;
     }
     $comments = ORM::factory("comment")->where("state", "published")->orderby("created", "DESC");
     $all_comments = ORM::factory("comment")->where("state", "published")->orderby("created", "DESC");
     if ($feed_id == "item") {
         $comments->where("item_id", $id);
         $all_comments->where("item_id", $id);
     }
     if (!empty($comments)) {
         $feed->view = "comment.mrss";
         $comments = $comments->find_all($limit, $offset);
         $feed->children = array();
         foreach ($comments as $comment) {
             $item = $comment->item();
             $feed->children[] = new ArrayObject(array("pub_date" => date("D, d M Y H:i:s T", $comment->created), "text" => $comment->text, "thumb_url" => $item->thumb_url(), "thumb_height" => $item->thumb_height, "thumb_width" => $item->thumb_width, "item_uri" => url::abs_site("{$item->type}s/{$item->id}"), "title" => $item->title, "author" => $comment->author_name()), ArrayObject::ARRAY_AS_PROPS);
         }
         $feed->max_pages = ceil($all_comments->find_all()->count() / $limit);
         $feed->title = htmlspecialchars(t("Recent Comments"));
         $feed->uri = url::abs_site("albums/" . (empty($id) ? "1" : $id));
         $feed->description = t("Recent Comments");
         return $feed;
     }
 }
开发者ID:ascseb,项目名称:gallery3,代码行数:26,代码来源:comment_rss.php

示例5: send_confirmation

 static function send_confirmation($user)
 {
     $message = new View("confirm_registration.html");
     $message->confirm_url = url::abs_site("register/confirm/{$user->hash}");
     $message->user = $user;
     self::_sendemail($user->email, t("User registration confirmation"), $message);
 }
开发者ID:Glooper,项目名称:gallery3-contrib,代码行数:7,代码来源:register.php

示例6: tagitems

 public function tagitems()
 {
     // Tag all non-album items in the current album with the specified tags.
     // Prevent Cross Site Request Forgery
     access::verify_csrf();
     // Generate an array of all non-album items in the current album.
     $children = ORM::factory("item")->where("parent_id", $this->input->post("item_id"))->where("type !=", "album")->find_all();
     // Loop through each item in the album and make sure the user has
     //   access to view and edit it.
     foreach ($children as $child) {
         if (access::can("view", $child) && access::can("edit", $child)) {
             // Assuming the user can view/edit the current item, loop
             //   through each tag that was submitted and apply it to
             //   the current item.
             foreach (split(",", $this->input->post("name")) as $tag_name) {
                 $tag_name = trim($tag_name);
                 if ($tag_name) {
                     tag::add($child, $tag_name);
                 }
             }
         }
     }
     // Redirect back to the album.
     $item = ORM::factory("item", $this->input->post("item_id"));
     url::redirect(url::abs_site("{$item->type}s/{$item->id}"));
 }
开发者ID:kuranoglu,项目名称:gallery3-contrib,代码行数:26,代码来源:batchtag.php

示例7: get_email_form

 static function get_email_form($user_id, $item_id = null)
 {
     // Determine name of the person the message is going to.
     $str_to_name = "";
     if ($user_id == -1) {
         $str_to_name = module::get_var("contactowner", "contact_owner_name");
     } else {
         // Locate the record for the user specified by $user_id,
         //   use this to determine the user's name.
         $userDetails = ORM::factory("user")->where("id", "=", $user_id)->find_all();
         $str_to_name = $userDetails[0]->name;
     }
     // If item_id is set, include a link to the item.
     $email_body = "";
     if (!empty($item_id)) {
         $item = ORM::factory("item", $item_id);
         $email_body = "This message refers to <a href=\"" . url::abs_site("{$item->type}s/{$item->id}") . "\">this page</a>.";
     }
     // Make a new form with a couple of text boxes.
     $form = new Forge("contactowner/sendemail/{$user_id}", "", "post", array("id" => "g-contact-owner-send-form"));
     $sendmail_fields = $form->group("contactOwner");
     $sendmail_fields->input("email_to")->label(t("To:"))->value($str_to_name)->id("g-contactowner-to-name");
     $sendmail_fields->input("email_from")->label(t("From:"))->value(identity::active_user()->email)->id("g-contactowner-from-email")->rules('required|valid_email')->error_messages("required", t("You must enter a valid email address"))->error_messages("valid_email", t("You must enter a valid email address"))->error_messages("invalid", t("You must enter a valid email address"));
     $sendmail_fields->input("email_subject")->label(t("Subject:"))->value("")->id("g-contactowner-subject")->rules('required')->error_messages("required", t("You must enter a subject"));
     $sendmail_fields->textarea("email_body")->label(t("Message:"))->value($email_body)->id("g-contactowner-email-body")->rules('required')->error_messages("required", t("You must enter a message"));
     // Add a captcha, if there's an active captcha module.
     module::event("captcha_protect_form", $form);
     // Add a save button to the form.
     $sendmail_fields->submit("SendMessage")->value(t("Send"));
     return $form;
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:31,代码来源:contactowner.php

示例8: tags

 public function tags($id)
 {
     $tag = ORM::factory("tag", $id);
     if (!$tag->loaded) {
         return Kohana::show_404();
     }
     $page = $this->input->get("page", 1);
     if ($page < 1) {
         url::redirect("media_rss/tags/{$tag->id}");
     }
     $children = $tag->items(self::$page_size, ($page - 1) * self::$page_size, "photo");
     $max_pages = ceil($tag->count / self::$page_size);
     if ($page > $max_pages) {
         url::redirect("media_rss/tags/{$tag->id}?page={$max_pages}");
     }
     $view = new View("feed.mrss");
     $view->title = $tag->name;
     $view->link = url::abs_site("tags/{$tag->id}");
     $view->description = t("Photos related to %tag_name", array("tag_name" => $tag->name));
     $view->feed_link = url::abs_site("media_rss/tags/{$tag->id}");
     $view->children = $children;
     if ($page > 1) {
         $previous_page = $page - 1;
         $view->previous_page_link = url::site("media_rss/tags/{$tag->id}?page={$previous_page}");
     }
     if ($page < $max_pages) {
         $next_page = $page + 1;
         $view->next_page_link = url::site("media_rss/tags/{$tag->id}?page={$next_page}");
     }
     // @todo do we want to add an upload date to the items table?
     $view->pub_date = date("D, d M Y H:i:s T");
     rest::http_content_type(rest::RSS);
     print $view;
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:34,代码来源:media_rss.php

示例9: feed

 public function feed($module_id, $feed_id, $id = null)
 {
     $page = $this->input->get("page", 1);
     if ($page < 1) {
         url::redirect(url::merge(array("page" => 1)));
     }
     // Configurable page size between 1 and 100, default 20
     $page_size = max(1, min(100, $this->input->get("page_size", self::$page_size)));
     // Run the appropriate feed callback
     if (module::is_active($module_id)) {
         $class_name = "{$module_id}_rss";
         if (method_exists($class_name, "feed")) {
             $feed = call_user_func(array($class_name, "feed"), $feed_id, ($page - 1) * $page_size, $page_size, $id);
         }
     }
     if (empty($feed)) {
         Kohana::show_404();
     }
     if ($feed->max_pages && $page > $feed->max_pages) {
         url::redirect(url::merge(array("page" => $feed->max_pages)));
     }
     $view = new View(empty($feed->view) ? "feed.mrss" : $feed->view);
     unset($feed->view);
     $view->feed = $feed;
     $view->pub_date = date("D, d M Y H:i:s T");
     $feed->uri = url::abs_site(Router::$current_uri);
     if ($page > 1) {
         $feed->previous_page_uri = url::abs_site(url::merge(array("page" => $page - 1)));
     }
     if ($page < $feed->max_pages) {
         $feed->next_page_uri = url::abs_site(url::merge(array("page" => $page + 1)));
     }
     rest::http_content_type(rest::RSS);
     print $view;
 }
开发者ID:Okat,项目名称:gallery3,代码行数:35,代码来源:rss.php

示例10: feed

 public function feed($module_id, $feed_id, $id = null)
 {
     $page = (int) Input::instance()->get("page", 1);
     if ($page < 1) {
         url::redirect(url::merge(array("page" => 1)));
     }
     // Configurable page size between 1 and 100, default 20
     $page_size = max(1, min(100, (int) Input::instance()->get("page_size", self::$page_size)));
     // Run the appropriate feed callback
     if (module::is_active($module_id)) {
         $class_name = "{$module_id}_rss";
         if (method_exists($class_name, "feed")) {
             $feed = call_user_func(array($class_name, "feed"), $feed_id, ($page - 1) * $page_size, $page_size, $id);
         }
     }
     if (empty($feed)) {
         throw new Kohana_404_Exception();
     }
     if ($feed->max_pages && $page > $feed->max_pages) {
         url::redirect(url::merge(array("page" => $feed->max_pages)));
     }
     $view = new View(empty($feed->view) ? "feed.mrss" : $feed->view);
     unset($feed->view);
     $view->feed = $feed;
     $view->pub_date = date("D, d M Y H:i:s T");
     $feed->uri = url::abs_site(url::merge($_GET));
     if ($page > 1) {
         $feed->previous_page_uri = url::abs_site(url::merge(array("page" => $page - 1)));
     }
     if ($page < $feed->max_pages) {
         $feed->next_page_uri = url::abs_site(url::merge(array("page" => $page + 1)));
     }
     header("Content-Type: application/rss+xml");
     print $view;
 }
开发者ID:kandsten,项目名称:gallery3,代码行数:35,代码来源:rss.php

示例11: send_admin_notify

 static function send_admin_notify($user)
 {
     $message = new View("register_admin_notify.html");
     $message->admin_register_url = url::abs_site("admin/register");
     $message->user = $user;
     $message->subject_prefix = module::get_var("registration", "subject_prefix");
     $message->locale = module::get_var("gallery", "default_locale");
     // as Gallery default
     $message->subject = t("New pending user registration", array("locale" => $message->locale));
     self::_sendemail(module::get_var("gallery", "email_reply_to"), $message->subject_prefix . $message->subject, $message);
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:11,代码来源:register.php

示例12: albums

 static function albums($offset, $limit, $id)
 {
     $item = ORM::factory("item", $id);
     access::required("view", $item);
     $feed = new stdClass();
     $feed->data["children"] = $item->viewable()->descendants($limit, $offset, "photo");
     $feed->max_pages = ceil($item->viewable()->descendants_count("photo") / $limit);
     $feed->data["title"] = $item->title;
     $feed->data["link"] = url::abs_site("albums/{$item->id}");
     $feed->data["description"] = $item->description;
     return $feed;
 }
开发者ID:kstyrvoll,项目名称:gallery3,代码行数:12,代码来源:gallery_rss.php

示例13: head

 static function head($theme)
 {
     // If the current page is an item, and if it's in the tags_album_id table,
     //   then redirect to the tag_albums page.
     if ($theme->item()) {
         $album_tags = ORM::factory("tags_album_id")->where("album_id", "=", $theme->item->id)->find_all();
         if (count($album_tags) > 0) {
             url::redirect(url::abs_site("tag_albums/album/" . $album_tags[0]->id . "/" . urlencode($theme->item->name)));
         }
     }
     return;
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:12,代码来源:tag_albums_theme.php

示例14: map

 public function map($map_type, $type_id)
 {
     // Map all items in the specified album or user.
     $map_title = "";
     if ($map_type == "album") {
         // Generate an array of all items in the current album that have exif gps
         //   coordinates and order by latitude (to group items w/ the same
         //   coordinates together).
         $items = ORM::factory("item", $type_id)->join("exif_coordinates", "items.id", "exif_coordinates.item_id")->viewable()->order_by("exif_coordinates.latitude", "ASC")->descendants();
         $curr_album = ORM::factory("item")->where("id", "=", $type_id)->find_all();
         $map_title = $curr_album[0]->name;
     } elseif ($map_type == "user") {
         // Generate an array of all items uploaded by the current user that
         //   have exif gps coordinates and order by latitude (to group items
         //   w/ the same coordinates together).
         $items = ORM::factory("item")->join("exif_coordinates", "items.id", "exif_coordinates.item_id")->where("items.owner_id", "=", $type_id)->viewable()->order_by("exif_coordinates.latitude", "ASC")->find_all();
         $curr_user = ORM::factory("user")->where("id", "=", $type_id)->find_all();
         $map_title = $curr_user[0]->full_name . "'s " . t("Photos");
     }
     // Make a new page.
     $template = new Theme_View("page.html", "other", "EXIFMap");
     $template->page_title = t("Gallery :: Map");
     $template->content = new View("exif_gps_map.html");
     if ($map_title == "") {
         $template->content->title = t("Map");
     } else {
         $template->content->title = t("Map of") . " " . $map_title;
     }
     // Figure out default map type.
     $int_map_type = module::get_var("exif_gps", "largemap_maptype");
     if ($int_map_type == 0) {
         $map_type = "ROADMAP";
     }
     if ($int_map_type == 1) {
         $map_type = "SATELLITE";
     }
     if ($int_map_type == 2) {
         $map_type = "HYBRID";
     }
     if ($int_map_type == 3) {
         $map_type = "TERRAIN";
     }
     $template->content->map_type = $map_type;
     // When mapping an album, generate a "return to album" link.
     if (isset($curr_album)) {
         $template->content->return_url = url::abs_site("{$curr_album[0]->type}s/{$curr_album[0]->id}");
     }
     // Load in module preferences.
     $template->content->items = $items;
     $template->content->google_map_key = module::get_var("exif_gps", "googlemap_api_key");
     // Display the page.
     print $template;
 }
开发者ID:Glooper,项目名称:gallery3-contrib,代码行数:53,代码来源:exif_gps.php

示例15: shorten

 /**
  * Shorten a G3 item's link and display the result in a status message.
  * @param int   $item_id
  */
 public function shorten($item_id)
 {
     // Prevent Cross Site Request Forgery
     access::verify_csrf();
     $item = ORM::factory("item", $item_id);
     // Ensure user has permission
     access::required("view", $item);
     access::required("edit", $item);
     // Get the item's URL and shorten it
     $short_url = bitly::shorten_url($item_id);
     // Redirect back to the item
     url::redirect(url::abs_site($item->relative_url_cache));
 }
开发者ID:Retroguy,项目名称:gallery3-contrib,代码行数:17,代码来源:bitly.php


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