aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-01-27 20:00:43 -0800
committerfriendica <info@friendica.com>2015-01-27 20:00:43 -0800
commita2cdd1499c968c31ae1b95933231f80be5fc639b (patch)
tree231780d92f46a0f265e79fa478c3b7e7fc84d085
parent0bfbe6d61d3c6250a162a29d2cdb0ec78ad02f1d (diff)
parent145b30adfc21b7f29d1431ebd1e2e0f4ebd853bf (diff)
downloadvolse-hubzilla-a2cdd1499c968c31ae1b95933231f80be5fc639b.tar.gz
volse-hubzilla-a2cdd1499c968c31ae1b95933231f80be5fc639b.tar.bz2
volse-hubzilla-a2cdd1499c968c31ae1b95933231f80be5fc639b.zip
Merge branch 'master' into tres
Conflicts: include/socgraph.php
-rwxr-xr-xboot.php2
-rw-r--r--include/RedDAV/RedBrowser.php95
-rw-r--r--include/enotify.php1
-rwxr-xr-xinclude/items.php53
-rw-r--r--include/onepoll.php2
-rw-r--r--include/poller.php2
-rw-r--r--include/socgraph.php14
-rw-r--r--include/text.php71
-rw-r--r--include/zot.php73
-rw-r--r--install/schema_mysql.sql4
-rw-r--r--install/schema_postgres.sql2
-rw-r--r--install/update.php13
-rw-r--r--mod/acl.php10
-rw-r--r--mod/directory.php14
-rw-r--r--mod/help.php20
-rw-r--r--mod/sharedwithme.php38
-rw-r--r--version.inc2
-rw-r--r--view/css/conversation.css4
-rw-r--r--view/css/mod_sharedwithme.css24
-rw-r--r--view/tpl/sharedwithme.tpl24
20 files changed, 302 insertions, 166 deletions
diff --git a/boot.php b/boot.php
index 31d4ea1e7..bd506db5e 100755
--- a/boot.php
+++ b/boot.php
@@ -49,7 +49,7 @@ define ( 'RED_PLATFORM', 'redmatrix' );
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 );
-define ( 'DB_UPDATE_VERSION', 1134 );
+define ( 'DB_UPDATE_VERSION', 1135 );
/**
* Constant with a HTML line break.
diff --git a/include/RedDAV/RedBrowser.php b/include/RedDAV/RedBrowser.php
index 5642c3f86..e893d6ebd 100644
--- a/include/RedDAV/RedBrowser.php
+++ b/include/RedDAV/RedBrowser.php
@@ -82,7 +82,7 @@ class RedBrowser extends DAV\Browser\Plugin {
date_default_timezone_set($this->auth->getTimezone());
require_once('include/conversation.php');
-
+ require_once('include/text.php');
if ($this->auth->owner_nick) {
$html = profile_tabs(get_app(), (($is_owner) ? true : false), $this->auth->owner_nick);
}
@@ -208,9 +208,9 @@ class RedBrowser extends DAV\Browser\Plugin {
$ft['displayName'] = $displayName;
$ft['type'] = $type;
$ft['size'] = $size;
- $ft['sizeFormatted'] = $this->userReadableSize($size);
+ $ft['sizeFormatted'] = userReadableSize($size);
$ft['lastmodified'] = (($lastmodified) ? datetime_convert('UTC', date_default_timezone_get(), $lastmodified) : '');
- $ft['iconFromType'] = $this->getIconFromType($type);
+ $ft['iconFromType'] = getIconFromType($type);
$f[] = $ft;
}
@@ -224,13 +224,13 @@ class RedBrowser extends DAV\Browser\Plugin {
if ($used) {
$quotaDesc = t('%1$s used');
$quotaDesc = sprintf($quotaDesc,
- $this->userReadableSize($used));
+ userReadableSize($used));
}
if ($limit && $used) {
$quotaDesc = t('%1$s used of %2$s (%3$s&#37;)');
$quotaDesc = sprintf($quotaDesc,
- $this->userReadableSize($used),
- $this->userReadableSize($limit),
+ userReadableSize($used),
+ userReadableSize($limit),
round($used / $limit, 1));
}
@@ -283,29 +283,6 @@ class RedBrowser extends DAV\Browser\Plugin {
}
/**
- * @brief Returns a human readable formatted string for filesizes.
- *
- * Don't we need such a functionality in other places, too?
- *
- * @param int $size filesize in bytes
- * @return string
- */
- function userReadableSize($size) {
- $ret = "";
- if (is_numeric($size)) {
- $incr = 0;
- $k = 1024;
- $unit = array('bytes', 'KB', 'MB', 'GB', 'TB', 'PB');
- while (($size / $k) >= 1){
- $incr++;
- $size = round($size / $k, 2);
- }
- $ret = $size . " " . $unit[$incr];
- }
- return $ret;
- }
-
- /**
* @brief Creates a form to add new folders and upload files.
*
* @param \Sabre\DAV\INode $node
@@ -340,65 +317,6 @@ class RedBrowser extends DAV\Browser\Plugin {
}
/**
- * @brief returns icon name for use with e.g. font-awesome based on mime-type
- *
- * @param string $type
- * @return string
- */
- protected function getIconFromType($type) {
- $iconMap = array(
- //Folder
- t('Collection') => 'icon-folder-close',
-
- //Common file
- 'application/octet-stream' => 'icon-file-alt',
-
- //Text
- 'text/plain' => 'icon-file-text-alt',
- 'application/msword' => 'icon-file-text-alt',
- 'application/pdf' => 'icon-file-text-alt',
- 'application/vnd.oasis.opendocument.text' => 'icon-file-text-alt',
- 'application/epub+zip' => 'icon-book',
-
- //Spreadsheet
- 'application/vnd.oasis.opendocument.spreadsheet' => 'icon-table',
- 'application/vnd.ms-excel' => 'icon-table',
-
- //Image
- 'image/jpeg' => 'icon-picture',
- 'image/png' => 'icon-picture',
- 'image/gif' => 'icon-picture',
- 'image/svg+xml' => 'icon-picture',
-
- //Archive
- 'application/zip' => 'icon-archive',
- 'application/x-rar-compressed' => 'icon-archive',
-
- //Audio
- 'audio/mpeg' => 'icon-music',
- 'audio/wav' => 'icon-music',
- 'application/ogg' => 'icon-music',
- 'audio/ogg' => 'icon-music',
- 'audio/webm' => 'icon-music',
- 'audio/mp4' => 'icon-music',
-
- //Video
- 'video/quicktime' => 'icon-film',
- 'video/webm' => 'icon-film',
- 'video/mp4' => 'icon-film'
- );
-
- $iconFromType = 'icon-file-alt';
-
- if (array_key_exists($type, $iconMap))
- {
- $iconFromType = $iconMap[$type];
- }
-
- return $iconFromType;
- }
-
- /**
* @brief Return the hash of an attachment.
*
* Given the owner, the parent folder and and attach name get the attachment
@@ -412,6 +330,7 @@ class RedBrowser extends DAV\Browser\Plugin {
* The name of the attachment
* @return string
*/
+
protected function findAttachHash($owner, $parentHash, $attachName) {
$r = q("SELECT hash FROM attach WHERE uid = %d AND folder = '%s' AND filename = '%s' ORDER BY edited DESC LIMIT 1",
intval($owner),
diff --git a/include/enotify.php b/include/enotify.php
index 34552cc36..77b84d373 100644
--- a/include/enotify.php
+++ b/include/enotify.php
@@ -333,6 +333,7 @@ function notification($params) {
$datarray = array();
$datarray['hash'] = $hash;
+ $datarray['sender_hash'] = $sender['xchan_hash'];
$datarray['name'] = $sender['xchan_name'];
$datarray['url'] = $sender['xchan_url'];
$datarray['photo'] = $sender['xchan_photo_s'];
diff --git a/include/items.php b/include/items.php
index 21025f76f..916838f3f 100755
--- a/include/items.php
+++ b/include/items.php
@@ -2181,6 +2181,20 @@ function item_store($arr,$allow_exec = false) {
unset($arr['term']);
}
+ if(strlen($allow_cid) || strlen($allow_gid) || strlen($deny_cid) || strlen($deny_gid) || strlen($public_policy))
+ $private = 1;
+ else
+ $private = $arr['item_private'];
+
+ $arr['parent'] = $parent_id;
+ $arr['allow_cid'] = $allow_cid;
+ $arr['allow_gid'] = $allow_gid;
+ $arr['deny_cid'] = $deny_cid;
+ $arr['deny_gid'] = $deny_gid;
+ $arr['public_policy'] = $public_policy;
+ $arr['item_private'] = $private;
+ $arr['comments_closed'] = $comments_closed;
+
logger('item_store: ' . print_r($arr,true), LOGGER_DATA);
dbesc_array($arr);
@@ -2198,7 +2212,6 @@ function item_store($arr,$allow_exec = false) {
intval($arr['uid'])
);
-
if($r && count($r)) {
$current_post = $r[0]['id'];
$arr = $r[0]; // This will gives us a fresh copy of what's now in the DB and undo the db escaping, which really messes up the notifications
@@ -2218,40 +2231,14 @@ function item_store($arr,$allow_exec = false) {
);
}
- if((! $parent_id) || ($arr['parent_mid'] === $arr['mid']))
- $parent_id = $current_post;
-
- if(strlen($allow_cid) || strlen($allow_gid) || strlen($deny_cid) || strlen($deny_gid) || strlen($public_policy))
- $private = 1;
- else
- $private = $arr['item_private'];
+ $arr['id'] = $current_post;
- // Set parent id - and also make sure to inherit the parent's ACL's.
-
- $r = q("UPDATE item SET parent = %d, allow_cid = '%s', allow_gid = '%s',
- deny_cid = '%s', deny_gid = '%s', public_policy = '%s', item_private = %d, comments_closed = '%s'
- WHERE id = %d",
- intval($parent_id),
- dbesc($allow_cid),
- dbesc($allow_gid),
- dbesc($deny_cid),
- dbesc($deny_gid),
- dbesc($public_policy),
- intval($private),
- dbesc($comments_closed),
- intval($current_post)
- );
+ if(! intval($r[0]['parent'])) {
+ $x = q("update item set parent = id where id = %d",
+ intval($r[0]['id'])
+ );
+ }
- // These are probably redundant now that we've queried the just stored post
- $arr['id'] = $current_post;
- $arr['parent'] = $parent_id;
- $arr['allow_cid'] = $allow_cid;
- $arr['allow_gid'] = $allow_gid;
- $arr['deny_cid'] = $deny_cid;
- $arr['deny_gid'] = $deny_gid;
- $arr['public_policy'] = $public_policy;
- $arr['item_private'] = $private;
- $arr['comments_closed'] = $comments_closed;
// Store taxonomy
diff --git a/include/onepoll.php b/include/onepoll.php
index 095edd095..ee90fbdb1 100644
--- a/include/onepoll.php
+++ b/include/onepoll.php
@@ -145,7 +145,7 @@ function onepoll_run($argv, $argc){
if($contact['xchan_connurl']) {
$r = q("SELECT xlink_id from xlink
- where xlink_xchan = '%s' and xlink_updated > %s - INTERVAL %s limit 1",
+ where xlink_xchan = '%s' and xlink_updated > %s - INTERVAL %s and xlink_static = 0 limit 1",
intval($contact['xchan_hash']),
db_utcnow(), db_quoteinterval('1 DAY')
);
diff --git a/include/poller.php b/include/poller.php
index b655259a4..b21919b3d 100644
--- a/include/poller.php
+++ b/include/poller.php
@@ -159,7 +159,7 @@ function poller_run($argv, $argc){
// get rid of really old poco records
- q("delete from xlink where xlink_updated < %s - INTERVAL %s",
+ q("delete from xlink where xlink_updated < %s - INTERVAL %s and xlink_static = 0 ",
db_utcnow(), db_quoteinterval('14 DAY')
);
diff --git a/include/socgraph.php b/include/socgraph.php
index ae135b2a8..507f9bb36 100644
--- a/include/socgraph.php
+++ b/include/socgraph.php
@@ -186,13 +186,13 @@ function poco_load($xchan = '',$url = null) {
$total ++;
- $r = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' limit 1",
+ $r = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' and xlink_static = 0 limit 1",
dbesc($xchan),
dbesc($hash)
);
if(! $r) {
- q("insert into xlink ( xlink_xchan, xlink_link, xlink_rating, xlink_rating_text, xlink_updated ) values ( '%s', '%s', %d, '%s', '%s' ) ",
+ q("insert into xlink ( xlink_xchan, xlink_link, xlink_rating, xlink_rating_text, xlink_updated, xlink_static ) values ( '%s', '%s', %d, '%s', '%s', 0 ) ",
dbesc($xchan),
dbesc($hash),
intval($rating),
@@ -211,7 +211,7 @@ function poco_load($xchan = '',$url = null) {
}
logger("poco_load: loaded $total entries",LOGGER_DEBUG);
- q("delete from xlink where xlink_xchan = '%s' and xlink_updated < %s - INTERVAL %s",
+ q("delete from xlink where xlink_xchan = '%s' and xlink_updated < %s - INTERVAL %s and xlink_static = 0",
dbesc($xchan),
db_utcnow(), db_quoteinterval('2 DAY')
);
@@ -222,7 +222,7 @@ function poco_load($xchan = '',$url = null) {
function count_common_friends($uid,$xchan) {
- $r = q("SELECT count(xlink_id) as total from xlink where xlink_xchan = '%s' and xlink_link in
+ $r = q("SELECT count(xlink_id) as total from xlink where xlink_xchan = '%s' and xlink_static = 0 and xlink_link in
(select abook_xchan from abook where abook_xchan != '%s' and abook_channel = %d and abook_flags = 0 )",
dbesc($xchan),
dbesc($xchan),
@@ -243,7 +243,7 @@ function common_friends($uid,$xchan,$start = 0,$limit=100000000,$shuffle = false
else
$sql_extra = " order by xchan_name asc ";
- $r = q("SELECT * from xchan left join xlink on xlink_link = xchan_hash where xlink_xchan = '%s' and xlink_link in
+ $r = q("SELECT * from xchan left join xlink on xlink_link = xchan_hash where xlink_xchan = '%s' and xlink_static = 0 and xlink_link in
(select abook_xchan from abook where abook_xchan != '%s' and abook_channel = %d and abook_flags = 0 ) $sql_extra limit %d offset %d",
dbesc($xchan),
dbesc($xchan),
@@ -342,6 +342,7 @@ function suggestion_query($uid, $myxchan, $start = 0, $limit = 80) {
and xlink_xchan != ''
and xchan_hidden = 0
and xchan_deleted = 0
+ and xlink_static = 0
group by xchan_hash order by total desc limit %d offset %d ",
intval($uid),
intval($uid),
@@ -360,6 +361,7 @@ function suggestion_query($uid, $myxchan, $start = 0, $limit = 80) {
and not xlink_link in ( select xchan from xign where uid = %d )
and xchan_hidden = 0
and xchan_deleted = 0
+ and xlink_static = 0
group by xchan_hash order by total desc limit %d offset %d ",
intval($uid),
intval($uid),
@@ -401,7 +403,7 @@ function update_suggestions() {
// the targets may have changed their preferences and don't want to be suggested - and they
// may have simply gone away.
- $r = q("delete from xlink where xlink_xchan = '' and xlink_updated < %s - INTERVAL %s",
+ $r = q("delete from xlink where xlink_xchan = '' and xlink_updated < %s - INTERVAL %s and xlink_static = 0",
db_utcnow(), db_quoteinterval('7 DAY')
);
diff --git a/include/text.php b/include/text.php
index 2aa270f3b..9a13e5e72 100644
--- a/include/text.php
+++ b/include/text.php
@@ -2377,3 +2377,74 @@ function linkify_tags($a, &$body, $uid) {
return $results;
}
+/**
+ * @brief returns icon name for use with e.g. font-awesome based on mime-type
+ *
+ * @param string $type
+ * @return string
+ */
+function getIconFromType($type) {
+ $iconMap = array(
+ //Folder
+ t('Collection') => 'icon-folder-close',
+ //Common file
+ 'application/octet-stream' => 'icon-file-alt',
+ //Text
+ 'text/plain' => 'icon-file-text-alt',
+ 'application/msword' => 'icon-file-text-alt',
+ 'application/pdf' => 'icon-file-text-alt',
+ 'application/vnd.oasis.opendocument.text' => 'icon-file-text-alt',
+ 'application/epub+zip' => 'icon-book',
+ //Spreadsheet
+ 'application/vnd.oasis.opendocument.spreadsheet' => 'icon-table',
+ 'application/vnd.ms-excel' => 'icon-table',
+ //Image
+ 'image/jpeg' => 'icon-picture',
+ 'image/png' => 'icon-picture',
+ 'image/gif' => 'icon-picture',
+ 'image/svg+xml' => 'icon-picture',
+ //Archive
+ 'application/zip' => 'icon-archive',
+ 'application/x-rar-compressed' => 'icon-archive',
+ //Audio
+ 'audio/mpeg' => 'icon-music',
+ 'audio/wav' => 'icon-music',
+ 'application/ogg' => 'icon-music',
+ 'audio/ogg' => 'icon-music',
+ 'audio/webm' => 'icon-music',
+ 'audio/mp4' => 'icon-music',
+ //Video
+ 'video/quicktime' => 'icon-film',
+ 'video/webm' => 'icon-film',
+ 'video/mp4' => 'icon-film'
+ );
+
+ $iconFromType = 'icon-file-alt';
+
+ if (array_key_exists($type, $iconMap)) {
+ $iconFromType = $iconMap[$type];
+ }
+
+ return $iconFromType;
+}
+
+/**
+ * @brief Returns a human readable formatted string for filesizes.
+ *
+ * @param int $size filesize in bytes
+ * @return string
+ */
+function userReadableSize($size) {
+ $ret = "";
+ if (is_numeric($size)) {
+ $incr = 0;
+ $k = 1024;
+ $unit = array('bytes', 'KB', 'MB', 'GB', 'TB', 'PB');
+ while (($size / $k) >= 1){
+ $incr++;
+ $size = round($size / $k, 2);
+ }
+ $ret = $size . " " . $unit[$incr];
+ }
+ return $ret;
+}
diff --git a/include/zot.php b/include/zot.php
index d8b9a1485..7bdde836f 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -1078,6 +1078,12 @@ function zot_import($arr, $sender_url) {
$i['notify']['sender']['hash'] = make_xchan_hash($i['notify']['sender']['guid'],$i['notify']['sender']['guid_sig']);
$deliveries = null;
+ if(array_key_exists('message',$i) && array_key_exists('type',$i['message']) && $i['message']['type'] === 'rating') {
+ // rating messages are processed only by directory servers
+ logger('Rating received: ' . print_r($arr,true), LOGGER_DATA);
+ $result = process_rating_delivery($i['notify']['sender'],$arr);
+ }
+
if(array_key_exists('recipients',$i['notify']) && count($i['notify']['recipients'])) {
logger('specific recipients');
$recip_arr = array();
@@ -1097,7 +1103,8 @@ function zot_import($arr, $sender_url) {
// It's a specifically targetted post. If we were sent a public_scope hint (likely),
// get rid of it so that it doesn't get stored and cause trouble.
- if(($i) && is_array($i) && array_key_exists('message',$i) && is_array($i['message']) && array_key_exists('public_scope',$i['message']))
+ if(($i) && is_array($i) && array_key_exists('message',$i) && is_array($i['message'])
+ && $i['message']['type'] === 'activity' && array_key_exists('public_scope',$i['message']))
unset($i['message']['public_scope']);
$deliveries = $r;
@@ -1106,7 +1113,7 @@ function zot_import($arr, $sender_url) {
}
else {
- if(($i['message']) && (array_key_exists('flags',$i['message'])) && (in_array('private',$i['message']['flags']))) {
+ if(($i['message']) && (array_key_exists('flags',$i['message'])) && (in_array('private',$i['message']['flags'])) && $i['message']['type'] === 'activity') {
if(array_key_exists('public_scope',$i['message']) && $i['message']['public_scope'] === 'public') {
// This should not happen but until we can stop it...
logger('private message was delivered with no recipients.');
@@ -1197,6 +1204,7 @@ function zot_import($arr, $sender_url) {
$result = process_profile_delivery($i['notify']['sender'],$arr,$deliveries);
}
+
elseif($i['message']['type'] === 'channel_sync') {
// $arr = get_channelsync_elements($i['message']);
@@ -1456,7 +1464,7 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false,$reque
// As a side effect we will also do a preliminary check that we have the top-level-post, otherwise
// processing it is pointless.
- $r = q("select route from item where mid = '%s' and uid = %d limit 1",
+ $r = q("select route, id from item where mid = '%s' and uid = %d limit 1",
dbesc($arr['parent_mid']),
intval($channel['channel_id'])
);
@@ -1493,14 +1501,34 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false,$reque
// going downstream check that we have the same upstream provider that
// sent it to us originally. Ignore it if it came from another source
- // (with potentially different permissions)
+ // (with potentially different permissions).
+ // only compare the last hop since it could have arrived at the last location any number of ways.
+ // Always accept empty routes.
+
+ $existing_route = explode(',', $r[0]['route']);
+ $routes = count($existing_route);
+ if($routes) {
+ $last_hop = array_pop($existing_route);
+ $last_prior_route = implode(',',$existing_route);
+ }
+ else {
+ $last_hop = '';
+ $last_prior_route = '';
+ }
$current_route = (($arr['route']) ? $arr['route'] . ',' : '') . $sender['hash'];
- if($r[0]['route'] != $current_route) {
+ if($last_hop && $last_hop != $sender['hash'] && $sender['hash'] != 'undefined') {
+ logger('comment route mismatch: parent route = ' . $r[0]['route'] . ' expected = ' . $current_route, LOGGER_DEBUG);
+ logger('comment route mismatch: parent msg = ' . $r[0]['id'],LOGGER_DEBUG);
$result[] = array($d['hash'],'comment route mismatch',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']);
continue;
}
+
+ // we'll add sender['hash'] onto this when we deliver it. $last_prior_route now has the previously stored route
+ // *except* for the sender['hash'] which would've been the last hop before it got to us.
+
+ $arr['route'] = $last_prior_route;
}
}
@@ -1750,6 +1778,41 @@ function process_mail_delivery($sender,$arr,$deliveries) {
return $result;
}
+function process_rating_delivery($sender,$arr) {
+
+ $dirmode = intval(get_config('system','directory_mode'));
+ if($dirmode == DIRECTORY_MODE_NORMAL)
+ return;
+
+ if(! $arr['target'])
+ return;
+
+ $r = q("select * from xlink where xlink_xchan = '%s' and xlink_target = '%s' limit 1",
+ dbesc($sender['hash']),
+ dbesc($arr['target'])
+ );
+ if($r) {
+ $x = q("update xlink set xlink_rating = %d, xlink_rating_text = '%s', xlink_updated = '%s' where xlink_id = %d",
+ intval($arr['rating']),
+ intval($arr['rating_text']),
+ dbesc(datetime_convert()),
+ intval($r[0]['xlink_id'])
+ );
+ }
+ else {
+ $x = q("insert into xlink ( xlink_xchan, xlink_link, xlink_rating, xlink_rating_text, xlink_updated, xlink_static )
+ values( '%s', '%s', %d, '%s', '%s', 1 ) ",
+ dbesc($sender['hash']),
+ dbesc($arr['target']),
+ intval($arr['rating']),
+ intval($arr['rating_text']),
+ dbesc(datetime_convert())
+ );
+ }
+ return;
+}
+
+
function process_profile_delivery($sender,$arr,$deliveries) {
logger('process_profile_delivery', LOGGER_DEBUG);
diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql
index 226ea2308..ba41073f8 100644
--- a/install/schema_mysql.sql
+++ b/install/schema_mysql.sql
@@ -1532,11 +1532,13 @@ CREATE TABLE IF NOT EXISTS `xlink` (
`xlink_rating` int(11) NOT NULL DEFAULT '0',
`xlink_rating_text` TEXT NOT NULL DEFAULT '',
`xlink_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `xlink_static` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`xlink_id`),
KEY `xlink_xchan` (`xlink_xchan`),
KEY `xlink_link` (`xlink_link`),
KEY `xlink_updated` (`xlink_updated`),
- KEY `xlink_rating` (`xlink_rating`)
+ KEY `xlink_rating` (`xlink_rating`),
+ KEY `xlink_static` (`xlink_static`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
diff --git a/install/schema_postgres.sql b/install/schema_postgres.sql
index 8539e672d..2fcc7f9ba 100644
--- a/install/schema_postgres.sql
+++ b/install/schema_postgres.sql
@@ -1145,12 +1145,14 @@ CREATE TABLE "xlink" (
"xlink_rating" bigint NOT NULL DEFAULT '0',
"xlink_rating_text" TEXT NOT NULL DEFAULT '',
"xlink_updated" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
+ "xlink_static" numeric(1) NOT NULL DEFAULT '0',
PRIMARY KEY ("xlink_id")
);
create index "xlink_xchan" on xlink ("xlink_xchan");
create index "xlink_link" on xlink ("xlink_link");
create index "xlink_updated" on xlink ("xlink_updated");
create index "xlink_rating" on xlink ("xlink_rating");
+create index "xlink_static" on xlink ("xlink_static");
CREATE TABLE "xperm" (
"xp_id" serial NOT NULL,
"xp_client" varchar( 20 ) NOT NULL DEFAULT '',
diff --git a/install/update.php b/install/update.php
index 8cd25f1bf..346b2c25a 100644
--- a/install/update.php
+++ b/install/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1134 );
+define( 'UPDATE_VERSION' , 1135 );
/**
*
@@ -1537,3 +1537,14 @@ function update_r1133() {
return UPDATE_FAILED;
}
+
+function update_r1134() {
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r = q("ALTER TABLE xlink ADD xlink_static numeric(1) NOT NULL DEFAULT '0', create index xlink_static on xlink ( \"xlink_static\" ) ");
+ }
+ else
+ $r = q("ALTER TABLE xlink ADD xlink_static TINYINT( 1 ) NOT NULL DEFAULT '0', ADD INDEX ( xlink_static ) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+} \ No newline at end of file
diff --git a/mod/acl.php b/mod/acl.php
index a1ed177c8..5d08c3e5b 100644
--- a/mod/acl.php
+++ b/mod/acl.php
@@ -33,7 +33,7 @@ function acl_init(&$a){
$sql_extra2 = "AND ( xchan_name LIKE " . protect_sprintf( "'%" . dbesc($search) . "%'" ) . " OR xchan_addr LIKE " . protect_sprintf( "'%" . dbesc($search) . ((strpos($search,'@') === false) ? "%@%'" : "%'")) . ") ";
// This horrible mess is needed because position also returns 0 if nothing is found. W/ould be MUCH easier if it instead returned a very large value
- // Otherwise we could just order by LEAST(POSTION($search IN xchan_name),POSITION($search IN xchan_addr)).
+ // Otherwise we could just order by LEAST(POSITION($search IN xchan_name),POSITION($search IN xchan_addr)).
$order_extra2 = "CASE WHEN xchan_name LIKE " . protect_sprintf( "'%" . dbesc($search) . "%'" ) ." then POSITION('".dbesc($search)."' IN xchan_name) else position('".dbesc($search)."' IN xchan_addr) end, ";
$col = ((strpos($search,'@') !== false) ? 'xchan_addr' : 'xchan_name' );
$sql_extra3 = "AND $col like " . protect_sprintf( "'%" . dbesc($search) . "%'" ) . " ";
@@ -167,6 +167,7 @@ function acl_init(&$a){
);
}
elseif(($type == 'a') || ($type == 'p')) {
+
$r = q("SELECT abook_id as id, xchan_name as name, xchan_hash as hash, xchan_addr as nick, xchan_photo_s as micro, xchan_network as network, xchan_url as url, xchan_addr as attag , abook_their_perms FROM abook left join xchan on abook_xchan = xchan_hash
WHERE abook_channel = %d
and xchan_deleted = 0
@@ -174,6 +175,7 @@ function acl_init(&$a){
ORDER BY xchan_name ASC ",
intval(local_user())
);
+
}
elseif($type == 'x') {
$r = navbar_complete($a);
@@ -203,7 +205,7 @@ function acl_init(&$a){
foreach($r as $g){
// remove RSS feeds from ACLs - they are inaccessible
- if(strpos($g['hash'],'/'))
+ if(strpos($g['hash'],'/') && $type != 'a')
continue;
if(($g['abook_their_perms'] & PERMS_W_TAGWALL) && $type == 'c' && (! $noforums)) {
@@ -227,7 +229,7 @@ function acl_init(&$a){
"id" => $g['id'],
"xid" => $g['hash'],
"link" => $g['nick'],
- "nick" => substr($g['nick'],0,strpos($g['nick'],'@')),
+ "nick" => (($g['nick']) ? substr($g['nick'],0,strpos($g['nick'],'@')) : t('RSS')),
"self" => (($g['abook_flags'] & ABOOK_FLAG_SELF) ? 'abook-self' : ''),
"taggable" => '',
"label" => '',
@@ -242,6 +244,8 @@ function acl_init(&$a){
'count' => $count,
'items' => $items,
);
+
+
echo json_encode($o);
diff --git a/mod/directory.php b/mod/directory.php
index 4ceda293d..2a07208a4 100644
--- a/mod/directory.php
+++ b/mod/directory.php
@@ -274,17 +274,21 @@ function directory_content(&$a) {
$arr = array('contact' => $rr, 'entry' => $entry);
call_hooks('directory_item', $arr);
-
+
+ unset($profile);
+ unset($location);
+
+ if(! $arr['entry']) {
+ continue;
+ }
+
if($sort_order == '' && $suggest) {
$entries[$addresses[$rr['address']]] = $arr['entry']; // Use the same indexes as originally to get the best suggestion first
}
+
else {
$entries[] = $arr['entry'];
}
- unset($profile);
- unset($location);
-
-
}
ksort($entries); // Sort array by key so that foreach-constructs work as expected
diff --git a/mod/help.php b/mod/help.php
index 5cdeda58f..0081e54e7 100644
--- a/mod/help.php
+++ b/mod/help.php
@@ -37,20 +37,28 @@ function help_content(&$a) {
$text = '';
if(argc() > 1) {
- $text = load_doc_file('doc/' . $a->argv[1] . '.md');
- $a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('-',' ',notags(argv(1))));
+ $path = '';
+ for($x = 1; $x < argc(); $x ++) {
+ if(strlen($path))
+ $path .= '/';
+ $path .= argv($x);
+ }
+ $title = basename($path);
+
+ $text = load_doc_file('doc/' . $path . '.md');
+ $a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('-',' ',notags($title)));
if(! $text) {
- $text = load_doc_file('doc/' . $a->argv[1] . '.bb');
+ $text = load_doc_file('doc/' . $path . '.bb');
if($text)
$doctype = 'bbcode';
- $a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('_',' ',notags(argv(1))));
+ $a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('_',' ',notags($title)));
}
if(! $text) {
- $text = load_doc_file('doc/' . $a->argv[1] . '.html');
+ $text = load_doc_file('doc/' . $path . '.html');
if($text)
$doctype = 'html';
- $a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('-',' ',notags(argv(1))));
+ $a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('-',' ',notags($title)));
}
}
diff --git a/mod/sharedwithme.php b/mod/sharedwithme.php
index 8b7d2661c..56cbc35ec 100644
--- a/mod/sharedwithme.php
+++ b/mod/sharedwithme.php
@@ -73,27 +73,37 @@ function sharedwithme_content(&$a) {
dbesc($channel['channel_hash'])
);
- $o = profile_tabs($a, $is_owner, $channel['channel_address']);
-
- $o .= '<div class="section-title-wrapper">';
-
- $o .= '<a href="/sharedwithme/dropall" onclick="return confirmDelete();" class="btn btn-xs btn-default pull-right"><i class="icon-trash"></i>&nbsp;' . t('Remove all entries') . '</a>';
-
- $o .= '<h2>' . t('Files shared with me') . '</h2>';
-
- $o .= '</div>';
-
- $o .= '<div class="section-content-wrapper">';
+ $items =array();
if($r) {
foreach($r as $rr) {
$object = json_decode($rr['object'],true);
- $url = rawurldecode(get_rel_link($object['link'],'alternate'));
- $o .= '<a href="' . $url . '?f=&zid=' . $channel['xchan_addr'] . '">' . $url . '</a>&nbsp;<a href="/sharedwithme/' . $rr['id'] . '/drop" onclick="return confirmDelete();"><i class="icon-trash drop-icons"></i></a><br><br>';
+
+ $item = array();
+ $item['id'] = $rr['id'];
+ $item['objfiletype'] = $object['filetype'];
+ $item['objfiletypeclass'] = getIconFromType($object['filetype']);
+ $item['objurl'] = rawurldecode(get_rel_link($object['link'],'alternate')) . '?f=&zid=' . $channel['xchan_addr'];
+ $item['objfilename'] = $object['filename'];
+ $item['objfilesize'] = userReadableSize($object['filesize']);
+ $item['objedited'] = $object['edited'];
+
+ $items[] = $item;
+
}
}
- $o .= '</div>';
+ $o = profile_tabs($a, $is_owner, $channel['channel_address']);
+
+ $o .= replace_macros(get_markup_template('sharedwithme.tpl'), array(
+ '$header' => t('Files: shared with me'),
+ '$name' => t('Name'),
+ '$size' => t('Size'),
+ '$lastmod' => t('Last Modified'),
+ '$dropall' => t('Remove all files'),
+ '$drop' => t('Remove this file'),
+ '$items' => $items
+ ));
return $o;
diff --git a/version.inc b/version.inc
index 5a4a46961..f140c0f66 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2015-01-26.928
+2015-01-27.929
diff --git a/view/css/conversation.css b/view/css/conversation.css
index 7a5ffc2f7..8bc71bb6d 100644
--- a/view/css/conversation.css
+++ b/view/css/conversation.css
@@ -195,6 +195,10 @@ a.wall-item-name-link {
clear: both;
}
+.shared_header {
+ margin-bottom: 20px;
+}
+
/* comment_item */
.comment-edit-text-empty, .comment-edit-text-full {
diff --git a/view/css/mod_sharedwithme.css b/view/css/mod_sharedwithme.css
new file mode 100644
index 000000000..79fe0d7a9
--- /dev/null
+++ b/view/css/mod_sharedwithme.css
@@ -0,0 +1,24 @@
+#cloud-index {
+ width: 100%;
+}
+
+#cloud-index td:nth-child(1){
+ padding: 7px 3px 7px 10px;
+}
+
+#cloud-index th:nth-child(4),
+#cloud-index td:nth-child(4){
+ padding: 7px 3px;
+ white-space: nowrap;
+}
+
+#cloud-index th:nth-child(5),
+#cloud-index td:nth-child(5){
+ padding: 7px 10px 7px 7px;
+ white-space: nowrap;
+}
+
+.cloud-index-tool {
+ padding: 7px 10px;
+}
+
diff --git a/view/tpl/sharedwithme.tpl b/view/tpl/sharedwithme.tpl
new file mode 100644
index 000000000..1aeb9d4d7
--- /dev/null
+++ b/view/tpl/sharedwithme.tpl
@@ -0,0 +1,24 @@
+<div class="section-title-wrapper">
+ <a href="/sharedwithme/dropall" onclick="return confirmDelete();" class="btn btn-xs btn-default pull-right"><i class="icon-trash"></i>&nbsp;{{$dropall}}</a>
+ <h2>{{$header}}</h2>
+</div>
+<div class="generic-content-wrapper section-content-wrapper-np">
+ <table id="cloud-index">
+ <tr>
+ <th width="1%"></th>
+ <th width="92%">{{$name}}</th>
+ <th width="1%"></th>
+ <th width="1%" class="hidden-xs">{{$size}}</th>
+ <th width="1%" class="hidden-xs">{{$lastmod}}</th>
+ </tr>
+ {{foreach $items as $item}}
+ <tr id="cloud-index-{{$item.id}}">
+ <td><i class="{{$item.objfiletypeclass}}" title="{{$item.objfiletype}}"></i></td>
+ <td><a href="{{$item.objurl}}">{{$item.objfilename}}</a></td>
+ <td class="cloud-index-tool"><a href="/sharedwithme/{{$item.id}}/drop" title="{{$drop}}" onclick="return confirmDelete();"><i class="icon-trash drop-icons"></i></a></td>
+ <td class="hidden-xs">{{$item.objfilesize}}</td>
+ <td class="hidden-xs">{{$item.objedited}}</td>
+ </tr>
+ {{/foreach}}
+ </table>
+</div>