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

PHP proxy_url函数代码示例

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

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



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

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


示例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'] .= follow_widget();
    $a->page['aside'] .= findpeople_widget();
    $o .= '<h2>' . t('Friend Suggestions') . '</h2>';
    $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;
    }
    $tpl = get_markup_template('suggest_friends.tpl');
    foreach ($r as $rr) {
        $connlnk = $a->get_baseurl() . '/follow/?url=' . ($rr['connect'] ? $rr['connect'] : $rr['url']);
        $o .= replace_macros($tpl, array('$url' => zrl($rr['url']), '$name' => $rr['name'], '$photo' => proxy_url($rr['photo']), '$ignlnk' => $a->get_baseurl() . '/suggest?ignore=' . $rr['id'], '$ignid' => $rr['id'], '$conntxt' => t('Connect'), '$connlnk' => $connlnk, '$ignore' => t('Ignore/Hide')));
    }
    $o .= cleardiv();
    //	$o .= paginate($a);
    return $o;
}
开发者ID:strk,项目名称:friendica,代码行数:26,代码来源:suggest.php


示例3: match_content

/**
 * @brief Controller for /match.
 *
 * It takes keywords from your profile and queries the directory server for
 * matching keywords from other profiles.
 *
 * @param App &$a
 * @return void|string
 */
function match_content(&$a)
{
    $o = '';
    if (!local_user()) {
        return;
    }
    $a->page['aside'] .= findpeople_widget();
    $a->page['aside'] .= follow_widget();
    $_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd;
    $r = q("SELECT `pub_keywords`, `prv_keywords` FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1", intval(local_user()));
    if (!count($r)) {
        return;
    }
    if (!$r[0]['pub_keywords'] && !$r[0]['prv_keywords']) {
        notice(t('No keywords to match. Please add keywords to your default profile.') . EOL);
        return;
    }
    $params = array();
    $tags = trim($r[0]['pub_keywords'] . ' ' . $r[0]['prv_keywords']);
    if ($tags) {
        $params['s'] = $tags;
        if ($a->pager['page'] != 1) {
            $params['p'] = $a->pager['page'];
        }
        if (strlen(get_config('system', 'directory'))) {
            $x = post_url(get_server() . '/msearch', $params);
        } else {
            $x = post_url($a->get_baseurl() . '/msearch', $params);
        }
        $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) {
                $match_nurl = normalise_link($jj->url);
                $match = q("SELECT `nurl` FROM `contact` WHERE `uid` = '%d' AND nurl='%s' LIMIT 1", intval(local_user()), dbesc($match_nurl));
                if (!count($match)) {
                    $jj->photo = str_replace("http:///photo/", get_server() . "/photo/", $jj->photo);
                    $connlnk = $a->get_baseurl() . '/follow/?url=' . $jj->url;
                    $photo_menu = array(array(t("View Profile"), zrl($jj->url)));
                    $photo_menu[] = array(t("Connect/Follow"), $connlnk);
                    $contact_details = get_contact_details_by_url($jj->url, local_user());
                    $entry = array('url' => zrl($jj->url), 'itemurl' => $contact_details['addr'] != "" ? $contact_details['addr'] : $jj->url, 'name' => $jj->name, 'details' => $contact_details['location'], 'tags' => $contact_details['keywords'], 'about' => $contact_details['about'], 'account_type' => $contact_details['community'] ? t('Forum') : '', 'thumb' => proxy_url($jj->photo, false, PROXY_SIZE_THUMB), 'inttxt' => ' ' . t('is interested in:'), 'conntxt' => t('Connect'), 'connlnk' => $connlnk, 'img_hover' => $jj->tags, 'photo_menu' => $photo_menu, 'id' => ++$id);
                    $entries[] = $entry;
                }
            }
            $tpl = get_markup_template('viewcontact_template.tpl');
            $o .= replace_macros($tpl, array('$title' => t('Profile Match'), '$contacts' => $entries, '$paginate' => paginate($a)));
        } else {
            info(t('No matches') . EOL);
        }
    }
    return $o;
}
开发者ID:vinzv,项目名称:friendica,代码行数:66,代码来源:match.php


示例4: match_content

function match_content(&$a)
{
    $o = '';
    if (!local_user()) {
        return;
    }
    $a->page['aside'] .= follow_widget();
    $a->page['aside'] .= findpeople_widget();
    $_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd;
    $o .= replace_macros(get_markup_template("section_title.tpl"), array('$title' => t('Profile Match')));
    $r = q("SELECT `pub_keywords`, `prv_keywords` FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1", intval(local_user()));
    if (!count($r)) {
        return;
    }
    if (!$r[0]['pub_keywords'] && !$r[0]['prv_keywords']) {
        notice(t('No keywords to match. Please add keywords to your default profile.') . EOL);
        return;
    }
    $params = array();
    $tags = trim($r[0]['pub_keywords'] . ' ' . $r[0]['prv_keywords']);
    if ($tags) {
        $params['s'] = $tags;
        if ($a->pager['page'] != 1) {
            $params['p'] = $a->pager['page'];
        }
        if (strlen(get_config('system', 'directory'))) {
            $x = post_url(get_server() . '/msearch', $params);
        } else {
            $x = post_url($a->get_baseurl() . '/msearch', $params);
        }
        $j = json_decode($x);
        if ($j->total) {
            $a->set_pager_total($j->total);
            $a->set_pager_itemspage($j->items_page);
        }
        if (count($j->results)) {
            $tpl = get_markup_template('match.tpl');
            foreach ($j->results as $jj) {
                $match_nurl = normalise_link($jj->url);
                $match = q("SELECT `nurl` FROM `contact` WHERE `uid` = '%d' AND nurl='%s' LIMIT 1", intval(local_user()), dbesc($match_nurl));
                if (!count($match)) {
                    $jj->photo = str_replace("http:///photo/", get_server() . "/photo/", $jj->photo);
                    $connlnk = $a->get_baseurl() . '/follow/?url=' . $jj->url;
                    $o .= replace_macros($tpl, array('$url' => zrl($jj->url), '$name' => $jj->name, '$photo' => proxy_url($jj->photo), '$inttxt' => ' ' . t('is interested in:'), '$conntxt' => t('Connect'), '$connlnk' => $connlnk, '$tags' => $jj->tags));
                }
            }
        } else {
            info(t('No matches') . EOL);
        }
    }
    $o .= cleardiv();
    $o .= paginate($a);
    return $o;
}
开发者ID:ZerGabriel,项目名称:friendica,代码行数:54,代码来源:match.php


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


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


示例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;
    }
    $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


示例8: widget_forumlist

/**
 * @brief Forumlist widget
 *
 * Sidebar widget to show subcribed friendica forums. If activated
 * in the settings, it appears at the notwork page sidebar
 *
 * @param int $uid
 * @param int $cid
 *	The contact id which is used to mark a forum as "selected"
 * @return string
 */
function widget_forumlist($uid, $cid = 0)
{
    if (!intval(feature_enabled(local_user(), 'forumlist_widget'))) {
        return;
    }
    $o = '';
    //sort by last updated item
    $lastitem = true;
    $contacts = get_forumlist($uid, true, $lastitem, true);
    $total = count($contacts);
    $visible_forums = 10;
    if (count($contacts)) {
        $id = 0;
        foreach ($contacts as $contact) {
            $selected = $cid == $contact['id'] ? ' forum-selected' : '';
            $entry = array('url' => z_root() . '/network?f=&cid=' . $contact['id'], 'external_url' => z_root() . '/redir/' . $contact['id'], 'name' => $contact['name'], 'cid' => $contact['id'], 'selected' => $selected, 'micro' => proxy_url($contact['micro'], false, PROXY_SIZE_MICRO), 'id' => ++$id);
            $entries[] = $entry;
        }
        $tpl = get_markup_template('widget_forumlist.tpl');
        $o .= replace_macros($tpl, array('$title' => t('Forums'), '$forums' => $entries, '$link_desc' => t('External link to forum'), '$total' => $total, '$visible_forums' => $visible_forums, '$showmore' => t('show more')));
    }
    return $o;
}
开发者ID:vinzv,项目名称:friendica,代码行数:34,代码来源:forums.php


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


示例10: display_fetchauthor

function display_fetchauthor($a, $item)
{
    require_once "mod/proxy.php";
    require_once "include/bbcode.php";
    $profiledata = array();
    $profiledata["uid"] = -1;
    $profiledata["nickname"] = $item["author-name"];
    $profiledata["name"] = $item["author-name"];
    $profiledata["picdate"] = "";
    $profiledata["photo"] = proxy_url($item["author-avatar"]);
    $profiledata["url"] = $item["author-link"];
    $profiledata["network"] = $item["network"];
    // Fetching further contact data from the contact table
    $r = q("SELECT `photo`, `nick`, `location`, `about` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d", normalise_link($profiledata["url"]), $item["uid"]);
    if (count($r)) {
        $profiledata["photo"] = proxy_url($r[0]["photo"]);
        $profiledata["address"] = proxy_parse_html(bbcode($r[0]["location"]));
        $profiledata["about"] = proxy_parse_html(bbcode($r[0]["about"]));
        if ($r[0]["nick"] != "") {
            $profiledata["nickname"] = $r[0]["nick"];
        }
    }
    // Fetching profile data from unique contacts
    $r = q("SELECT `avatar`, `nick`, `location`, `about` FROM `unique_contacts` WHERE `url` = '%s'", normalise_link($profiledata["url"]));
    if (count($r)) {
        if ($profiledata["photo"] == "") {
            $profiledata["photo"] = proxy_url($r[0]["avatar"]);
        }
        if ($profiledata["address"] == "") {
            $profiledata["address"] = proxy_parse_html(bbcode($r[0]["location"]));
        }
        if ($profiledata["about"] == "") {
            $profiledata["about"] = proxy_parse_html(bbcode($r[0]["about"]));
        }
        if ($profiledata["nickname"] == "" and $r[0]["nick"] != "") {
            $profiledata["nickname"] = $r[0]["nick"];
        }
    }
    // Check for a repeated message
    $skip = false;
    $body = trim($item["body"]);
    // Skip if it isn't a pure repeated messages
    // Does it start with a share?
    if (!$skip and strpos($body, "[share") > 0) {
        $skip = true;
    }
    // Does it end with a share?
    if (!$skip and strlen($body) > strrpos($body, "[/share]") + 8) {
        $skip = true;
    }
    if (!$skip) {
        $attributes = preg_replace("/\\[share(.*?)\\]\\s?(.*?)\\s?\\[\\/share\\]\\s?/ism", "\$1", $body);
        // Skip if there is no shared message in there
        if ($body == $attributes) {
            $skip = true;
        }
    }
    if (!$skip) {
        $author = "";
        preg_match("/author='(.*?)'/ism", $attributes, $matches);
        if ($matches[1] != "") {
            $profiledata["name"] = html_entity_decode($matches[1], ENT_QUOTES, 'UTF-8');
        }
        preg_match('/author="(.*?)"/ism', $attributes, $matches);
        if ($matches[1] != "") {
            $profiledata["name"] = html_entity_decode($matches[1], ENT_QUOTES, 'UTF-8');
        }
        $profile = "";
        preg_match("/profile='(.*?)'/ism", $attributes, $matches);
        if ($matches[1] != "") {
            $profiledata["url"] = $matches[1];
        }
        preg_match('/profile="(.*?)"/ism', $attributes, $matches);
        if ($matches[1] != "") {
            $profiledata["url"] = $matches[1];
        }
        $avatar = "";
        preg_match("/avatar='(.*?)'/ism", $attributes, $matches);
        if ($matches[1] != "") {
            $profiledata["photo"] = $matches[1];
        }
        preg_match('/avatar="(.*?)"/ism', $attributes, $matches);
        if ($matches[1] != "") {
            $profiledata["photo"] = $matches[1];
        }
        $profiledata["nickname"] = $profiledata["name"];
        $profiledata["network"] = GetProfileUsername($profiledata["url"], "", false, true);
        $profiledata["address"] = "";
        $profiledata["about"] = "";
        // Fetching profile data from unique contacts
        if ($profiledata["url"] != "") {
            $r = q("SELECT `avatar`, `nick`, `location`, `about` FROM `unique_contacts` WHERE `url` = '%s'", normalise_link($profiledata["url"]));
            if (count($r)) {
                $profiledata["photo"] = proxy_url($r[0]["avatar"]);
                $profiledata["address"] = proxy_parse_html(bbcode($r[0]["location"]));
                $profiledata["about"] = proxy_parse_html(bbcode($r[0]["about"]));
                if ($r[0]["nick"] != "") {
                    $profiledata["nickname"] = $r[0]["nick"];
                }
            }
//.........这里部分代码省略.........
开发者ID:strk,项目名称:friendica,代码行数:101,代码来源:display.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: acl_lookup

function acl_lookup(&$a, $out_type = 'json')
{
    if (!local_user()) {
        return "";
    }
    $start = x($_REQUEST, 'start') ? $_REQUEST['start'] : 0;
    $count = x($_REQUEST, 'count') ? $_REQUEST['count'] : 100;
    $search = x($_REQUEST, 'search') ? $_REQUEST['search'] : "";
    $type = x($_REQUEST, 'type') ? $_REQUEST['type'] : "";
    $conv_id = x($_REQUEST, 'conversation') ? $_REQUEST['conversation'] : null;
    // For use with jquery.autocomplete for private mail completion
    if (x($_REQUEST, 'query') && strlen($_REQUEST['query'])) {
        if (!$type) {
            $type = 'm';
        }
        $search = $_REQUEST['query'];
    }
    if ($search != "") {
        $sql_extra = "AND `name` LIKE '%%" . dbesc($search) . "%%'";
        $sql_extra2 = "AND (`attag` LIKE '%%" . dbesc($search) . "%%' OR `name` LIKE '%%" . dbesc($search) . "%%' OR `nick` LIKE '%%" . dbesc($search) . "%%')";
    } else {
        $sql_extra = $sql_extra2 = "";
    }
    // count groups and contacts
    if ($type == '' || $type == 'g') {
        $r = q("SELECT COUNT(*) AS g FROM `group` WHERE `deleted` = 0 AND `uid` = %d {$sql_extra}", intval(local_user()));
        $group_count = (int) $r[0]['g'];
    } else {
        $group_count = 0;
    }
    if ($type == '' || $type == 'c') {
        $r = q("SELECT COUNT(*) AS c FROM `contact`\n\t\t\t\tWHERE `uid` = %d AND `self` = 0\n\t\t\t\tAND `blocked` = 0 AND `pending` = 0 AND `archive` = 0\n\t\t\t\tAND `notify` != '' {$sql_extra2}", intval(local_user()));
        $contact_count = (int) $r[0]['c'];
    } elseif ($type == 'm') {
        // autocomplete for Private Messages
        $r = q("SELECT COUNT(*) AS c FROM `contact`\n\t\t\t\tWHERE `uid` = %d AND `self` = 0\n\t\t\t\tAND `blocked` = 0 AND `pending` = 0 AND `archive` = 0\n\t\t\t\tAND `network` IN ('%s','%s','%s') {$sql_extra2}", intval(local_user()), dbesc(NETWORK_DFRN), dbesc(NETWORK_ZOT), dbesc(NETWORK_DIASPORA));
        $contact_count = (int) $r[0]['c'];
    } elseif ($type == 'a') {
        // autocomplete for Contacts
        $r = q("SELECT COUNT(*) AS c FROM `contact`\n\t\t\t\tWHERE `uid` = %d AND `self` = 0\n\t\t\t\tAND `pending` = 0 {$sql_extra2}", intval(local_user()));
        $contact_count = (int) $r[0]['c'];
    } else {
        $contact_count = 0;
    }
    $tot = $group_count + $contact_count;
    $groups = array();
    $contacts = array();
    if ($type == '' || $type == 'g') {
        $r = q("SELECT `group`.`id`, `group`.`name`, GROUP_CONCAT(DISTINCT `group_member`.`contact-id` SEPARATOR ',') as uids\n\t\t\t\tFROM `group`,`group_member`\n\t\t\t\tWHERE `group`.`deleted` = 0 AND `group`.`uid` = %d\n\t\t\t\t\tAND `group_member`.`gid`=`group`.`id`\n\t\t\t\t\t{$sql_extra}\n\t\t\t\tGROUP BY `group`.`id`\n\t\t\t\tORDER BY `group`.`name`\n\t\t\t\tLIMIT %d,%d", intval(local_user()), intval($start), intval($count));
        foreach ($r as $g) {
            //		logger('acl: group: ' . $g['name'] . ' members: ' . $g['uids']);
            $groups[] = array("type" => "g", "photo" => "images/twopeople.png", "name" => $g['name'], "id" => intval($g['id']), "uids" => array_map("intval", explode(",", $g['uids'])), "link" => '', "forum" => '0');
        }
    }
    if ($type == '' || $type == 'c') {
        $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, forum FROM `contact`\n\t\t\tWHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != ''\n\t\t\t{$sql_extra2}\n\t\t\tORDER BY `name` ASC ", intval(local_user()));
    } elseif ($type == 'm') {
        $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag` FROM `contact`\n\t\t\tWHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0\n\t\t\tAND `network` IN ('%s','%s','%s')\n\t\t\t{$sql_extra2}\n\t\t\tORDER BY `name` ASC ", intval(local_user()), dbesc(NETWORK_DFRN), dbesc(NETWORK_ZOT), dbesc(NETWORK_DIASPORA));
    } elseif ($type == 'a') {
        $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag` FROM `contact`\n\t\t\tWHERE `uid` = %d AND `pending` = 0\n\t\t\t{$sql_extra2}\n\t\t\tORDER BY `name` ASC ", intval(local_user()));
    } else {
        $r = array();
    }
    if ($type == 'm' || $type == 'a') {
        $x = array();
        $x['query'] = $search;
        $x['photos'] = array();
        $x['links'] = array();
        $x['suggestions'] = array();
        $x['data'] = array();
        if (count($r)) {
            foreach ($r as $g) {
                $x['photos'][] = proxy_url($g['micro']);
                $x['links'][] = $g['url'];
                $x['suggestions'][] = $g['name'];
                $x['data'][] = intval($g['id']);
            }
        }
        echo json_encode($x);
        killme();
    }
    if (count($r)) {
        foreach ($r as $g) {
            $contacts[] = array("type" => "c", "photo" => proxy_url($g['micro']), "name" => $g['name'], "id" => intval($g['id']), "network" => $g['network'], "link" => $g['url'], "nick" => $g['attag'] ? $g['attag'] : $g['nick'], "forum" => $g['forum']);
        }
    }
    $items = array_merge($groups, $contacts);
    if ($conv_id) {
        /* if $conv_id is set, get unknow contacts in thread */
        /* but first get know contacts url to filter them out */
        function _contact_link($i)
        {
            return dbesc($i['link']);
        }
        $known_contacts = array_map(_contact_link, $contacts);
        $unknow_contacts = array();
        $r = q("select\n\t\t\t\t\t`author-avatar`,`author-name`,`author-link`\n\t\t\t\tfrom item where parent=%d\n\t\t\t\tand (\n\t\t\t\t\t`author-name` LIKE '%%%s%%' OR\n\t\t\t\t\t`author-link` LIKE '%%%s%%'\n\t\t\t\t) and\n\t\t\t\t`author-link` NOT IN ('%s')\n\t\t\t\tGROUP BY `author-link`\n\t\t\t\tORDER BY `author-name` ASC\n\t\t\t\t", intval($conv_id), dbesc($search), dbesc($search), implode("','", $known_contacts));
        if (is_array($r) && count($r)) {
            foreach ($r as $row) {
                // nickname..
//.........这里部分代码省略.........
开发者ID:strk,项目名称:friendica,代码行数:101,代码来源:acl_selectors.php


示例13: xmlize

 function xmlize($href, $name, $url, $photo, $date, $seen, $message)
 {
     require_once "mod/proxy.php";
     $photo = proxy_url($photo);
     $data = array('href' => &$href, 'name' => &$name, 'url' => &$url, 'photo' => &$photo, 'date' => &$date, 'seen' => &$seen, 'messsage' => &$message);
     call_hooks('ping_xmlize', $data);
     $notsxml = '<note href="%s" name="%s" url="%s" photo="%s" date="%s" seen="%s" >%s</note>';
     return sprintf($notsxml, xmlify($href), xmlify($name), xmlify($url), xmlify($photo), xmlify($date), xmlify($seen), xmlify($message));
 }
开发者ID:jzacman,项目名称:friendica,代码行数:9,代码来源:ping.php


示例14: directory_content


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP prr函数代码示例发布时间:2022-05-15
下一篇:
PHP proxyURL函数代码示例发布时间: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