aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorFabio Comuni <fabrix.xm@gmail.com>2011-09-16 09:39:29 +0200
committerFabio Comuni <fabrix.xm@gmail.com>2011-09-16 09:39:29 +0200
commit9d2afc2d3c12f6b70eae11487e491e2d8604ed60 (patch)
treeced4fb400d25762866a773115b122f6c9cc498de /mod
parent019b735ec75989336826e5ad5db6377803ecb050 (diff)
parent2e43b291e73f6d7c36a9d8743fc2635dc3444841 (diff)
downloadvolse-hubzilla-9d2afc2d3c12f6b70eae11487e491e2d8604ed60.tar.gz
volse-hubzilla-9d2afc2d3c12f6b70eae11487e491e2d8604ed60.tar.bz2
volse-hubzilla-9d2afc2d3c12f6b70eae11487e491e2d8604ed60.zip
Merge remote-tracking branch 'friendika/master' into newui
Diffstat (limited to 'mod')
-rw-r--r--mod/events.php9
-rw-r--r--mod/item.php35
-rw-r--r--mod/localtime.php9
-rw-r--r--mod/network.php128
-rw-r--r--mod/notes.php42
-rw-r--r--mod/profile_photo.php8
-rw-r--r--mod/search.php56
-rw-r--r--mod/update_notes.php60
-rw-r--r--mod/wall_attach.php2
9 files changed, 266 insertions, 83 deletions
diff --git a/mod/events.php b/mod/events.php
index 27ca69830..5bc9807ed 100644
--- a/mod/events.php
+++ b/mod/events.php
@@ -45,13 +45,20 @@ function events_post(&$a) {
$finish = datetime_convert('UTC','UTC',$finish);
}
+ // Don't allow the event to finish before it begins.
+ // It won't hurt anything, but somebody will file a bug report
+ // and we'll waste a bunch of time responding to it. Time that
+ // could've been spent doing something else.
+
+ if(strcmp($finish,$start) < 0)
+ $finish = $start;
$desc = escape_tags(trim($_POST['desc']));
$location = escape_tags(trim($_POST['location']));
$type = 'event';
if((! $desc) || (! $start)) {
- notice('Event description and start time are required.');
+ notice( t('Event description and start time are required.') . EOL);
goaway($a->get_baseurl() . '/events/new');
}
diff --git a/mod/item.php b/mod/item.php
index b4ec7666f..025a12a32 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -38,6 +38,7 @@ function item_post(&$a) {
call_hooks('post_local_start', $_POST);
$api_source = ((x($_POST,'api_source') && $_POST['api_source']) ? true : false);
+ $return_path = ((x($_POST,'return')) ? $_POST['return'] : '');
/**
* Is this a reply to something?
@@ -82,7 +83,7 @@ function item_post(&$a) {
if(($r === false) || (! count($r))) {
notice( t('Unable to locate original post.') . EOL);
if(x($_POST,'return'))
- goaway($a->get_baseurl() . "/" . $_POST['return'] );
+ goaway($a->get_baseurl() . "/" . $return_path );
killme();
}
$parent_item = $r[0];
@@ -111,7 +112,7 @@ function item_post(&$a) {
if(! can_write_wall($a,$profile_uid)) {
notice( t('Permission denied.') . EOL) ;
if(x($_POST,'return'))
- goaway($a->get_baseurl() . "/" . $_POST['return'] );
+ goaway($a->get_baseurl() . "/" . $return_path );
killme();
}
@@ -197,7 +198,7 @@ function item_post(&$a) {
if(! strlen($body)) {
info( t('Empty post discarded.') . EOL );
if(x($_POST,'return'))
- goaway($a->get_baseurl() . "/" . $_POST['return'] );
+ goaway($a->get_baseurl() . "/" . $return_path );
killme();
}
}
@@ -549,9 +550,9 @@ function item_post(&$a) {
);
proc_run('php', "include/notifier.php", 'edit_post', "$post_id");
- if((x($_POST,'return')) && strlen($_POST['return'])) {
- logger('return: ' . $_POST['return']);
- goaway($a->get_baseurl() . "/" . $_POST['return'] );
+ if((x($_POST,'return')) && strlen($return_path)) {
+ logger('return: ' . $return_path);
+ goaway($a->get_baseurl() . "/" . $return_path );
}
killme();
}
@@ -798,11 +799,10 @@ function item_post(&$a) {
else {
logger('mod_item: unable to retrieve post that was just stored.');
notify( t('System error. Post not saved.'));
- goaway($a->get_baseurl() . "/" . $_POST['return'] );
+ goaway($a->get_baseurl() . "/" . $return_path );
// NOTREACHED
}
- proc_run('php', "include/notifier.php", $notify_type, "$post_id");
$datarray['id'] = $post_id;
$datarray['plink'] = $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id;
@@ -834,11 +834,16 @@ function item_post(&$a) {
}
}
+ // This is a real juggling act on shared hosting services which kill your processes
+ // e.g. dreamhost. We used to start delivery to our native delivery agents in the background
+ // and then run our plugin delivery from the foreground. We're now doing plugin delivery first,
+ // because as soon as you start loading up a bunch of remote delivey processes, *this* page is
+ // likely to get killed off. If you end up looking at an /item URL and a blank page,
+ // it's very likely the delivery got killed before all your friends could be notified.
+ // Currently the only realistic fixes are to use a reliable server - which precludes shared hosting,
+ // or cut back on plugins which do remote deliveries.
-
-
-
-
+ proc_run('php', "include/notifier.php", $notify_type, "$post_id");
logger('post_complete');
@@ -847,10 +852,10 @@ function item_post(&$a) {
if($api_source)
return;
- if((x($_POST,'return')) && strlen($_POST['return'])) {
- logger('return: ' . $_POST['return']);
- goaway($a->get_baseurl() . "/" . $_POST['return'] );
+ if($return_path) {
+ goaway($a->get_baseurl() . "/" . $return_path);
}
+
$json = array('success' => 1);
if(x($_POST,'jsreload') && strlen($_POST['jsreload']))
$json['reload'] = $a->get_baseurl() . '/' . $_POST['jsreload'];
diff --git a/mod/localtime.php b/mod/localtime.php
index f5ecf3a96..c03eae1b0 100644
--- a/mod/localtime.php
+++ b/mod/localtime.php
@@ -26,16 +26,21 @@ function localtime_content(&$a) {
$o .= '<p>' . t('Friendika provides this service for sharing events with other networks and friends in unknown timezones.') . '</p>';
+
+ $o .= '<p>' . sprintf( t('UTC time: %s'), $t) . '</p>';
+
+ if($_REQUEST['timezone'])
+ $o .= '<p>' . sprintf( t('Current timezone: %s'), $_REQUEST['timezone']) . '</p>';
+
if(x($a->data,'mod-localtime'))
$o .= '<p>' . sprintf( t('Converted localtime: %s'),$a->data['mod-localtime']) . '</p>';
- $o .= '<p>' . sprintf( t('UTC time: %s'), $t) . '</p>';
$o .= '<form action ="' . $a->get_baseurl() . '/localtime?f=&time=' . $t . '" method="post" >';
$o .= '<p>' . t('Please select your timezone:') . '</p>';
- $o .= select_timezone();
+ $o .= select_timezone(($_REQUEST['timezone']) ? $_REQUEST['timezone'] : 'America/Los_Angeles');
$o .= '<input type="submit" name="submit" value="' . t('Submit') . '" /></form>';
diff --git a/mod/network.php b/mod/network.php
index 145caa173..1de0bc212 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -20,6 +20,7 @@ function network_init(&$a) {
$srchurl = '/network'
. ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : '')
. ((x($_GET,'star')) ? '?star=' . $_GET['star'] : '')
+ . ((x($_GET,'order')) ? '?order=' . $_GET['order'] : '')
. ((x($_GET,'bmark')) ? '?bmark=' . $_GET['bmark'] : '');
if(x($_GET,'save')) {
@@ -127,9 +128,11 @@ function network_content(&$a, $update = 0) {
$nouveau = false;
require_once('include/acl_selectors.php');
- $cid = ((x($_GET['cid'])) ? intval($_GET['cid']) : 0);
- $star = ((x($_GET['star'])) ? intval($_GET['star']) : 0);
- $bmark = ((x($_GET['bmark'])) ? intval($_GET['bmark']) : 0);
+ $cid = ((x($_GET,'cid')) ? intval($_GET['cid']) : 0);
+ $star = ((x($_GET,'star')) ? intval($_GET['star']) : 0);
+ $bmark = ((x($_GET,'bmark')) ? intval($_GET['bmark']) : 0);
+ $order = ((x($_GET,'order')) ? notags($_GET['order']) : 'comment');
+
if(($a->argc > 2) && $a->argv[2] === 'new')
$nouveau = true;
@@ -190,6 +193,7 @@ function network_content(&$a, $update = 0) {
. ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '')
. ((x($_GET,'search')) ? '&search=' . $_GET['search'] : '')
. ((x($_GET,'star')) ? '&star=' . $_GET['star'] : '')
+ . ((x($_GET,'order')) ? '&order=' . $_GET['order'] : '')
. ((x($_GET,'bmark')) ? '&bmark=' . $_GET['bmark'] : '')
. "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
@@ -312,59 +316,95 @@ function network_content(&$a, $update = 0) {
// Normal conversation view
// Show conversation by activity date
-
-
- // First fetch a known number of parent items
-
- $r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact_uid`
- FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
- , (SELECT `_com`.`parent`,max(`_com`.`created`) as `created`
- FROM `item` AS `_com`
- WHERE `_com`.`uid`=%d AND
- (`_com`.`parent`!=`_com`.`id` OR `_com`.`id` NOT IN (SELECT `__com`.`parent` FROM `item` as `__com` WHERE `__com`.`parent`!=`__com`.`id`))
- GROUP BY `_com`.`parent` ORDER BY `created` DESC) AS `com`
- WHERE `item`.`id`=`com`.`parent` AND
- `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
- AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
-
- $sql_extra
- ORDER BY `com`.`created` DESC LIMIT %d ,%d ",
- intval(local_user()),
- intval(local_user()),
- intval($a->pager['start']),
- intval($a->pager['itemspage'])
- );
- // Then fetch all the children of the parents that are on this page
- $parents_arr = array();
- $parents_str = '';
- if(count($r)) {
- foreach($r as $rr)
- $parents_arr[] = $rr['item_id'];
- $parents_str = implode(', ', $parents_arr);
+ if($order === 'post') {
+ $r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact_uid`
+ FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
+ WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
+ AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
+ AND `item`.`parent` = `item`.`id`
+ $sql_extra
+ ORDER BY `item`.`created` DESC LIMIT %d ,%d ",
+ intval(local_user()),
+ intval($a->pager['start']),
+ intval($a->pager['itemspage'])
+ );
+ }
+ else {
+ // $order === 'comment'
+ // First fetch a known number of parent items
- $r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
- `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, `contact`.`writable`,
- `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
- `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
- FROM `item`, `contact`,
- (SELECT `_com`.`parent`,max(`_com`.`created`) as `created`
+ $r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact_uid`
+ FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
+ , (SELECT `_com`.`parent`,max(`_com`.`created`) as `created`
FROM `item` AS `_com`
WHERE `_com`.`uid`=%d AND
(`_com`.`parent`!=`_com`.`id` OR `_com`.`id` NOT IN (SELECT `__com`.`parent` FROM `item` as `__com` WHERE `__com`.`parent`!=`__com`.`id`))
GROUP BY `_com`.`parent` ORDER BY `created` DESC) AS `com`
- WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
- AND `contact`.`id` = `item`.`contact-id`
- AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
- AND `item`.`parent` = `com`.`parent` AND `item`.`parent` IN ( %s )
+ WHERE `item`.`id`=`com`.`parent` AND
+ `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
+ AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
$sql_extra
- ORDER BY `com`.`created` DESC, `item`.`gravity` ASC, `item`.`created` ASC ",
+ ORDER BY `com`.`created` DESC LIMIT %d ,%d ",
intval(local_user()),
intval(local_user()),
- dbesc($parents_str)
+ intval($a->pager['start']),
+ intval($a->pager['itemspage'])
);
}
+ // Then fetch all the children of the parents that are on this page
+
+ $parents_arr = array();
+ $parents_str = '';
+
+ if(count($r)) {
+ foreach($r as $rr)
+ $parents_arr[] = $rr['item_id'];
+ $parents_str = implode(', ', $parents_arr);
+
+ if($order === 'post') {
+ // parent created order
+ $r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
+ `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, `contact`.`writable`,
+ `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
+ `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
+ FROM `item`, (SELECT `p`.`id`,`p`.`created` FROM `item` AS `p` WHERE `p`.`parent`=`p`.`id`) as `parentitem`, `contact`
+ WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
+ AND `contact`.`id` = `item`.`contact-id`
+ AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
+ AND `item`.`parent` = `parentitem`.`id` AND `item`.`parent` IN ( %s )
+ $sql_extra
+ ORDER BY `parentitem`.`created` DESC, `item`.`gravity` ASC, `item`.`created` ASC ",
+ intval(local_user()),
+ dbesc($parents_str)
+ );
+ }
+ else {
+ // $order === 'comment'
+
+ $r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
+ `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, `contact`.`writable`,
+ `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
+ `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
+ FROM `item`, `contact`,
+ (SELECT `_com`.`parent`,max(`_com`.`created`) as `created`
+ FROM `item` AS `_com`
+ WHERE `_com`.`uid`=%d AND
+ (`_com`.`parent`!=`_com`.`id` OR `_com`.`id` NOT IN (SELECT `__com`.`parent` FROM `item` as `__com` WHERE `__com`.`parent`!=`__com`.`id`))
+ GROUP BY `_com`.`parent` ORDER BY `created` DESC) AS `com`
+ WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
+ AND `contact`.`id` = `item`.`contact-id`
+ AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
+ AND `item`.`parent` = `com`.`parent` AND `item`.`parent` IN ( %s )
+ $sql_extra
+ ORDER BY `com`.`created` DESC, `item`.`gravity` ASC, `item`.`created` ASC ",
+ intval(local_user()),
+ intval(local_user()),
+ dbesc($parents_str)
+ );
+ }
+ }
}
// Set this so that the conversation function can find out contact info for our wall-wall items
diff --git a/mod/notes.php b/mod/notes.php
index 9f1a4662d..369f120a7 100644
--- a/mod/notes.php
+++ b/mod/notes.php
@@ -14,7 +14,7 @@ function notes_init(&$a) {
}
-function notes_content(&$a) {
+function notes_content(&$a,$update = false) {
if(! local_user()) {
notice( t('Permission denied.') . EOL);
@@ -52,31 +52,37 @@ function notes_content(&$a) {
));
- $o .= '<h3>' . t('Personal Notes') . '</h3>';
+ if(! $update) {
+ $o .= '<h3>' . t('Personal Notes') . '</h3>';
- $commpage = false;
- $commvisitor = false;
+ $commpage = false;
+ $commvisitor = false;
- $celeb = false;
+ $celeb = false;
- $x = array(
- 'is_owner' => $is_owner,
- 'allow_location' => (($a->user['allow_location']) ? true : false),
- 'default_location' => $a->user['default-location'],
- 'nickname' => $a->user['nickname'],
- 'lockstate' => 'lock',
- 'acl' => '',
- 'bang' => '',
- 'visitor' => 'block',
- 'profile_uid' => local_user(),
- 'button' => t('Save')
+ $x = array(
+ 'is_owner' => $is_owner,
+ 'allow_location' => (($a->user['allow_location']) ? true : false),
+ 'default_location' => $a->user['default-location'],
+ 'nickname' => $a->user['nickname'],
+ 'lockstate' => 'lock',
+ 'acl' => '',
+ 'bang' => '',
+ 'visitor' => 'block',
+ 'profile_uid' => local_user(),
+ 'button' => t('Save')
- );
+ );
- $o .= status_editor($a,$x,$a->contact['id']);
+ $o .= status_editor($a,$x,$a->contact['id']);
+ $o .= '<div id="live-notes"></div>' . "\r\n";
+ $o .= "<script> var profile_uid = " . local_user()
+ . "; var netargs = '/?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
+
+ }
// Construct permissions
diff --git a/mod/profile_photo.php b/mod/profile_photo.php
index 8dc896653..4de3aaa3e 100644
--- a/mod/profile_photo.php
+++ b/mod/profile_photo.php
@@ -155,9 +155,15 @@ function profile_photo_content(&$a) {
notice( t('Permission denied.') . EOL );
return;
}
+ $havescale = false;
+ foreach($r as $rr) {
+ if($rr['scale'] == 5)
+ $havescale = true;
+ }
+
// set an already uloaded photo as profile photo
// if photo is in 'Profile Photos', change it in db
- if ($r[0]['album']== t('Profile Photos')){
+ if (($r[0]['album']== t('Profile Photos')) && ($havescale)){
$r=q("UPDATE `photo` SET `profile`=0 WHERE `profile`=1 AND `uid`=%d",
intval(local_user()));
diff --git a/mod/search.php b/mod/search.php
index f7ce75905..3264948be 100644
--- a/mod/search.php
+++ b/mod/search.php
@@ -1,5 +1,59 @@
<?php
+function search_saved_searches() {
+
+ $o = '';
+
+ $r = q("select `term` from `search` WHERE `uid` = %d",
+ intval(local_user())
+ );
+
+ if(count($r)) {
+ $o .= '<h3>' . t('Saved Searches') . '</h3>' . "\r\n";
+ $o .= '<div id="saved-search-list"><ul id="saved-search-ul">' . "\r\n";
+ foreach($r as $rr) {
+ $o .= '<li class="saved-search-li clear"><a href="search/?f=&remove=1&search=' . $rr['term'] . '" class="icon drophide savedsearchdrop" title="' . t('Remove term') . '" onclick="return confirmDelete();" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a> <a href="search/?f&search=' . $rr['term'] . '" class="savedsearchterm" >' . $rr['term'] . '</a></li>' . "\r\n";
+ }
+ $o .= '</ul></div>' . "\r\n";
+ }
+
+ return $o;
+
+}
+
+
+function search_init(&$a) {
+
+ $search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
+
+ if(local_user()) {
+ if(x($_GET,'save') && $search) {
+ $r = q("select * from `search` where `uid` = %d and `term` = '%s' limit 1",
+ intval(local_user()),
+ dbesc($search)
+ );
+ if(! count($r)) {
+ q("insert into `search` ( `uid`,`term` ) values ( %d, '%s') ",
+ intval(local_user()),
+ dbesc($search)
+ );
+ }
+ }
+ if(x($_GET,'remove') && $search) {
+ q("delete from `search` where `uid` = %d and `term` = '%s' limit 1",
+ intval(local_user()),
+ dbesc($search)
+ );
+ }
+
+ $a->page['aside'] .= search_saved_searches();
+
+ }
+
+
+}
+
+
function search_post(&$a) {
if(x($_POST,'search'))
@@ -32,7 +86,7 @@ function search_content(&$a) {
else
$search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
- $o .= search($search);
+ $o .= search($search,'search-box','/search',((local_user()) ? true : false));
if(! $search)
return $o;
diff --git a/mod/update_notes.php b/mod/update_notes.php
new file mode 100644
index 000000000..90cc5bc69
--- /dev/null
+++ b/mod/update_notes.php
@@ -0,0 +1,60 @@
+<?php
+
+/**
+ * Module: update_profile
+ * Purpose: AJAX synchronisation of profile page
+ *
+ */
+
+
+require_once('mod/notes.php');
+
+function update_notes_content(&$a) {
+
+ $profile_uid = intval($_GET['p']);
+
+ header("Content-type: text/html");
+ echo "<!DOCTYPE html><html><body>\r\n";
+
+ /**
+ * We can remove this hack once Internet Explorer recognises HTML5 natively
+ */
+
+ echo (($_GET['msie'] == 1) ? '<div>' : '<section>');
+
+ /**
+ *
+ * Grab the page inner contents by calling the content function from the profile module directly,
+ * but move any image src attributes to another attribute name. This is because
+ * some browsers will prefetch all the images for the page even if we don't need them.
+ * The only ones we need to fetch are those for new page additions, which we'll discover
+ * on the client side and then swap the image back.
+ *
+ */
+
+ $text = notes_content($a,$profile_uid);
+
+ $pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
+ $replace = "<img\${1} dst=\"\${2}\"";
+ $text = preg_replace($pattern, $replace, $text);
+
+ $replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';
+ $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
+ $text = preg_replace($pattern, $replace, $text);
+ $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
+ $text = preg_replace($pattern, $replace, $text);
+ $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
+ $text = preg_replace($pattern, $replace, $text);
+ $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
+ $text = preg_replace($pattern, $replace, $text);
+
+ /**
+ * reportedly some versions of MSIE don't handle tabs in XMLHttpRequest documents very well
+ */
+
+ echo str_replace("\t",' ',$text);
+ echo (($_GET['msie'] == 1) ? '</div>' : '</section>');
+ echo "</body></html>\r\n";
+ killme();
+
+} \ No newline at end of file
diff --git a/mod/wall_attach.php b/mod/wall_attach.php
index ef6554df3..a66ed0d05 100644
--- a/mod/wall_attach.php
+++ b/mod/wall_attach.php
@@ -61,7 +61,7 @@ function wall_attach_post(&$a) {
$filedata = @file_get_contents($src);
$mimetype = z_mime_content_type($filename);
- if((! strlen($mimetype)) || ($mimetype === 'application/octet-stream') && function_exists('mime_content_type'))
+ if(((! strlen($mimetype)) || ($mimetype === 'application/octet-stream')) && function_exists('mime_content_type'))
$mimetype = mime_content_type($filename);
$hash = random_string();
$created = datetime_convert();