diff options
author | Friendika <info@friendika.com> | 2011-05-24 20:41:29 -0700 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-05-24 20:41:29 -0700 |
commit | 87de83997499a380ef26d72acb6d5fd3df91e95b (patch) | |
tree | fdfe20c08b8ec5e49232731c93a7dec865161758 | |
parent | 44477397024df511b5b72fdace60978dd7816fb6 (diff) | |
download | volse-hubzilla-87de83997499a380ef26d72acb6d5fd3df91e95b.tar.gz volse-hubzilla-87de83997499a380ef26d72acb6d5fd3df91e95b.tar.bz2 volse-hubzilla-87de83997499a380ef26d72acb6d5fd3df91e95b.zip |
attachment display
-rw-r--r-- | boot.php | 36 | ||||
-rw-r--r-- | include/conversation.php | 9 | ||||
-rw-r--r-- | view/theme/dispy/style.css | 1 | ||||
-rw-r--r-- | view/theme/duepuntozero/style.css | 2 | ||||
-rw-r--r-- | view/theme/loozah/style.css | 2 |
5 files changed, 46 insertions, 4 deletions
@@ -2540,8 +2540,40 @@ function link_compare($a,$b) { if(! function_exists('prepare_body')) { -function prepare_body($item) { - return prepare_text($item['body']); +function prepare_body($item,$attach = false) { + + $s = prepare_text($item['body']); + if(! $attach) + return $s; + + $arr = explode(',',$item['attach']); + if(count($arr)) { + foreach($arr as $r) { + $matches = false; + $icon = ''; + $cnt = preg_match('|\[attach\]href=\"(.+?)\" size=\"(.+?)\" type=\"(.+?)\" title=\"(.+?)\"\[\/attach\]|',$r,$matches); + if($cnt) { + $icontype = strtolower(substr($matches[3],0,strpos($matches[3],'/'))); + switch($icontype) { + case 'video': + case 'audio': + case 'image': + case 'text': + $icon = '<div class="attachtype type-' . $attachtype . '"></div>'; + break; + default: + $icon = '<div class="attachtype type-unkn"></div>'; + break; + } + $title = ((strlen(trim($matches[4]))) ? escape_tags(trim($matches[4])) : escape_tags($matches[1])); + $title .= ' ' . $matches[2] . ' ' . t('bytes'); + + $s .= '<a href="' . strip_tags($matches[1]) . '" title="' . $title . '" >' . $icon . '</a>'; + } + } + } + $s .= '<div class="clear"></div>'; + return $s; }} if(! function_exists('prepare_text')) { diff --git a/include/conversation.php b/include/conversation.php index 4fa4b92ad..742df20cb 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -183,6 +183,8 @@ function conversation(&$a, $items, $mode, $update) { $drop = replace_macros($droptpl,array('$id' => $item['id'])); $lock = '<div class="wall-item-lock"></div>'; + + $body = prepare_body($item); $o .= replace_macros($tpl,array( '$id' => $item['item_id'], @@ -194,7 +196,7 @@ function conversation(&$a, $items, $mode, $update) { '$lock' => $lock, '$thumb' => $profile_avatar, '$title' => $item['title'], - '$body' => smilies(bbcode($item['body'])), + '$body' => $body, '$ago' => relative_date($item['created']), '$location' => $location, '$indent' => '', @@ -441,6 +443,9 @@ function conversation(&$a, $items, $mode, $update) { // Build the HTML + $body = prepare_body($item); + + $tmp_item = replace_macros($template,array( '$id' => $item['item_id'], '$linktitle' => sprintf( t('View %s\'s profile'), $profile_name), @@ -455,7 +460,7 @@ function conversation(&$a, $items, $mode, $update) { '$osparkle' => $osparkle, '$sparkle' => $sparkle, '$title' => $item['title'], - '$body' => smilies(bbcode($item['body'])), + '$body' => $body, '$ago' => relative_date($item['created']), '$lock' => $lock, '$location' => $location, diff --git a/view/theme/dispy/style.css b/view/theme/dispy/style.css index 9ef5df0ce..a72f8c60c 100644 --- a/view/theme/dispy/style.css +++ b/view/theme/dispy/style.css @@ -807,6 +807,7 @@ section { margin: 10px 11% 0px 11%; font-size: 0.8em; padding-right: 230px;} .attachtype { display: block; width: 20px; height: 23px; + padding: 3px; background-image: url('../../../images/content-types.gif'); } diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index c639f1571..485efec59 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -2426,6 +2426,8 @@ a.mail-list-link { .attachtype { display: block; width: 20px; height: 23px; + padding: 3px; + float: left; background-image: url('../../../images/content-types.gif'); } diff --git a/view/theme/loozah/style.css b/view/theme/loozah/style.css index f5bc4b3c8..c5358aad9 100644 --- a/view/theme/loozah/style.css +++ b/view/theme/loozah/style.css @@ -2443,6 +2443,8 @@ a.mail-list-link { .attachtype { display: block; width: 20px; height: 23px; + padding: 3px; + float: left; background-image: url('../../../images/content-types.gif'); } |