示例#1
0
function get_gateway_variables()
{
    /*
     $user =  get_loggedin_user()->name ;
     $domain = $vars['entity']->cclite_payment_domain ;
     $protocol = $vars['entity']->cclite_transfer_protocol ;
     $apikey = $vars['entity']->cclite_api_key;
     $hashing = $vars['entity']->cclite_hashing_algorithm;
     $registry = $vars['entity']->cclite_registry;
     $limit = $vars['entity']->cclite_api_transaction_display_limit ;
    */
    $user = get_loggedin_user()->name;
    $domain = get_plugin_setting('cclite_payment_domain', 'cclite');
    $protocol = get_plugin_setting('cclite_protocol', 'cclite');
    $apikey = get_plugin_setting('cclite_api_key', 'cclite');
    $hashing = get_plugin_setting('cclite_hashing_algorithm', 'cclite');
    $registry = get_plugin_setting('cclite_registry', 'cclite');
    $limit = get_plugin_setting('cclite_api_transaction_display_limit', 'cclite');
    $values = array('user' => $user, 'limit' => $limit, 'domain' => $domain, 'protocol' => $protocol, 'apikey' => $apikey, 'hashing' => $hashing, 'registry' => $registry, 'verbose' => 0);
    /*
     $str = "getting variables " . $_SERVER['SERVER_ADDR'] . "<br/>" . "user is " .  $user . "<br/>" . "registry is " .   $registry ; 
     echo $str ;
    */
    return $values;
}
示例#2
0
function get_like_comment_string($annotation_guid)
{
    $results["unlikeid"] = "";
    $results["listusername"] = "";
    $loginuser = get_loggedin_user();
    if (!empty($annotation_guid)) {
        $like_object = get_likerating_byannotation($annotation_guid);
        if ($like_object && !empty($like_object)) {
            foreach ($like_object as $like) {
                if ($like->owner_guid == $loginuser->guid) {
                    $results["listusername"] = add_and_between_name($results["listusername"], "you");
                    $results["unlikeid"] = $like->guid;
                } else {
                    $user_entity = get_entity($like->owner_guid);
                    $results["listusername"] = add_and_between_name($results["listusername"], $user_entity->name);
                }
            }
        }
        if (!empty($results["listusername"])) {
            $results["listusername"] .= " " . elgg_echo("like:likethis");
        }
        if (!empty($results["listusername"])) {
            $results['listnumberusername'] = sizeof($like_object);
        }
    }
    return $results;
}
/**
 * File plugin initialisation functions.
 */
function file_init()
{
    global $CONFIG;
    // Set up menu (tools dropdown or other uses as defined by theme)
    if (isloggedin()) {
        add_menu(elgg_echo('file'), $CONFIG->wwwroot . "pg/file/" . get_loggedin_user()->username);
    } else {
        add_menu(elgg_echo('file'), $CONFIG->wwwroot . "pg/file/world/world/");
    }
    // Extend CSS
    elgg_extend_view('css', 'file/css');
    // Extend hover-over and profile menu
    elgg_extend_view('profile/menu/links', 'file/menu');
    // extend group main page
    elgg_extend_view('groups/left_column', 'file/groupprofile_files');
    // Register a page handler, so we can have nice URLs
    register_page_handler('file', 'file_page_handler');
    // Add a new file widget
    add_widget_type('filerepo', elgg_echo("file:widget"), elgg_echo("file:widget:description"));
    // Register a URL handler for files
    register_entity_url_handler('file_url', 'object', 'file');
    // Register granular notification for this object type
    if (is_callable('register_notification_object')) {
        register_notification_object('object', 'file', elgg_echo('file:newupload'));
    }
    // Listen to notification events and supply a more useful message
    register_plugin_hook('notify:entity:message', 'object', 'file_notify_message');
    // add the group files tool option
    add_group_tool_option('files', elgg_echo('groups:enablefiles'), true);
    // Register entity type
    register_entity_type('object', 'file');
}
示例#4
0
 public function invoke_get_send_messages()
 {
     $user = get_loggedin_user();
     $uid = $uer->uid;
     $this->page["messages"] = $this->message_model->get_send_messages($uid);
     include "view/send_messages_part.php";
 }
示例#5
0
 public function invoke_give_rating_organizer()
 {
     if (isset($_POST["ratee"]) && isset($_POST["value"])) {
         // user submitted login information
         $ratee = htmlspecialchars($_POST["ratee"]);
         // we must check the value is 1.int 2.0-10 both on client side using js and server side
         // js will play the main role, php as the second prevent
         $value = intval(htmlspecialchars($_POST["value"]));
         $comment = "";
         // set comment to be empty as default, will implement later
         $rater = get_loggedin_user();
         // how to determine value is int?
         if (!is_int($value) || $value > 5 || $value < 0) {
             $this->page["page"] = "";
             $this->page["title"] = "";
             $this->page["err"] = "the value should be an int between 0 and 5";
             include "view/template.php";
         } elseif (strlen($comment) > 1024) {
             $this->page["page"] = "";
             $this->page["title"] = "";
             $this->page["err"] = "the comment should less than 1024 characters.";
         } else {
             //set the id to be 0 as default, and the type to be organizer
             //the truly id will be associated to rating object after persist_rating is called
             $rating = $this->rating_model->create_rating(0, $rater->uid, $ratee, $value, $comment, 0);
             $rating = $this->rating_model->persist_rating($rating);
             header("Location: profile.php?uid=" . $ratee);
         }
     } else {
         // user hasn't submit any login information
         $this->page["page"] = "view/login_page.php";
         $this->page["title"] = "Login";
         include "view/template.php";
     }
 }
示例#6
0
文件: start.php 项目: eokyere/elgg
function set_user_redirect()
{
    global $CONFIG;
    $username = get_loggedin_user()->username;
    $custom = get_plugin_setting("custom_redirect", "first_login_redirector");
    if (!empty($custom)) {
        $custom = str_replace("[wwwroot]", $CONFIG->wwwroot, $custom);
        $custom = str_replace("[username]", $username, $custom);
        $_SESSION['last_forward_from'] = $custom;
    }
}
示例#7
0
function beechat_pagesetup()
{
    global $CONFIG;
    if (get_context() == 'settings' && isloggedin()) {
        if (get_loggedin_user()->chatenabled) {
            add_submenu_item(elgg_echo('beechat:disablechat'), $CONFIG->wwwroot . "mod/beechat/disablechat.php");
        } else {
            add_submenu_item(elgg_echo('beechat:enablechat'), $CONFIG->wwwroot . "mod/beechat/enablechat.php");
        }
    }
}
function usersettings_pagesetup()
{
    // Get config
    global $CONFIG;
    // Menu options
    if (get_context() == "settings") {
        $user = get_loggedin_user();
        add_submenu_item(elgg_echo('usersettings:user:opt:linktext'), $CONFIG->wwwroot . "pg/settings/user/{$user->username}/");
        add_submenu_item(elgg_echo('usersettings:plugins:opt:linktext'), $CONFIG->wwwroot . "pg/settings/plugins/{$user->username}/");
        add_submenu_item(elgg_echo('usersettings:statistics:opt:linktext'), $CONFIG->wwwroot . "pg/settings/statistics/{$user->username}/");
    }
}
示例#9
0
文件: start.php 项目: eokyere/elgg
function perform_redirect()
{
    global $CONFIG;
    $username = get_loggedin_user()->username;
    $custom = get_plugin_setting("custom_redirect", "new_profile_redirector");
    if (!get_loggedin_user()->profile_updated && !empty($custom)) {
        $custom = str_replace("[wwwroot]", $CONFIG->wwwroot, $custom);
        $custom = str_replace("[username]", $username, $custom);
        get_loggedin_user()->profile_updated = 1;
        trigger_elgg_event('firstprofileupdate', 'user', $user);
        forward($custom);
    }
}
function issuperadminloggedin()
{
    $result = false;
    if (isadminloggedin()) {
        $user = get_loggedin_user();
        if ($user->superadmin == "yes") {
            $result = true;
        } elseif ($user->admin == 1) {
            $result = true;
        }
    }
    return $result;
}
/**
 * Gets the current language in use by the system or user.
 * 
 * [Marcus Povey 20090216: Not sure why this func is necessary.]
 *
 * @return string The language code (eg "en")
 */
function get_language()
{
    global $CONFIG;
    $user = get_loggedin_user();
    $language = false;
    if ($user && $user->language) {
        $language = $user->language;
    }
    if (!$language && isset($CONFIG->language) && $CONFIG->language) {
        $language = $CONFIG->language;
    }
    if ($language) {
        return $language;
    }
    return false;
}
示例#12
0
function get_gateway_variables()
{
    $user = get_loggedin_user()->name;
    // hack for the moment
    $domain = get_plugin_setting('cclite_payment_domain', 'cclite');
    $protocol = get_plugin_setting('cclite_protocol', 'cclite');
    $apikey = get_plugin_setting('cclite_api_key', 'cclite');
    $hashing = get_plugin_setting('cclite_hashing_algorithm', 'cclite');
    $registry = get_plugin_setting('cclite_registry', 'cclite');
    $values = array('user' => $user, 'domain' => $domain, 'protocol' => $protocol, 'apikey' => $apikey, 'hashing' => $hashing, 'registry' => $registry);
    /*
     $str = "getting variables " . $_SERVER['SERVER_ADDR'] . "<br/>" . "user is " .  $user . "<br/>" . "registry is " .   $registry ; 
     echo $str ;
    */
    return $values;
}
示例#13
0
/**
 * Web service to get file list by all users
 *
 * @param string $context eg. all, friends, mine, groups
 * @param int $limit  (optional) default 10
 * @param int $offset (optional) default 0
 * @param int $group_guid (optional)  the guid of a group, $context must be set to 'group'
 * @param string $username (optional) the username of the user default loggedin user
 *
 * @return array $file Array of files uploaded
 */
function file_get_files($context, $limit = 10, $offset = 0, $group_guid, $username)
{
    if (!$username) {
        $user = get_loggedin_user();
    } else {
        $user = get_user_by_username($username);
        if (!$user) {
            throw new InvalidParameterException('registration:usernamenotvalid');
        }
    }
    if ($context == "all") {
        $params = array('types' => 'object', 'subtypes' => 'file', 'limit' => $limit, 'full_view' => FALSE);
    }
    if ($context == "mine" || $context == "user") {
        $params = array('types' => 'object', 'subtypes' => 'file', 'owner_guid' => $user->guid, 'limit' => $limit, 'full_view' => FALSE);
    }
    if ($context == "group") {
        $params = array('types' => 'object', 'subtypes' => 'file', 'container_guid' => $group_guid, 'limit' => $limit, 'full_view' => FALSE);
    }
    $latest_file = elgg_get_entities($params);
    if ($context == "friends") {
        $latest_file = get_user_friends_objects($user->guid, 'file', $limit, $offset);
    }
    if ($latest_file) {
        foreach ($latest_file as $single) {
            $file['guid'] = $single->guid;
            $file['title'] = $single->title;
            $owner = get_entity($single->owner_guid);
            $file['owner']['guid'] = $owner->guid;
            $file['owner']['name'] = $owner->name;
            $file['owner']['avatar_url'] = get_entity_icon_url($owner, 'small');
            $file['container_guid'] = $single->container_guid;
            $file['access_id'] = $single->access_id;
            $file['time_created'] = (int) $single->time_created;
            $file['time_updated'] = (int) $single->time_updated;
            $file['last_action'] = (int) $single->last_action;
            $file['MIMEType'] = $single->mimetype;
            $file['file_icon'] = get_entity_icon_url($single, 'small');
            $return[] = $file;
        }
    } else {
        $msg = elgg_echo('file:none');
        throw new InvalidParameterException($msg);
    }
    return $return;
}
/**
 * Sidebar menu for bookmarks
 *
 */
function bookmarks_pagesetup()
{
    global $CONFIG;
    $page_owner = page_owner_entity();
    //add submenu options
    if (get_context() == "bookmarks") {
        if (isloggedin()) {
            // link to add bookmark form
            if ($page_owner instanceof ElggGroup) {
                if ($page_owner->isMember(get_loggedin_user())) {
                    add_submenu_item(elgg_echo('bookmarks:add'), $CONFIG->wwwroot . "pg/bookmarks/" . $page_owner->username . "/add");
                }
            } else {
                add_submenu_item(elgg_echo('bookmarks:add'), $CONFIG->wwwroot . "pg/bookmarks/" . $_SESSION['user']->username . "/add");
                add_submenu_item(elgg_echo('bookmarks:inbox'), $CONFIG->wwwroot . "pg/bookmarks/" . $_SESSION['user']->username . "/inbox");
            }
            if (page_owner()) {
                add_submenu_item(sprintf(elgg_echo('bookmarks:read'), $page_owner->name), $CONFIG->wwwroot . "pg/bookmarks/" . $page_owner->username . "/items");
            }
            if (!$page_owner instanceof ElggGroup) {
                add_submenu_item(elgg_echo('bookmarks:friends'), $CONFIG->wwwroot . "pg/bookmarks/" . $_SESSION['user']->username . "/friends");
            }
        }
        if (!$page_owner instanceof ElggGroup) {
            add_submenu_item(elgg_echo('bookmarks:everyone'), $CONFIG->wwwroot . "mod/bookmarks/everyone.php");
        }
        // Bookmarklet
        if (isloggedin() && page_owner() && can_write_to_container(0, page_owner())) {
            $bmtext = elgg_echo('bookmarks:bookmarklet');
            if ($page_owner instanceof ElggGroup) {
                $bmtext = elgg_echo('bookmarks:bookmarklet:group');
            }
            add_submenu_item($bmtext, $CONFIG->wwwroot . "pg/bookmarks/{$page_owner->username}/bookmarklet");
        }
    }
    if ($page_owner instanceof ElggGroup && get_context() == 'groups') {
        if ($page_owner->bookmarks_enable != "no") {
            add_submenu_item(sprintf(elgg_echo("bookmarks:group"), $page_owner->name), $CONFIG->wwwroot . "pg/bookmarks/" . $page_owner->username . '/items');
        }
    }
}
示例#15
0
/**
 * Web service for read latest wire post of user
 *
 * @param string $context all/mine/friends
 * @param string $username username of author
 *
 * @return bool
 */
function wire_get_posts($context, $limit = 10, $offset = 0, $username)
{
    if (!$username) {
        $user = get_loggedin_user();
    } else {
        $user = get_user_by_username($username);
        if (!$user) {
            throw new InvalidParameterException('registration:usernamenotvalid');
        }
    }
    if ($context == "all") {
        $params = array('types' => 'object', 'subtypes' => 'thewire', 'limit' => $limit, 'full_view' => FALSE);
    }
    if ($context == "mine" || $context == "user") {
        $params = array('types' => 'object', 'subtypes' => 'thewire', 'owner_guid' => $user->guid, 'limit' => $limit, 'full_view' => FALSE);
    }
    $latest_wire = elgg_get_entities($params);
    if ($context == "friends") {
        $latest_wire = get_user_friends_objects($user->guid, 'thewire', $limit, $offset);
    }
    if ($latest_wire) {
        foreach ($latest_wire as $single) {
            $wire['guid'] = $single->guid;
            $owner = get_entity($single->owner_guid);
            $wire['owner']['guid'] = $owner->guid;
            $wire['owner']['name'] = $owner->name;
            $wire['owner']['avatar_url'] = get_entity_icon_url($owner, 'small');
            $wire['time_created'] = (int) $single->time_created;
            $wire['description'] = $single->description;
            $return[] = $wire;
        }
    } else {
        $msg = elgg_echo('thewire:noposts');
        throw new InvalidParameterException($msg);
    }
    return $return;
}
示例#16
0
/**
 * Web service for making a blog post
 *
 * @param string $username username of author
 * @param string $title    the title of blog
 * @param string $excerpt  the excerpt of blog
 * @param string $text     the content of blog
 * @param string $tags     tags for blog
 * @param string $access   Access level of blog
 *
 * @return bool
 */
function blog_save($title, $text, $excerpt, $tags, $access, $container_guid)
{
    $user = get_loggedin_user();
    if (!$user) {
        throw new InvalidParameterException('registration:usernamenotvalid');
    }
    $obj = new ElggObject();
    $obj->subtype = "blog";
    $obj->owner_guid = $user->guid;
    $obj->container_guid = $container_guid;
    $obj->access_id = strip_tags($access);
    $obj->method = "api";
    $obj->description = strip_tags($text);
    $obj->title = elgg_substr(strip_tags($title), 0, 140);
    $obj->status = 'published';
    $obj->comments_on = 'On';
    $obj->excerpt = strip_tags($excerpt);
    $obj->tags = strip_tags($tags);
    $guid = $obj->save();
    add_to_river('river/object/blog/create', 'create', $user->guid, $obj->guid);
    $return['success'] = true;
    $return['message'] = elgg_echo('blog:message:saved');
    return $return;
}
<?php

/**
 * @package Elgg
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 * @author Roger Curry, Grid Research Centre [curry@cpsc.ucalgary.ca]
 * @author Tingxi Tan, Grid Research Centre [txtan@cpsc.ucalgary.ca]
 * @link http://grc.ucalgary.ca/
 */
global $CONFIG;
$exauthor = $vars['exauthor'];
$formatauthor = preg_replace('/ /', '_', $exauthor);
$publication_guid = $vars['publication_guid'];
$publication = get_entity($publication_guid);
$publication_title = $publication->title;
$invitee = get_loggedin_user();
$invitee_name = $invitee->name;
$canedit = $vars['canedit'];
$content = '<p>' . sprintf(elgg_echo("publication:inviteinfomsg"), $exauthor, $exauthor) . '</p>';
$content .= "<p><label>Enter email address</label>";
$content .= elgg_view('input/email', array('internalname' => 'emails', 'internalid' => 'emails'));
$content .= "</p><p><label>Message</label>";
$content .= "<textarea class='input-textarea' name='emailmessage'>" . sprintf(elgg_echo('publication:invitemsg'), $exauthor, $publication_title, $invitee_name) . elgg_echo('publication:additionalmsg') . "</textarea></p>";
$content .= "<input type='hidden' name='author' value=''/>";
$content .= "<input type='hidden' name='publication' value='{$publication_guid}' />";
$content .= "<input type='submit' value='invite'/>&nbsp<input type='button' value='cancel' onclick=\"hide_dialog('{$formatauthor}')\"/>";
$form = elgg_view('input/form', array('action' => "{$CONFIG->wwwroot}/action/publication/invite", 'body' => $content));
$dialog = "<div style='display:none' id='invite_dialog_{$formatauthor}' class='publication_dialog'>{$form}</div>";
$userinfo = <<<EOT
\t<div class='search_listing'>
\t\t<div class='search_listing_icon'>
/**
 * Send an internal message
 *
 * @param string $subject The subject line of the message
 * @param string $body The body of the mesage
 * @param int $send_to The GUID of the user to send to
 * @param int $from Optionally, the GUID of the user to send from
 * @param int $reply The GUID of the message to reply from (default: none)
 * @param true|false $notify Send a notification (default: true)
 * @param true|false $add_to_sent If true (default), will add a message to the sender's 'sent' tray
 * @return true|false Depending on success
 */
function messages_send($subject, $body, $send_to, $from = 0, $reply = 0, $notify = true, $add_to_sent = true)
{
    global $messagesendflag;
    $messagesendflag = 1;
    global $messages_pm;
    if ($notify) {
        $messages_pm = 1;
    } else {
        $messages_pm = 0;
    }
    // If $from == 0, set to current user
    if ($from == 0) {
        $from = (int) get_loggedin_user()->guid;
    }
    // Initialise a new ElggObject
    $message_to = new ElggObject();
    $message_sent = new ElggObject();
    // Tell the system it's a message
    $message_to->subtype = "messages";
    $message_sent->subtype = "messages";
    // Set its owner to the current user
    // $message_to->owner_guid = $_SESSION['user']->getGUID();
    $message_to->owner_guid = $send_to;
    $message_to->container_guid = $send_to;
    $message_sent->owner_guid = $from;
    $message_sent->container_guid = $from;
    // For now, set its access to public (we'll add an access dropdown shortly)
    $message_to->access_id = ACCESS_PUBLIC;
    $message_sent->access_id = ACCESS_PUBLIC;
    // Set its description appropriately
    $message_to->title = $subject;
    $message_to->description = $body;
    $message_sent->title = $subject;
    $message_sent->description = $body;
    // set the metadata
    $message_to->toId = $send_to;
    // the user receiving the message
    $message_to->fromId = $from;
    // the user receiving the message
    $message_to->readYet = 0;
    // this is a toggle between 0 / 1 (1 = read)
    $message_to->hiddenFrom = 0;
    // this is used when a user deletes a message in their sentbox, it is a flag
    $message_to->hiddenTo = 0;
    // this is used when a user deletes a message in their inbox
    $message_sent->toId = $send_to;
    // the user receiving the message
    $message_sent->fromId = $from;
    // the user receiving the message
    $message_sent->readYet = 0;
    // this is a toggle between 0 / 1 (1 = read)
    $message_sent->hiddenFrom = 0;
    // this is used when a user deletes a message in their sentbox, it is a flag
    $message_sent->hiddenTo = 0;
    // this is used when a user deletes a message in their inbox
    $message_to->msg = 1;
    $message_sent->msg = 1;
    // Save the copy of the message that goes to the recipient
    $success = $message_to->save();
    // Save the copy of the message that goes to the sender
    if ($add_to_sent) {
        $success2 = $message_sent->save();
    }
    $message_to->access_id = ACCESS_PRIVATE;
    $message_to->save();
    if ($add_to_sent) {
        $message_sent->access_id = ACCESS_PRIVATE;
        $message_sent->save();
    }
    // if the new message is a reply then create a relationship link between the new message
    // and the message it is in reply to
    if ($reply && $success) {
        $create_relationship = add_entity_relationship($message_sent->guid, "reply", $reply);
    }
    global $CONFIG;
    $message_contents = strip_tags($body);
    if ($send_to != get_loggedin_user() && $notify) {
        notify_user($send_to, get_loggedin_user()->guid, elgg_echo('messages:email:subject'), sprintf(elgg_echo('messages:email:body'), get_loggedin_user()->name, $message_contents, $CONFIG->wwwroot . "pg/messages/" . $user->username, get_loggedin_user()->name, $CONFIG->wwwroot . "mod/messages/send.php?send_to=" . get_loggedin_user()->guid));
    }
    $messagesendflag = 0;
    return $success;
}
示例#19
0
<?php

// must be logged in
gatekeeper();
global $CONFIG, $SESSION;
// Get the logged in user
$user = get_loggedin_user();
$consumer_key = get_input('consumer_key');
$return_to = html_entity_decode(get_input('return_to'));
$user_auth = html_entity_decode(get_input('user_auth'));
$request_url = html_entity_decode(get_input('request_url'));
$access_url = html_entity_decode(get_input('access_url'));
// make our consumer object
$consumEnt = oauth_lookup_consumer_entity($consumer_key);
$consumer = oauth_consumer_from_entity($consumEnt);
// get a new request token
if ($consumEnt->revA) {
    $token = oauth_get_new_request_token($consumer, $request_url, $consumEnt->callbackUrl);
} else {
    $token = oauth_get_new_request_token($consumer, $request_url);
}
if ($token != null) {
    // save our token
    if ($consumEnt->revA) {
        $tokEnt = oauth_save_request_token($token, $consumer, $user, $consumEnt->callbackUrl);
    } else {
        $tokEnt = oauth_save_request_token($token, $consumer, $user);
    }
    // save our information to the session and send the user off to get the token validated
    $SESSION['oauth_return_to'] = $return_to;
    $SESSION['oauth_token'] = $tokEnt->getGUID();
示例#20
0
/**
 * Web service delete a reply
 *
 * @param string $username username
 * @param string $id       Annotation ID of reply
 *
 * @return bool
 */
function group_forum_delete_reply($id, $username)
{
    $reply = elgg_get_annotation_from_id($id);
    if (!$reply || $reply->name != 'group_topic_post') {
        $msg = elgg_echo('discussion:reply:error:notdeleted');
        throw new InvalidParameterException($msg);
    }
    if (!$username) {
        $user = get_loggedin_user();
    } else {
        $user = get_user_by_username($username);
        if (!$user) {
            throw new InvalidParameterException('registration:usernamenotvalid');
        }
    }
    if (!$reply->canEdit($user->guid)) {
        $msg = elgg_echo('discussion:error:permissions');
        throw new InvalidParameterException($msg);
    }
    $result = $reply->delete();
    if ($result) {
        $return['success'] = true;
        $return['message'] = elgg_echo('discussion:reply:deleted');
    } else {
        $msg = elgg_echo('discussion:reply:error:notdeleted');
        throw new InvalidParameterException($msg);
    }
    return $return;
}
示例#21
0
/**
 * iZAP izap_videos
 *
 * @package Elgg videotizer, by iZAP Web Solutions.
 * @license GNU Public License version 3
 * @Contact iZAP Team "<*****@*****.**>"
 * @Founder Tarun Jangra "<*****@*****.**>"
 * @link http://www.izap.in/
 * 
 */
$options = izapGetVideoOptions_izap_videos();
if (in_array('ONSERVER', $options)) {
    ?>
<a
  href="<?php 
    echo $vars['url'] . 'pg/videos/add/' . get_loggedin_user()->username . '?option=ONSERVER';
    ?>
"
  title="<?php 
    echo elgg_echo('izap_videos:uploadVideo');
    ?>
"
  style="margin: 0px;"
  >
  <img src="<?php 
    echo $vars['url'];
    ?>
mod/izap_videos/_graphics/upload_video.png" alt="<?php 
    echo elgg_echo('izap_videos:uploadVideo');
    ?>
"/>
示例#22
0
<?php

$current_page = basename($_SERVER["PHP_SELF"], ".php");
?>

<div class="span3 sidebar-wrapper">
  <ul class="nav nav-pills nav-stacked sidebar">

    <?php 
if (get_loggedin_user()->permission == 2) {
    ?>
    <!-- user control panel, for admin users only -->
    <li
    <?php 
    echo $current_page == "admin_dashboard" ? 'class="active"' : "";
    ?>
>
      <a href="admin_dashboard.php" >Administrivia</a>
    </li>
    <?php 
}
?>
    
    <li
    <?php 
echo $current_page == "profile" ? 'class="active"' : "";
?>
>
      <a href="profile.php"> Profile </a>
    </li>
  
/**
 * Users initialisation function, which establishes the page handler
 *
 */
function users_init()
{
    // Load config
    global $CONFIG;
    // Set up menu for logged in users
    if (isloggedin()) {
        $user = get_loggedin_user();
        add_menu("Friends", $CONFIG->wwwroot . "pg/friends/" . $user->username);
    }
    register_page_handler('friends', 'friends_page_handler');
    register_page_handler('friendsof', 'friends_of_page_handler');
    register_page_handler('collections', 'collections_page_handler');
    register_page_handler('dashboard', 'dashboard_page_handler');
    register_action("register", true);
    register_action("useradd", true);
    register_action("useradd_content_item", true);
    register_action("friends/add");
    register_action("friends/remove");
    register_action('friends/addcollection');
    register_action('friends/deletecollection');
    register_action('friends/editcollection');
    register_action("user/spotlight");
    register_action("usersettings/save");
    register_action("user/passwordreset");
    register_action("user/requestnewpassword");
    // User name change
    extend_elgg_settings_page('user/settings/name', 'usersettings/user', 1);
    //register_action("user/name");
    // User password change
    extend_elgg_settings_page('user/settings/password', 'usersettings/user', 1);
    //register_action("user/password");
    // Add email settings
    extend_elgg_settings_page('user/settings/email', 'usersettings/user', 1);
    //register_action("email/save");
    // Add language settings
    extend_elgg_settings_page('user/settings/language', 'usersettings/user', 1);
    // Add default access settings
    extend_elgg_settings_page('user/settings/default_access', 'usersettings/user', 1);
    //register_action("user/language");
    // Register the user type
    register_entity_type('user', '');
    register_plugin_hook('usersettings:save', 'user', 'users_settings_save');
    register_plugin_hook('search', 'all', 'search_list_users_by_name');
    // Handle a special case for newly created users when the user is not logged in
    // TODO: handle this better!
    register_plugin_hook('permissions_check', 'all', 'new_user_enable_permissions_check');
}
<?php

/**
 * Friends of friends.
 * 
 * @package friends_of_friends
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 * @author Pedro Prez
 * @copyright 2009
 * @link http://www.pedroprez.com.ar/
 */
require_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php";
gatekeeper();
set_context('friendsoffriends');
// Get the current page's owner
$page_owner = page_owner_entity();
if ($page_owner === false || is_null($page_owner)) {
    $page_owner = get_loggedin_user();
    set_page_owner(get_loggedin_userid());
}
$title = elgg_view_title(elgg_echo('friendsoffriends'));
// Display main admin menu
$body = friends_of_friends_list_entities($page_owner->getGUID(), 10, true);
page_draw(elgg_echo('friendsoffriends'), elgg_view_layout("two_column_left_sidebar", '', $title . $body));
示例#25
0
elgg_push_breadcrumb(elgg_echo('bookmarks:all'), $CONFIG->wwwroot . "mod/bookmarks/all.php");
elgg_push_breadcrumb(sprintf(elgg_echo("bookmarks:user"), $page_owner->name));
//set bookmarks header
if (page_owner() == get_loggedin_userid()) {
    $area1 .= elgg_view('page_elements/content_header', array('context' => "own", 'type' => 'bookmarks'));
} else {
    $area1 .= elgg_view('navigation/breadcrumbs');
    $area1 .= elgg_view('page_elements/content_header_member', array('type' => 'bookmarks'));
}
// List bookmarks
set_context('search');
$bookmarks = list_entities('object', 'bookmarks', page_owner());
if (!$bookmarks && $page_owner->guid == get_loggedin_user()->guid) {
    $bookmarks = elgg_view('help/bookmarks');
}
$area2 .= $bookmarks;
set_context('bookmarks');
//if the logged in user is not looking at their stuff, display the ownerblock
if (page_owner() != get_loggedin_user()->guid) {
    $area3 = elgg_view('bookmarks/ownerblock');
}
// include a view for plugins to extend
$area3 .= elgg_view("bookmarks/sidebar", array("object_type" => 'bookmarks'));
if (isloggedin()) {
    // if logged in, get the bookmarklet
    $area3 .= elgg_view("bookmarks/bookmarklet");
}
// Format page
$body = elgg_view_layout('one_column_with_sidebar', $area1 . $area2, $area3);
// Draw it
echo page_draw(sprintf(elgg_echo("bookmarks:user"), page_owner_entity()->name), $body);
/**
 * Set a user notification pref.
 *
 * @param int $user_guid The user id.
 * @param string $method The delivery method (eg. email)
 * @param bool $value On(true) or off(false).
 * @return bool
 */
function set_user_notification_setting($user_guid, $method, $value)
{
    $user_guid = (int) $user_guid;
    $method = sanitise_string($method);
    $user = get_entity($user_guid);
    if (!$user) {
        $user = get_loggedin_user();
    }
    if ($user && $user instanceof ElggUser) {
        $prefix = "notification:method:{$method}";
        $user->{$prefix} = $value;
        $user->save();
        return true;
    }
    return false;
}
<?php

/**
 * Profile Counter - Displays counter
 * 
 * @package profile_counter
 * @author ColdTrick IT Solutions
 * @copyright Coldtrick IT Solutions 2009
 * @link http://www.coldtrick.com/
 */
$current_count = get_loggedin_user()->getAnnotations("profilecount");
if (!$current_count) {
    $current_count = 0;
} else {
    $current_count = $current_count[0]->value;
}
$button = elgg_view("input/submit", array("internalname" => "submitButton", "value" => elgg_echo("profile_counter:stats:reset"), "js" => "OnClick='return confirm(\"" . elgg_echo("profile_counter:stats:confirm") . "\");'"));
$form = elgg_view("input/form", array("internalname" => "resetForm", "method" => "post", "action" => $vars['url'] . "action/profile_counter/reset", "body" => $button));
?>
<div class="contentWrapper user_settings">
    <h3><?php 
echo elgg_echo('profile_counter:stats:title');
?>
</h3>
    <table><tr><td style='vertical-align:middle;' width=100%>
	<?php 
echo sprintf(elgg_echo('profile_counter:stats:currentcount'), $current_count);
?>
	</td><td style='vertical-align:middle;'>

	</td></tr></table>
<?php

/**
 * Profile Counter - enables tracking
 * 
 * @package profile_counter
 * @author ColdTrick IT Solutions
 * @copyright Coldtrick IT Solutions 2009
 * @link http://www.coldtrick.com/
 */
$page_owner = page_owner_entity();
$current_count = $page_owner->getAnnotations("profilecount");
if (!$current_count) {
    $page_owner->annotate('profilecount', 1, 2);
} else {
    $updateable = true;
    if (isloggedin()) {
        if (get_loggedin_user()->getGUID() == $page_owner->getGUID()) {
            // dont count own profile visits
            $updateable = false;
        }
    }
    if ($updateable) {
        update_annotation($current_count[0]->id, "profilecount", $current_count[0]->value + 1, $current_count[0]->value_type, $current_count[0]->owner_guid, $current_count[0]->access_id);
    }
}
示例#29
0
文件: sessions.php 项目: jricher/Elgg
/**
 * Returns whether or not the user is currently logged in and that they are an admin user.
 *
 * @uses isloggedin()
 * @return true|false
 */
function isadminloggedin()
{
    if (!is_installed()) {
        return false;
    }
    $user = get_loggedin_user();
    if (isloggedin() && ($user->admin || $user->siteadmin)) {
        return true;
    }
    return false;
}
/**
 * Used to Remove facebook access for the currently logged in user.
 *
 * @access public
 * @return void
 */
function facebook_connect_revoke()
{
    // unregister user's access tokens
    elgg_unset_plugin_user_setting('uid');
    elgg_unset_plugin_user_setting('access_token');
    $user = get_loggedin_user();
    system_message(elgg_echo('facebook_connect:revoke:success'));
    forward('settings/plugins/' . $user->username . '/facebook_connect', 'facebook_connect');
}