• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP network_to_name函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: networks_widget

function networks_widget($baseurl, $selected = '')
{
    $a = get_app();
    if (!local_user()) {
        return '';
    }
    if (!feature_enabled(local_user(), 'networks')) {
        return '';
    }
    $extra_sql = unavailable_networks();
    $r = q("SELECT DISTINCT(`network`) FROM `contact` WHERE `uid` = %d AND NOT `self` {$extra_sql} ORDER BY `network`", intval(local_user()));
    $nets = array();
    if (count($r)) {
        require_once 'include/contact_selectors.php';
        foreach ($r as $rr) {
            if ($rr['network']) {
                $nets[] = array('ref' => $rr['network'], 'name' => network_to_name($rr['network']), 'selected' => $selected == $rr['network'] ? 'selected' : '');
            }
        }
    }
    if (count($nets) < 2) {
        return '';
    }
    return replace_macros(get_markup_template('nets.tpl'), array('$title' => t('Networks'), '$desc' => '', '$sel_all' => $selected == '' ? 'selected' : '', '$all' => t('All Networks'), '$nets' => $nets, '$base' => $baseurl));
}
开发者ID:vinzv,项目名称:friendica,代码行数:25,代码来源:contact_widgets.php


示例2: suggest_content

function suggest_content(&$a)
{
    require_once "mod/proxy.php";
    $o = '';
    if (!local_user()) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd;
    $a->page['aside'] .= findpeople_widget();
    $a->page['aside'] .= follow_widget();
    $r = suggestion_query(local_user());
    if (!count($r)) {
        $o .= t('No suggestions available. If this is a new site, please try again in 24 hours.');
        return $o;
    }
    require_once 'include/contact_selectors.php';
    foreach ($r as $rr) {
        $connlnk = $a->get_baseurl() . '/follow/?url=' . ($rr['connect'] ? $rr['connect'] : $rr['url']);
        $ignlnk = $a->get_baseurl() . '/suggest?ignore=' . $rr['id'];
        $photo_menu = array(array(t("View Profile"), zrl($rr["url"])));
        $photo_menu[] = array(t("Connect/Follow"), $connlnk);
        $photo_menu[] = array(t('Ignore/Hide'), $ignlnk);
        $contact_details = get_contact_details_by_url($rr["url"], local_user());
        $entry = array('url' => zrl($rr['url']), 'itemurl' => $contact_details['addr'] != "" ? $contact_details['addr'] : $rr['url'], 'img_hover' => $rr['url'], 'name' => $rr['name'], 'thumb' => proxy_url($rr['photo'], false, PROXY_SIZE_THUMB), 'details' => $contact_details['location'], 'tags' => $contact_details['keywords'], 'about' => $contact_details['about'], 'account_type' => $contact_details['community'] ? t('Forum') : '', 'ignlnk' => $ignlnk, 'ignid' => $rr['id'], 'conntxt' => t('Connect'), 'connlnk' => $connlnk, 'photo_menu' => $photo_menu, 'ignore' => t('Ignore/Hide'), 'network' => network_to_name($rr['network'], $rr['url']), 'id' => ++$id);
        $entries[] = $entry;
    }
    $tpl = get_markup_template('viewcontact_template.tpl');
    $o .= replace_macros($tpl, array('$title' => t('Friend Suggestions'), '$contacts' => $entries));
    return $o;
}
开发者ID:vinzv,项目名称:friendica,代码行数:31,代码来源:suggest.php


示例3: allfriends_content

function allfriends_content(&$a)
{
    $o = '';
    if (!local_user()) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    if ($a->argc > 1) {
        $cid = intval($a->argv[1]);
    }
    if (!$cid) {
        return;
    }
    $uid = $a->user[uid];
    $c = q("SELECT `name`, `url`, `photo` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($cid), intval(local_user()));
    if (!count($c)) {
        return;
    }
    $a->page['aside'] = "";
    profile_load($a, "", 0, get_contact_details_by_url($c[0]["url"]));
    $total = count_all_friends(local_user(), $cid);
    if (count($total)) {
        $a->set_pager_total($total);
    }
    $r = all_friends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']);
    if (!count($r)) {
        $o .= t('No friends to display.');
        return $o;
    }
    $id = 0;
    foreach ($r as $rr) {
        //get further details of the contact
        $contact_details = get_contact_details_by_url($rr['url'], $uid);
        $photo_menu = '';
        // $rr[cid] is only available for common contacts. So if the contact is a common one, use contact_photo_menu to generate the photo_menu
        // If the contact is not common to the user, Connect/Follow' will be added to the photo menu
        if ($rr[cid]) {
            $rr[id] = $rr[cid];
            $photo_menu = contact_photo_menu($rr);
        } else {
            $connlnk = $a->get_baseurl() . '/follow/?url=' . $rr['url'];
            $photo_menu = array(array(t("View Profile"), zrl($rr['url'])));
            $photo_menu[] = array(t("Connect/Follow"), $connlnk);
        }
        $entry = array('url' => $rr['url'], 'itemurl' => $contact_details['addr'] != "" ? $contact_details['addr'] : $rr['url'], 'name' => htmlentities($rr['name']), 'thumb' => proxy_url($rr['photo'], false, PROXY_SIZE_THUMB), 'img_hover' => htmlentities($rr['name']), 'details' => $contact_details['location'], 'tags' => $contact_details['keywords'], 'about' => $contact_details['about'], 'account_type' => $contact_details['community'] ? t('Forum') : '', 'network' => network_to_name($contact_details['network'], $contact_details['url']), 'photo_menu' => $photo_menu, 'conntxt' => t('Connect'), 'connlnk' => $connlnk, 'id' => ++$id);
        $entries[] = $entry;
    }
    $tab_str = contacts_tab($a, $cid, 3);
    $tpl = get_markup_template('viewcontact_template.tpl');
    $o .= replace_macros($tpl, array('$tab_str' => $tab_str, '$contacts' => $entries, '$paginate' => paginate($a)));
    return $o;
}
开发者ID:vinzv,项目名称:friendica,代码行数:52,代码来源:allfriends.php


示例4: follow_content

function follow_content(&$a)
{
    if (!local_user()) {
        notice(t('Permission denied.') . EOL);
        goaway($_SESSION['return_url']);
        // NOTREACHED
    }
    $uid = local_user();
    $url = notags(trim($_REQUEST['url']));
    // There is a current issue. It seems as if you can't start following a Friendica that is following you
    // With Diaspora this works - but Friendica is special, it seems ...
    $r = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND ((`rel` != %d) OR (`network` = '%s')) AND\n\t\t(`nurl` = '%s' OR `alias` = '%s' OR `alias` = '%s') AND\n\t\t`network` != '%s' LIMIT 1", intval(local_user()), dbesc(CONTACT_IS_FOLLOWER), dbesc(NETWORK_DFRN), dbesc(normalise_link($url)), dbesc(normalise_link($url)), dbesc($url), dbesc(NETWORK_STATUSNET));
    if ($r) {
        notice(t('You already added this contact.') . EOL);
        goaway($_SESSION['return_url']);
        // NOTREACHED
    }
    $ret = probe_url($url);
    if ($ret["network"] == NETWORK_MAIL) {
        $ret["url"] = $ret["addr"];
    }
    if ($ret['network'] === NETWORK_DFRN) {
        $request = $ret["request"];
        $tpl = get_markup_template('dfrn_request.tpl');
    } else {
        $request = $a->get_baseurl() . "/follow";
        $tpl = get_markup_template('auto_request.tpl');
    }
    $r = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1", intval($uid));
    if (!$r) {
        notice(t('Permission denied.') . EOL);
        goaway($_SESSION['return_url']);
        // NOTREACHED
    }
    $myaddr = $r[0]["url"];
    // Makes the connection request for friendica contacts easier
    $_SESSION["fastlane"] = $ret["url"];
    $header = $ret["name"];
    if ($ret["addr"] != "") {
        $header .= " <" . $ret["addr"] . ">";
    }
    $header .= " (" . network_to_name($ret['network']) . ")";
    $o = replace_macros($tpl, array('$header' => htmlentities($header), '$photo' => $ret["photo"], '$desc' => "", '$pls_answer' => t('Please answer the following:'), '$does_know_you' => array('knowyou', sprintf(t('Does %s know you?'), $ret["name"]), false, '', array(t('No'), t('Yes'))), '$add_note' => t('Add a personal note:'), '$page_desc' => "", '$friendica' => "", '$statusnet' => "", '$diaspora' => "", '$diasnote' => "", '$your_address' => t('Your Identity Address:'), '$invite_desc' => "", '$emailnet' => "", '$submit' => t('Submit Request'), '$cancel' => t('Cancel'), '$nickname' => "", '$name' => $ret["name"], '$url' => $ret["url"], '$myaddr' => $myaddr, '$request' => $request));
    return $o;
}
开发者ID:ZerGabriel,项目名称:friendica,代码行数:45,代码来源:follow.php


示例5: 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


示例6: networks_widget

function networks_widget($baseurl, $selected = '')
{
    $a = get_app();
    if (!local_user()) {
        return '';
    }
    $r = q("select distinct(network) from contact where uid = %d and self = 0", intval(local_user()));
    $nets = array();
    if (count($r)) {
        require_once 'include/contact_selectors.php';
        foreach ($r as $rr) {
            if ($rr['network']) {
                $nets[] = array('ref' => $rr['network'], 'name' => network_to_name($rr['network']), 'selected' => $selected == $rr['network'] ? 'selected' : '');
            }
        }
    }
    if (count($nets) < 2) {
        return '';
    }
    return replace_macros(get_markup_template('nets.tpl'), array('$title' => t('Networks'), '$desc' => '', '$sel_all' => $selected == '' ? 'selected' : '', '$all' => t('All Networks'), '$nets' => $nets, '$base' => $baseurl));
}
开发者ID:robhell,项目名称:friendica,代码行数:21,代码来源:contact_widgets.php


示例7: nogroup_content

function nogroup_content(&$a)
{
    if (!local_user()) {
        notice(t('Permission denied.') . EOL);
        return '';
    }
    require_once 'include/Contact.php';
    $r = contacts_not_grouped(local_user());
    if (count($r)) {
        $a->set_pager_total($r[0]['total']);
    }
    $r = contacts_not_grouped(local_user(), $a->pager['start'], $a->pager['itemspage']);
    if (count($r)) {
        foreach ($r as $rr) {
            $contacts[] = array('img_hover' => sprintf(t('Visit %s\'s profile [%s]'), $rr['name'], $rr['url']), 'edit_hover' => t('Edit contact'), 'photo_menu' => contact_photo_menu($rr), 'id' => $rr['id'], 'alt_text' => $alt_text, 'dir_icon' => $dir_icon, 'thumb' => $rr['thumb'], 'name' => $rr['name'], 'username' => $rr['name'], 'sparkle' => $sparkle, 'itemurl' => $rr['url'], 'url' => $url, 'network' => network_to_name($rr['network']));
        }
    }
    $tpl = get_markup_template("nogroup-template.tpl");
    $o .= replace_macros($tpl, array('$header' => t('Contacts who are not members of a group'), '$contacts' => $contacts, '$paginate' => paginate($a)));
    return $o;
}
开发者ID:robhell,项目名称:friendica,代码行数:21,代码来源:nogroup.php


示例8: 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


示例9: contacts_content


//.........这里部分代码省略.........
        require_once 'include/contact_selectors.php';
        $tpl = get_markup_template("contact_edit.tpl");
        switch ($contact['rel']) {
            case CONTACT_IS_FRIEND:
                $dir_icon = 'images/lrarrow.gif';
                $relation_text = t('You are mutual friends with %s');
                break;
            case CONTACT_IS_FOLLOWER:
                $dir_icon = 'images/larrow.gif';
                $relation_text = t('You are sharing with %s');
                break;
            case CONTACT_IS_SHARING:
                $dir_icon = 'images/rarrow.gif';
                $relation_text = t('%s is sharing with you');
                break;
            default:
                break;
        }
        $relation_text = sprintf($relation_text, $contact['name']);
        if ($contact['network'] === NETWORK_DFRN && $contact['rel']) {
            $url = "redir/{$contact['id']}";
            $sparkle = ' class="sparkle" ';
        } else {
            $url = $contact['url'];
            $sparkle = '';
        }
        $insecure = t('Private communications are not available for this contact.');
        $last_update = $contact['last-update'] == '0000-00-00 00:00:00' ? t('Never') : datetime_convert('UTC', date_default_timezone_get(), $contact['last-update'], 'D, j M Y, g:i A');
        if ($contact['last-update'] !== '0000-00-00 00:00:00') {
            $last_update .= ' ' . ($contact['last-update'] == $contact['success_update'] ? t("(Update was successful)") : t("(Update was not successful)"));
        }
        $lblsuggest = $contact['network'] === NETWORK_DFRN ? t('Suggest friends') : '';
        $poll_enabled = $contact['network'] !== NETWORK_DIASPORA ? true : false;
        $nettype = sprintf(t('Network type: %s'), network_to_name($contact['network']));
        $common = count_common_friends(local_user(), $contact['id']);
        $common_text = $common ? sprintf(tt('%d contact in common', '%d contacts in common', $common), $common) : '';
        $polling = $contact['network'] === NETWORK_MAIL | $contact['network'] === NETWORK_FEED ? 'polling' : '';
        $x = count_all_friends(local_user(), $contact['id']);
        $all_friends = $x ? t('View all contacts') : '';
        // tabs
        $tabs = array(array('label' => $contact['blocked'] ? t('Unblock') : t('Block'), 'url' => $a->get_baseurl() . '/contacts/' . $contact_id . '/block', 'sel' => ''), array('label' => $contact['readonly'] ? t('Unignore') : t('Ignore'), 'url' => $a->get_baseurl() . '/contacts/' . $contact_id . '/ignore', 'sel' => ''), array('label' => t('Repair'), 'url' => $a->get_baseurl() . '/crepair/' . $contact_id, 'sel' => ''));
        $tab_tpl = get_markup_template('common_tabs.tpl');
        $tab_str = replace_macros($tab_tpl, array('$tabs' => $tabs));
        $o .= replace_macros($tpl, array('$header' => t('Contact Editor'), '$tab_str' => $tab_str, '$submit' => t('Submit'), '$lbl_vis1' => t('Profile Visibility'), '$lbl_vis2' => sprintf(t('Please choose the profile you would like to display to %s when viewing your profile securely.'), $contact['name']), '$lbl_info1' => t('Contact Information / Notes'), '$infedit' => t('Edit contact notes'), '$common_text' => $common_text, '$common_link' => $a->get_baseurl() . '/common/' . $contact['id'], '$all_friends' => $all_friends, '$relation_text' => $relation_text, '$visit' => sprintf(t('Visit %s\'s profile [%s]'), $contact['name'], $contact['url']), '$blockunblock' => t('Block/Unblock contact'), '$ignorecont' => t('Ignore contact'), '$lblcrepair' => t("Repair URL settings"), '$lblrecent' => t('View conversations'), '$lblsuggest' => $lblsuggest, '$delete' => t('Delete contact'), '$nettype' => $nettype, '$poll_interval' => contact_poll_interval($contact['priority'], !$poll_enabled), '$poll_enabled' => $poll_enabled, '$lastupdtext' => t('Last update:'), '$updpub' => t('Update public posts'), '$last_update' => $last_update, '$udnow' => t('Update now'), '$profile_select' => contact_profile_assign($contact['profile-id'], $contact['network'] !== NETWORK_DFRN ? true : false), '$contact_id' => $contact['id'], '$block_text' => $contact['blocked'] ? t('Unblock') : t('Block'), '$ignore_text' => $contact['readonly'] ? t('Unignore') : t('Ignore'), '$insecure' => $contact['network'] !== NETWORK_DFRN && $contact['network'] !== NETWORK_MAIL && $contact['network'] !== NETWORK_FACEBOOK && $contact['network'] !== NETWORK_DIASPORA ? $insecure : '', '$info' => $contact['info'], '$blocked' => $contact['blocked'] ? t('Currently blocked') : '', '$ignored' => $contact['readonly'] ? t('Currently ignored') : '', '$hidden' => array('hidden', t('Hide this contact from others'), $contact['hidden'] == 1, t('Replies/likes to your public posts <strong>may</strong> still be visible')), '$photo' => $contact['photo'], '$name' => $contact['name'], '$dir_icon' => $dir_icon, '$alt_text' => $alt_text, '$sparkle' => $sparkle, '$url' => $url));
        $arr = array('contact' => $contact, 'output' => $o);
        call_hooks('contact_edit', $arr);
        return $arr['output'];
    }
    $blocked = false;
    $hidden = false;
    $ignored = false;
    $all = false;
    $_SESSION['return_url'] = $a->query_string;
    if ($a->argc == 2 && $a->argv[1] === 'all') {
        $sql_extra = '';
        $all = true;
    } elseif ($a->argc == 2 && $a->argv[1] === 'blocked') {
        $sql_extra = " AND `blocked` = 1 ";
        $blocked = true;
    } elseif ($a->argc == 2 && $a->argv[1] === 'hidden') {
        $sql_extra = " AND `hidden` = 1 ";
        $hidden = true;
    } elseif ($a->argc == 2 && $a->argv[1] === 'ignored') {
        $sql_extra = " AND `readonly` = 1 ";
        $ignored = true;
    } else {
开发者ID:nextgensh,项目名称:friendica,代码行数:67,代码来源:contacts.php


示例10: get_template_data


//.........这里部分代码省略.........
     if (strcmp(datetime_convert('UTC', 'UTC', $item['created']), datetime_convert('UTC', 'UTC', 'now - 12 hours')) > 0) {
         $shiny = 'shiny';
     }
     localize_item($item);
     if ($item["postopts"] and !get_config("system", "suppress_language")) {
         //$langdata = explode(";", $item["postopts"]);
         //$langstr = substr($langdata[0], 5)." (".round($langdata[1]*100, 1)."%)";
         $langstr = "";
         if (substr($item["postopts"], 0, 5) == "lang=") {
             $postopts = substr($item["postopts"], 5);
             $languages = explode(":", $postopts);
             if (sizeof($languages) == 1) {
                 $languages = array();
                 $languages[] = $postopts;
             }
             foreach ($languages as $language) {
                 $langdata = explode(";", $language);
                 if ($langstr != "") {
                     $langstr .= ", ";
                 }
                 //$langstr .= $langdata[0]." (".round($langdata[1]*100, 1)."%)";
                 $langstr .= round($langdata[1] * 100, 1) . "% " . $langdata[0];
             }
         }
     }
     $body = prepare_body($item, true);
     list($categories, $folders) = get_cats_and_terms($item);
     if ($a->theme['template_engine'] === 'internal') {
         $body_e = template_escape($body);
         $text_e = strip_tags(template_escape($body));
         $name_e = template_escape($profile_name);
         $title_e = template_escape($item['title']);
         $location_e = template_escape($location);
         $owner_name_e = template_escape($this->get_owner_name());
     } else {
         $body_e = $body;
         $text_e = strip_tags($body);
         $name_e = $profile_name;
         $title_e = $item['title'];
         $location_e = $location;
         $owner_name_e = $this->get_owner_name();
     }
     // Disable features that aren't available in several networks
     if ($item["item_network"] != "dfrn" and isset($buttons["dislike"])) {
         unset($buttons["dislike"]);
         $tagger = '';
     }
     if ($item["item_network"] == "feed" and isset($buttons["like"])) {
         unset($buttons["like"]);
     }
     if ($item["item_network"] == "mail" and isset($buttons["like"])) {
         unset($buttons["like"]);
     }
     if ($item["item_network"] == "dspr" and $indent == 'comment' and isset($buttons["like"])) {
         unset($buttons["like"]);
     }
     // Facebook can like comments - but it isn't programmed in the connector yet.
     if ($item["item_network"] == "face" and $indent == 'comment' and isset($buttons["like"])) {
         unset($buttons["like"]);
     }
     $tmp_item = array('template' => $this->get_template(), 'type' => implode("", array_slice(explode("/", $item['verb']), -1)), 'tags' => $item['tags'], 'hashtags' => $item['hashtags'], 'mentions' => $item['mentions'], 'txt_cats' => t('Categories:'), 'txt_folders' => t('Filed under:'), 'has_cats' => count($categories) ? 'true' : '', 'has_folders' => count($folders) ? 'true' : '', 'categories' => $categories, 'folders' => $folders, 'body' => $body_e, 'text' => $text_e, 'id' => $this->get_id(), 'guid' => $item['guid'], 'linktitle' => sprintf(t('View %s\'s profile @ %s'), $profile_name, strlen($item['author-link']) ? $item['author-link'] : $item['url']), 'olinktitle' => sprintf(t('View %s\'s profile @ %s'), $this->get_owner_name(), strlen($item['owner-link']) ? $item['owner-link'] : $item['url']), 'to' => t('to'), 'via' => t('via'), 'wall' => t('Wall-to-Wall'), 'vwall' => t('via Wall-To-Wall:'), 'profile_url' => $profile_link, 'item_photo_menu' => item_photo_menu($item), 'name' => $name_e, 'thumb' => proxy_url($profile_avatar), 'osparkle' => $osparkle, 'sparkle' => $sparkle, 'title' => $title_e, 'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'), 'ago' => $item['app'] ? sprintf(t('%s from %s'), relative_date($item['created']), $item['app']) : relative_date($item['created']), 'app' => $item['app'], 'created' => relative_date($item['created']), 'lock' => $lock, 'location' => $location_e, 'indent' => $indent, 'shiny' => $shiny, 'owner_url' => $this->get_owner_url(), 'owner_photo' => proxy_url($this->get_owner_photo()), 'owner_name' => $owner_name_e, 'plink' => get_plink($item), 'edpost' => feature_enabled($conv->get_profile_owner(), 'edit_posts') ? $edpost : '', 'isstarred' => $isstarred, 'star' => feature_enabled($conv->get_profile_owner(), 'star_posts') ? $star : '', 'ignore' => feature_enabled($conv->get_profile_owner(), 'ignore_posts') ? $ignore : '', 'tagger' => $tagger, 'filer' => feature_enabled($conv->get_profile_owner(), 'filing') ? $filer : '', 'drop' => $drop, 'vote' => $buttons, 'like' => $like, 'dislike' => $dislike, 'switchcomment' => t('Comment'), 'comment' => $this->get_comment_box($indent), 'previewing' => $conv->is_preview() ? ' preview ' : '', 'wait' => t('Please wait'), 'thread_level' => $thread_level, 'postopts' => $langstr, 'edited' => $edited, 'network' => $item["item_network"], 'network_name' => network_to_name($item['item_network']));
     $arr = array('item' => $item, 'output' => $tmp_item);
     call_hooks('display_item', $arr);
     $result = $arr['output'];
     $result['children'] = array();
     $children = $this->get_children();
     $nb_children = count($children);
     if ($nb_children > 0) {
         foreach ($children as $child) {
             $result['children'][] = $child->get_template_data($alike, $dlike, $thread_level + 1);
         }
         // Collapse
         if ($nb_children > 2 || $thread_level > 1) {
             $result['children'][0]['comment_firstcollapsed'] = true;
             $result['children'][0]['num_comments'] = sprintf(tt('%d comment', '%d comments', $total_children), $total_children);
             $result['children'][0]['hidden_comments_num'] = $total_children;
             $result['children'][0]['hidden_comments_text'] = tt('comment', 'comments', $total_children);
             $result['children'][0]['hide_text'] = t('show more');
             if ($thread_level > 1) {
                 $result['children'][$nb_children - 1]['comment_lastcollapsed'] = true;
             } else {
                 $result['children'][$nb_children - 3]['comment_lastcollapsed'] = true;
             }
         }
     }
     if ($this->is_toplevel()) {
         $result['total_comments_num'] = "{$total_children}";
         $result['total_comments_text'] = tt('comment', 'comments', $total_children);
     }
     $result['private'] = $item['private'];
     $result['toplevel'] = $this->is_toplevel() ? 'toplevel_item' : '';
     if ($this->is_threaded()) {
         $result['flatten'] = false;
         $result['threaded'] = true;
     } else {
         $result['flatten'] = true;
         $result['threaded'] = false;
     }
     return $result;
 }
开发者ID:jzacman,项目名称:friendica,代码行数:101,代码来源:Item.php


示例11: dirfind_content


//.........这里部分代码省略.........
            $objresult->photo = $user_data["photo"];
            $objresult->tags = "";
            $objresult->network = $user_data["network"];
            $contact = q("SELECT `id` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d LIMIT 1", dbesc(normalise_link($user_data["url"])), intval(local_user()));
            if ($contact) {
                $objresult->cid = $contact[0]["id"];
            }
            $j->results[] = $objresult;
            poco_check($user_data["url"], $user_data["name"], $user_data["network"], $user_data["photo"], "", "", "", "", "", datetime_convert(), 0);
        } elseif ($local) {
            if ($community) {
                $extra_sql = " AND `community`";
            } else {
                $extra_sql = "";
            }
            $perpage = 80;
            $startrec = $a->pager['page'] * $perpage - $perpage;
            if (get_config('system', 'diaspora_enabled')) {
                $diaspora = NETWORK_DIASPORA;
            } else {
                $diaspora = NETWORK_DFRN;
            }
            if (!get_config('system', 'ostatus_disabled')) {
                $ostatus = NETWORK_OSTATUS;
            } else {
                $ostatus = NETWORK_DFRN;
            }
            $count = q("SELECT count(*) AS `total` FROM `gcontact` WHERE `network` IN ('%s', '%s', '%s') AND\n\t\t\t\t\t(`url` REGEXP '%s' OR `name` REGEXP '%s' OR `location` REGEXP '%s' OR\n\t\t\t\t\t\t`about` REGEXP '%s' OR `keywords` REGEXP '%s')" . $extra_sql, dbesc(NETWORK_DFRN), dbesc($ostatus), dbesc($diaspora), dbesc(escape_tags($search)), dbesc(escape_tags($search)), dbesc(escape_tags($search)), dbesc(escape_tags($search)), dbesc(escape_tags($search)));
            $results = q("SELECT `contact`.`id` AS `cid`, `gcontact`.`url`, `gcontact`.`name`, `gcontact`.`photo`, `gcontact`.`network`, `gcontact`.`keywords`, `gcontact`.`addr`\n\t\t\t\t\tFROM `gcontact`\n\t\t\t\t\tLEFT JOIN `contact` ON `contact`.`nurl` = `gcontact`.`nurl`\n\t\t\t\t\t\tAND `contact`.`uid` = %d AND NOT `contact`.`blocked`\n\t\t\t\t\t\tAND NOT `contact`.`pending` AND `contact`.`rel` IN ('%s', '%s')\n\t\t\t\t\tWHERE `gcontact`.`network` IN ('%s', '%s', '%s') AND\n\t\t\t\t\t((`gcontact`.`last_contact` >= `gcontact`.`last_failure`) OR (`gcontact`.`updated` >= `gcontact`.`last_failure`)) AND\n\t\t\t\t\t(`gcontact`.`url` REGEXP '%s' OR `gcontact`.`name` REGEXP '%s' OR `gcontact`.`location` REGEXP '%s' OR\n\t\t\t\t\t\t`gcontact`.`about` REGEXP '%s' OR `gcontact`.`keywords` REGEXP '%s') {$extra_sql}\n\t\t\t\t\t\tGROUP BY `gcontact`.`nurl`\n\t\t\t\t\t\tORDER BY `gcontact`.`updated` DESC LIMIT %d, %d", intval(local_user()), dbesc(CONTACT_IS_SHARING), dbesc(CONTACT_IS_FRIEND), dbesc(NETWORK_DFRN), dbesc($ostatus), dbesc($diaspora), dbesc(escape_tags($search)), dbesc(escape_tags($search)), dbesc(escape_tags($search)), dbesc(escape_tags($search)), dbesc(escape_tags($search)), intval($startrec), intval($perpage));
            $j = new stdClass();
            $j->total = $count[0]["total"];
            $j->items_page = $perpage;
            $j->page = $a->pager['page'];
            foreach ($results as $result) {
                if (poco_alternate_ostatus_url($result["url"])) {
                    continue;
                }
                if ($result["name"] == "") {
                    $urlparts = parse_url($result["url"]);
                    $result["name"] = end(explode("/", $urlparts["path"]));
                }
                $objresult = new stdClass();
                $objresult->cid = $result["cid"];
                $objresult->name = $result["name"];
                $objresult->addr = $result["addr"];
                $objresult->url = $result["url"];
                $objresult->photo = $result["photo"];
                $objresult->tags = $result["keywords"];
                $objresult->network = $result["network"];
                $j->results[] = $objresult;
            }
            // Add found profiles from the global directory to the local directory
            proc_run('php', 'include/discover_poco.php', "dirsearch", urlencode($search));
        } else {
            $p = $a->pager['page'] != 1 ? '&p=' . $a->pager['page'] : '';
            if (strlen(get_config('system', 'directory'))) {
                $x = fetch_url(get_server() . '/lsearch?f=' . $p . '&search=' . urlencode($search));
            }
            $j = json_decode($x);
        }
        if ($j->total) {
            $a->set_pager_total($j->total);
            $a->set_pager_itemspage($j->items_page);
        }
        if (count($j->results)) {
            $id = 0;
            foreach ($j->results as $jj) {
                $alt_text = "";
                $contact_details = get_contact_details_by_url($jj->url, local_user());
                $itemurl = $contact_details["addr"] != "" ? $contact_details["addr"] : $jj->url;
                // If We already know this contact then don't show the "connect" button
                if ($jj->cid > 0) {
                    $connlnk = "";
                    $conntxt = "";
                    $contact = q("SELECT * FROM `contact` WHERE `id` = %d", intval($jj->cid));
                    if ($contact) {
                        $photo_menu = contact_photo_menu($contact[0]);
                        $details = _contact_detail_for_template($contact[0]);
                        $alt_text = $details['alt_text'];
                    } else {
                        $photo_menu = array();
                    }
                } else {
                    $connlnk = $a->get_baseurl() . '/follow/?url=' . ($jj->connect ? $jj->connect : $jj->url);
                    $conntxt = t('Connect');
                    $photo_menu = array(array(t("View Profile"), zrl($jj->url)));
                    $photo_menu[] = array(t("Connect/Follow"), $connlnk);
                }
                $jj->photo = str_replace("http:///photo/", get_server() . "/photo/", $jj->photo);
                $entry = array('alt_text' => $alt_text, 'url' => zrl($jj->url), 'itemurl' => $itemurl, 'name' => htmlentities($jj->name), 'thumb' => proxy_url($jj->photo, false, PROXY_SIZE_THUMB), 'img_hover' => $jj->tags, 'conntxt' => $conntxt, 'connlnk' => $connlnk, 'photo_menu' => $photo_menu, 'details' => $contact_details['location'], 'tags' => $contact_details['keywords'], 'about' => $contact_details['about'], 'account_type' => $contact_details['community'] ? t('Forum') : '', 'network' => network_to_name($jj->network, $jj->url), 'id' => ++$id);
                $entries[] = $entry;
            }
            $tpl = get_markup_template('viewcontact_template.tpl');
            $o .= replace_macros($tpl, array('title' => sprintf(t('People Search - %s'), $search), '$contacts' => $entries, '$paginate' => paginate($a)));
        } else {
            info(t('No matches') . EOL);
        }
    }
    return $o;
}
开发者ID:vinzv,项目名称:friendica,代码行数:101,代码来源:dirfind.php


示例12: diaspora_send_relay

function diaspora_send_relay($item, $owner, $contact, $public_batch = false)
{
    $a = get_app();
    $myaddr = $owner['nickname'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(), '://') + 3);
    $theiraddr = $contact['addr'];
    $p = q("select guid from item where parent = %d limit 1", $item['parent']);
    if (count($p)) {
        $parent_guid = $p[0]['guid'];
    } else {
        return;
    }
    if ($item['verb'] === ACTIVITY_LIKE) {
        $tpl = get_markup_template('diaspora_like_relay.tpl');
        $like = true;
        $target_type = 'Post';
        $positive = $item['deleted'] ? 'false' : 'true';
    } else {
        $tpl = get_markup_template('diaspora_comment_relay.tpl');
        $like = false;
    }
    $body = $item['body'];
    $text = html_entity_decode(bb2diaspora($body));
    // fetch the original signature	if somebody sent the post to us to relay
    // If we are relaying for a reply originating on our own account, there wasn't a 'send to relay'
    // action. It wasn't needed. In that case create the original signature and the
    // owner (parent author) signature
    // comments from other networks will be relayed under our name, with a brief
    // preamble to describe what's happening and noting the real author
    $r = q("select * from sign where iid = %d limit 1", intval($item['id']));
    if (count($r)) {
        $orig_sign = $r[0];
        $signed_text = $orig_sign['signed_text'];
        $authorsig = $orig_sign['signature'];
        $handle = $orig_sign['signer'];
    } else {
        $itemcontact = q("select * from contact where `id` = %d limit 1", intval($item['contact-id']));
        if (count($itemcontact)) {
            if (!$itemcontact[0]['self']) {
                $prefix = sprintf(t('[Relayed] Comment authored by %s from network %s'), '[' . $item['author-name'] . ']' . '(' . $item['author-link'] . ')', network_to_name($itemcontact['network'])) . "\n";
                $body = $prefix . $body;
            }
        } else {
            if ($like) {
                $signed_text = $item['guid'] . ';' . $target_type . ';' . $parent_guid . ';' . $positive . ';' . $myaddr;
            } else {
                $signed_text = $item['guid'] . ';' . $parent_guid . ';' . $text . ';' . $myaddr;
            }
            $authorsig = base64_encode(rsa_sign($signed_text, $owner['uprvkey'], 'sha256'));
            q("insert into sign (`iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ", intval($item['id']), dbesc($signed_text), dbesc(base64_encode($authorsig)), dbesc($myaddr));
            $handle = $myaddr;
        }
    }
    // sign it
    $parentauthorsig = base64_encode(rsa_sign($signed_text, $owner['uprvkey'], 'sha256'));
    $msg = replace_macros($tpl, array('$guid' => xmlify($item['guid']), '$parent_guid' => xmlify($parent_guid), '$target_type' => xmlify($target_type), '$authorsig' => xmlify($orig_sign['signature']), '$parentsig' => xmlify($parentauthorsig), '$body' => xmlify($text), '$positive' => xmlify($positive), '$handle' => xmlify($handle)));
    logger('diaspora_relay_comment: base message: ' . $msg, LOGGER_DATA);
    $slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg, $owner, $contact, $owner['uprvkey'], $contact['pubkey'], $public_batch)));
    return diaspora_transmit($owner, $contact, $slap, $public_batch);
}
开发者ID:nphyx,项目名称:friendica,代码行数:59,代码来源:diaspora.php


示例13: profile_sidebar

 function profile_sidebar($profile, $block = 0)
 {
     $a = get_app();
     $o = '';
     $location = false;
     $address = false;
     $pdesc = true;
     if (!is_array($profile) && !count($profile)) {
         return $o;
     }
     $profile['picdate'] = urlencode($profile['picdate']);
     if ($profile['network'] != "" and $profile['network'] != NETWORK_DFRN) {
         require_once 'include/contact_selectors.php';
         if ($profile['url'] != "") {
             $profile['network_name'] = '<a href="' . $profile['url'] . '">' . network_to_name($profile['network']) . "</a>";
         } else {
             $profile['network_name'] = network_to_name($profile['network']);
         }
     } else {
         $profile['network_name'] = "";
     }
     call_hooks('profile_sidebar_enter', $profile);
     // don't show connect link to yourself
     $connect = $profile['uid'] != local_user() ? t('Connect') : False;
     // don't show connect link to authenticated visitors either
     if (remote_user() && count($_SESSION['remote'])) {
         foreach ($_SESSION['remote'] as $visitor) {
             if ($visitor['uid'] == $profile['uid']) {
                 $connect = false;
                 break;
             }
         }
     }
     // Is the local user already connected to that user?
     if ($connect and local_user()) {
         if (isset($profile["url"])) {
             $profile_url = normalise_link($profile["url"]);
         } else {
             $profile_url = normalise_link($a->get_baseurl() . "/profile/" . $profile["nickname"]);
         }
         $r = q("SELECT * FROM `contact` WHERE NOT `pending` AND `uid` = %d AND `nurl` = '%s'", local_user(), $profile_url);
         if (count($r)) {
             $connect = false;
         }
     }
     if ($connect and $profile['network'] != NETWORK_DFRN and !isset($profile['remoteconnect'])) {
         $connect = false;
     }
     if (isset($profile['remoteconnect'])) {
         $remoteconnect = $profile['remoteconnect'];
     }
     if (get_my_url() && $profile['unkmail'] && $profile['uid'] != local_user()) {
         $wallmessage = t('Message');
     } else {
         $wallmessage = false;
     }
     // show edit profile to yourself
     if ($profile['uid'] == local_user() && feature_enabled(local_user(), 'multi_profiles')) {
         $profile['edit'] = array($a->get_baseurl() . '/profiles', t('Profiles'), "", t('Manage/edit profiles'));
         $r = q("SELECT * FROM `profile` WHERE `uid` = %d", local_user());
         $profile['menu'] = array('chg_photo' => t('Change profile photo'), 'cr_new' => t('Create New Profile'), 'entries' => array());
         if (count($r)) {
             foreach ($r as $rr) {
                 $profile['menu']['entries'][] = array('photo' => $rr['thumb'], 'id' => $rr['id'], 'alt' => t('Profile Image'), 'profile_name' => $rr['profile-name'], 'isdefault' => $rr['is-default'], 'visibile_to_everybody' => t('visible to everybody'), 'edit_visibility' => t('Edit visibility'));
             }
         }
     }
     if ($profile['uid'] == local_user() && !feature_enabled(local_user(), 'multi_profiles')) {
         $profile['edit'] = array($a->get_baseurl() . '/profiles/' . $profile['id'], t('Edit profile'), "", t('Edit profile'));
         $profile['menu'] = array('chg_photo' => t('Change profile photo'), 'cr_new' => null, 'entries' => array());
     }
     if (x($profile, 'address') == 1 || x($profile, 'locality') == 1 || x($profile, 'region') == 1 || x($profile, 'postal-code') == 1 || x($profile, 'country-name') == 1) {
         $location = t('Location:');
     }
     $gender = x($profile, 'gender') == 1 ? t('Gender:') : False;
     $marital = x($profile, 'marital') == 1 ? t('Status:') : False;
     $homepage = x($profile, 'homepage') == 1 ? t('Homepage:') : False;
     if (($profile['hidewall'] || $block) && !local_user() && !remote_user()) {
         $location = $pdesc = $gender = $marital = $homepage = False;
     }
     $firstname = strpos($profile['name'], ' ') ? trim(substr($profile['name'], 0, strpos($profile['name'], ' '))) : $profile['name'];
     $lastname = $firstname === $profile['name'] ? '' : trim(substr($profile['name'], strlen($firstname)));
     $diaspora = array('podloc' => $a->get_baseurl(), 'searchable' => $profile['publish'] && $profile['net-publish'] ? 'true' : 'false', 'nickname' => $profile['nickname'], 'fullname' => $profile['name'], 'firstname' => $firstname, 'lastname' => $lastname, 'photo300' => $a->get_cached_avatar_image($a->get_baseurl() . '/photo/custom/300/' . $profile['uid'] . '.jpg'), 'photo100' => $a->get_cached_avatar_image($a->get_baseurl() . '/photo/custom/100/' . $profile['uid'] . '.jpg'), 'photo50' => $a->get_cached_avatar_image($a->get_baseurl() . '/photo/custom/50/' . $profile['uid'] . '.jpg'));
     if (!$block) {
         $contact_block = contact_block();
     }
     $p = array();
     foreach ($profile as $k => $v) {
         $k = str_replace('-', '_', $k);
         $p[$k] = $v;
     }
     if ($a->theme['template_engine'] === 'internal') {
         $location = template_escape($location);
     }
     $tpl = get_markup_template('profile_vcard.tpl');
     $o .= replace_macros($tpl, array('$profile' => $p, '$connect' => $connect, '$remoteconnect' => $remoteconnect, '$wallmessage' => $wallmessage, '$location' => $location, '$gender' => $gender 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP newAlbum函数代码示例发布时间:2022-05-15
下一篇:
PHP network_site_url函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap