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


PHP getLoggedInUser函数代码示例

本文整理汇总了PHP中getLoggedInUser函数的典型用法代码示例。如果您正苦于以下问题:PHP getLoggedInUser函数的具体用法?PHP getLoggedInUser怎么用?PHP getLoggedInUser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: __construct

 public function __construct()
 {
     gateKeeper();
     $guid = getInput("guid");
     $title = getInput("blog_title");
     $description = getInput("description");
     $access_id = getInput("access_id");
     $container_guid = getInput("container_guid");
     $owner_guid = getLoggedInUserGuid();
     if ($guid) {
         $blog = getEntity($guid);
     } else {
         $blog = new Blog();
     }
     $blog->title = $title;
     $blog->description = $description;
     $blog->access_id = $access_id;
     $blog->owner_guid = $owner_guid;
     $blog->status = "published";
     $blog->container_guid = $container_guid;
     $blog->save();
     new Activity(getLoggedInUserGuid(), "blog:add", array(getLoggedInUser()->getURL(), getLoggedInUser()->full_name, $blog->getURL(), $blog->title, truncate($blog->description)), "", $access_id);
     new SystemMessage("Your blog has been published");
     forward("blogs/all_blogs");
 }
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:25,代码来源:AddBlogActionHandler.php

示例2: doAuth

function doAuth($info, $trusted = null, $fail_cancels = false)
{
    if (!$info) {
        // There is no authentication information, so bail
        return authCancel(null);
    }
    $req_url = $info->identity;
    $user = getLoggedInUser();
    setRequestInfo($info);
    if ($req_url != $user) {
        return login_render(array(), $req_url, $req_url);
    }
    $sites = getSessionSites();
    $trust_root = $info->trust_root;
    $fail_cancels = $fail_cancels || isset($sites[$trust_root]);
    $trusted = isset($trusted) ? $trusted : isTrusted($req_url, $trust_root);
    if ($trusted) {
        setRequestInfo();
        $server =& getServer();
        $response =& $info->answer(true);
        $webresponse =& $server->encodeResponse($response);
        $new_headers = array();
        foreach ($webresponse->headers as $k => $v) {
            $new_headers[] = $k . ": " . $v;
        }
        return array($new_headers, $webresponse->body);
    } elseif ($fail_cancels) {
        return authCancel($info);
    } else {
        return trust_render($info);
    }
}
开发者ID:honchoman,项目名称:singpolyma,代码行数:32,代码来源:common.php

示例3: __construct

 public function __construct()
 {
     gateKeeper();
     $user = getLoggedInUser();
     $user->createAvatar();
     if (isEnabledPlugin("photos")) {
         $album = getEntity(array("type" => "Photoalbum", "metadata_name_value_pairs" => array(array("name" => "owner_guid", "value" => getLoggedInUserGuid()), array("name" => "title", "value" => "Profile Avatars"))));
         $photo = new Photo();
         $photo->owner_guid = getLoggedInUserGuid();
         $photo_guid = $photo->save();
         Image::copyAvatar($user, $photo);
         $photo = getEntity($photo_guid);
         if (!$album) {
             $album = new Photoalbum();
             $album->owner_guid = getLoggedInUserGuid();
             $album->title = "Profile Avatars";
             $album_guid = $album->save();
             $album = getEntity($album_guid);
             Image::copyAvatar($photo, $album);
         }
         $photo->container_guid = $album->guid;
         $photo->save();
     }
     runHook("action:edit_avatar:after", array("user" => $user));
     new Activity(getLoggedInUserGuid(), "activity:avatar:updated", array($user->getURL(), $user->full_name));
     new SystemMessage("Your avatar has been uploaded.");
     forward("profile/" . $user->guid);
 }
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:28,代码来源:EditAvatarActionHandler.php

示例4: init

 public function init($file)
 {
     if (!loggedIn()) {
         return false;
     }
     if (!is_a($file, "SocialApparatus\\File")) {
         return false;
     }
     $product = getEntity($file->container_guid);
     if (!is_a($product, "SocialApparatus\\Product")) {
         return false;
     }
     $user = getLoggedInUser();
     if ($user->stripe_cust) {
         \Stripe\Stripe::setApiKey(EcommercePlugin::secretKey());
         $orders = \Stripe\Order::all(array("limit" => 300, "customer" => $user->stripe_cust));
         foreach ($orders['data'] as $order) {
             foreach ($order->items as $item) {
                 if ($item->description != "Taxes (included)" && $item->description != "Free shipping") {
                     $sku = $item->parent;
                     if ($sku == $product->stripe_sku) {
                         return true;
                     }
                 }
             }
         }
     }
     return false;
 }
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:29,代码来源:ProductAccessHandler.php

示例5: __construct

 public function __construct()
 {
     gateKeeper();
     $message = NULL;
     $user = getLoggedInUser();
     $user->profile_complete = true;
     $profile_type = $user->profile_type;
     $fields = ProfileField::get($profile_type);
     foreach ($fields as $key => $field) {
         if ($field['required'] == "true" && !getInput($key)) {
             $message .= "{$field['label']} cannot be empty.";
         }
     }
     if ($message) {
         new SystemMessage($message);
         forward("editProfile");
     }
     foreach ($fields as $key => $field) {
         $user->{$key} = getInput($key);
     }
     $user->save();
     new Activity($user->guid, "activity:profile:updated", array($user->getURL(), $user->full_name));
     new SystemMessage("Your profile has been updated.");
     forward("profile/{$user->guid}");
 }
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:25,代码来源:EditProfileActionHandler.php

示例6: __construct

 public function __construct()
 {
     $editor = getInput("editor_id");
     if (file_exists($_FILES['avatar']['tmp_name'])) {
         // Check if General album exists
         $album = getEntity(array("type" => "Photoalbum", "metadata_name_value_pairs" => array(array("name" => "owner_guid", "value" => getLoggedInUserGuid()), array("name" => "title", "value" => "General"))));
         $photo = new Photo();
         $photo->owner_guid = getLoggedInUserGuid();
         $photo->save();
         $photo->createAvatar();
         if (!$album) {
             $album = new Photoalbum();
             $album->title = "General";
             $album->owner_guid = getLoggedInUserGuid();
             $album->access_id = "public";
             Image::copyAvatar($photo, $album);
             $album->save();
         }
         $photo->container_guid = $album->guid;
         if (!$album->title != "Profile Avatars" && $album->title != "General") {
             new Activity(getLoggedInUserGuid(), "activity:add:photo", array(getLoggedInUser()->getURL(), getLoggedInUser()->full_name, $album->getURL(), $album->title, "<a href='" . $album->getURL() . "'>" . $photo->icon(EXTRALARGE, "img-responsive") . "</a>"), $album->access_id);
         }
         $photo->save();
         forward(false, array("insertphoto" => $photo->guid, "editor" => $editor));
     } else {
         forward();
     }
 }
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:28,代码来源:UploadPhotoActionHandler.php

示例7: __construct

 public function __construct()
 {
     gateKeeper();
     $title = getInput("title");
     $description = getInput("description");
     $access_id = getInput("access_id");
     $membership = getInput("membership");
     $group = new Group();
     $group->title = $title;
     $group->description = $description;
     $group->access_id = $access_id;
     $group->membership = $membership;
     $group->owner_guid = getLoggedInUserGuid();
     $group->save();
     $group->createAvatar();
     $test = getEntity(array("type" => "Groupmembership", "metadata_name_value_pairs" => array(array("name" => "group", "value" => $group->guid), array("name" => "member_guid", "value" => getLoggedInUserGuid()))));
     if (!$test) {
         $group_membership = new Groupmembership();
         $group_membership->group = $group->guid;
         $group_membership->member_guid = getLoggedInUserGuid();
         $group_membership->access_id = "system";
         $group_membership->save();
     }
     new Activity(getLoggedInUserGuid(), "group:created", array(getLoggedInUser()->getURL(), getLoggedInUser()->full_name, $group->getURL(), $group->title), $group->guid);
     new SystemMessage("Your group has been created.");
     forward("groups");
 }
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:27,代码来源:CreateGroupActionHandler.php

示例8: __construct

 function __construct()
 {
     $guid = getInput("guid");
     $reply = getInput("reply");
     if (!$reply) {
         new SystemMessage("Message body cannot be left empty.");
         forward();
     }
     $message = getEntity($guid);
     $to = getLoggedInUserGuid() == $message->to ? $message->from : $message->to;
     $from = getLoggedInUserGuid();
     $to_user = getEntity($to);
     $from_user = getEntity($from);
     $message_element = new Messageelement();
     $message_element->message = $reply;
     $message_element->to = $to;
     $message_element->from = $from;
     $message_element->container_guid = $guid;
     $message_element->save();
     $link = getSiteURL() . "messages";
     notifyUser("message", $to, getLoggedInUserGuid(), $to);
     sendEmail(array("to" => array("name" => $to_user->full_name, "email" => $to_user->email), "from" => array("name" => getSiteName(), "email" => getSiteEmail()), "subject" => "You have a new message from " . getLoggedInUser()->full_name, "body" => "You have received a new message from " . getLoggedInUser()->full_name . "<br/><a href='{$link}'>Click here to view it.</a>", "html" => true));
     new SystemMessage("Your message has been sent.");
     forward("messages/" . $message->guid);
 }
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:25,代码来源:MessageReplyActionHandler.php

示例9: __construct

 function __construct()
 {
     \Stripe\Stripe::setApiKey(EcommercePlugin::secretKey());
     $order_items = array();
     $user = getLoggedInUser();
     $stripe_cust = $user->stripe_cust;
     $cart = Cache::get("cart", "session");
     if (!$stripe_cust) {
         try {
             $cu = \Stripe\Customer::create(array("description" => $user->email, "source" => getInput("stripeToken")));
         } catch (Exception $e) {
             new SystemMessage("There has been an error.  Please contact us.");
             forward("home");
         }
         $user->stripe_cust = $cu->id;
         $user->save();
     } else {
         $cu = \Stripe\Customer::retrieve($stripe_cust);
         try {
             $cu->source = getInput("stripeToken");
         } catch (Exception $e) {
             new SystemMessage("There has been an error.  Please contact us.");
             forward("home");
         }
         $cu->save();
     }
     foreach ($cart as $guid => $details) {
         $product = getEntity($guid);
         if ($product->interval == "one_time") {
             $order_item = array("type" => "sku", "parent" => $product->stripe_sku, "description" => $product->description . $details);
             $order_items[] = $order_item;
         } else {
             try {
                 $cu->subscriptions->create(array("plan" => $guid));
             } catch (Exception $e) {
                 new SystemMessage("There has been an error.  Please contact us.");
                 forward("home");
             }
         }
     }
     if (!empty($order_items)) {
         try {
             $order = \Stripe\Order::create(array("items" => $order_items, "currency" => "usd", "customer" => $cu->id));
             $order->pay(array("customer" => $cu->id, "email" => $user->email));
         } catch (Exception $e) {
             new SystemMessage("There has been an error.  Please contact us.");
             forward("home");
         }
     }
     $invoice = new Invoice();
     $invoice->items = $cart;
     $invoice->status = "paid";
     $invoice->owner_guid = getLoggedInUserGuid();
     $invoice->stripe_order = $order->id;
     $invoice->save();
     Cache::delete("cart", "session");
     new SystemMessage("Your purchase is complete.");
     forward("billing");
 }
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:59,代码来源:ChargeCardActionHandler.php

示例10: trust_render

function trust_render($info)
{
    $current_user = getLoggedInUser();
    $lnk = link_render($current_user);
    $trust_root = htmlspecialchars($info->trust_root);
    $trust_url = buildURL('trust', true);
    $form = sprintf(trust_form_pat, $lnk, $trust_root, $trust_url);
    return page_render($form, $current_user, 'Trust This Site');
}
开发者ID:honchoman,项目名称:singpolyma,代码行数:9,代码来源:trust.php

示例11: __construct

 public function __construct()
 {
     runHook("action:logout:before");
     $user = getLoggedInUser();
     if ($user) {
         $user->logout();
     }
     runHook("action:logout:after");
     new SystemMessage(translate("system_message:logged_out"));
     forward("home");
 }
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:11,代码来源:LogoutActionHandler.php

示例12: sites_render

function sites_render($sites)
{
    if ($sites) {
        $rows = siteList_render($sites);
        $form = sprintf(sites_form, buildURL('sites'), $rows);
        $body = $pre . $form;
    } else {
        $body = sprintf(sites_empty_message, link_render(buildURL(''), 'Return home'));
    }
    return page_render($body, getLoggedInUser(), 'Remembered Sites');
}
开发者ID:honchoman,项目名称:singpolyma,代码行数:11,代码来源:sites.php

示例13: action_default

/**
 * Handle a standard OpenID server request
 */
function action_default()
{
    header('X-XRDS-Location: ' . buildURL('idpXrds'));
    $server = getServer();
    $method = $_SERVER['REQUEST_METHOD'];
    $request = null;
    if ($method == 'GET') {
        $request = $_GET;
    } else {
        $request = $_POST;
    }
    $request = $server->decodeRequest();
    if (!$request) {
        return about_render();
    }
    setRequestInfo($request);
    if (in_array($request->mode, array('checkid_immediate', 'checkid_setup'))) {
        if ($request->idSelect()) {
            // Perform IDP-driven identifier selection
            if ($request->mode == 'checkid_immediate') {
                $response = $request->answer(false);
            } else {
                return trust_render($request);
            }
        } else {
            if (!$request->identity && !$request->idSelect()) {
                // No identifier used or desired; display a page saying
                // so.
                return noIdentifier_render();
            } else {
                if ($request->immediate) {
                    $response = $request->answer(false, buildURL());
                } else {
                    if (!getLoggedInUser()) {
                        return login_render();
                    }
                    return trust_render($request);
                }
            }
        }
    } else {
        $response = $server->handleRequest($request);
    }
    $webresponse = $server->encodeResponse($response);
    if ($webresponse->code != AUTH_OPENID_HTTP_OK) {
        header(sprintf("HTTP/1.1 %d ", $webresponse->code), true, $webresponse->code);
    }
    foreach ($webresponse->headers as $k => $v) {
        header("{$k}: {$v}");
    }
    header(header_connection_close);
    print $webresponse->body;
    exit(0);
}
开发者ID:marcioyonamine,项目名称:php-openid,代码行数:57,代码来源:actions.php

示例14: about_render

/**
 * Render the about page, potentially with an error message
 */
function about_render($error = false, $internal = true)
{
    $headers = array();
    $body = sprintf(about_body, buildURL());
    if ($error) {
        $headers[] = $internal ? http_internal_error : http_bad_request;
        $body .= sprintf(about_error_template, htmlspecialchars($error));
    }
    $current_user = getLoggedInUser();
    return page_render($body, $current_user, 'OpenID Server Endpoint');
}
开发者ID:matheuscsc,项目名称:finalproject,代码行数:14,代码来源:about.php

示例15: __construct

 public function __construct()
 {
     gateKeeper();
     $topic = new Forumtopic();
     $topic->title = getInput("title");
     $topic->description = getInput("description");
     $topic->container_guid = getInput("container_guid");
     $topic->save();
     new SystemMessage("Your topic has been posted.");
     new Activity(getLoggedInUserGuid(), "forum:topic:posted", $params = array(getLoggedInUser()->getURL(), getLoggedInUser()->full_name, $topic->getURL(), $topic->title, getEntity($topic->container_guid)->getURL(), getEntity($topic->container_guid)->title), getInput("container_guid"));
     forward("forum/category/" . getInput("container_guid"));
 }
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:12,代码来源:AddTopicActionHandler.php


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