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


PHP remote_user函数代码示例

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


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

示例1: zotfeed_init

function zotfeed_init(&$a)
{
    $result = array('success' => false);
    $mindate = $_REQUEST['mindate'] ? datetime_convert('UTC', 'UTC', $_REQUEST['mindate']) : '';
    if (!$mindate) {
        $mindate = datetime_convert('UTC', 'UTC', 'now - 1 month');
    }
    if (get_config('system', 'block_public') && !get_account_id() && !remote_user()) {
        $result['message'] = 'Public access denied';
        json_return_and_die($result);
    }
    $observer = $a->get_observer();
    $channel_address = argc() > 1 ? argv(1) : '';
    if ($channel_address) {
        $r = q("select channel_id, channel_name from channel where channel_address = '%s' and not (channel_pageflags & %d) limit 1", dbesc(argv(1)), intval(PAGE_REMOVED));
    } else {
        $x = get_sys_channel();
        if ($x) {
            $r = array($x);
        }
    }
    if (!$r) {
        $result['message'] = 'Channel not found.';
        json_return_and_die($result);
    }
    logger('zotfeed request: ' . $r[0]['channel_name'], LOGGER_DEBUG);
    $result['messages'] = zot_feed($r[0]['channel_id'], $observer['xchan_hash'], $mindate);
    $result['success'] = true;
    json_return_and_die($result);
}
开发者ID:Mauru,项目名称:red,代码行数:30,代码来源:zotfeed.php

示例2: share_init

function share_init(&$a)
{
    $post_id = argc() > 1 ? intval(argv(1)) : 0;
    if (!$post_id) {
        killme();
    }
    if (!(local_user() || remote_user())) {
        killme();
    }
    $r = q("SELECT * from item left join xchan on author_xchan = xchan_hash WHERE id = %d  LIMIT 1", intval($post_id));
    if (!$r) {
        killme();
    }
    if ($r[0]['item_private'] && $r[0]['xchan_network'] !== 'rss') {
        killme();
    }
    $sql_extra = item_permissions_sql($r[0]['uid']);
    $r = q("select * from item where id = %d {$sql_extra}", intval($post_id));
    if (!$r) {
        killme();
    }
    // FIXME - we only share bbcode
    if ($r[0]['mimetype'] !== 'text/bbcode') {
        killme();
    }
    // FIXME - eventually we want to post remotely via rpost
    // on your home site.
    // When that works remove this next bit:
    if (!local_user()) {
        killme();
    }
    xchan_query($r);
    if (strpos($r[0]['body'], "[/share]") !== false) {
        $pos = strpos($r[0]['body'], "[share");
        $o = substr($r[0]['body'], $pos);
    } else {
        $o = "[share author='" . urlencode($r[0]['author']['xchan_name']) . "' profile='" . $r[0]['author']['xchan_url'] . "' avatar='" . $r[0]['author']['xchan_photo_s'] . "' link='" . $r[0]['plink'] . "' posted='" . $r[0]['created'] . "' message_id='" . $r[0]['mid'] . "']\n";
        if ($r[0]['title']) {
            $o .= '[b]' . $r[0]['title'] . '[/b]' . "\n";
        }
        $o .= $r[0]['body'];
        $o .= "[/share]";
    }
    if (local_user()) {
        echo $o;
        killme();
    }
    $observer = $a->get_observer();
    $parsed = $observer['xchan_url'];
    if ($parsed) {
        $post_url = $parsed['scheme'] . ':' . $parsed['host'] . ($parsed['port'] ? ':' . $parsed['port'] : '') . '/rpost';
        // FIXME - we were probably called from JS
        // so we don't know the return page.
        // in fact we won't be able to load the remote page.
        // we might need an iframe
        $x = z_post_url($post_url, array('f' => '', 'body' => $o));
        killme();
    }
}
开发者ID:Mauru,项目名称:red,代码行数:59,代码来源:share.php

示例3: auto_redir

function auto_redir(&$a, $contact_nick)
{
    // prevent looping
    if (x($_REQUEST, 'redir') && intval($_REQUEST['redir'])) {
        return;
    }
    if (!$contact_nick || $contact_nick === $a->user['nickname']) {
        return;
    }
    if (local_user()) {
        // We need to find out if $contact_nick is a user on this hub, and if so, if I
        // am a contact of that user. However, that user may have other contacts with the
        // same nickname as me on other hubs or other networks. Exclude these by requiring
        // that the contact have a local URL. I will be the only person with my nickname at
        // this URL, so if a result is found, then I am a contact of the $contact_nick user.
        //
        // We also have to make sure that I'm a legitimate contact--I'm not blocked or pending.
        $baseurl = $a->get_baseurl();
        $domain_st = strpos($baseurl, "://");
        if ($domain_st === false) {
            return;
        }
        $baseurl = substr($baseurl, $domain_st + 3);
        $nurl = normalise_link($baseurl);
        $r = q("SELECT id FROM contact WHERE uid = ( SELECT uid FROM user WHERE nickname = '%s' LIMIT 1 )\n\t\t        AND nick = '%s' AND self = 0 AND ( url LIKE '%%%s%%' or nurl LIKE '%%%s%%' ) AND blocked = 0 AND pending = 0 LIMIT 1", dbesc($contact_nick), dbesc($a->user['nickname']), dbesc($baseurl), dbesc($nurl));
        if (!$r || !count($r) || $r[0]['id'] == remote_user()) {
            return;
        }
        $r = q("SELECT * FROM contact WHERE nick = '%s'\n\t\t        AND network = '%s' AND uid = %d  AND url LIKE '%%%s%%' LIMIT 1", dbesc($contact_nick), dbesc(NETWORK_DFRN), intval(local_user()), dbesc($baseurl));
        if (!($r && count($r))) {
            return;
        }
        $cid = $r[0]['id'];
        $dfrn_id = $orig_id = $r[0]['issued-id'] ? $r[0]['issued-id'] : $r[0]['dfrn-id'];
        if ($r[0]['duplex'] && $r[0]['issued-id']) {
            $orig_id = $r[0]['issued-id'];
            $dfrn_id = '1:' . $orig_id;
        }
        if ($r[0]['duplex'] && $r[0]['dfrn-id']) {
            $orig_id = $r[0]['dfrn-id'];
            $dfrn_id = '0:' . $orig_id;
        }
        // ensure that we've got a valid ID. There may be some edge cases with forums and non-duplex mode
        // that may have triggered some of the "went to {profile/intro} and got an RSS feed" issues
        if (strlen($dfrn_id) < 3) {
            return;
        }
        $sec = random_string();
        q("INSERT INTO `profile_check` ( `uid`, `cid`, `dfrn_id`, `sec`, `expire`)\n\t\t\tVALUES( %d, %s, '%s', '%s', %d )", intval(local_user()), intval($cid), dbesc($dfrn_id), dbesc($sec), intval(time() + 45));
        $url = curPageURL();
        logger('auto_redir: ' . $r[0]['name'] . ' ' . $sec, LOGGER_DEBUG);
        $dest = $url ? '&destination_url=' . $url : '';
        goaway($r[0]['poll'] . '?dfrn_id=' . $dfrn_id . '&dfrn_version=' . DFRN_PROTOCOL_VERSION . '&type=profile&sec=' . $sec . $dest);
    }
    return;
}
开发者ID:ZerGabriel,项目名称:friendica,代码行数:56,代码来源:redir.php

示例4: community_content

function community_content(&$a, $update = 0)
{
    $o = '';
    if (get_config('system', 'block_public') && !local_user() && !remote_user()) {
        notice(t('Public access denied.') . EOL);
        return;
    }
    if (get_config('system', 'no_community_page')) {
        notice(t('Not available.') . EOL);
        return;
    }
    require_once "include/bbcode.php";
    require_once 'include/security.php';
    require_once 'include/conversation.php';
    $o .= '<h3>' . t('Community') . '</h3>';
    if (!$update) {
        nav_set_selected('community');
    }
    if (x($a->data, 'search')) {
        $search = notags(trim($a->data['search']));
    } else {
        $search = x($_GET, 'search') ? notags(trim(rawurldecode($_GET['search']))) : '';
    }
    // Here is the way permissions work in this module...
    // Only public posts can be shown
    // OR your own posts if you are a logged in member
    if (!get_config('alt_pager', 'global') && !get_pconfig(local_user(), 'system', 'alt_pager')) {
        $r = q("SELECT COUNT(distinct(`item`.`uri`)) AS `total`\n\t\t\tFROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`\n\t\t\tWHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0\n\t\t\tAND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = '' \n\t\t\tAND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = ''\n\t\t\tAND `item`.`private` = 0 AND `item`.`wall` = 1 AND `user`.`hidewall` = 0 \n\t\t\tAND `contact`.`blocked` = 0 AND `contact`.`pending` = 0");
        if (count($r)) {
            $a->set_pager_total($r[0]['total']);
        }
        if (!$r[0]['total']) {
            info(t('No results.') . EOL);
            return $o;
        }
    }
    //$r = q("SELECT distinct(`item`.`uri`)
    $r = q("SELECT `item`.`uri`, `item`.*, `item`.`id` AS `item_id`, \n\t\t`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`,\n\t\t`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`, \n\t\t`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`,\n\t\t`user`.`nickname`, `user`.`hidewall`\n\t\tFROM `item` FORCE INDEX (`received`) LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`\n\t\tLEFT JOIN `user` ON `user`.`uid` = `item`.`uid`\n\t\tWHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0\n\t\tAND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = ''\n\t\tAND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = '' \n\t\tAND `item`.`private` = 0 AND `item`.`wall` = 1 AND `item`.`id` = `item`.`parent`\n\t\tAND `user`.`hidewall` = 0\n\t\tAND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`self`\n\t\tORDER BY `received` DESC LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
    //		group by `item`.`uri`
    if (!count($r)) {
        info(t('No results.') . EOL);
        return $o;
    }
    // we behave the same in message lists as the search module
    $o .= conversation($a, $r, 'community', $update);
    if (get_config('alt_pager', 'global') || get_pconfig(local_user(), 'system', 'alt_pager')) {
        $o .= alt_pager($a, count($r));
    } else {
        $o .= paginate($a);
    }
    return $o;
}
开发者ID:ridcully,项目名称:friendica,代码行数:52,代码来源:community.php

示例5: can_write_wall

function can_write_wall(&$a, $owner)
{
    if (!local_user() && !remote_user()) {
        return false;
    }
    if (local_user() && $_SESSION['uid'] == $owner) {
        return true;
    }
    $sql_extra = $a->config['rockstar'] ? '' : sprintf(" AND `readonly` = 0  AND `rel` IN ( %d , %d ) ", intval(DIRECTION_OUT), intval(DIRECTION_BOTH));
    $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `blocked` = 0 AND `pending` = 0 {$sql_extra} LIMIT 1", intval($_SESSION['visitor_id']));
    if (count($r)) {
        return true;
    }
    return false;
}
开发者ID:vishalp,项目名称:MistparkPE-Remix,代码行数:15,代码来源:security.php

示例6: redir_init

function redir_init(&$a)
{
    $url = x($_GET, 'url') ? $_GET['url'] : '';
    $quiet = x($_GET, 'quiet') ? '&quiet=1' : '';
    $con_url = x($_GET, 'conurl') ? $_GET['conurl'] : '';
    // traditional DFRN
    if ($con_url || local_user() && $a->argc > 1 && intval($a->argv[1])) {
        if ($con_url) {
            $con_url = str_replace('https', 'http', $con_url);
            $r = q("SELECT * FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d LIMIT 1", dbesc($con_url), intval(local_user()));
            if (!count($r) || $r[0]['network'] !== NETWORK_DFRN) {
                goaway(z_root());
            }
            $cid = $r[0]['id'];
        } else {
            $cid = $a->argv[1];
            $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($cid), intval(local_user()));
            if (!count($r) || $r[0]['network'] !== NETWORK_DFRN) {
                goaway(z_root());
            }
        }
        $dfrn_id = $orig_id = $r[0]['issued-id'] ? $r[0]['issued-id'] : $r[0]['dfrn-id'];
        if ($r[0]['duplex'] && $r[0]['issued-id']) {
            $orig_id = $r[0]['issued-id'];
            $dfrn_id = '1:' . $orig_id;
        }
        if ($r[0]['duplex'] && $r[0]['dfrn-id']) {
            $orig_id = $r[0]['dfrn-id'];
            $dfrn_id = '0:' . $orig_id;
        }
        $sec = random_string();
        q("INSERT INTO `profile_check` ( `uid`, `cid`, `dfrn_id`, `sec`, `expire`)\n\t\t\tVALUES( %d, %s, '%s', '%s', %d )", intval(local_user()), intval($cid), dbesc($dfrn_id), dbesc($sec), intval(time() + 45));
        logger('mod_redir: ' . $r[0]['name'] . ' ' . $sec, LOGGER_DEBUG);
        $dest = $url ? '&destination_url=' . $url : '';
        goaway($r[0]['poll'] . '?dfrn_id=' . $dfrn_id . '&dfrn_version=' . DFRN_PROTOCOL_VERSION . '&type=profile&sec=' . $sec . $dest . $quiet);
    }
    if (local_user()) {
        $handle = $a->user['nickname'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(), '://') + 3);
    }
    if (remote_user()) {
        $handle = $_SESSION['handle'];
    }
    if ($url) {
        $url = str_replace('{zid}', '&zid=' . $handle, $url);
        goaway($url);
    }
    goaway(z_root());
}
开发者ID:ZerGabriel,项目名称:friendica,代码行数:48,代码来源:redir.php

示例7: viewcontacts_content

function viewcontacts_content(&$a)
{
    require_once "mod/proxy.php";
    if (get_config('system', 'block_public') && !local_user() && !remote_user()) {
        notice(t('Public access denied.') . EOL);
        return;
    }
    if (!count($a->profile) || $a->profile['hide-friends']) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $o = "";
    // tabs
    $o .= profile_tabs($a, $is_owner, $a->data['user']['nickname']);
    $r = q("SELECT COUNT(*) AS `total` FROM `contact`\n\t\tWHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0\n\t\t\tAND `network` IN ('%s', '%s', '%s')", intval($a->profile['uid']), dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_OSTATUS));
    if (count($r)) {
        $a->set_pager_total($r[0]['total']);
    }
    $r = q("SELECT * FROM `contact`\n\t\tWHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0\n\t\t\tAND `network` IN ('%s', '%s', '%s')\n\t\tORDER BY `name` ASC LIMIT %d, %d", intval($a->profile['uid']), dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_OSTATUS), intval($a->pager['start']), intval($a->pager['itemspage']));
    if (!count($r)) {
        info(t('No contacts.') . EOL);
        return $o;
    }
    $contacts = array();
    foreach ($r as $rr) {
        if ($rr['self']) {
            continue;
        }
        $url = $rr['url'];
        // route DFRN profiles through the redirect
        $is_owner = local_user() && $a->profile['profile_uid'] == local_user() ? true : false;
        if ($is_owner && $rr['network'] === NETWORK_DFRN && $rr['rel']) {
            $url = 'redir/' . $rr['id'];
        } else {
            $url = zrl($url);
        }
        $contact_details = get_contact_details_by_url($rr['url'], $a->profile['uid']);
        $contacts[] = array('id' => $rr['id'], 'img_hover' => sprintf(t('Visit %s\'s profile [%s]'), $rr['name'], $rr['url']), 'photo_menu' => contact_photo_menu($rr), 'thumb' => proxy_url($rr['thumb'], false, PROXY_SIZE_THUMB), 'name' => htmlentities(substr($rr['name'], 0, 20)), 'username' => htmlentities($rr['name']), 'details' => $contact_details['location'], 'tags' => $contact_details['keywords'], 'about' => $contact_details['about'], 'account_type' => $contact_details['community'] ? t('Forum') : '', 'url' => $url, 'sparkle' => '', 'itemurl' => $contact_details['addr'] != "" ? $contact_details['addr'] : $rr['url'], 'network' => network_to_name($rr['network'], $rr['url']));
    }
    $tpl = get_markup_template("viewcontact_template.tpl");
    $o .= replace_macros($tpl, array('$title' => t('Contacts'), '$contacts' => $contacts, '$paginate' => paginate($a)));
    return $o;
}
开发者ID:vinzv,项目名称:friendica,代码行数:43,代码来源:viewcontacts.php

示例8: oexchange_content

function oexchange_content(&$a)
{
    if (!local_user()) {
        if (remote_user()) {
            $observer = $a->get_observer();
            if ($observer && $observer['xchan_url']) {
                $parsed = @parse_url($observer['xchan_url']);
                if (!$parsed) {
                    notice(t('Unable to find your hub.') . EOL);
                    return;
                }
                $url = $parsed['scheme'] . '://' . $parsed['host'] . ($parsed['port'] ? ':' . $parsed['port'] : '');
                $url .= '/oexchange';
                $result = z_post_url($url, $_REQUEST);
                json_return_and_die($result);
            }
        }
        return login(false);
    }
    if (argc() > 1 && argv(1) === 'done') {
        info(t('Post successful.') . EOL);
        return;
    }
    $url = x($_REQUEST, 'url') && strlen($_REQUEST['url']) ? urlencode(notags(trim($_REQUEST['url']))) : '';
    $title = x($_REQUEST, 'title') && strlen($_REQUEST['title']) ? '&title=' . urlencode(notags(trim($_REQUEST['title']))) : '';
    $description = x($_REQUEST, 'description') && strlen($_REQUEST['description']) ? '&description=' . urlencode(notags(trim($_REQUEST['description']))) : '';
    $tags = x($_REQUEST, 'tags') && strlen($_REQUEST['tags']) ? '&tags=' . urlencode(notags(trim($_REQUEST['tags']))) : '';
    $ret = z_fetch_url($a->get_baseurl() . '/parse_url?f=&url=' . $url . $title . $description . $tags);
    if ($ret['success']) {
        $s = $ret['body'];
    }
    if (!strlen($s)) {
        return;
    }
    $post = array();
    $post['profile_uid'] = local_user();
    $post['return'] = '/oexchange/done';
    $post['body'] = $s;
    $post['type'] = 'wall';
    $_REQUEST = $post;
    require_once 'mod/item.php';
    item_post($a);
}
开发者ID:Mauru,项目名称:red,代码行数:43,代码来源:oexchange.php

示例9: community_content

function community_content(&$a, $update = 0)
{
    $o = '';
    if (get_config('system', 'block_public') && !local_user() && !remote_user()) {
        notice(t('Public access denied.') . EOL);
        return;
    }
    if (get_config('system', 'no_community_page')) {
        notice(t('Not available.') . EOL);
        return;
    }
    require_once "include/bbcode.php";
    require_once 'include/security.php';
    require_once 'include/conversation.php';
    $o .= '<h3>' . t('Community') . '</h3>';
    if (!$update) {
        nav_set_selected('community');
        $o .= '<div id="live-community"></div>' . "\r\n";
        $o .= "<script> var profile_uid = -1; var netargs = '/?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
    }
    if (x($a->data, 'search')) {
        $search = notags(trim($a->data['search']));
    } else {
        $search = x($_GET, 'search') ? notags(trim(rawurldecode($_GET['search']))) : '';
    }
    // Here is the way permissions work in this module...
    // Only public wall posts can be shown
    // OR your own posts if you are a logged in member
    $r = q("SELECT COUNT(*) AS `total`\n\t\tFROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`\n\t\tWHERE `item`.`visible` = 1 AND `item`.`deleted` = 0\n\t\tAND `wall` = 1 AND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = '' \n\t\tAND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = '' AND `user`.`hidewall` = 0 \n\t\tAND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 ");
    if (count($r)) {
        $a->set_pager_total($r[0]['total']);
    }
    if (!$r[0]['total']) {
        info(t('No results.') . EOL);
        return $o;
    }
    $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, \n\t\t`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,\n\t\t`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`, \n\t\t`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`,\n\t\t`user`.`nickname`, `user`.`hidewall`\n\t\tFROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`\n\t\tLEFT JOIN `user` ON `user`.`uid` = `item`.`uid`\n\t\tWHERE `item`.`visible` = 1 AND `item`.`deleted` = 0\n\t\tAND `wall` = 1 AND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = '' \n\t\tAND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = '' AND `user`.`hidewall` = 0 \n\t\tAND `contact`.`blocked` = 0 AND `contact`.`pending` = 0\n\t\tORDER BY `received` DESC LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
    // we behave the same in message lists as the search module
    $o .= conversation($a, $r, 'community', false);
    $o .= paginate($a);
    $o .= '<div class="cc-license">' . t('Shared content is covered by the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license.') . '</div>';
    return $o;
}
开发者ID:nphyx,项目名称:friendica,代码行数:43,代码来源:community.php

示例10: hcard_init

function hcard_init(&$a)
{
    $blocked = get_config('system', 'block_public') && !local_user() && !remote_user() ? true : false;
    if ($a->argc > 1) {
        $which = $a->argv[1];
    } else {
        notice(t('No profile') . EOL);
        $a->error = 404;
        return;
    }
    $profile = 0;
    if (local_user() && $a->argc > 2 && $a->argv[2] === 'view') {
        $which = $a->user['nickname'];
        $profile = $a->argv[1];
    }
    profile_load($a, $which, $profile);
    if (x($a->profile, 'page-flags') && $a->profile['page-flags'] == PAGE_COMMUNITY) {
        $a->page['htmlhead'] .= '<meta name="friendika.community" content="true" />';
    }
    if (x($a->profile, 'openidserver')) {
        $a->page['htmlhead'] .= '<link rel="openid.server" href="' . $a->profile['openidserver'] . '" />' . "\r\n";
    }
    if (x($a->profile, 'openid')) {
        $delegate = strstr($a->profile['openid'], '://') ? $a->profile['openid'] : 'http://' . $a->profile['openid'];
        $a->page['htmlhead'] .= '<link rel="openid.delegate" href="' . $delegate . '" />' . "\r\n";
    }
    if (!$blocked) {
        $keywords = x($a->profile, 'pub_keywords') ? $a->profile['pub_keywords'] : '';
        $keywords = str_replace(array(',', ' ', ',,'), array(' ', ',', ','), $keywords);
        if (strlen($keywords)) {
            $a->page['htmlhead'] .= '<meta name="keywords" content="' . $keywords . '" />' . "\r\n";
        }
    }
    $a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . ($a->profile['net-publish'] ? 'true' : 'false') . '" />' . "\r\n";
    $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/dfrn_poll/' . $which . '" />' . "\r\n";
    $uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->get_hostname() . ($a->path ? '/' . $a->path : ''));
    $a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . $a->get_baseurl() . '/xrd/?uri=' . $uri . '" />' . "\r\n";
    header('Link: <' . $a->get_baseurl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
    $dfrn_pages = array('request', 'confirm', 'notify', 'poll');
    foreach ($dfrn_pages as $dfrn) {
        $a->page['htmlhead'] .= "<link rel=\"dfrn-{$dfrn}\" href=\"" . $a->get_baseurl() . "/dfrn_{$dfrn}/{$which}\" />\r\n";
    }
}
开发者ID:nextgensh,项目名称:friendica,代码行数:43,代码来源:hcard.php

示例11: viewconnections_content

function viewconnections_content(&$a)
{
    if (get_config('system', 'block_public') && !local_user() && !remote_user()) {
        notice(t('Public access denied.') . EOL);
        return;
    }
    if (!count($a->profile) || $a->profile['hide_friends']) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    if (!perm_is_allowed($a->profile['uid'], get_observer_hash(), 'view_contacts')) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $is_owner = local_user() && local_user() == $a->profile['uid'] ? true : false;
    $abook_flags = ABOOK_FLAG_PENDING | ABOOK_FLAG_SELF;
    $xchan_flags = XCHAN_FLAGS_ORPHAN | XCHAN_FLAGS_DELETED;
    if (!$is_owner) {
        $abook_flags = $abook_flags | ABOOK_FLAG_HIDDEN;
        $xchan_flags = $xchan_flags | XCHAN_FLAGS_HIDDEN;
    }
    $r = q("SELECT count(*) as total FROM abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and not (abook_flags & %d ) and not ( xchan_flags & %d ) ", intval($a->profile['uid']), intval($abook_flags), intval($xchan_flags));
    if ($r) {
        $a->set_pager_total($r[0]['total']);
    }
    $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and not ( abook_flags & %d ) and not ( xchan_flags & %d ) order by xchan_name LIMIT %d , %d ", intval($a->profile['uid']), intval($abook_flags), intval($xchan_flags), intval($a->pager['start']), intval($a->pager['itemspage']));
    if (!$r) {
        info(t('No connections.') . EOL);
        return $o;
    }
    $contacts = array();
    foreach ($r as $rr) {
        $url = chanlink_url($rr['xchan_url']);
        if ($url) {
            $contacts[] = array('id' => $rr['abook_id'], 'archived' => $rr['abook_flags'] & ABOOK_FLAG_ARCHIVED ? true : false, 'img_hover' => sprintf(t('Visit %s\'s profile [%s]'), $rr['xchan_name'], $rr['xchan_url']), 'thumb' => $rr['xchan_photo_m'], 'name' => substr($rr['xchan_name'], 0, 20), 'username' => $rr['xchan_addr'], 'link' => $url, 'sparkle' => '', 'itemurl' => $rr['url'], 'network' => '');
        }
    }
    $tpl = get_markup_template("viewcontact_template.tpl");
    $o .= replace_macros($tpl, array('$title' => t('View Connnections'), '$contacts' => $contacts, '$paginate' => paginate($a)));
    return $o;
}
开发者ID:Mauru,项目名称:red,代码行数:41,代码来源:viewconnections.php

示例12: search_content

function search_content(&$a)
{
    if (get_config('system', 'block_public') && !local_user() && !remote_user()) {
        notice(t('Public access denied.') . EOL);
        return;
    }
    nav_set_selected('search');
    require_once "include/bbcode.php";
    require_once 'include/security.php';
    require_once 'include/conversation.php';
    $o = '<div id="live-search"></div>' . "\r\n";
    $o .= '<h3>' . t('Search This Site') . '</h3>';
    if (x($a->data, 'search')) {
        $search = notags(trim($a->data['search']));
    } else {
        $search = x($_GET, 'search') ? notags(trim(rawurldecode($_GET['search']))) : '';
    }
    $o .= search($search, 'search-box', '/search', local_user() ? true : false);
    if (!$search) {
        return $o;
    }
    // Here is the way permissions work in the search module...
    // Only public wall posts can be shown
    // OR your own posts if you are a logged in member
    $s_regx = sprintf("AND ( `item`.`body` REGEXP '%s' OR `item`.`tag` REGEXP '%s' )", dbesc(preg_quote($search)), dbesc('\\]' . preg_quote($search) . '\\['));
    $search_alg = $s_regx;
    $r = q("SELECT COUNT(*) AS `total`\n\t\tFROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`\n\t\tWHERE `item`.`visible` = 1 AND `item`.`deleted` = 0\n\t\tAND (( `wall` = 1 AND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = '' AND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = '' AND `user`.`hidewall` = 0) \n\t\t\tOR `item`.`uid` = %d )\n\t\tAND `contact`.`blocked` = 0 AND `contact`.`pending` = 0\n\t\t{$search_alg} ", intval(local_user()));
    if (count($r)) {
        $a->set_pager_total($r[0]['total']);
    }
    if (!$r[0]['total']) {
        info(t('No results.') . EOL);
        return $o;
    }
    $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, \n\t\t`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,\n\t\t`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`, \n\t\t`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`,\n\t\t`user`.`nickname`\n\t\tFROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`\n\t\tLEFT JOIN `user` ON `user`.`uid` = `item`.`uid`\n\t\tWHERE `item`.`visible` = 1 AND `item`.`deleted` = 0\n\t\tAND (( `wall` = 1 AND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = '' AND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = '' AND `user`.`hidewall` = 0 ) \n\t\t\tOR `item`.`uid` = %d )\n\t\tAND `contact`.`blocked` = 0 AND `contact`.`pending` = 0\n\t\t{$search_alg}\n\t\tORDER BY `received` DESC LIMIT %d , %d ", intval(local_user()), intval($a->pager['start']), intval($a->pager['itemspage']));
    $o .= '<h2>Search results for: ' . $search . '</h2>';
    $o .= conversation($a, $r, 'search', false);
    $o .= paginate($a);
    return $o;
}
开发者ID:nphyx,项目名称:friendica,代码行数:40,代码来源:search.php

示例13: viewcontacts_content

function viewcontacts_content(&$a)
{
    require_once "mod/proxy.php";
    if (get_config('system', 'block_public') && !local_user() && !remote_user()) {
        notice(t('Public access denied.') . EOL);
        return;
    }
    if (!count($a->profile) || $a->profile['hide-friends']) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $r = q("SELECT COUNT(*) as `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 ", intval($a->profile['uid']));
    if (count($r)) {
        $a->set_pager_total($r[0]['total']);
    }
    $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 ORDER BY `name` ASC LIMIT %d , %d ", intval($a->profile['uid']), intval($a->pager['start']), intval($a->pager['itemspage']));
    if (!count($r)) {
        info(t('No contacts.') . EOL);
        return $o;
    }
    $contacts = array();
    foreach ($r as $rr) {
        if ($rr['self']) {
            continue;
        }
        $url = $rr['url'];
        // route DFRN profiles through the redirect
        $is_owner = local_user() && $a->profile['profile_uid'] == local_user() ? true : false;
        if ($is_owner && $rr['network'] === NETWORK_DFRN && $rr['rel']) {
            $url = 'redir/' . $rr['id'];
        } else {
            $url = zrl($url);
        }
        $contacts[] = array('id' => $rr['id'], 'img_hover' => sprintf(t('Visit %s\'s profile [%s]'), $rr['name'], $rr['url']), 'thumb' => proxy_url($rr['thumb']), 'name' => substr($rr['name'], 0, 20), 'username' => $rr['name'], 'url' => $url, 'sparkle' => '', 'itemurl' => $rr['url'], 'network' => network_to_name($rr['network'], $rr['url']));
    }
    $tpl = get_markup_template("viewcontact_template.tpl");
    $o .= replace_macros($tpl, array('$title' => t('View Contacts'), '$contacts' => $contacts, '$paginate' => paginate($a)));
    return $o;
}
开发者ID:ZerGabriel,项目名称:friendica,代码行数:39,代码来源:viewcontacts.php

示例14: profile_content

function profile_content(&$a, $update = 0)
{
    if (get_config('system', 'block_public') && !get_account_id() && !remote_user()) {
        return login();
    }
    $groups = array();
    $tab = 'profile';
    $o = '';
    if (!perm_is_allowed($a->profile['profile_uid'], get_observer_hash(), 'view_profile')) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $is_owner = local_user() && local_user() == $a->profile['profile_uid'] ? true : false;
    if ($a->profile['hidewall'] && !$is_owner && !remote_user()) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $o .= profile_tabs($a, $is_owner, $a->profile['channel_address']);
    $o .= advanced_profile($a);
    call_hooks('profile_advanced', $o);
    return $o;
}
开发者ID:Mauru,项目名称:red,代码行数:22,代码来源:profile.php

示例15: viewcontacts_content

function viewcontacts_content(&$a)
{
    if (get_config('system', 'block_public') && !local_user() && !remote_user()) {
        notice(t('Public access denied.') . EOL);
        return;
    }
    if (!count($a->profile) || $a->profile['hide-friends']) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $o .= '<h3>' . t('View Contacts') . '</h3>';
    $r = q("SELECT COUNT(*) as `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 ", intval($a->profile['uid']));
    if (count($r)) {
        $a->set_pager_total($r[0]['total']);
    }
    $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 ORDER BY `name` ASC LIMIT %d , %d ", intval($a->profile['uid']), intval($a->pager['start']), intval($a->pager['itemspage']));
    if (!count($r)) {
        info(t('No contacts.') . EOL);
        return $o;
    }
    $tpl = get_markup_template("viewcontact_template.tpl");
    foreach ($r as $rr) {
        if ($rr['self']) {
            continue;
        }
        $url = $rr['url'];
        // route DFRN profiles through the redirect
        $is_owner = local_user() && $a->profile['profile_uid'] == local_user() ? true : false;
        if ($is_owner && $rr['network'] === NETWORK_DFRN && $rr['rel']) {
            $url = 'redir/' . $rr['id'];
        }
        $o .= replace_macros($tpl, array('$id' => $rr['id'], '$alt_text' => sprintf(t('Visit %s\'s profile [%s]'), $rr['name'], $rr['url']), '$thumb' => $rr['thumb'], '$name' => substr($rr['name'], 0, 20), '$username' => $rr['name'], '$url' => $url));
    }
    $o .= '<div id="view-contact-end"></div>';
    $o .= paginate($a);
    return $o;
}
开发者ID:nextgensh,项目名称:friendica,代码行数:37,代码来源:viewcontacts.php


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