aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorThomas Willingham <founder@kakste.com>2012-12-07 22:27:35 +0000
committerThomas Willingham <founder@kakste.com>2012-12-07 22:27:35 +0000
commit44263d5ac3e5189df28c92f58c2875137052b6ea (patch)
tree70aa75426f2b3c984faecdb5f684157bccedda3a /include/text.php
parent555226ada4946b78be5fa2966f5c8532a997953f (diff)
parent2452b822f909a3cac432a76d8c928733a7683c6a (diff)
downloadvolse-hubzilla-44263d5ac3e5189df28c92f58c2875137052b6ea.tar.gz
volse-hubzilla-44263d5ac3e5189df28c92f58c2875137052b6ea.tar.bz2
volse-hubzilla-44263d5ac3e5189df28c92f58c2875137052b6ea.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'include/text.php')
-rw-r--r--include/text.php75
1 files changed, 32 insertions, 43 deletions
diff --git a/include/text.php b/include/text.php
index b97b21981..3ca0b3b6d 100644
--- a/include/text.php
+++ b/include/text.php
@@ -70,7 +70,7 @@ function notags($string) {
if(! function_exists('escape_tags')) {
function escape_tags($string) {
- return(htmlspecialchars($string, ENT_QUOTES, 'UTF-8', false));
+ return(htmlspecialchars($string, ENT_COMPAT, 'UTF-8', false));
}}
@@ -331,7 +331,7 @@ function expand_acl($s) {
if(! function_exists('sanitise_acl')) {
function sanitise_acl(&$item) {
- if(intval($item))
+ if(strlen($item))
$item = '<' . notags(trim($item)) . '>';
else
unset($item);
@@ -545,7 +545,7 @@ function contact_block() {
$total = intval($r[0]['total']);
}
if(! $total) {
- $contacts = t('No contacts');
+ $contacts = t('No connnections');
$micropro = Null;
} else {
@@ -556,7 +556,7 @@ function contact_block() {
);
if(count($r)) {
- $contacts = sprintf( tt('%d Contact','%d Contacts', $total),$total);
+ $contacts = sprintf( tt('%d Connection','%d Connections', $total),$total);
$micropro = Array();
foreach($r as $rr) {
$micropro[] = micropro($rr,true,'mpfriend');
@@ -568,7 +568,7 @@ function contact_block() {
$o = replace_macros($tpl, array(
'$contacts' => $contacts,
'$nickname' => $a->profile['nickname'],
- '$viewcontacts' => t('View Contacts'),
+ '$viewcontacts' => t('View Connnections'),
'$micropro' => $micropro,
));
@@ -579,46 +579,35 @@ function contact_block() {
}}
+
+function chanlink_hash($s) {
+ return z_root() . '/chanview?f=&hash=' . urlencode($s);
+}
+
+function chanlink_url($s) {
+ return z_root() . '/chanview?f=&url=' . urlencode($s);
+}
+
+
+function chanlink_cid($d) {
+ return z_root() . '/chanview?f=&cid=' . intval($d);
+}
+
+
+
if(! function_exists('micropro')) {
function micropro($contact, $redirect = false, $class = '', $textmode = false) {
- if($class)
- $class = ' ' . $class;
-
- $url = $contact['xchan_url'];
- $sparkle = '';
- $redir = false;
+ $url = chanlink_hash($contact['xchan_hash']);
- if($redirect) {
- $a = get_app();
- $redirect_url = $a->get_baseurl() . '/magic/' . $contact['abook_id'];
- if(local_user() && ($contact['abook_channel'] == local_user()) && ($contact['xchan_network'] === NETWORK_ZOT)) {
- $redir = true;
- $url = $redirect_url;
- $sparkle = ' sparkle';
- }
- else
- $url = zid($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) ? ' ' : '')
- . (($url) ? ' href="' . $url . '"' : '') . $click
- . '" title="' . $contact['xchan_name'] . ' [' . $contact['xchan_url'] . ']" alt="' . $contact['xchan_name']
- . '" >'. $contact['xchan_name'] . '</a></div>' . "\r\n";
- }
- else {
- return '<div class="contact-block-div' . $class . '"><a class="contact-block-link' . $class . $sparkle
- . (($click) ? ' fakelink' : '') . '" '
- . (($redir) ? ' ' : '')
- . (($url) ? ' href="' . $url . '"' : '') . $click . ' ><img class="contact-block-img' . $class . $sparkle . '" src="'
- . $contact['xchan_photo_s'] . '" title="' . $contact['xchan_name'] . ' [' . $contact['xchan_url'] . ']" alt="' . $contact['xchan_name']
- . '" /></a></div>' . "\r\n";
- }
+ return replace_macros(get_markup_template(($textmode)?'micropro_txt.tpl':'micropro_img.tpl'),array(
+ '$click' => $click,
+ '$class' => $class,
+ '$url' => $url,
+ '$photo' => $contact['xchan_photo_s'],
+ '$name' => $contact['xchan_name'],
+ '$title' => $contact['xchan_name'] . ' [' . $contact['xchan_addr'] . ']',
+ ));
}}
@@ -963,7 +952,7 @@ function prepare_body($item,$attach = false) {
foreach($terms as $t) {
if(strlen($x))
$x .= ',';
- $x .= htmlspecialchars($t['term'],ENT_QUOTES,'UTF-8')
+ $x .= htmlspecialchars($t['term'],ENT_COMPAT,'UTF-8')
. ((local_user() == $item['uid']) ? ' <a href="' . $a->get_baseurl() . '/filerm/' . $item['id'] . '?f=&cat=' . urlencode($t['term']) . '" title="' . t('remove') . '" >' . t('[remove]') . '</a>' : '');
}
if(strlen($x))
@@ -978,7 +967,7 @@ function prepare_body($item,$attach = false) {
foreach($terms as $t) {
if(strlen($x))
$x .= '&nbsp;&nbsp;&nbsp;';
- $x .= htmlspecialchars($t['term'],ENT_QUOTES,'UTF-8')
+ $x .= htmlspecialchars($t['term'],ENT_COMPAT,'UTF-8')
. ' <a href="' . $a->get_baseurl() . '/filerm/' . $item['id'] . '?f=&term=' . urlencode($t['term']) . '" title="' . t('remove') . '" >' . t('[remove]') . '</a>';
}
if(strlen($x) && (local_user() == $item['uid']))