1
1
Fork 0

Merge pull request #1944 from annando/1510-proxy-picture-size

Picture size and bugfix for contact names with "<" and ">"
This commit is contained in:
Tobias Diekershoff 2015-10-08 08:03:42 +02:00
commit 26983bafff
24 changed files with 141 additions and 93 deletions

View file

@ -545,7 +545,7 @@ function acl_lookup(&$a, $out_type = 'json') {
$x['data'] = array(); $x['data'] = array();
if(count($r)) { if(count($r)) {
foreach($r as $g) { foreach($r as $g) {
$x['photos'][] = proxy_url($g['micro']); $x['photos'][] = proxy_url($g['micro'], false, PROXY_SIZE_MICRO);
$x['links'][] = $g['url']; $x['links'][] = $g['url'];
$x['suggestions'][] = $g['name']; $x['suggestions'][] = $g['name'];
$x['data'][] = intval($g['id']); $x['data'][] = intval($g['id']);
@ -559,7 +559,7 @@ function acl_lookup(&$a, $out_type = 'json') {
foreach($r as $g){ foreach($r as $g){
$contacts[] = array( $contacts[] = array(
"type" => "c", "type" => "c",
"photo" => proxy_url($g['micro']), "photo" => proxy_url($g['micro'], false, PROXY_SIZE_MICRO),
"name" => $g['name'], "name" => $g['name'],
"id" => intval($g['id']), "id" => intval($g['id']),
"network" => $g['network'], "network" => $g['network'],
@ -604,7 +604,7 @@ function acl_lookup(&$a, $out_type = 'json') {
// /nickname // /nickname
$unknow_contacts[] = array( $unknow_contacts[] = array(
"type" => "c", "type" => "c",
"photo" => proxy_url($row['author-avatar']), "photo" => proxy_url($row['author-avatar'], false, PROXY_SIZE_MICRO),
"name" => $row['author-name'], "name" => $row['author-name'],
"id" => '', "id" => '',
"network" => "unknown", "network" => "unknown",

View file

@ -601,7 +601,7 @@ function bb_ShareAttributes($share, $simplehtml) {
default: default:
$headline = trim($share[1]).'<div class="shared_header">'; $headline = trim($share[1]).'<div class="shared_header">';
if ($avatar != "") if ($avatar != "")
$headline .= '<img src="'.proxy_url($avatar).'" height="32" width="32" >'; $headline .= '<img src="'.proxy_url($avatar, false, PROXY_SIZE_MICRO).'" height="32" width="32" >';
$headline .= sprintf(t('<span><a href="%s" target="_blank">%s</a> wrote the following <a href="%s" target="_blank">post</a>'.$reldate.':</span>'), $profile, $author, $link); $headline .= sprintf(t('<span><a href="%s" target="_blank">%s</a> wrote the following <a href="%s" target="_blank">post</a>'.$reldate.':</span>'), $profile, $author, $link);
$headline .= "</div>"; $headline .= "</div>";

View file

@ -396,25 +396,25 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
$page_writeable = true; $page_writeable = true;
if(!$update) { if(!$update) {
// The special div is needed for liveUpdate to kick in for this page. // The special div is needed for liveUpdate to kick in for this page.
// We only launch liveUpdate if you aren't filtering in some incompatible // We only launch liveUpdate if you aren't filtering in some incompatible
// way and also you aren't writing a comment (discovered in javascript). // way and also you aren't writing a comment (discovered in javascript).
$live_update_div = '<div id="live-network"></div>' . "\r\n" $live_update_div = '<div id="live-network"></div>' . "\r\n"
. "<script> var profile_uid = " . $_SESSION['uid'] . "<script> var profile_uid = " . $_SESSION['uid']
. "; var netargs = '" . substr($a->cmd,8) . "; var netargs = '" . substr($a->cmd,8)
. '?f=' . '?f='
. ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '')
. ((x($_GET,'search')) ? '&search=' . $_GET['search'] : '') . ((x($_GET,'search')) ? '&search=' . $_GET['search'] : '')
. ((x($_GET,'star')) ? '&star=' . $_GET['star'] : '') . ((x($_GET,'star')) ? '&star=' . $_GET['star'] : '')
. ((x($_GET,'order')) ? '&order=' . $_GET['order'] : '') . ((x($_GET,'order')) ? '&order=' . $_GET['order'] : '')
. ((x($_GET,'bmark')) ? '&bmark=' . $_GET['bmark'] : '') . ((x($_GET,'bmark')) ? '&bmark=' . $_GET['bmark'] : '')
. ((x($_GET,'liked')) ? '&liked=' . $_GET['liked'] : '') . ((x($_GET,'liked')) ? '&liked=' . $_GET['liked'] : '')
. ((x($_GET,'conv')) ? '&conv=' . $_GET['conv'] : '') . ((x($_GET,'conv')) ? '&conv=' . $_GET['conv'] : '')
. ((x($_GET,'spam')) ? '&spam=' . $_GET['spam'] : '') . ((x($_GET,'spam')) ? '&spam=' . $_GET['spam'] : '')
. ((x($_GET,'nets')) ? '&nets=' . $_GET['nets'] : '') . ((x($_GET,'nets')) ? '&nets=' . $_GET['nets'] : '')
. ((x($_GET,'cmin')) ? '&cmin=' . $_GET['cmin'] : '') . ((x($_GET,'cmin')) ? '&cmin=' . $_GET['cmin'] : '')
. ((x($_GET,'cmax')) ? '&cmax=' . $_GET['cmax'] : '') . ((x($_GET,'cmax')) ? '&cmax=' . $_GET['cmax'] : '')
. ((x($_GET,'file')) ? '&file=' . $_GET['file'] : '') . ((x($_GET,'file')) ? '&file=' . $_GET['file'] : '')
. "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n"; . "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
} }
@ -431,7 +431,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
// because browser prefetching might change it on us. We have to deliver it with the page. // because browser prefetching might change it on us. We have to deliver it with the page.
$live_update_div = '<div id="live-profile"></div>' . "\r\n" $live_update_div = '<div id="live-profile"></div>' . "\r\n"
. "<script> var profile_uid = " . $a->profile['profile_uid'] . "<script> var profile_uid = " . $a->profile['profile_uid']
. "; var netargs = '?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n"; . "; var netargs = '?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
} }
} }
@ -441,7 +441,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
$page_writeable = true; $page_writeable = true;
if(!$update) { if(!$update) {
$live_update_div = '<div id="live-notes"></div>' . "\r\n" $live_update_div = '<div id="live-notes"></div>' . "\r\n"
. "<script> var profile_uid = " . local_user() . "<script> var profile_uid = " . local_user()
. "; var netargs = '/?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n"; . "; var netargs = '/?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
} }
} }
@ -656,7 +656,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
'name' => $profile_name_e, 'name' => $profile_name_e,
'sparkle' => $sparkle, 'sparkle' => $sparkle,
'lock' => $lock, 'lock' => $lock,
'thumb' => proxy_url($profile_avatar), 'thumb' => proxy_url($profile_avatar, false, PROXY_SIZE_THUMB),
'title' => $item['title_e'], 'title' => $item['title_e'],
'body' => $body_e, 'body' => $body_e,
'tags' => $tags_e, 'tags' => $tags_e,
@ -675,7 +675,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
'indent' => '', 'indent' => '',
'owner_name' => $owner_name_e, 'owner_name' => $owner_name_e,
'owner_url' => $owner_url, 'owner_url' => $owner_url,
'owner_photo' => proxy_url($owner_photo), 'owner_photo' => proxy_url($owner_photo, false, PROXY_SIZE_THUMB),
'plink' => get_plink($item), 'plink' => get_plink($item),
'edpost' => false, 'edpost' => false,
'isstarred' => $isstarred, 'isstarred' => $isstarred,

View file

@ -110,6 +110,9 @@ function diaspora_dispatch($importer,$msg,$attempt=1) {
elseif($xmlbase->message) { elseif($xmlbase->message) {
$ret = diaspora_message($importer,$xmlbase->message,$msg); $ret = diaspora_message($importer,$xmlbase->message,$msg);
} }
elseif($xmlbase->participation) {
$ret = diaspora_participation($importer,$xmlbase->participation);
}
else { else {
logger('diaspora_dispatch: unknown message type: ' . print_r($xmlbase,true)); logger('diaspora_dispatch: unknown message type: ' . print_r($xmlbase,true));
} }
@ -1834,7 +1837,7 @@ function diaspora_message($importer,$xml,$msg) {
$author_signature = base64_decode($msg_author_signature); $author_signature = base64_decode($msg_author_signature);
$person = find_diaspora_person_by_handle($msg_diaspora_handle); $person = find_diaspora_person_by_handle($msg_diaspora_handle);
if(is_array($person) && x($person,'pubkey')) if(is_array($person) && x($person,'pubkey'))
$key = $person['pubkey']; $key = $person['pubkey'];
else { else {
@ -1881,6 +1884,9 @@ function diaspora_message($importer,$xml,$msg) {
return; return;
} }
function diaspora_participation($importer,$xml) {
logger("Unsupported message type 'participation' ".print_r($xml, true));
}
function diaspora_photo($importer,$xml,$msg,$attempt=1) { function diaspora_photo($importer,$xml,$msg,$attempt=1) {

View file

@ -1287,11 +1287,24 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
} }
if ($arr['network'] == "") { if ($arr['network'] == "") {
$r = q("SELECT `network` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", $r = q("SELECT `network` FROM `contact` WHERE `network` IN ('%s', '%s', '%s') AND `nurl` = '%s' AND `uid` = %d LIMIT 1",
intval($arr['contact-id']), dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_OSTATUS),
dbesc(normalise_link($arr['author-link'])),
intval($arr['uid']) intval($arr['uid'])
); );
if(!count($r))
$r = q("SELECT `network` FROM `gcontact` WHERE `network` IN ('%s', '%s', '%s') AND `nurl` = '%s' LIMIT 1",
dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_OSTATUS),
dbesc(normalise_link($arr['author-link']))
);
if(!count($r))
$r = q("SELECT `network` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($arr['contact-id']),
intval($arr['uid'])
);
if(count($r)) if(count($r))
$arr['network'] = $r[0]["network"]; $arr['network'] = $r[0]["network"];

View file

@ -970,7 +970,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
. (($click) ? ' fakelink' : '') . '" ' . (($click) ? ' fakelink' : '') . '" '
. (($redir) ? ' target="redir" ' : '') . (($redir) ? ' target="redir" ' : '')
. (($url) ? ' href="' . $url . '"' : '') . $click . ' ><img class="contact-block-img' . $class . $sparkle . '" src="' . (($url) ? ' href="' . $url . '"' : '') . $click . ' ><img class="contact-block-img' . $class . $sparkle . '" src="'
. proxy_url($contact['micro']) . '" title="' . $contact['name'] . ' [' . $contact['url'] . ']" alt="' . $contact['name'] . proxy_url($contact['micro'], false, PROXY_SIZE_THUMB) . '" title="' . $contact['name'] . ' [' . $contact['url'] . ']" alt="' . $contact['name']
. '" /></a></div>' . "\r\n"; . '" /></a></div>' . "\r\n";
} }
}} }}

View file

@ -21,7 +21,7 @@ function allfriends_content(&$a) {
); );
$vcard_widget .= replace_macros(get_markup_template("vcard-widget.tpl"),array( $vcard_widget .= replace_macros(get_markup_template("vcard-widget.tpl"),array(
'$name' => $c[0]['name'], '$name' => htmlentities($c[0]['name']),
'$photo' => $c[0]['photo'], '$photo' => $c[0]['photo'],
'url' => z_root() . '/contacts/' . $cid 'url' => z_root() . '/contacts/' . $cid
)); ));
@ -34,7 +34,7 @@ function allfriends_content(&$a) {
return; return;
$o .= replace_macros(get_markup_template("section_title.tpl"),array( $o .= replace_macros(get_markup_template("section_title.tpl"),array(
'$title' => sprintf( t('Friends of %s'), $c[0]['name']) '$title' => sprintf( t('Friends of %s'), htmlentities($c[0]['name']))
)); ));
@ -48,10 +48,10 @@ function allfriends_content(&$a) {
$tpl = get_markup_template('common_friends.tpl'); $tpl = get_markup_template('common_friends.tpl');
foreach($r as $rr) { foreach($r as $rr) {
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$url' => $rr['url'], '$url' => $rr['url'],
'$name' => $rr['name'], '$name' => htmlentities($rr['name']),
'$photo' => $rr['photo'], '$photo' => $rr['photo'],
'$tags' => '' '$tags' => ''
)); ));

View file

@ -16,7 +16,7 @@ function common_content(&$a) {
if(! $uid) if(! $uid)
return; return;
if($cmd === 'loc' && $cid) { if($cmd === 'loc' && $cid) {
$c = q("select name, url, photo from contact where id = %d and uid = %d limit 1", $c = q("select name, url, photo from contact where id = %d and uid = %d limit 1",
intval($cid), intval($cid),
intval($uid) intval($uid)
@ -26,10 +26,10 @@ function common_content(&$a) {
$c = q("select name, url, photo from contact where self = 1 and uid = %d limit 1", $c = q("select name, url, photo from contact where self = 1 and uid = %d limit 1",
intval($uid) intval($uid)
); );
} }
$vcard_widget .= replace_macros(get_markup_template("vcard-widget.tpl"),array( $vcard_widget .= replace_macros(get_markup_template("vcard-widget.tpl"),array(
'$name' => $c[0]['name'], '$name' => htmlentities($c[0]['name']),
'$photo' => $c[0]['photo'], '$photo' => $c[0]['photo'],
'url' => z_root() . '/contacts/' . $cid 'url' => z_root() . '/contacts/' . $cid
)); ));
@ -97,10 +97,10 @@ function common_content(&$a) {
$tpl = get_markup_template('common_friends.tpl'); $tpl = get_markup_template('common_friends.tpl');
foreach($r as $rr) { foreach($r as $rr) {
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$url' => $rr['url'], '$url' => $rr['url'],
'$name' => $rr['name'], '$name' => htmlentities($rr['name']),
'$photo' => $rr['photo'], '$photo' => $rr['photo'],
'$tags' => '' '$tags' => ''
)); ));

View file

@ -33,7 +33,7 @@ function contacts_init(&$a) {
if($contact_id) { if($contact_id) {
$a->data['contact'] = $r[0]; $a->data['contact'] = $r[0];
$vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"),array( $vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"),array(
'$name' => $a->data['contact']['name'], '$name' => htmlentities($a->data['contact']['name']),
'$photo' => $a->data['contact']['photo'], '$photo' => $a->data['contact']['photo'],
'$url' => ($a->data['contact']['network'] == NETWORK_DFRN) ? $a->get_baseurl()."/redir/".$a->data['contact']['id'] : $a->data['contact']['url'] '$url' => ($a->data['contact']['network'] == NETWORK_DFRN) ? $a->get_baseurl()."/redir/".$a->data['contact']['id'] : $a->data['contact']['url']
)); ));
@ -432,7 +432,7 @@ function contacts_content(&$a) {
} }
$a->page['aside'] = ''; $a->page['aside'] = '';
return replace_macros(get_markup_template('contact_drop_confirm.tpl'), array( return replace_macros(get_markup_template('contact_drop_confirm.tpl'), array(
'$contact' => _contact_detail_for_template($orig_record[0]), '$contact' => _contact_detail_for_template($orig_record[0]),
'$method' => 'get', '$method' => 'get',
@ -509,7 +509,7 @@ function contacts_content(&$a) {
if(!in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA))) if(!in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA)))
$relation_text = ""; $relation_text = "";
$relation_text = sprintf($relation_text,$contact['name']); $relation_text = sprintf($relation_text,htmlentities($contact['name']));
if(($contact['network'] === NETWORK_DFRN) && ($contact['rel'])) { if(($contact['network'] === NETWORK_DFRN) && ($contact['rel'])) {
$url = "redir/{$contact['id']}"; $url = "redir/{$contact['id']}";
@ -632,7 +632,7 @@ function contacts_content(&$a) {
'$ffi_keyword_blacklist' => $contact['ffi_keyword_blacklist'], '$ffi_keyword_blacklist' => $contact['ffi_keyword_blacklist'],
'$ffi_keyword_blacklist' => array('ffi_keyword_blacklist', t('Blacklisted keywords'), $contact['ffi_keyword_blacklist'], t('Comma separated list of keywords that should not be converted to hashtags, when "Fetch information and keywords" is selected')), '$ffi_keyword_blacklist' => array('ffi_keyword_blacklist', t('Blacklisted keywords'), $contact['ffi_keyword_blacklist'], t('Comma separated list of keywords that should not be converted to hashtags, when "Fetch information and keywords" is selected')),
'$photo' => $contact['photo'], '$photo' => $contact['photo'],
'$name' => $contact['name'], '$name' => htmlentities($contact['name']),
'$dir_icon' => $dir_icon, '$dir_icon' => $dir_icon,
'$alt_text' => $alt_text, '$alt_text' => $alt_text,
'$sparkle' => $sparkle, '$sparkle' => $sparkle,
@ -832,8 +832,8 @@ function _contact_detail_for_template($rr){
$url = $rr['url']; $url = $rr['url'];
$sparkle = ''; $sparkle = '';
} }
return array( return array(
'img_hover' => sprintf( t('Visit %s\'s profile [%s]'),$rr['name'],$rr['url']), 'img_hover' => sprintf( t('Visit %s\'s profile [%s]'),$rr['name'],$rr['url']),
'edit_hover' => t('Edit contact'), 'edit_hover' => t('Edit contact'),
@ -841,9 +841,9 @@ function _contact_detail_for_template($rr){
'id' => $rr['id'], 'id' => $rr['id'],
'alt_text' => $alt_text, 'alt_text' => $alt_text,
'dir_icon' => $dir_icon, 'dir_icon' => $dir_icon,
'thumb' => proxy_url($rr['thumb']), 'thumb' => proxy_url($rr['thumb'], false, PROXY_SIZE_THUMB),
'name' => $rr['name'], 'name' => htmlentities($rr['name']),
'username' => $rr['name'], 'username' => htmlentities($rr['name']),
'sparkle' => $sparkle, 'sparkle' => $sparkle,
'itemurl' => $rr['url'], 'itemurl' => $rr['url'],
'url' => $url, 'url' => $url,

View file

@ -11,8 +11,8 @@
// There is no "pagination query", but we will manage the "current page" on the client // There is no "pagination query", but we will manage the "current page" on the client
// and provide a link to fetch the next page - until there are no pages left to fetch. // and provide a link to fetch the next page - until there are no pages left to fetch.
// With the exception of complex tag and text searches, this prototype is incredibly // With the exception of complex tag and text searches, this prototype is incredibly
// fast - e.g. one or two milliseconds to fetch parent items for the current content, // fast - e.g. one or two milliseconds to fetch parent items for the current content,
// and 10-20 milliseconds to fetch all the child items. // and 10-20 milliseconds to fetch all the child items.
@ -476,7 +476,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
'name' => $name_e, 'name' => $name_e,
'sparkle' => $sparkle, 'sparkle' => $sparkle,
'lock' => $lock, 'lock' => $lock,
'thumb' => proxy_url($profile_avatar), 'thumb' => proxy_url($profile_avatar, false, PROXY_SIZE_THUMB),
'title' => $title_e, 'title' => $title_e,
'body' => $body_e, 'body' => $body_e,
'text' => $text_e, 'text' => $text_e,
@ -485,7 +485,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
'indent' => '', 'indent' => '',
'owner_name' => $owner_name_e, 'owner_name' => $owner_name_e,
'owner_url' => $owner_url, 'owner_url' => $owner_url,
'owner_photo' => proxy_url($owner_photo), 'owner_photo' => proxy_url($owner_photo, false, PROXY_SIZE_THUMB),
'plink' => get_plink($item), 'plink' => get_plink($item),
'edpost' => false, 'edpost' => false,
'isstarred' => $isstarred, 'isstarred' => $isstarred,
@ -859,7 +859,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
'profile_url' => $profile_link, 'profile_url' => $profile_link,
'item_photo_menu' => item_photo_menu($item), 'item_photo_menu' => item_photo_menu($item),
'name' => $name_e, 'name' => $name_e,
'thumb' => proxy_url($profile_avatar), 'thumb' => proxy_url($profile_avatar, false, PROXY_SIZE_THUMB),
'osparkle' => $osparkle, 'osparkle' => $osparkle,
'sparkle' => $sparkle, 'sparkle' => $sparkle,
'title' => $title_e, 'title' => $title_e,
@ -869,7 +869,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
'indent' => $indent, 'indent' => $indent,
'shiny' => $shiny, 'shiny' => $shiny,
'owner_url' => $owner_url, 'owner_url' => $owner_url,
'owner_photo' => proxy_url($owner_photo), 'owner_photo' => proxy_url($owner_photo, false, PROXY_SIZE_THUMB),
'owner_name' => $owner_name_e, 'owner_name' => $owner_name_e,
'plink' => get_plink($item), 'plink' => get_plink($item),
'edpost' => $edpost, 'edpost' => $edpost,

View file

@ -24,7 +24,7 @@ function crepair_init(&$a) {
$a->data['contact'] = $r[0]; $a->data['contact'] = $r[0];
$tpl = get_markup_template("vcard-widget.tpl"); $tpl = get_markup_template("vcard-widget.tpl");
$vcard_widget .= replace_macros($tpl, array( $vcard_widget .= replace_macros($tpl, array(
'$name' => $a->data['contact']['name'], '$name' => htmlentities($a->data['contact']['name']),
'$photo' => $a->data['contact']['photo'] '$photo' => $a->data['contact']['photo']
)); ));
$a->page['aside'] .= $vcard_widget; $a->page['aside'] .= $vcard_widget;
@ -179,8 +179,8 @@ function crepair_content(&$a) {
'$label_remote_self' => t('Remote Self'), '$label_remote_self' => t('Remote Self'),
'$allow_remote_self' => $allow_remote_self, '$allow_remote_self' => $allow_remote_self,
'$remote_self' => array('remote_self', t('Mirror postings from this contact'), $contact['remote_self'], t('Mark this contact as remote_self, this will cause friendica to repost new entries from this contact.'), $remote_self_options), '$remote_self' => array('remote_self', t('Mirror postings from this contact'), $contact['remote_self'], t('Mark this contact as remote_self, this will cause friendica to repost new entries from this contact.'), $remote_self_options),
'$contact_name' => $contact['name'], '$contact_name' => htmlentities($contact['name']),
'$contact_nick' => $contact['nick'], '$contact_nick' => htmlentities($contact['nick']),
'$contact_id' => $contact['id'], '$contact_id' => $contact['id'],
'$contact_url' => $contact['url'], '$contact_url' => $contact['url'],
'$request' => $contact['request'], '$request' => $contact['request'],

View file

@ -171,7 +171,7 @@ function directory_content(&$a) {
$entry = replace_macros($tpl,array( $entry = replace_macros($tpl,array(
'$id' => $rr['id'], '$id' => $rr['id'],
'$profile_link' => $profile_link, '$profile_link' => $profile_link,
'$photo' => proxy_url($a->get_cached_avatar_image($rr[$photo])), '$photo' => proxy_url($a->get_cached_avatar_image($rr[$photo]), false, PROXY_SIZE_THUMB),
'$alt_text' => $rr['name'], '$alt_text' => $rr['name'],
'$name' => $rr['name'], '$name' => $rr['name'],
'$details' => $pdesc . $details, '$details' => $pdesc . $details,

View file

@ -140,7 +140,7 @@ function dirfind_content(&$a, $prefix = "") {
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$url' => zrl($jj->url), '$url' => zrl($jj->url),
'$name' => $jj->name, '$name' => $jj->name,
'$photo' => proxy_url($jj->photo), '$photo' => proxy_url($jj->photo, false, PROXY_SIZE_THUMB),
'$tags' => $jj->tags, '$tags' => $jj->tags,
'$conntxt' => $conntxt, '$conntxt' => $conntxt,
'$connlnk' => $connlnk, '$connlnk' => $connlnk,

View file

@ -97,7 +97,7 @@ function display_fetchauthor($a, $item) {
$profiledata["nickname"] = $item["author-name"]; $profiledata["nickname"] = $item["author-name"];
$profiledata["name"] = $item["author-name"]; $profiledata["name"] = $item["author-name"];
$profiledata["picdate"] = ""; $profiledata["picdate"] = "";
$profiledata["photo"] = proxy_url($item["author-avatar"]); $profiledata["photo"] = proxy_url($item["author-avatar"], false, PROXY_SIZE_SMALL);
$profiledata["url"] = $item["author-link"]; $profiledata["url"] = $item["author-link"];
$profiledata["network"] = $item["network"]; $profiledata["network"] = $item["network"];
@ -174,7 +174,7 @@ function display_fetchauthor($a, $item) {
$r[0]["about"] = ""; $r[0]["about"] = "";
} }
$profiledata["photo"] = proxy_url($r[0]["photo"]); $profiledata["photo"] = proxy_url($r[0]["photo"], false, PROXY_SIZE_SMALL);
$profiledata["address"] = bbcode($r[0]["location"]); $profiledata["address"] = bbcode($r[0]["location"]);
$profiledata["about"] = bbcode($r[0]["about"]); $profiledata["about"] = bbcode($r[0]["about"]);
if ($r[0]["nick"] != "") if ($r[0]["nick"] != "")
@ -185,7 +185,7 @@ function display_fetchauthor($a, $item) {
$r = q("SELECT `avatar`, `nick`, `location`, `about` FROM `unique_contacts` WHERE `url` = '%s'", dbesc(normalise_link($profiledata["url"]))); $r = q("SELECT `avatar`, `nick`, `location`, `about` FROM `unique_contacts` WHERE `url` = '%s'", dbesc(normalise_link($profiledata["url"])));
if (count($r)) { if (count($r)) {
if ($profiledata["photo"] == "") if ($profiledata["photo"] == "")
$profiledata["photo"] = proxy_url($r[0]["avatar"]); $profiledata["photo"] = proxy_url($r[0]["avatar"], false, PROXY_SIZE_SMALL);
if (($profiledata["address"] == "") AND ($profiledata["network"] != NETWORK_DIASPORA)) if (($profiledata["address"] == "") AND ($profiledata["network"] != NETWORK_DIASPORA))
$profiledata["address"] = bbcode($r[0]["location"]); $profiledata["address"] = bbcode($r[0]["location"]);
if (($profiledata["about"] == "") AND ($profiledata["network"] != NETWORK_DIASPORA)) if (($profiledata["about"] == "") AND ($profiledata["network"] != NETWORK_DIASPORA))

View file

@ -81,7 +81,7 @@ function follow_content(&$a) {
$o = replace_macros($tpl,array( $o = replace_macros($tpl,array(
'$header' => htmlentities($header), '$header' => htmlentities($header),
'$photo' => proxy_url($ret["photo"]), '$photo' => proxy_url($ret["photo"], false, PROXY_SIZE_SMALL),
'$desc' => "", '$desc' => "",
'$pls_answer' => t('Please answer the following:'), '$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'))), '$does_know_you' => array('knowyou', sprintf(t('Does %s know you?'),$ret["name"]), false, '', array(t('No'),t('Yes'))),

View file

@ -2,6 +2,7 @@
include_once('include/text.php'); include_once('include/text.php');
require_once('include/socgraph.php'); require_once('include/socgraph.php');
require_once('include/contact_widgets.php'); require_once('include/contact_widgets.php');
require_once('mod/proxy.php');
function match_content(&$a) { function match_content(&$a) {
@ -65,7 +66,7 @@ function match_content(&$a) {
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$url' => zrl($jj->url), '$url' => zrl($jj->url),
'$name' => $jj->name, '$name' => $jj->name,
'$photo' => proxy_url($jj->photo), '$photo' => proxy_url($jj->photo, false, PROXY_SIZE_THUMB),
'$inttxt' => ' ' . t('is interested in:'), '$inttxt' => ' ' . t('is interested in:'),
'$conntxt' => t('Connect'), '$conntxt' => t('Connect'),
'$connlnk' => $connlnk, '$connlnk' => $connlnk,

View file

@ -568,14 +568,14 @@ function network_content(&$a, $update = 0) {
intval($cid) intval($cid)
); );
if(count($r)) { if(count($r)) {
$sql_post_table = " INNER JOIN (SELECT DISTINCT(`parent`) FROM `item` $sql_post_table = " INNER JOIN (SELECT DISTINCT(`parent`) FROM `item`
WHERE 1 $sql_options AND `contact-id` = ".intval($cid)." and deleted = 0 WHERE 1 $sql_options AND `contact-id` = ".intval($cid)." and deleted = 0
ORDER BY `item`.`received` DESC) AS `temp1` ORDER BY `item`.`received` DESC) AS `temp1`
ON $sql_table.$sql_parent = `temp1`.`parent` "; ON $sql_table.$sql_parent = `temp1`.`parent` ";
$sql_extra = ""; $sql_extra = "";
$o = replace_macros(get_markup_template("section_title.tpl"),array( $o = replace_macros(get_markup_template("section_title.tpl"),array(
'$title' => sprintf( t('Contact: %s'), $r[0]['name']) '$title' => sprintf( t('Contact: %s'), htmlentities($r[0]['name']))
)) . $o; )) . $o;
if($r[0]['network'] === NETWORK_OSTATUS && $r[0]['writable'] && (! get_pconfig(local_user(),'system','nowarn_insecure'))) { if($r[0]['network'] === NETWORK_OSTATUS && $r[0]['writable'] && (! get_pconfig(local_user(),'system','nowarn_insecure'))) {

View file

@ -166,7 +166,7 @@ function notifications_content(&$a) {
'$intro_id' => $rr['intro_id'], '$intro_id' => $rr['intro_id'],
'$madeby' => sprintf( t('suggested by %s'),$rr['name']), '$madeby' => sprintf( t('suggested by %s'),$rr['name']),
'$contact_id' => $rr['contact-id'], '$contact_id' => $rr['contact-id'],
'$photo' => ((x($rr,'fphoto')) ? proxy_url($rr['fphoto']) : "images/person-175.jpg"), '$photo' => ((x($rr,'fphoto')) ? proxy_url($rr['fphoto'], false, PROXY_SIZE_SMALL) : "images/person-175.jpg"),
'$fullname' => $rr['fname'], '$fullname' => $rr['fname'],
'$url' => zrl($rr['furl']), '$url' => zrl($rr['furl']),
'$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''), '$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''),
@ -238,7 +238,7 @@ function notifications_content(&$a) {
'$uid' => $_SESSION['uid'], '$uid' => $_SESSION['uid'],
'$intro_id' => $rr['intro_id'], '$intro_id' => $rr['intro_id'],
'$contact_id' => $rr['contact-id'], '$contact_id' => $rr['contact-id'],
'$photo' => ((x($rr,'photo')) ? proxy_url($rr['photo']) : "images/person-175.jpg"), '$photo' => ((x($rr,'photo')) ? proxy_url($rr['photo'], false, PROXY_SIZE_SMALL) : "images/person-175.jpg"),
'$fullname' => $rr['name'], '$fullname' => $rr['name'],
'$location' => bbcode($rr['glocation'], false, false), '$location' => bbcode($rr['glocation'], false, false),
'$location_label' => t('Location:'), '$location_label' => t('Location:'),
@ -303,7 +303,7 @@ function notifications_content(&$a) {
$notif_content .= replace_macros($tpl_item_likes,array( $notif_content .= replace_macros($tpl_item_likes,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'], //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'], '$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'], '$item_image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
'$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']), '$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
)); ));
@ -313,7 +313,7 @@ function notifications_content(&$a) {
$notif_content .= replace_macros($tpl_item_dislikes,array( $notif_content .= replace_macros($tpl_item_dislikes,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'], //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'], '$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'], '$item_image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
'$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']), '$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
)); ));
@ -328,7 +328,7 @@ function notifications_content(&$a) {
$notif_content .= replace_macros($tpl_item_friends,array( $notif_content .= replace_macros($tpl_item_friends,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'], //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'], '$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'], '$item_image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
'$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']), '$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
)); ));
@ -343,7 +343,7 @@ function notifications_content(&$a) {
$notif_content .= replace_macros($tpl,array( $notif_content .= replace_macros($tpl,array(
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'], //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'], '$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'], '$item_image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
'$item_text' => $item_text, '$item_text' => $item_text,
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
)); ));
@ -376,7 +376,7 @@ function notifications_content(&$a) {
foreach ($r as $it) { foreach ($r as $it) {
$notif_content .= replace_macros($not_tpl,array( $notif_content .= replace_macros($not_tpl,array(
'$item_link' => $a->get_baseurl(true).'/notify/view/'. $it['id'], '$item_link' => $a->get_baseurl(true).'/notify/view/'. $it['id'],
'$item_image' => proxy_url($it['photo']), '$item_image' => proxy_url($it['photo'], false, PROXY_SIZE_MICRO),
'$item_text' => strip_tags(bbcode($it['msg'])), '$item_text' => strip_tags(bbcode($it['msg'])),
'$item_when' => relative_date($it['date']) '$item_when' => relative_date($it['date'])
)); ));

View file

@ -173,7 +173,7 @@ function ping_init(&$a) {
* 'message' => notification message. "{0}" will be replaced by subject name * 'message' => notification message. "{0}" will be replaced by subject name
**/ **/
function xmlize($n){ function xmlize($n){
$n['photo'] = proxy_url($n['photo']); $n['photo'] = proxy_url($n['photo'], false, PROXY_SIZE_MICRO);
$n['message'] = html_entity_decode($n['message'], ENT_COMPAT | ENT_HTML401, "UTF-8"); $n['message'] = html_entity_decode($n['message'], ENT_COMPAT | ENT_HTML401, "UTF-8");
$n['name'] = html_entity_decode($n['name'], ENT_COMPAT | ENT_HTML401, "UTF-8"); $n['name'] = html_entity_decode($n['name'], ENT_COMPAT | ENT_HTML401, "UTF-8");

View file

@ -3,6 +3,12 @@
define("PROXY_DEFAULT_TIME", 86400); // 1 Day define("PROXY_DEFAULT_TIME", 86400); // 1 Day
define("PROXY_SIZE_MICRO", "micro");
define("PROXY_SIZE_THUMB", "thumb");
define("PROXY_SIZE_SMALL", "small");
define("PROXY_SIZE_MEDIUM", "medium");
define("PROXY_SIZE_LARGE", "large");
require_once('include/security.php'); require_once('include/security.php');
require_once("include/Photo.php"); require_once("include/Photo.php");
@ -37,6 +43,7 @@ function proxy_init() {
$thumb = false; $thumb = false;
$size = 1024; $size = 1024;
$sizetype = "";
// If the cache path isn't there, try to create it // If the cache path isn't there, try to create it
if (!is_dir($_SERVER["DOCUMENT_ROOT"]."/proxy")) if (!is_dir($_SERVER["DOCUMENT_ROOT"]."/proxy"))
@ -59,14 +66,27 @@ function proxy_init() {
$size = 200; $size = 200;
// thumb, small, medium and large. // thumb, small, medium and large.
if (substr($url, -6) == ":thumb") if (substr($url, -6) == ":micro") {
$size = 150; $size = 48;
if (substr($url, -6) == ":small") $sizetype = ":micro";
$size = 340; $url = substr($url, 0, -6);
if (substr($url, -7) == ":medium") } elseif (substr($url, -6) == ":thumb") {
$size = 80;
$sizetype = ":thumb";
$url = substr($url, 0, -6);
} elseif (substr($url, -6) == ":small") {
$size = 175;
$url = substr($url, 0, -6);
$sizetype = ":small";
} elseif (substr($url, -7) == ":medium") {
$size = 600; $size = 600;
if (substr($url, -6) == ":large") $url = substr($url, 0, -7);
$sizetype = ":medium";
} elseif (substr($url, -6) == ":large") {
$size = 1024; $size = 1024;
$url = substr($url, 0, -6);
$sizetype = ":large";
}
$pos = strrpos($url, "=."); $pos = strrpos($url, "=.");
if ($pos) if ($pos)
@ -176,6 +196,8 @@ function proxy_init() {
} }
} }
$img_str_orig = $img_str;
// reduce quality - if it isn't a GIF // reduce quality - if it isn't a GIF
if ($mime != "image/gif") { if ($mime != "image/gif") {
$img = new Photo($img_str, $mime); $img = new Photo($img_str, $mime);
@ -188,10 +210,12 @@ function proxy_init() {
// If there is a real existing directory then put the cache file there // If there is a real existing directory then put the cache file there
// advantage: real file access is really fast // advantage: real file access is really fast
// Otherwise write in cachefile // Otherwise write in cachefile
if ($valid AND $direct_cache) if ($valid AND $direct_cache) {
file_put_contents($_SERVER["DOCUMENT_ROOT"]."/proxy/".proxy_url($_REQUEST['url'], true), $img_str); file_put_contents($_SERVER["DOCUMENT_ROOT"]."/proxy/".proxy_url($_REQUEST['url'], true), $img_str_orig);
elseif ($cachefile != '') if ($sizetype <> '')
file_put_contents($cachefile, $img_str); file_put_contents($_SERVER["DOCUMENT_ROOT"]."/proxy/".proxy_url($_REQUEST['url'], true).$sizetype, $img_str);
} elseif ($cachefile != '')
file_put_contents($cachefile, $img_str_orig);
header("Content-type: $mime"); header("Content-type: $mime");
@ -208,7 +232,7 @@ function proxy_init() {
killme(); killme();
} }
function proxy_url($url, $writemode = false) { function proxy_url($url, $writemode = false, $size = "") {
global $_SERVER; global $_SERVER;
$a = get_app(); $a = get_app();
@ -251,6 +275,9 @@ function proxy_url($url, $writemode = false) {
$proxypath = $a->get_baseurl()."/proxy/".$path; $proxypath = $a->get_baseurl()."/proxy/".$path;
if ($size != "")
$size = ":".$size;
// Too long files aren't supported by Apache // Too long files aren't supported by Apache
// Writemode in combination with long files shouldn't be possible // Writemode in combination with long files shouldn't be possible
if ((strlen($proxypath) > 250) AND $writemode) if ((strlen($proxypath) > 250) AND $writemode)
@ -260,7 +287,7 @@ function proxy_url($url, $writemode = false) {
elseif ($writemode) elseif ($writemode)
return ($path); return ($path);
else else
return ($proxypath); return ($proxypath.$size);
} }
/** /**

View file

@ -81,12 +81,12 @@ function suggest_content(&$a) {
foreach($r as $rr) { foreach($r as $rr) {
$connlnk = $a->get_baseurl() . '/follow/?url=' . (($rr['connect']) ? $rr['connect'] : $rr['url']); $connlnk = $a->get_baseurl() . '/follow/?url=' . (($rr['connect']) ? $rr['connect'] : $rr['url']);
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$url' => zrl($rr['url']), '$url' => zrl($rr['url']),
'$name' => $rr['name'], '$name' => $rr['name'],
'$photo' => proxy_url($rr['photo']), '$photo' => proxy_url($rr['photo'], false, PROXY_SIZE_THUMB),
'$ignlnk' => $a->get_baseurl() . '/suggest?ignore=' . $rr['id'], '$ignlnk' => $a->get_baseurl() . '/suggest?ignore=' . $rr['id'],
'$ignid' => $rr['id'], '$ignid' => $rr['id'],
'$conntxt' => t('Connect'), '$conntxt' => t('Connect'),

View file

@ -62,9 +62,9 @@ function viewcontacts_content(&$a) {
$contacts[] = array( $contacts[] = array(
'id' => $rr['id'], 'id' => $rr['id'],
'img_hover' => sprintf( t('Visit %s\'s profile [%s]'), $rr['name'], $rr['url']), 'img_hover' => sprintf( t('Visit %s\'s profile [%s]'), $rr['name'], $rr['url']),
'thumb' => proxy_url($rr['thumb']), 'thumb' => proxy_url($rr['thumb'], false, PROXY_SIZE_THUMB),
'name' => substr($rr['name'],0,20), 'name' => htmlentities(substr($rr['name'],0,20)),
'username' => $rr['name'], 'username' => htmlentities($rr['name']),
'url' => $url, 'url' => $url,
'sparkle' => '', 'sparkle' => '',
'itemurl' => $rr['url'], 'itemurl' => $rr['url'],

View file

@ -134,7 +134,7 @@ class Item extends BaseObject {
$filer = (($conv->get_profile_owner() == local_user()) ? t("save to folder") : false); $filer = (($conv->get_profile_owner() == local_user()) ? t("save to folder") : false);
$diff_author = ((link_compare($item['url'],$item['author-link'])) ? false : true); $diff_author = ((link_compare($item['url'],$item['author-link'])) ? false : true);
$profile_name = (((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']); $profile_name = htmlentities(((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']);
if($item['author-link'] && (! $item['author-name'])) if($item['author-link'] && (! $item['author-name']))
$profile_name = $item['author-link']; $profile_name = $item['author-link'];
@ -334,7 +334,7 @@ class Item extends BaseObject {
'profile_url' => $profile_link, 'profile_url' => $profile_link,
'item_photo_menu' => item_photo_menu($item), 'item_photo_menu' => item_photo_menu($item),
'name' => $name_e, 'name' => $name_e,
'thumb' => proxy_url($profile_avatar), 'thumb' => proxy_url($profile_avatar, false, PROXY_SIZE_THUMB),
'osparkle' => $osparkle, 'osparkle' => $osparkle,
'sparkle' => $sparkle, 'sparkle' => $sparkle,
'title' => $title_e, 'title' => $title_e,
@ -347,7 +347,7 @@ class Item extends BaseObject {
'indent' => $indent, 'indent' => $indent,
'shiny' => $shiny, 'shiny' => $shiny,
'owner_url' => $this->get_owner_url(), 'owner_url' => $this->get_owner_url(),
'owner_photo' => proxy_url($this->get_owner_photo()), 'owner_photo' => proxy_url($this->get_owner_photo(), false, PROXY_SIZE_THUMB),
'owner_name' => $owner_name_e, 'owner_name' => $owner_name_e,
'plink' => get_plink($item), 'plink' => get_plink($item),
'edpost' => ((feature_enabled($conv->get_profile_owner(),'edit_posts')) ? $edpost : ''), 'edpost' => ((feature_enabled($conv->get_profile_owner(),'edit_posts')) ? $edpost : ''),

View file

@ -84,7 +84,8 @@ function cmtBbClose(id) {
EOT; EOT;
// Hide the left menu bar // Hide the left menu bar
if (($a->page['aside'] == "") AND in_array($a->argv[0], array("community", "events", "help", "manage", "notifications", "probe", "webfinger", "login"))) if (($a->page['aside'] == "") AND in_array($a->argv[0], array("community", "events", "help", "manage", "notifications",
"probe", "webfinger", "login", "invite")))
$a->page['htmlhead'] .= "<link rel='stylesheet' href='view/theme/vier/hide.css' />"; $a->page['htmlhead'] .= "<link rel='stylesheet' href='view/theme/vier/hide.css' />";
} }
@ -132,7 +133,7 @@ function vier_community_info() {
'$id' => $rr['id'], '$id' => $rr['id'],
//'$profile_link' => zrl($rr['url']), //'$profile_link' => zrl($rr['url']),
'$profile_link' => $a->get_baseurl().'/follow/?url='.urlencode($rr['url']), '$profile_link' => $a->get_baseurl().'/follow/?url='.urlencode($rr['url']),
'$photo' => proxy_url($rr['photo']), '$photo' => proxy_url($rr['photo'], false, PROXY_SIZE_MICRO),
'$alt_text' => $rr['name'], '$alt_text' => $rr['name'],
)); ));
$aside['$comunity_profiles_items'][] = $entry; $aside['$comunity_profiles_items'][] = $entry;