aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/attach.php92
-rw-r--r--include/auth.php4
-rw-r--r--include/conversation.php3
-rw-r--r--include/features.php2
-rw-r--r--include/identity.php3
-rw-r--r--include/import.php251
-rwxr-xr-xinclude/items.php26
-rw-r--r--include/nav.php11
-rw-r--r--include/network.php22
-rw-r--r--include/photos.php12
-rw-r--r--include/reddav.php3
-rw-r--r--include/session.php4
-rw-r--r--include/text.php25
-rw-r--r--include/widgets.php8
-rw-r--r--include/zot.php3
15 files changed, 431 insertions, 38 deletions
diff --git a/include/attach.php b/include/attach.php
index 4ecc273e9..ae4681994 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -864,6 +864,12 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
// This would've been called already with a success result in photos_upload() if it was a photo.
call_hooks('photo_upload_end',$ret);
}
+
+ $sync = attach_export_data($channel,$hash);
+
+ if($sync)
+ build_sync_packet($channel['channel_id'],array('file' => array($sync)));
+
return $ret;
}
@@ -1814,3 +1820,89 @@ function filepath_macro($s) {
}
+function attach_export_data($channel, $resource_id, $deleted = false) {
+
+ $ret = array();
+
+ $paths = array();
+
+ $hash_ptr = $resource_id;
+
+ $ret['fetch_url'] = z_root() . '/getfile';
+ $ret['original_channel'] = $channel['channel_address'];
+
+
+ if($deleted) {
+ $ret['attach'] = array(array('hash' => $resource_id, 'deleted' => 1));
+ return $ret;
+ }
+
+ do {
+ $r = q("select * from attach where hash = '%s' and uid = %d limit 1",
+ dbesc($hash_ptr),
+ intval($channel['channel_id'])
+ );
+ if(! $r)
+ break;
+
+ if($hash_ptr === $resource_id) {
+ $attach_ptr = $r[0];
+ }
+
+ $hash_ptr = $r[0]['folder'];
+ $paths[] = $r[0];
+ } while($hash_ptr);
+
+
+
+
+ $paths = array_reverse($paths);
+
+ $ret['attach'] = $paths;
+
+
+ if($attach_ptr['is_photo']) {
+ $r = q("select * from photo where resource_id = '%s' and uid = %d order by scale asc",
+ dbesc($resource_id),
+ intval($channel['channel_id'])
+ );
+ if($r) {
+ for($x = 0; $x < count($r); $x ++) {
+ $r[$x]['data'] = base64_encode($r[$x]['data']);
+ }
+ $ret['photo'] = $r;
+ }
+
+ $r = q("select * from item where resource_id = '%s' and resource_type = 'photo' and uid = %d ",
+ dbesc($resource_id),
+ intval($channel['channel_id'])
+ );
+ if($r) {
+ $ret['item'] = array();
+ $items = q("select item.*, item.id as item_id from item where item.parent = %d ",
+ intval($r[0]['id'])
+ );
+ if($items) {
+ xchan_query($items);
+ $items = fetch_post_tags($items,true);
+ foreach($items as $rr)
+ $ret['item'][] = encode_item($rr,true);
+ }
+ }
+ }
+
+ return $ret;
+
+}
+
+
+/* strip off 'store/nickname/' from the provided path */
+
+function get_attach_binname($s) {
+ $p = $s;
+ if(strpos($s,'store/') === 0) {
+ $p = substr($s,6);
+ $p = substr($p,strpos($p,'/')+1);
+ }
+ return $p;
+} \ No newline at end of file
diff --git a/include/auth.php b/include/auth.php
index aaec45c40..228143e12 100644
--- a/include/auth.php
+++ b/include/auth.php
@@ -246,7 +246,7 @@ else {
notice( t('Failed authentication') . EOL);
}
- logger('authenticate: ' . print_r(App::$account, true), LOGGER_DEBUG);
+ logger('authenticate: ' . print_r(App::$account, true), LOGGER_ALL);
}
if((! $record) || (! count($record))) {
@@ -274,7 +274,7 @@ else {
// (i.e. expire when the browser is closed), even when there's a time expiration
// on the cookie
- if($_POST['remember']) {
+ if($_POST['remember_me']) {
new_cookie(31449600); // one year
}
else {
diff --git a/include/conversation.php b/include/conversation.php
index 829e85382..5e9ba16a1 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -1592,6 +1592,7 @@ function network_tabs() {
function profile_tabs($a, $is_owner = false, $nickname = null){
// Don't provide any profile tabs if we're running as the sys channel
+
if (App::$is_sys)
return;
@@ -1669,7 +1670,7 @@ function profile_tabs($a, $is_owner = false, $nickname = null){
}
- if ($p['chat']) {
+ if ($p['chat'] && feature_enabled($uid,'ajaxchat')) {
require_once('include/chat.php');
$has_chats = chatroom_list_count($uid);
if ($has_chats) {
diff --git a/include/features.php b/include/features.php
index ff6b71d4c..38700f9f5 100644
--- a/include/features.php
+++ b/include/features.php
@@ -56,7 +56,7 @@ function get_features($filtered = true) {
array('private_notes', t('Private Notes'), t('Enables a tool to store notes and reminders (note: not encrypted)'),false,get_config('feature_lock','private_notes')),
array('nav_channel_select', t('Navigation Channel Select'), t('Change channels directly from within the navigation dropdown menu'),false,get_config('feature_lock','nav_channel_select')),
array('photo_location', t('Photo Location'), t('If location data is available on uploaded photos, link this to a map.'),false,get_config('feature_lock','photo_location')),
-
+ array('ajaxchat', t('Access Controlled Chatrooms'), t('Provide chatrooms and chat services with access control.'),true,get_config('feature_lock','ajaxchat')),
array('smart_birthdays', t('Smart Birthdays'), t('Make birthday events timezone aware in case your friends are scattered across the planet.'),true,get_config('feature_lock','smart_birthdays')),
array('expert', t('Expert Mode'), t('Enable Expert Mode to provide advanced configuration options'),false,get_config('feature_lock','expert')),
array('premium_channel', t('Premium Channel'), t('Allows you to set restrictions and terms on those that connect with your channel'),false,get_config('feature_lock','premium_channel')),
diff --git a/include/identity.php b/include/identity.php
index 849742c8e..9bb4fb3c5 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -550,7 +550,8 @@ function identity_basic_export($channel_id, $items = false) {
if($r)
$ret['config'] = $r;
- $r = q("select type, data, os_storage from photo where scale = 4 and profile = 1 and uid = %d limit 1",
+ $r = q("select type, data, os_storage from photo where scale = 4 and photo_usage = %d and uid = %d limit 1",
+ intval(PHOTO_PROFILE),
intval($channel_id)
);
diff --git a/include/import.php b/include/import.php
index 9a57012b2..f15dedfe0 100644
--- a/include/import.php
+++ b/include/import.php
@@ -870,6 +870,257 @@ function import_mail($channel,$mails) {
+function sync_files($channel,$files) {
+ require_once('include/attach.php');
+
+ if($channel && $files) {
+ foreach($files as $f) {
+ if(! $f)
+ continue;
+
+ $fetch_url = $f['fetch_url'];
+ $oldbase = dirname($fetch_url);
+ $original_channel = $f['original_channel'];
+
+ if(! ($fetch_url && $original_channel))
+ continue;
+
+ if($f['attach']) {
+ $attachment_stored = false;
+ foreach($f['attach'] as $att) {
+
+ if($att['deleted']) {
+ attach_delete($channel,$att['hash']);
+ continue;
+ }
+
+ $attach_exists = false;
+ $x = attach_by_hash($att['hash']);
+
+ if($x) {
+ $attach_exists = true;
+ $attach_id = $x[0]['id'];
+ }
+
+ $newfname = 'store/' . $channel['channel_address'] . '/' . get_attach_binname($att['data']);
+
+ unset($att['id']);
+ $att['aid'] = $channel['channel_account_id'];
+ $att['uid'] = $channel['channel_id'];
+
+
+ // check for duplicate folder names with the same parent.
+ // If we have a duplicate that doesn't match this hash value
+ // change the name so that the contents won't be "covered over"
+ // by the existing directory. Use the same logic we use for
+ // duplicate files.
+
+ if(strpos($att['filename'],'.') !== false) {
+ $basename = substr($att['filename'],0,strrpos($att['filename'],'.'));
+ $ext = substr($att['filename'],strrpos($att['filename'],'.'));
+ }
+ else {
+ $basename = $att['filename'];
+ $ext = '';
+ }
+
+ $r = q("select filename from attach where ( filename = '%s' OR filename like '%s' ) and folder == '%s' and hash != '%s' ",
+ dbesc($basename . $ext),
+ dbesc($basename . '(%)' . $ext),
+ dbesc($att['folder']),
+ dbesc($att['hash'])
+ );
+
+ if($r) {
+ $x = 1;
+
+ do {
+ $found = false;
+ foreach($r as $rr) {
+ if($rr['filename'] === $basename . '(' . $x . ')' . $ext) {
+ $found = true;
+ break;
+ }
+ }
+ if($found)
+ $x++;
+ }
+ while($found);
+ $att['filename'] = $basename . '(' . $x . ')' . $ext;
+ }
+ else
+ $att['filename'] = $basename . $ext;
+
+ // end duplicate detection
+
+// @fixme - update attachment structures if they are modified rather than created
+
+ $att['data'] = $newfname;
+
+ // Note: we use $att['hash'] below after it has been escaped to
+ // fetch the file contents.
+ // If the hash ever contains any escapable chars this could cause
+ // problems. Currently it does not.
+
+ dbesc_array($att);
+
+
+ if($attach_exists) {
+ $str = '';
+ foreach($att as $k => $v) {
+ if($str)
+ $str .= ",";
+ $str .= " `" . $k . "` = '" . $v . "' ";
+ }
+ $r = dbq("update `attach` set " . $str . " where id = " . intval($attach_id) );
+ }
+ else {
+ $r = dbq("INSERT INTO attach (`"
+ . implode("`, `", array_keys($att))
+ . "`) VALUES ('"
+ . implode("', '", array_values($att))
+ . "')" );
+ }
+
+
+ // is this a directory?
+
+ if($att['filetype'] === 'multipart/mixed' && $att['is_dir']) {
+ os_mkdir($newfname, STORAGE_DEFAULT_PERMISSIONS,true);
+ continue;
+ }
+ else {
+
+ // it's a file
+ // for the sync version of this algorithm (as opposed to 'offline import')
+ // we will fetch the actual file from the source server so it can be
+ // streamed directly to disk and avoid consuming PHP memory if it's a huge
+ // audio/video file or something.
+
+ $time = datetime_convert();
+
+ $parr = array('hash' => $channel['channel_hash'],
+ 'time' => $time,
+ 'resource' => $att['hash'],
+ 'revision' => 0,
+ 'signature' => base64url_encode(rsa_sign($channel['channel_hash'] . '.' . $time, $channel['channel_prvkey']))
+ );
+
+ $store_path = $newfname;
+
+ $fp = fopen($newfname,'w');
+ if(! $fp) {
+ logger('failed to open storage file.',LOGGER_NORMAL,LOG_ERR);
+ continue;
+ }
+ $redirects = 0;
+ $x = z_post_url($fetch_url,$parr,$redirects,array('filep' => $fp));
+ fclose($fp);
+
+ if($x['success']) {
+ $attachment_stored = true;
+ }
+ continue;
+ }
+ }
+ }
+ if(! $attachment_stored) {
+ // @TODO should we queue this and retry or delete everything or what?
+ logger('attachment store failed',LOGGER_NORMAL,LOG_ERR);
+ }
+ if($f['photo']) {
+ foreach($f['photo'] as $p) {
+ unset($p['id']);
+ $p['aid'] = $channel['channel_account_id'];
+ $p['uid'] = $channel['channel_id'];
+
+ // if this is a profile photo, undo the profile photo bit
+ // for any other photo which previously held it.
+
+ if($p['photo_usage'] == PHOTO_PROFILE) {
+ $e = q("update photo set photo_usage = %d where photo_usage = %d
+ and resource_id != '%s' and uid = %d ",
+ intval(PHOTO_NORMAL),
+ intval(PHOTO_PROFILE),
+ dbesc($p['resource_id']),
+ intval($channel['channel_id'])
+ );
+ }
+
+ // same for cover photos
+
+ if($p['photo_usage'] == PHOTO_COVER) {
+ $e = q("update photo set photo_usage = %d where photo_usage = %d
+ and resource_id != '%s' and uid = %d ",
+ intval(PHOTO_NORMAL),
+ intval(PHOTO_COVER),
+ dbesc($p['resource_id']),
+ intval($channel['channel_id'])
+ );
+ }
+
+ if($p['scale'] === 0 && $p['os_storage'])
+ $p['data'] = $store_path;
+ else
+ $p['data'] = base64_decode($p['data']);
+
+
+ $exists = q("select * from photo where resource_id = '%s' and scale = %d and uid = %d limit 1",
+ dbesc($p['resource_id']),
+ intval($p['scale']),
+ intval($channel['channel_id'])
+ );
+
+ dbesc_array($p);
+
+ if($exists) {
+ $str = '';
+ foreach($p as $k => $v) {
+ if($str)
+ $str .= ",";
+ $str .= " `" . $k . "` = '" . $v . "' ";
+ }
+ $r = dbq("update `photo` set " . $str . " where id = " . intval($exists[0]['id']) );
+ }
+ else {
+ $r = dbq("INSERT INTO photo (`"
+ . implode("`, `", array_keys($p))
+ . "`) VALUES ('"
+ . implode("', '", array_values($p))
+ . "')" );
+ }
+ }
+ }
+ if($f['item']) {
+ sync_items($channel,$f['item']);
+ foreach($f['item'] as $i) {
+ if($i['message_id'] !== $i['message_parent'])
+ continue;
+ $r = q("select * from item where mid = '%s' and uid = %d limit 1",
+ dbesc($i['message_id']),
+ intval($channel['channel_id'])
+ );
+ if($r) {
+ $item = $r[0];
+ item_url_replace($channel,$item,$oldbase,z_root(),$original_channel);
+
+ dbesc_array($item);
+ $item_id = $item['id'];
+ unset($item['id']);
+ $str = '';
+ foreach($item as $k => $v) {
+ if($str)
+ $str .= ",";
+ $str .= " `" . $k . "` = '" . $v . "' ";
+ }
+
+ $r = dbq("update `item` set " . $str . " where id = " . $item_id );
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/include/items.php b/include/items.php
index 07cf2e0e8..95822c0ba 100755
--- a/include/items.php
+++ b/include/items.php
@@ -4118,22 +4118,26 @@ function feed_meta($xml) {
$rawauthor = $feed->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10,'author');
logger('rawauthor: ' . print_r($rawauthor,true));
- if($rawauthor && $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']) {
- $base = $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'];
- foreach($base as $link) {
- if(!x($author, 'author_photo') || ! $author['author_photo']) {
- if($link['attribs']['']['rel'] === 'photo' || $link['attribs']['']['rel'] === 'avatar') {
- $author['author_photo'] = unxmlify($link['attribs']['']['href']);
- break;
- }
- }
- }
+ if($rawauthor) {
+ if($rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']) {
+ $base = $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'];
+ foreach($base as $link) {
+ if(!x($author, 'author_photo') || ! $author['author_photo']) {
+ if($link['attribs']['']['rel'] === 'photo' || $link['attribs']['']['rel'] === 'avatar') {
+ $author['author_photo'] = unxmlify($link['attribs']['']['href']);
+ break;
+ }
+ }
+ }
+ }
if($rawauthor[0]['child'][NAMESPACE_POCO]['displayName'][0]['data'])
$author['full_name'] = unxmlify($rawauthor[0]['child'][NAMESPACE_POCO]['displayName'][0]['data']);
+ if($rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])
+ $author['author_uri'] = unxmlify($rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']);
+
}
}
-
if(substr($author['author_link'],-1,1) == '/')
$author['author_link'] = substr($author['author_link'],0,-1);
diff --git a/include/nav.php b/include/nav.php
index 3f5c7963a..541ab3aed 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -92,7 +92,7 @@ EOT;
$nav['usermenu'][] = Array('photos/' . $channel['channel_address'], t('Photos'), "", t('Your photos'),'photos_nav_btn');
$nav['usermenu'][] = Array('cloud/' . $channel['channel_address'],t('Files'),"",t('Your files'),'cloud_nav_btn');
- if(! UNO)
+ if((! UNO) && feature_enabled(local_channel(),'ajaxchat'))
$nav['usermenu'][] = Array('chat/' . $channel['channel_address'], t('Chat'),"",t('Your chatrooms'),'chat_nav_btn');
@@ -149,9 +149,11 @@ EOT;
$help_url = z_root() . '/help?f=&cmd=' . App::$cmd;
- if(! get_config('system','hide_help'))
- $nav['help'] = array($help_url, t('Help'), "", t('Help and documentation'),'help_nav_btn');
-
+ if(! get_config('system','hide_help')) {
+ require_once('mod/help.php');
+ $context_help = load_context_help();
+ $nav['help'] = array($help_url, t('Help'), "", t('Help and documentation'),'help_nav_btn',$context_help);
+ }
if(! UNO)
$nav['apps'] = array('apps', t('Apps'), "", t('Applications, utilities, links, games'),'apps_nav_btn');
@@ -256,7 +258,6 @@ $powered_by = '';
*
*/
function nav_set_selected($item){
- $a = get_app();
App::$nav_sel = array(
'community' => null,
'network' => null,
diff --git a/include/network.php b/include/network.php
index ac14548a5..ec255581d 100644
--- a/include/network.php
+++ b/include/network.php
@@ -27,11 +27,12 @@ function get_capath() {
* * \b http_auth => username:password
* * \b novalidate => do not validate SSL certs, default is to validate using our CA list
* * \b nobody => only return the header
+ * * \b filep => stream resource to write body to. header and body are not returned when using this option.
*
* @return array an assoziative array with:
* * \e int \b return_code => HTTP return code or 0 if timeout or failure
* * \e boolean \b success => boolean true (if HTTP 2xx result) or false
- * * \e string \b header => HTTP headers
+ * * \e string \b header => HTTP headers
* * \e string \b body => fetched content
*/
function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
@@ -53,6 +54,11 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
if($ciphers)
@curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, $ciphers);
+ if(x($opts,'filep')) {
+ @curl_setopt($ch, CURLOPT_FILE, $opts['filep']);
+ @curl_setopt($ch, CURLOPT_HEADER, $false);
+ }
+
if(x($opts,'headers'))
@curl_setopt($ch, CURLOPT_HTTPHEADER, $opts['headers']);
@@ -158,6 +164,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
* 'timeout' => int seconds, default system config value or 60 seconds
* 'http_auth' => username:password
* 'novalidate' => do not validate SSL certs, default is to validate using our CA list
+ * 'filep' => stream resource to write body to. header and body are not returned when using this option.
* @return array an assoziative array with:
* * \e int \b return_code => HTTP return code or 0 if timeout or failure
* * \e boolean \b success => boolean true (if HTTP 2xx result) or false
@@ -185,6 +192,11 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) {
if($ciphers)
@curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, $ciphers);
+ if(x($opts,'filep')) {
+ @curl_setopt($ch, CURLOPT_FILE, $opts['filep']);
+ @curl_setopt($ch, CURLOPT_HEADER, $false);
+ }
+
if(x($opts,'headers')) {
@curl_setopt($ch, CURLOPT_HTTPHEADER, $opts['headers']);
logger('headers: ' . print_r($opts['headers'],true) . 'redir: ' . $redirects);
@@ -1089,7 +1101,7 @@ function discover_by_webbie($webbie) {
// If we discover zot - don't search further; grab the info and get out of
// here.
- if($link['rel'] == 'http://purl.org/zot/protocol') {
+ if($link['rel'] === PROTOCOL_ZOT) {
logger('discover_by_webbie: zot found for ' . $webbie, LOGGER_DEBUG);
if(array_key_exists('zot',$x) && $x['zot']['success'])
$i = import_xchan($x['zot']);
@@ -1265,6 +1277,12 @@ function discover_by_webbie($webbie) {
if($feed_meta['author']['author_photo'])
$avatar = $feed_meta['author']['author_photo'];
}
+
+ // for GNU-social over-ride any url aliases we may have picked up in webfinger
+ // The author.uri element in the feed is likely to be more accurate
+
+ if($gnusoc && $feed_meta['author']['author_uri'])
+ $location = $feed_meta['author']['author_uri'];
}
}
else {
diff --git a/include/photos.php b/include/photos.php
index 5838c013f..943d7d503 100644
--- a/include/photos.php
+++ b/include/photos.php
@@ -194,7 +194,7 @@ function photo_upload($channel, $observer, $args) {
$link[0] = array(
'rel' => 'alternate',
'type' => 'text/html',
- 'href' => $url = rawurlencode(z_root() . '/photo/' . $photo_hash . '-0.' . $ph->getExt()),
+ 'href' => z_root() . '/photo/' . $photo_hash . '-0.' . $ph->getExt(),
'width' => $ph->getWidth(),
'height' => $ph->getHeight()
);
@@ -212,7 +212,7 @@ function photo_upload($channel, $observer, $args) {
$link[1] = array(
'rel' => 'alternate',
'type' => 'text/html',
- 'href' => $url = rawurlencode(z_root() . '/photo/' . $photo_hash . '-1.' . $ph->getExt()),
+ 'href' => z_root() . '/photo/' . $photo_hash . '-1.' . $ph->getExt(),
'width' => $ph->getWidth(),
'height' => $ph->getHeight()
);
@@ -227,7 +227,7 @@ function photo_upload($channel, $observer, $args) {
$link[2] = array(
'rel' => 'alternate',
'type' => 'text/html',
- 'href' => $url = rawurlencode(z_root() . '/photo/' . $photo_hash . '-2.' . $ph->getExt()),
+ 'href' => z_root() . '/photo/' . $photo_hash . '-2.' . $ph->getExt(),
'width' => $ph->getWidth(),
'height' => $ph->getHeight()
);
@@ -242,7 +242,7 @@ function photo_upload($channel, $observer, $args) {
$link[3] = array(
'rel' => 'alternate',
'type' => 'text/html',
- 'href' => $url = rawurlencode(z_root() . '/photo/' . $photo_hash . '-3.' . $ph->getExt()),
+ 'href' => z_root() . '/photo/' . $photo_hash . '-3.' . $ph->getExt(),
'width' => $ph->getWidth(),
'height' => $ph->getHeight()
);
@@ -312,7 +312,7 @@ function photo_upload($channel, $observer, $args) {
'title' => $title,
'created' => $p['created'],
'edited' => $p['edited'],
- 'id' => rawurlencode(z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo_hash),
+ 'id' => z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo_hash,
'link' => $link,
'body' => $obj_body
);
@@ -320,7 +320,7 @@ function photo_upload($channel, $observer, $args) {
$target = array(
'type' => ACTIVITY_OBJ_ALBUM,
'title' => (($album) ? $album : '/'),
- 'id' => rawurlencode(z_root() . '/photos/' . $channel['channel_address'] . '/album/' . bin2hex($album))
+ 'id' => z_root() . '/photos/' . $channel['channel_address'] . '/album/' . bin2hex($album)
);
// Create item container
diff --git a/include/reddav.php b/include/reddav.php
index a0bd1b1fc..abf21b86d 100644
--- a/include/reddav.php
+++ b/include/reddav.php
@@ -23,9 +23,6 @@ use Zotlabs\Storage;
require_once('vendor/autoload.php');
require_once('include/attach.php');
-//require_once('Zotlabs/Storage/File.php');
-//require_once('Zotlabs/Storage/Directory.php');
-//require_once('Zotlabs/Storage/BasicAuth.php');
/**
* @brief Returns an array with viewable channels.
diff --git a/include/session.php b/include/session.php
index 71bfdc12a..4a7c8052e 100644
--- a/include/session.php
+++ b/include/session.php
@@ -45,12 +45,13 @@ function nuke_session() {
function new_cookie($time) {
+
$old_sid = session_id();
// ??? This shouldn't have any effect if called after session_start()
// We probably need to set the session expiration and change the PHPSESSID cookie.
+ // session_set_cookie_params($time);
- session_set_cookie_params($time);
session_regenerate_id(false);
q("UPDATE session SET sid = '%s' WHERE sid = '%s'",
@@ -66,6 +67,7 @@ function new_cookie($time) {
}
setcookie('jsAvailable', $_COOKIE['jsAvailable'], $expires);
}
+ setcookie(session_name(),session_id(),$expires);
}
diff --git a/include/text.php b/include/text.php
index a1a1cfb1c..0a7f84b01 100644
--- a/include/text.php
+++ b/include/text.php
@@ -2730,22 +2730,37 @@ function json_url_replace($old,$new,&$s) {
}
-function item_url_replace($channel,&$item,$old,$new) {
+function item_url_replace($channel,&$item,$old,$new,$oldnick = '') {
- if($item['attach'])
+ if($item['attach']) {
json_url_replace($old,$new,$item['attach']);
- if($item['object'])
+ if($oldnick)
+ json_url_replace('/' . $oldnick . '/' ,'/' . $channel['channel_address'] . '/' ,$item['attach']);
+ }
+ if($item['object']) {
json_url_replace($old,$new,$item['object']);
- if($item['target'])
+ if($oldnick)
+ json_url_replace('/' . $oldnick . '/' ,'/' . $channel['channel_address'] . '/' ,$item['object']);
+ }
+ if($item['target']) {
json_url_replace($old,$new,$item['target']);
+ if($oldnick)
+ json_url_replace('/' . $oldnick . '/' ,'/' . $channel['channel_address'] . '/' ,$item['target']);
+ }
if(string_replace($old,$new,$item['body'])) {
$item['sig'] = base64url_encode(rsa_sign($item['body'],$channel['channel_prvkey']));
$item['item_verified'] = 1;
}
- // @fixme item['plink'] and item['llink']
+ $item['plink'] = str_replace($old,$new,$item['plink']);
+ if($oldnick)
+ $item['plink'] = str_replace('/' . $oldnick . '/' ,'/' . $channel['channel_address'] . '/' ,$item['plink']);
+ $item['llink'] = str_replace($old,$new,$item['llink']);
+ if($oldnick)
+ $item['llink'] = str_replace('/' . $oldnick . '/' ,'/' . $channel['channel_address'] . '/' ,$item['llink']);
+
}
diff --git a/include/widgets.php b/include/widgets.php
index 0116e5bd1..0355ebd8c 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -785,6 +785,7 @@ function widget_menu_preview($arr) {
function widget_chatroom_list($arr) {
+
require_once("include/chat.php");
$r = chatroom_list(App::$profile['profile_uid']);
@@ -808,6 +809,10 @@ function widget_chatroom_members() {
}
function widget_bookmarkedchats($arr) {
+
+ if(! feature_enabled(App::$profile['profile_uid'],'ajaxchat'))
+ return '';
+
$h = get_observer_hash();
if(! $h)
return;
@@ -827,6 +832,9 @@ function widget_bookmarkedchats($arr) {
function widget_suggestedchats($arr) {
+ if(! feature_enabled(App::$profile['profile_uid'],'ajaxchat'))
+ return '';
+
// probably should restrict this to your friends, but then the widget will only work
// if you are logged in locally.
diff --git a/include/zot.php b/include/zot.php
index fa3563085..a5ab56154 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -3138,6 +3138,9 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
if(array_key_exists('menu',$arr) && $arr['menu'])
sync_menus($channel,$arr['menu']);
+ if(array_key_exists('file',$arr) && $arr['file'])
+ sync_files($channel,$arr['file']);
+
if(array_key_exists('channel',$arr) && is_array($arr['channel']) && count($arr['channel'])) {
if(array_key_exists('channel_pageflags',$arr['channel']) && intval($arr['channel']['channel_pageflags'])) {