diff options
Diffstat (limited to 'include/text.php')
-rwxr-xr-x | include/text.php | 103 |
1 files changed, 87 insertions, 16 deletions
diff --git a/include/text.php b/include/text.php index 5f4adb27c..b9813cfa9 100755 --- a/include/text.php +++ b/include/text.php @@ -428,8 +428,10 @@ if(! function_exists('logger')) { function logger($msg,$level = 0) { // turn off logger in install mode global $a; - if ($a->module == 'install') return; - + global $db; + + if(($a->module == 'install') || (! ($db && $db->connected))) return; + $debugging = get_config('system','debugging'); $loglevel = intval(get_config('system','loglevel')); $logfile = get_config('system','logfile'); @@ -538,8 +540,10 @@ function contact_block() { $a = get_app(); $shown = get_pconfig($a->profile['uid'],'system','display_friend_count'); - if(! $shown) + if($shown === false) $shown = 24; + if($shown == 0) + return; if((! is_array($a->profile)) || ($a->profile['hide-friends'])) return $o; @@ -674,41 +678,105 @@ function linkify($s) { */ if(! function_exists('smilies')) { -function smilies($s) { +function smilies($s, $sample = false) { $a = get_app(); - $s = str_replace( - array( '<3', '</3', '<\\3', ':-)', ':)', ';-)', ':-(', ':(', ':-P', ':P', ':-"', ':-x', ':-X', ':-D', '8-|', '8-O', '\\o/', 'o.O', 'O.o', '\\.../', '\\ooo/', - '~friendika', '~friendica', 'Diaspora*' ), - array( + $texts = array( + '<3', + '</3', + '<\\3', + ':-)', +// ':)', + ';-)', +// ';)', + ':-(', +// ':(', + ':-P', +// ':P', + ':-"', + ':-"', + ':-x', + ':-X', + ':-D', +// ':D', + '8-|', + '8-O', + ':-O', + '\\o/', + 'o.O', + 'O.o', + '\\.../', + '\\ooo/', + ":'(", + ":-!", + ":-/", + ":-[", + "8-)", + ':beer', + ':homebrew', + ':coffee', + ':facepalm', + ':headdesk', + '~friendika', + '~friendica', + 'Diaspora*' + ); + + $icons = array( '<img src="' . $a->get_baseurl() . '/images/smiley-heart.gif" alt="<3" />', '<img src="' . $a->get_baseurl() . '/images/smiley-brokenheart.gif" alt="</3" />', '<img src="' . $a->get_baseurl() . '/images/smiley-brokenheart.gif" alt="<\\3" />', '<img src="' . $a->get_baseurl() . '/images/smiley-smile.gif" alt=":-)" />', - '<img src="' . $a->get_baseurl() . '/images/smiley-smile.gif" alt=":)" />', +// '<img src="' . $a->get_baseurl() . '/images/smiley-smile.gif" alt=":)" />', '<img src="' . $a->get_baseurl() . '/images/smiley-wink.gif" alt=";-)" />', +// '<img src="' . $a->get_baseurl() . '/images/smiley-wink.gif" alt=";)"/>', '<img src="' . $a->get_baseurl() . '/images/smiley-frown.gif" alt=":-(" />', - '<img src="' . $a->get_baseurl() . '/images/smiley-frown.gif" alt=":(" />', +// '<img src="' . $a->get_baseurl() . '/images/smiley-frown.gif" alt=":(" />', '<img src="' . $a->get_baseurl() . '/images/smiley-tongue-out.gif" alt=":-P" />', - '<img src="' . $a->get_baseurl() . '/images/smiley-tongue-out.gif" alt=":P" />', +// '<img src="' . $a->get_baseurl() . '/images/smiley-tongue-out.gif" alt=":P" />', + '<img src="' . $a->get_baseurl() . '/images/smiley-kiss.gif" alt=":-\"" />', '<img src="' . $a->get_baseurl() . '/images/smiley-kiss.gif" alt=":-\"" />', '<img src="' . $a->get_baseurl() . '/images/smiley-kiss.gif" alt=":-x" />', '<img src="' . $a->get_baseurl() . '/images/smiley-kiss.gif" alt=":-X" />', '<img src="' . $a->get_baseurl() . '/images/smiley-laughing.gif" alt=":-D" />', +// '<img src="' . $a->get_baseurl() . '/images/smiley-laughing.gif" alt=":D"/>', '<img src="' . $a->get_baseurl() . '/images/smiley-surprised.gif" alt="8-|" />', '<img src="' . $a->get_baseurl() . '/images/smiley-surprised.gif" alt="8-O" />', + '<img src="' . $a->get_baseurl() . '/images/smiley-surprised.gif" alt=":-O" />', '<img src="' . $a->get_baseurl() . '/images/smiley-thumbsup.gif" alt="\\o/" />', '<img src="' . $a->get_baseurl() . '/images/smiley-Oo.gif" alt="o.O" />', '<img src="' . $a->get_baseurl() . '/images/smiley-Oo.gif" alt="O.o" />', '<img src="' . $a->get_baseurl() . '/images/smiley-shaka.gif" alt="\\.../" />', '<img src="' . $a->get_baseurl() . '/images/smiley-shaka.gif" alt="\\ooo/" />', + '<img src="' . $a->get_baseurl() . '/images/smiley-cry.gif" alt=":\'(" />', + '<img src="' . $a->get_baseurl() . '/images/smiley-foot-in-mouth.gif" alt=":-!" />', + '<img src="' . $a->get_baseurl() . '/images/smiley-undecided.gif" alt=":-/" />', + '<img src="' . $a->get_baseurl() . '/images/smiley-embarassed.gif" alt=":-[" />', + '<img src="' . $a->get_baseurl() . '/images/smiley-cool.gif" alt="8-)" />', + '<img src="' . $a->get_baseurl() . '/images/beer_mug.gif" alt=":beer" />', + '<img src="' . $a->get_baseurl() . '/images/beer_mug.gif" alt=":homebrew" />', + '<img src="' . $a->get_baseurl() . '/images/coffee.gif" alt=":coffee" />', + '<img src="' . $a->get_baseurl() . '/images/smiley-facepalm.gif" alt=":facepalm" />', + '<img src="' . $a->get_baseurl() . '/images/smiley-bangheaddesk.gif" alt=":headdesk" />', '<a href="http://project.friendika.com">~friendika <img src="' . $a->get_baseurl() . '/images/friendika-16.png" alt="~friendika" /></a>', '<a href="http://friendica.com">~friendica <img src="' . $a->get_baseurl() . '/images/friendika-16.png" alt="~friendica" /></a>', '<a href="http://diasporafoundation.org">Diaspora<img src="' . $a->get_baseurl() . '/images/diaspora.png" alt="Diaspora*" /></a>', - ), $s); + ); + + $params = array('texts' => $texts, 'icons' => $icons, 'string' => $s); + call_hooks('smilie', $params); - call_hooks('smilie', $s); + if($sample) { + $s = '<div class="smiley-sample">'; + for($x = 0; $x < count($params['texts']); $x ++) { + $s .= '<dl><dt>' . $params['texts'][$x] . '</dt><dd>' . $params['icons'][$x] . '</dd></dl>'; + } + } + else { + $s = str_replace($params['texts'],$params['icons'],$params['string']); + } + return $s; }} @@ -785,10 +853,10 @@ function prepare_body($item,$attach = false) { case 'audio': case 'image': case 'text': - $icon = '<div class="attachtype type-' . $icontype . '"></div>'; + $icon = '<div class="attachtype icon s22 type-' . $icontype . '"></div>'; break; default: - $icon = '<div class="attachtype type-unkn"></div>'; + $icon = '<div class="attachtype icon s22 type-unkn"></div>'; break; } $title = ((strlen(trim($matches[4]))) ? escape_tags(trim($matches[4])) : escape_tags($matches[1])); @@ -814,7 +882,10 @@ function prepare_text($text) { require_once('include/bbcode.php'); - $s = smilies(bbcode($text)); + if(stristr($text,'[nosmile]')) + $s = bbcode($text); + else + $s = smilies(bbcode($text)); return $s; }} |