X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Ftext.php;h=409d40d59f6155a6a5533e986ff7a29b99ea9329;hb=8b6942c5727a80d85ab4a9fca2d74acb2b7c9739;hp=6d557ed84e8c62706cca664776d0e71337137055;hpb=953840cf822718cba66a0727b576c674c6e44875;p=friendica.git
diff --git a/include/text.php b/include/text.php
index 6d557ed84e..409d40d59f 100644
--- a/include/text.php
+++ b/include/text.php
@@ -80,6 +80,9 @@ function escape_tags($string) {
if(! function_exists('autoname')) {
function autoname($len) {
+ if($len <= 0)
+ return '';
+
$vowels = array('a','a','ai','au','e','e','e','ee','ea','i','ie','o','ou','u');
if(mt_rand(0,5) == 4)
$vowels[] = 'y';
@@ -205,7 +208,6 @@ function hex2bin($s) {
return '';
if(! ctype_xdigit($s)) {
- logger('hex2bin: illegal input: ' . print_r(debug_backtrace(), true));
return($s);
}
@@ -226,6 +228,9 @@ if(! function_exists('paginate')) {
function paginate(&$a) {
$o = '';
$stripped = preg_replace('/(&page=[0-9]*)/','',$a->query_string);
+
+// $stripped = preg_replace('/&zrl=(.*?)([\?&]|$)/ism','',$stripped);
+
$stripped = str_replace('q=','',$stripped);
$stripped = trim($stripped,'/');
$pagenum = $a->pager['page'];
@@ -553,7 +558,7 @@ function contact_block() {
if((! is_array($a->profile)) || ($a->profile['hide-friends']))
return $o;
- $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 AND `hidden` = 0",
+ $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 AND `hidden` = 0 AND `archive` = 0",
intval($a->profile['uid'])
);
if(count($r)) {
@@ -564,7 +569,7 @@ function contact_block() {
$micropro = Null;
} else {
- $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 AND `hidden` = 0 ORDER BY RAND() LIMIT %d",
+ $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 AND `hidden` = 0 AND `archive` = 0 ORDER BY RAND() LIMIT %d",
intval($a->profile['uid']),
intval($shown)
);
@@ -610,6 +615,8 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
$url = $redirect_url;
$sparkle = ' sparkle';
}
+ else
+ $url = zrl($url);
}
$click = ((x($contact,'click')) ? ' onclick="' . $contact['click'] . '" ' : '');
if($click)
@@ -639,7 +646,7 @@ function search($s,$id='search-box',$url='/search',$save = false) {
$a = get_app();
$o = '
';
@@ -919,7 +945,8 @@ function prepare_body($item,$attach = false) {
foreach($matches as $mtch) {
if(strlen($x))
$x .= ',';
- $x .= file_tag_decode($mtch[1]);
+ $x .= xmlify(file_tag_decode($mtch[1]))
+ . ((local_user() == $item['uid']) ? ' ' . t('[remove]') . '' : '');
}
if(strlen($x))
$s .= '' . t('Categories:') . ' ' . $x . '
';
@@ -934,7 +961,7 @@ function prepare_body($item,$attach = false) {
foreach($matches as $mtch) {
if(strlen($x))
$x .= ' ';
- $x .= file_tag_decode($mtch[1]). ' ' . t('[remove]') . '';
+ $x .= xmlify(file_tag_decode($mtch[1])) . ' ' . t('[remove]') . '';
}
if(strlen($x) && (local_user() == $item['uid']))
$s .= '' . t('Filed under:') . ' ' . $x . '
';
@@ -1036,12 +1063,13 @@ function feed_salmonlinks($nick) {
if(! function_exists('get_plink')) {
function get_plink($item) {
$a = get_app();
- if (x($item,'plink') && (! $item['private'])){
+ if (x($item,'plink') && ($item['private'] != 1)) {
return array(
'href' => $item['plink'],
'title' => t('link to source'),
);
- } else {
+ }
+ else {
return false;
}
}}
@@ -1057,10 +1085,12 @@ function unamp($s) {
if(! function_exists('lang_selector')) {
function lang_selector() {
global $lang;
- $o = '';
- $o .= '';
- $o .= '
';
+
+ $tpl = get_markup_template("lang_selector.tpl");
+ $o = replace_macros($tpl, array(
+ '$title' => t('Select an alternate language'),
+ '$langs' => array($lang_options, $selected),
+
+ ));
return $o;
}}
@@ -1225,13 +1260,13 @@ function bb_translate_video($s) {
function html2bb_video($s) {
- $s = preg_replace('##ism',
+ $s = preg_replace('##ism',
'[youtube]$2[/youtube]', $s);
- $s = preg_replace('##ism',
+ $s = preg_replace('##ism',
'[youtube]$2[/youtube]', $s);
- $s = preg_replace('##ism',
+ $s = preg_replace('##ism',
'[vimeo]$2[/vimeo]', $s);
return $s;
@@ -1305,13 +1340,126 @@ function file_tag_decode($s) {
}
function file_tag_file_query($table,$s,$type = 'file') {
+
if($type == 'file')
- $str = preg_quote( '[' . file_tag_encode($s) . ']' );
+ $str = preg_quote( '[' . str_replace('%','%%',file_tag_encode($s)) . ']' );
else
- $str = preg_quote( '<' . file_tag_encode($s) . '>' );
+ $str = preg_quote( '<' . str_replace('%','%%',file_tag_encode($s)) . '>' );
return " AND " . (($table) ? dbesc($table) . '.' : '') . "file regexp '" . dbesc($str) . "' ";
}
+// ex. given music,video return