本文整理汇总了PHP中zrl函数的典型用法代码示例。如果您正苦于以下问题:PHP zrl函数的具体用法?PHP zrl怎么用?PHP zrl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zrl函数的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: dirfind_content
function dirfind_content(&$a)
{
$search = notags(trim($_REQUEST['search']));
if (strpos($search, '@') === 0) {
$search = substr($search, 1);
}
$o = '';
$o .= '<h2>' . t('People Search') . ' - ' . $search . '</h2>';
if ($search) {
$p = $a->pager['page'] != 1 ? '&p=' . $a->pager['page'] : '';
if (strlen(get_config('system', 'directory_submit_url'))) {
$x = fetch_url('http://dir.friendica.com/lsearch?f=' . $p . '&search=' . urlencode($search));
}
//TODO fallback local search if global dir not available.
// else
// $x = post_url($a->get_baseurl() . '/lsearch', $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) {
$o .= replace_macros($tpl, array('$url' => zrl($jj->url), '$name' => $jj->name, '$photo' => $jj->photo, '$tags' => $jj->tags));
}
} else {
info(t('No matches') . EOL);
}
}
$o .= '<div class="clear"></div>';
$o .= paginate($a);
return $o;
}
开发者ID:jzacman,项目名称:friendica,代码行数:34,代码来源:dirfind.php
示例3: suggest_content
function suggest_content(&$a)
{
$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' => $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:jzacman,项目名称:friendica,代码行数:25,代码来源:suggest.php
示例4: 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
示例5: randprof_init
function randprof_init(&$a)
{
require_once 'include/Contact.php';
$x = random_profile();
if ($x) {
goaway(zrl($x));
}
goaway($a->get_baseurl() . '/profile');
}
开发者ID:ZerGabriel,项目名称:friendica,代码行数:9,代码来源:randprof.php
示例6: 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
示例7: 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
示例8: match_content
function match_content(&$a)
{
$o = '';
if (!local_user()) {
return;
}
$_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd;
$o .= '<h2>' . t('Profile Match') . '</h2>';
$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_submit_url'))) {
$x = post_url('http://dir.friendica.com/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) {
$connlnk = $a->get_baseurl() . '/follow/?url=' . $jj->url;
$o .= replace_macros($tpl, array('$url' => zrl($jj->url), '$name' => $jj->name, '$photo' => $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:jzacman,项目名称:friendica,代码行数:47,代码来源:match.php
示例9: 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
示例10: 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
示例11: notifications_content
function notifications_content(&$a)
{
if (!local_user()) {
notice(t('Permission denied.') . EOL);
return;
}
nav_set_selected('notifications');
$json = $a->argc > 1 && $a->argv[$a->argc - 1] === 'json' ? true : false;
$o = '';
$tabs = array(array('label' => t('System'), 'url' => $a->get_baseurl(true) . '/notifications/system', 'sel' => $a->argv[1] == 'system' ? 'active' : ''), array('label' => t('Network'), 'url' => $a->get_baseurl(true) . '/notifications/network', 'sel' => $a->argv[1] == 'network' ? 'active' : ''), array('label' => t('Personal'), 'url' => $a->get_baseurl(true) . '/notifications/personal', 'sel' => $a->argv[1] == 'personal' ? 'active' : ''), array('label' => t('Home'), 'url' => $a->get_baseurl(true) . '/notifications/home', 'sel' => $a->argv[1] == 'home' ? 'active' : ''), array('label' => t('Introductions'), 'url' => $a->get_baseurl(true) . '/notifications/intros', 'sel' => $a->argv[1] == 'intros' ? 'active' : ''));
$o = "";
if ($a->argc > 1 && $a->argv[1] == 'intros' || $a->argc == 1) {
nav_set_selected('introductions');
if ($a->argc > 2 && $a->argv[2] == 'all') {
$sql_extra = '';
} else {
$sql_extra = " AND `ignore` = 0 ";
}
$notif_tpl = get_markup_template('notifications.tpl');
$notif_content .= '<a href="' . (strlen($sql_extra) ? 'notifications/intros/all' : 'notifications/intros') . '" id="notifications-show-hide-link" >' . (strlen($sql_extra) ? t('Show Ignored Requests') : t('Hide Ignored Requests')) . '</a></div>' . "\r\n";
$r = q("SELECT COUNT(*)\tAS `total` FROM `intro`\n\t\t\tWHERE `intro`.`uid` = %d {$sql_extra} AND `intro`.`blocked` = 0 ", intval($_SESSION['uid']));
if ($r && count($r)) {
$a->set_pager_total($r[0]['total']);
$a->set_pager_itemspage(20);
}
$r = q("SELECT `intro`.`id` AS `intro_id`, `intro`.*, `contact`.*, `fcontact`.`name` AS `fname`,`fcontact`.`url` AS `furl`,`fcontact`.`photo` AS `fphoto`,`fcontact`.`request` AS `frequest`\n\t\t\tFROM `intro` LEFT JOIN `contact` ON `contact`.`id` = `intro`.`contact-id` LEFT JOIN `fcontact` ON `intro`.`fid` = `fcontact`.`id`\n\t\t\tWHERE `intro`.`uid` = %d {$sql_extra} AND `intro`.`blocked` = 0 ", intval($_SESSION['uid']));
if ($r !== false && count($r)) {
$sugg = get_markup_template('suggestions.tpl');
$tpl = get_markup_template("intros.tpl");
foreach ($r as $rr) {
if ($rr['fid']) {
$return_addr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname() . ($a->path ? '/' . $a->path : ''));
$notif_content .= replace_macros($sugg, array('$str_notifytype' => t('Notification type: '), '$notify_type' => t('Friend Suggestion'), '$intro_id' => $rr['intro_id'], '$madeby' => sprintf(t('suggested by %s'), $rr['name']), '$contact_id' => $rr['contact-id'], '$photo' => x($rr, 'fphoto') ? $rr['fphoto'] : "images/person-175.jpg", '$fullname' => $rr['fname'], '$url' => zrl($rr['furl']), '$hidden' => array('hidden', t('Hide this contact from others'), $rr['hidden'] == 1, ''), '$activity' => array('activity', t('Post a new friend activity'), intval(get_pconfig(local_user(), 'system', 'post_newfriend')) ? '1' : 0, t('if applicable')), '$knowyou' => $knowyou, '$approve' => t('Approve'), '$note' => $rr['note'], '$request' => $rr['frequest'] . '?addr=' . $return_addr, '$ignore' => t('Ignore'), '$discard' => t('Discard')));
continue;
}
$friend_selected = $rr['network'] !== NETWORK_OSTATUS ? ' checked="checked" ' : ' disabled ';
$fan_selected = $rr['network'] === NETWORK_OSTATUS ? ' checked="checked" disabled ' : '';
$dfrn_tpl = get_markup_template('netfriend.tpl');
$knowyou = '';
$dfrn_text = '';
if ($rr['network'] === NETWORK_DFRN || $rr['network'] === NETWORK_DIASPORA) {
if ($rr['network'] === NETWORK_DFRN) {
$knowyou = t('Claims to be known to you: ') . ($rr['knowyou'] ? t('yes') : t('no'));
$helptext = t('Shall your connection be bidirectional or not? "Friend" implies that you allow to read and you subscribe to their posts. "Fan/Admirer" means that you allow to read but you do not want to read theirs. Approve as: ');
} else {
$knowyou = '';
$helptext = t('Shall your connection be bidirectional or not? "Friend" implies that you allow to read and you subscribe to their posts. "Sharer" means that you allow to read but you do not want to read theirs. Approve as: ');
}
$dfrn_text = replace_macros($dfrn_tpl, array('$intro_id' => $rr['intro_id'], '$friend_selected' => $friend_selected, '$fan_selected' => $fan_selected, '$approve_as' => $helptext, '$as_friend' => t('Friend'), '$as_fan' => $rr['network'] == NETWORK_DIASPORA ? t('Sharer') : t('Fan/Admirer')));
}
$notif_content .= replace_macros($tpl, array('$str_notifytype' => t('Notification type: '), '$notify_type' => $rr['network'] !== NETWORK_OSTATUS ? t('Friend/Connect Request') : t('New Follower'), '$dfrn_text' => $dfrn_text, '$dfrn_id' => $rr['issued-id'], '$uid' => $_SESSION['uid'], '$intro_id' => $rr['intro_id'], '$contact_id' => $rr['contact-id'], '$photo' => x($rr, 'photo') ? $rr['photo'] : "images/person-175.jpg", '$fullname' => $rr['name'], '$hidden' => array('hidden', t('Hide this contact from others'), $rr['hidden'] == 1, ''), '$activity' => array('activity', t('Post a new friend activity'), intval(get_pconfig(local_user(), 'system', 'post_newfriend')) ? '1' : 0, t('if applicable')), '$url' => zrl($rr['url']), '$knowyou' => $knowyou, '$approve' => t('Approve'), '$note' => $rr['note'], '$ignore' => t('Ignore'), '$discard' => t('Discard')));
}
} else {
info(t('No introductions.') . EOL);
}
$o .= replace_macros($notif_tpl, array('$notif_header' => t('Notifications'), '$tabs' => $tabs, '$notif_content' => $notif_content));
$o .= paginate($a);
return $o;
} else {
if ($a->argc > 1 && $a->argv[1] == 'network') {
$notif_tpl = get_markup_template('notifications.tpl');
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`,\n\t\t\t\t`item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` as `object`,\n\t\t\t\t`pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink`, `pitem`.`guid` as `pguid`\n\t\t\t\tFROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent`\n\t\t\t\tWHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND `pitem`.`parent` != 0 AND\n\t\t\t\t `item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 0 ORDER BY `item`.`created` DESC", intval(local_user()));
$tpl_item_likes = get_markup_template('notifications_likes_item.tpl');
$tpl_item_dislikes = get_markup_template('notifications_dislikes_item.tpl');
$tpl_item_friends = get_markup_template('notifications_friends_item.tpl');
$tpl_item_comments = get_markup_template('notifications_comments_item.tpl');
$tpl_item_posts = get_markup_template('notifications_posts_item.tpl');
$notif_content = '';
if ($r) {
foreach ($r as $it) {
switch ($it['verb']) {
case ACTIVITY_LIKE:
$notif_content .= replace_macros($tpl_item_likes, array('$item_link' => $a->get_baseurl(true) . '/display/' . $it['pguid'], '$item_image' => $it['author-avatar'], '$item_text' => sprintf(t("%s liked %s's post"), $it['author-name'], $it['pname']), '$item_when' => relative_date($it['created'])));
break;
case ACTIVITY_DISLIKE:
$notif_content .= replace_macros($tpl_item_dislikes, array('$item_link' => $a->get_baseurl(true) . '/display/' . $it['pguid'], '$item_image' => $it['author-avatar'], '$item_text' => sprintf(t("%s disliked %s's post"), $it['author-name'], $it['pname']), '$item_when' => relative_date($it['created'])));
break;
case ACTIVITY_FRIEND:
$xmlhead = "<" . "?xml version='1.0' encoding='UTF-8' ?" . ">";
$obj = parse_xml_string($xmlhead . $it['object']);
$it['fname'] = $obj->title;
$notif_content .= replace_macros($tpl_item_friends, array('$item_link' => $a->get_baseurl(true) . '/display/' . $it['pguid'], '$item_image' => $it['author-avatar'], '$item_text' => sprintf(t("%s is now friends with %s"), $it['author-name'], $it['fname']), '$item_when' => relative_date($it['created'])));
break;
default:
$item_text = $it['id'] == $it['parent'] ? sprintf(t("%s created a new post"), $it['author-name']) : sprintf(t("%s commented on %s's post"), $it['author-name'], $it['pname']);
$tpl = $it['id'] == $it['parent'] ? $tpl_item_posts : $tpl_item_comments;
$notif_content .= replace_macros($tpl, array('$item_link' => $a->get_baseurl(true) . '/display/' . $it['pguid'], '$item_image' => $it['author-avatar'], '$item_text' => $item_text, '$item_when' => relative_date($it['created'])));
}
}
} else {
$notif_content = t('No more network notifications.');
}
$o .= replace_macros($notif_tpl, array('$notif_header' => t('Network Notifications'), '$tabs' => $tabs, '$notif_content' => $notif_content));
} else {
if ($a->argc > 1 && $a->argv[1] == 'system') {
$notif_tpl = get_markup_template('notifications.tpl');
$not_tpl = get_markup_template('notify.tpl');
require_once 'include/bbcode.php';
$r = q("SELECT * from notify where uid = %d and seen = 0 order by date desc", intval(local_user()));
if (count($r) > 0) {
//.........这里部分代码省略.........
开发者ID:rahmiyildiz,项目名称:friendica,代码行数:101,代码来源:notifications.php
示例12: micropro
/**
*
* @param array $contact
* @param boolean $redirect
* @param string $class
* @param boolean $textmode
* @return string #FIXME: remove html
*/
function micropro($contact, $redirect = false, $class = '', $textmode = false)
{
if ($class) {
$class = ' ' . $class;
}
$url = $contact['url'];
$sparkle = '';
$redir = false;
if ($redirect) {
$a = get_app();
$redirect_url = $a->get_baseurl() . '/redir/' . $contact['id'];
if (local_user() && $contact['uid'] == local_user() && $contact['network'] === 'dfrn') {
$redir = true;
$url = $redirect_url;
$sparkle = ' sparkle';
} else {
$url = zrl($url);
}
}
$click = x($contact, 'click') ? ' onclick="' . $contact['click'] . '" ' : '';
if ($click) {
$url = '';
}
if ($textmode) {
return '<div class="contact-block-textdiv' . $class . '"><a class="contact-block-link' . $class . $sparkle . ($click ? ' fakelink' : '') . '" ' . ($redir ? ' target="redir" ' : '') . ($url ? ' href="' . $url . '"' : '') . $click . '" title="' . $contact['name'] . ' [' . $contact['url'] . ']" alt="' . $contact['name'] . '" >' . $contact['name'] . '</a></div>' . "\r\n";
} else {
return '<div class="contact-block-div' . $class . '"><a class="contact-block-link' . $class . $sparkle . ($click ? ' fakelink' : '') . '" ' . ($redir ? ' target="redir" ' : '') . ($url ? ' href="' . $url . '"' : '') . $click . ' ><img class="contact-block-img' . $class . $sparkle . '" src="' . $contact['micro'] . '" title="' . $contact['name'] . ' [' . $contact['url'] . ']" alt="' . $contact['name'] . '" /></a></div>' . "\r\n";
}
}
开发者ID:jzacman,项目名称:friendica,代码行数:37,代码来源:text.php
示例13: check_wall_to_wall
/**
* Check if we are a wall to wall item and set the relevant properties
*/
protected function check_wall_to_wall()
{
$a = $this->get_app();
$conv = $this->get_conversation();
$this->wall_to_wall = false;
if ($this->is_toplevel()) {
if ($conv->get_mode() !== 'profile') {
if ($this->get_data_value('wall') and !$this->get_data_value('self')) {
// On the network page, I am the owner. On the display page it will be the profile owner.
// This will have been stored in $a->page_contact by our calling page.
// Put this person as the wall owner of the wall-to-wall notice.
$this->owner_url = zrl($a->page_contact['url']);
$this->owner_photo = $a->page_contact['thumb'];
$this->owner_name = $a->page_contact['name'];
$this->wall_to_wall = true;
} else {
if ($this->get_data_value('owner-link')) {
$owner_linkmatch = $this->get_data_value('owner-link') && link_compare($this->get_data_value('owner-link'), $this->get_data_value('author-link'));
$alias_linkmatch = $this->get_data_value('alias') && link_compare($this->get_data_value('alias'), $this->get_data_value('author-link'));
$owner_namematch = $this->get_data_value('owner-name') && $this->get_data_value('owner-name') == $this->get_data_value('author-name');
if (!$owner_linkmatch && !$alias_linkmatch && !$owner_namematch) {
// The author url doesn't match the owner (typically the contact)
// and also doesn't match the contact alias.
// The name match is a hack to catch several weird cases where URLs are
// all over the park. It can be tricked, but this prevents you from
// seeing "Bob Smith to Bob Smith via Wall-to-wall" and you know darn
// well that it's the same Bob Smith.
// But it could be somebody else with the same name. It just isn't highly likely.
$this->owner_photo = $this->get_data_value('owner-avatar');
$this->owner_name = $this->get_data_value('owner-name');
$this->wall_to_wall = true;
// If it is our contact, use a friendly redirect link
if (link_compare($this->get_data_value('owner-link'), $this->get_data_value('url')) && $this->get_data_value('network') === NETWORK_DFRN) {
$this->owner_url = $this->get_redirect_url();
} else {
$this->owner_url = zrl($this->get_data_value('owner-link'));
}
}
}
}
}
}
if (!$this->wall_to_wall) {
$this->set_template('wall');
$this->owner_url = '';
$this->owner_photo = '';
$this->owner_name = '';
}
}
开发者ID:jzacman,项目名称:friendica,代码行数:52,代码来源:Item.php
示例14: 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']));
$submit = t('Submit Request');
// 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);
$submit = "";
//goaway($_SESSION['return_url']);
// NOTREACHED
}
$ret = probe_url($url);
if ($ret["network"] == NETWORK_DIASPORA and !get_config('system', 'diaspora_enabled')) {
notice(t("Diaspora support isn't enabled. Contact can't be added.") . EOL);
$submit = "";
//goaway($_SESSION['return_url']);
// NOTREACHED
}
if ($ret["network"] == NETWORK_OSTATUS and get_config('system', 'ostatus_disabled')) {
notice(t("OStatus support is disabled. Contact can't be added.") . EOL);
$submit = "";
//goaway($_SESSION['return_url']);
// NOTREACHED
}
if ($ret["network"] == NETWORK_PHANTOM) {
notice(t("The network type couldn't be detected. Contact can't be added.") . EOL);
$submit = "";
//goaway($_SESSION['return_url']);
// NOTREACHED
}
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"];
$r = q("SELECT `location`, `about`, `keywords` FROM `gcontact` WHERE `nurl` = '%s'", normalise_link($ret["url"]));
if (!$r) {
$r = array(array("location" => "", "about" => "", "keywords" => ""));
}
if ($ret['network'] === NETWORK_DIASPORA) {
$r[0]["location"] = "";
$r[0]["about"] = "";
}
$header = $ret["name"];
if ($ret["addr"] != "") {
$header .= " <" . $ret["addr"] . ">";
}
$header .= " (" . network_to_name($ret['network'], $ret['url']) . ")";
$o = replace_macros($tpl, array('$header' => htmlentities($header), '$photo' => proxy_url($ret["photo"], false, PROXY_SIZE_SMALL), '$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' => $submit, '$cancel' => t('Cancel'), '$nickname' => "", '$name' => $ret["name"], '$url' => $ret["url"], '$zrl' => zrl($ret["url"]), '$url_label' => t("Profile URL"), '$myaddr' => $myaddr, '$request' => $request, '$location' => bbcode($r[0]["location"]), '$location_label' => t("Location:"), '$about' => bbcode($r[0]["about"], false, false), '$about_label' => t("About:"), '$keywords' => $r[0]["keywords"], '$keywords_label' => t("Tags:")));
return $o;
}
开发者ID:vinzv,项目名称:friendica,代码行数:73,代码来源:follow.php
示例15: diabook_community_info
function diabook_community_info()
{
$a = get_app();
$close_pages = get_diabook_config("close_pages", 1);
$close_profiles = get_diabook_config("close_profiles", 0);
$close_helpers = get_diabook_config("close_helpers", 0);
$close_services = get_diabook_config("close_services", 0);
$close_friends = get_diabook_config("close_friends", 0);
$close_lastusers = get_diabook_config("close_lastusers", 0);
$close_lastphotos = get_diabook_config("close_lastphotos", 0);
$close_lastlikes = get_diabook_config("close_lastlikes", 0);
$close_mapquery = get_diabook_config("close_mapquery", 1);
// comunity_profiles
if ($close_profiles != "1") {
$aside['$comunity_profiles_title'] = t('Community Profiles');
$aside['$comunity_profiles_items'] = array();
$r = q("select gcontact.* from gcontact left join glink on glink.gcid = gcontact.id\n\t\t\t where glink.cid = 0 and glink.uid = 0 order by rand() limit 9");
$tpl = get_markup_template('ch_directory_item.tpl');
if (count($r)) {
$photo = 'photo';
foreach ($r as $rr) {
$profile_link = $a->get_baseurl() . '/profile/' . (strlen($rr['nickname']) ? $rr['nickname'] : $rr['profile_uid']);
$entry = replace_macros($tpl, array('$id' => $rr['id'], '$profile_link' => zrl($rr['url']), '$photo' => $rr[$photo], '$alt_text' => $rr['name']));
$aside['$comunity_profiles_items'][] = $entry;
}
}
}
// last 12 users
if ($close_lastusers != "1") {
$aside['$lastusers_title'] = t('Last users');
$aside['$lastusers_items'] = array();
$sql_extra = "";
$publish = get_config('system', 'publish_all') ? '' : " AND `publish` = 1 ";
$order = " ORDER BY `register_date` DESC ";
$r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`\n\t\t\tFROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`\n\t\t\tWHERE `is-default` = 1 {$publish} AND `user`.`blocked` = 0 {$sql_extra} {$order} LIMIT %d , %d ", 0, 9);
$tpl = get_markup_template('ch_directory_item.tpl');
if (count($r)) {
|
请发表评论