aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/attach.php80
-rw-r--r--include/conversation.php10
-rw-r--r--include/template_processor.php2
3 files changed, 89 insertions, 3 deletions
diff --git a/include/attach.php b/include/attach.php
new file mode 100644
index 000000000..ca53081d9
--- /dev/null
+++ b/include/attach.php
@@ -0,0 +1,80 @@
+<?php
+
+if(!function_exists('mime_content_type')) {
+function mime_content_type($filename) {
+
+ $mime_types = array(
+
+ 'txt' => 'text/plain',
+ 'htm' => 'text/html',
+ 'html' => 'text/html',
+ 'php' => 'text/html',
+ 'css' => 'text/css',
+ 'js' => 'application/javascript',
+ 'json' => 'application/json',
+ 'xml' => 'application/xml',
+ 'swf' => 'application/x-shockwave-flash',
+ 'flv' => 'video/x-flv',
+
+ // images
+ 'png' => 'image/png',
+ 'jpe' => 'image/jpeg',
+ 'jpeg' => 'image/jpeg',
+ 'jpg' => 'image/jpeg',
+ 'gif' => 'image/gif',
+ 'bmp' => 'image/bmp',
+ 'ico' => 'image/vnd.microsoft.icon',
+ 'tiff' => 'image/tiff',
+ 'tif' => 'image/tiff',
+ 'svg' => 'image/svg+xml',
+ 'svgz' => 'image/svg+xml',
+
+ // archives
+ 'zip' => 'application/zip',
+ 'rar' => 'application/x-rar-compressed',
+ 'exe' => 'application/x-msdownload',
+ 'msi' => 'application/x-msdownload',
+ 'cab' => 'application/vnd.ms-cab-compressed',
+
+ // audio/video
+ 'mp3' => 'audio/mpeg',
+ 'qt' => 'video/quicktime',
+ 'mov' => 'video/quicktime',
+ 'ogg' => 'application/ogg',
+
+ // adobe
+ 'pdf' => 'application/pdf',
+ 'psd' => 'image/vnd.adobe.photoshop',
+ 'ai' => 'application/postscript',
+ 'eps' => 'application/postscript',
+ 'ps' => 'application/postscript',
+
+ // ms office
+ 'doc' => 'application/msword',
+ 'rtf' => 'application/rtf',
+ 'xls' => 'application/vnd.ms-excel',
+ 'ppt' => 'application/vnd.ms-powerpoint',
+
+
+ // open office
+ 'odt' => 'application/vnd.oasis.opendocument.text',
+ 'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
+ );
+
+ if(strpos($filename,'.') !== false) {
+ $ext = strtolower(array_pop(explode('.',$filename)));
+ if (array_key_exists($ext, $mime_types)) {
+ return $mime_types[$ext];
+ }
+ }
+ elseif (function_exists('finfo_open')) {
+ $finfo = finfo_open(FILEINFO_MIME);
+ $mimetype = finfo_file($finfo, $filename);
+ finfo_close($finfo);
+ return $mimetype;
+ }
+ else {
+ return 'application/octet-stream';
+ }
+}}
+
diff --git a/include/conversation.php b/include/conversation.php
index 4fa4b92ad..9ffcbe157 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,true);
$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,true);
+
+
$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,
@@ -725,6 +730,7 @@ function status_editor($a,$x, $notes_cid = 0) {
'$action' => 'item',
'$share' => (($x['button']) ? $x['button'] : t('Share')),
'$upload' => t('Upload photo'),
+ '$attach' => t('Attach file'),
'$weblink' => t('Insert web link'),
'$youtube' => t('Insert YouTube video'),
'$video' => t('Insert Vorbis [.ogg] video'),
diff --git a/include/template_processor.php b/include/template_processor.php
index efdfbaecb..d8dfbaedb 100644
--- a/include/template_processor.php
+++ b/include/template_processor.php
@@ -128,7 +128,7 @@
#$s = str_replace(array("\n","\r"),array("§n§","§r§"),$s);
$s = $this->_build_nodes($s);
$s = preg_replace_callback('/\|\|([0-9]+)\|\|/', array($this, "_replcb_node"), $s);
- $s = str_replace($this->search,$this->replace, (string) $s);
+ $s = str_replace($this->search,$this->replace, $s);
return $s;
}