aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authormrjive <mrjive@mrjive.it>2015-11-11 16:51:48 +0100
committermrjive <mrjive@mrjive.it>2015-11-11 16:51:48 +0100
commit53a796afcc0cff6f9e3f51457df4506a43db1945 (patch)
treea2366c48e0dae047b052283cc44284224369c8cd /mod
parenta4c3058f845a1c38d06b2201a10700c5f878366d (diff)
parentbc7c0ed844711e81c4bc642e3024849195a48421 (diff)
downloadvolse-hubzilla-53a796afcc0cff6f9e3f51457df4506a43db1945.tar.gz
volse-hubzilla-53a796afcc0cff6f9e3f51457df4506a43db1945.tar.bz2
volse-hubzilla-53a796afcc0cff6f9e3f51457df4506a43db1945.zip
Merge pull request #8 from redmatrix/master
get fresh code from HZ base
Diffstat (limited to 'mod')
-rw-r--r--mod/admin.php29
-rw-r--r--mod/attach.php5
-rw-r--r--mod/connedit.php50
-rw-r--r--mod/editpost.php1
-rw-r--r--mod/ffsapi.php65
-rw-r--r--mod/fhublocs.php80
-rw-r--r--mod/import.php16
-rw-r--r--mod/item.php5
-rw-r--r--mod/locs.php12
-rw-r--r--mod/mail.php2
-rw-r--r--mod/post.php81
-rw-r--r--mod/pubsites.php5
-rw-r--r--mod/rbmark.php4
-rw-r--r--mod/settings.php8
-rw-r--r--mod/share.php12
-rwxr-xr-xmod/subthread.php109
16 files changed, 330 insertions, 154 deletions
diff --git a/mod/admin.php b/mod/admin.php
index aaf00b14f..a884b7658 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -237,7 +237,7 @@ function admin_page_site_post(&$a){
$register_text = ((x($_POST,'register_text')) ? notags(trim($_POST['register_text'])) : '');
$frontpage = ((x($_POST,'frontpage')) ? notags(trim($_POST['frontpage'])) : '');
$mirror_frontpage = ((x($_POST,'mirror_frontpage')) ? intval(trim($_POST['mirror_frontpage'])) : 0);
-
+ $directory_server = ((x($_POST,'directory_server')) ? trim($_POST['directory_server']) : '');
$allowed_sites = ((x($_POST,'allowed_sites')) ? notags(trim($_POST['allowed_sites'])) : '');
$allowed_email = ((x($_POST,'allowed_email')) ? notags(trim($_POST['allowed_email'])) : '');
$not_allowed_email = ((x($_POST,'not_allowed_email')) ? notags(trim($_POST['not_allowed_email'])) : '');
@@ -272,6 +272,9 @@ function admin_page_site_post(&$a){
set_config('system', 'verify_email', $verify_email);
set_config('system', 'default_expire_days', $default_expire_days);
+ if($directory_server)
+ set_config('system','directory_server',$directory_server);
+
if ($banner == '') {
del_config('system', 'banner');
} else {
@@ -371,6 +374,26 @@ function admin_page_site(&$a) {
}
}
+ $dir_choices = null;
+ $dirmode = get_config('system','directory_mode');
+ $realm = get_directory_realm();
+
+ // directory server should not be set or settable unless we are a directory client
+
+ if($dirmode == DIRECTORY_MODE_NORMAL) {
+ $x = q("select site_url from site where site_flags in (%d,%d) and site_realm = '%s'",
+ intval(DIRECTORY_MODE_SECONDARY),
+ intval(DIRECTORY_MODE_PRIMARY),
+ dbesc($realm)
+ );
+ if($x) {
+ $dir_choices = array();
+ foreach($x as $xx) {
+ $dir_choices[$xx['site_url']] = $xx['site_url'];
+ }
+ }
+ }
+
/* Banner */
$banner = get_config('system', 'banner');
if($banner == false)
@@ -440,6 +463,8 @@ function admin_page_site(&$a) {
'$disable_discover_tab' => array('disable_discover_tab', t("Disable discovery tab"), get_config('system','disable_discover_tab'), t("Remove the tab in the network view with public content pulled from sources chosen for this site.")),
'$login_on_homepage' => array('login_on_homepage', t("login on Homepage"),((intval($homelogin) || $homelogin === false) ? 1 : '') , t("Present a login box to visitors on the home page if no other content has been configured.")),
+ '$directory_server' => (($dir_choices) ? array('directory_server', t("Directory Server URL"), get_config('system','directory_server'), t("Default directory server"), $dir_choices) : null),
+
'$proxyuser' => array('proxyuser', t("Proxy user"), get_config('system','proxyuser'), ""),
'$proxy' => array('proxy', t("Proxy URL"), get_config('system','proxy'), ""),
'$timeout' => array('timeout', t("Network timeout"), (x(get_config('system','curl_timeout'))?get_config('system','curl_timeout'):60), t("Value is in seconds. Set to 0 for unlimited (not recommended).")),
@@ -557,7 +582,7 @@ function admin_page_dbsync(&$a) {
}
}
if(! count($failed))
- return '<h3>' . t('No failed updates.') . '</h3>';
+ return '<div class="generic-content-wrapper-styled"><h3>' . t('No failed updates.') . '</h3></div>';
$o = replace_macros(get_markup_template('failed_updates.tpl'),array(
'$base' => $a->get_baseurl(true),
diff --git a/mod/attach.php b/mod/attach.php
index ad5dead07..306e39519 100644
--- a/mod/attach.php
+++ b/mod/attach.php
@@ -37,7 +37,10 @@ function attach_init(&$a) {
header('Content-disposition: attachment; filename="' . $r['data']['filename'] . '"');
if(intval($r['data']['os_storage'])) {
$fname = dbunescbin($r['data']['data']);
- $istream = fopen('store/' . $c[0]['channel_address'] . '/' . $fname,'rb');
+ if(strpos($fname,'store') !== false)
+ $istream = fopen($fname,'rb');
+ else
+ $istream = fopen('store/' . $c[0]['channel_address'] . '/' . $fname,'rb');
$ostream = fopen('php://output','wb');
if($istream && $ostream) {
pipe_streams($istream,$ostream);
diff --git a/mod/connedit.php b/mod/connedit.php
index 65eba885a..9c46fa999 100644
--- a/mod/connedit.php
+++ b/mod/connedit.php
@@ -177,16 +177,21 @@ function connedit_post(&$a) {
if(($_REQUEST['pending']) && intval($orig_record[0]['abook_pending'])) {
$new_friend = true;
- if(! $abook_my_perms) {
- $abook_my_perms = get_channel_default_perms(local_channel());
+ // @fixme it won't be common, but when you accept a new connection request
+ // the permissions will now be that of your permissions role and ignore
+ // any you may have set manually on the form. We'll probably see a bug if somebody
+ // tries to set the permissions *and* approve the connection in the same
+ // request. The workaround is to approve the connection, then go back and
+ // adjust permissions as desired.
- $role = get_pconfig(local_channel(),'system','permissions_role');
- if($role) {
- $x = get_role_perms($role);
- if($x['perms_accept'])
- $abook_my_perms = $x['perms_accept'];
- }
+ $abook_my_perms = get_channel_default_perms(local_channel());
+
+ $role = get_pconfig(local_channel(),'system','permissions_role');
+ if($role) {
+ $x = get_role_perms($role);
+ if($x['perms_accept'])
+ $abook_my_perms = $x['perms_accept'];
}
}
@@ -652,12 +657,35 @@ function connedit_content(&$a) {
$perms[] = array('perms_' . $k, $v[3], (($contact['abook_their_perms'] & $v[1]) ? "1" : ""),$thisperm, $v[1], (($channel[$v[0]] == PERMS_SPECIFIC) ? '' : '1'), $v[4], $checkinherited);
}
+ $locstr = '';
+
+ $locs = q("select hubloc_addr as location from hubloc left join site on hubloc_url = site_url where hubloc_hash = '%s'
+ and hubloc_deleted = 0 and site_dead = 0",
+ dbesc($contact['xchan_hash'])
+ );
+
+ if($locs) {
+ foreach($locs as $l) {
+ if(!($l['location']))
+ continue;
+ if(strpos($locstr,$l['location']) !== false)
+ continue;
+ if(strlen($locstr))
+ $locstr .= ', ';
+ $locstr .= $l['location'];
+ }
+ }
+ else
+ $locstr = t('none');
+
$o .= replace_macros($tpl,array(
'$header' => (($self) ? t('Connection Default Permissions') : sprintf( t('Connection: %s'),$contact['xchan_name'])),
'$autoperms' => array('autoperms',t('Apply these permissions automatically'), ((get_pconfig(local_channel(),'system','autoperms')) ? 1 : 0), 'Connection requests will be approved without your interaction', array(t('No'),('Yes'))),
'$addr' => $contact['xchan_addr'],
- '$addr_text' => t('This connection\'s address is'),
+ '$addr_text' => t('This connection\'s primary address is'),
+ '$loc_text' => t('Available locations:'),
+ '$locstr' => $locstr,
'$notself' => (($self) ? '' : '1'),
'$self' => (($self) ? '1' : ''),
'$autolbl' => t('The permissions indicated on this page will be applied to all new connections.'),
@@ -668,8 +696,8 @@ function connedit_content(&$a) {
'$lbl_rating_txt' => t('Optionally explain your rating'),
'$connfilter' => feature_enabled(local_channel(),'connfilter'),
'$connfilter_label' => t('Custom Filter'),
- '$incl' => array('abook_incl',t('Only import posts with this text'), $contact['abook_incl'],t('words one per line or #tags or /patterns/, leave blank to import all posts')),
- '$excl' => array('abook_excl',t('Do not import posts with this text'), $contact['abook_excl'],t('words one per line or #tags or /patterns/, leave blank to import all posts')),
+ '$incl' => array('abook_incl',t('Only import posts with this text'), $contact['abook_incl'],t('words one per line or #tags or /patterns/ or lang=xx, leave blank to import all posts')),
+ '$excl' => array('abook_excl',t('Do not import posts with this text'), $contact['abook_excl'],t('words one per line or #tags or /patterns/ or lang=xx, leave blank to import all posts')),
'$rating_text' => array('rating_text', t('Optionally explain your rating'),$rating_text,''),
'$rating_info' => t('This information is public!'),
'$rating' => $rating,
diff --git a/mod/editpost.php b/mod/editpost.php
index 1bee16ee7..2f999858f 100644
--- a/mod/editpost.php
+++ b/mod/editpost.php
@@ -90,7 +90,6 @@ function editpost_content(&$a) {
$category .= ', ';
$category .= $cat['term'];
}
-
}
if($itm[0]['attach']) {
diff --git a/mod/ffsapi.php b/mod/ffsapi.php
new file mode 100644
index 000000000..1f68a87ba
--- /dev/null
+++ b/mod/ffsapi.php
@@ -0,0 +1,65 @@
+<?php
+
+
+function ffsapi_content(&$a) {
+
+$baseurl = z_root();
+$name = get_config('system','sitename');
+$description = t('Share content from Firefox to $Projectname');
+$author = 'Mike Macgirvin';
+$homepage = 'http://hubzilla.org';
+$activate = t('Activate the Firefox $Projectname provider');
+
+$s = <<< EOT
+
+<script>
+
+var baseurl = '$baseurl';
+
+var data = {
+ "origin": baseurl,
+ // currently required
+ "name": '$name',
+ "iconURL": baseurl+"/images/hz-16.png",
+ "icon32URL": baseurl+"/images/hz-32.png",
+ "icon64URL": baseurl+"/images/hz-64.png",
+
+ // at least one of these must be defined
+ // "workerURL": baseurl+"/worker.js",
+ // "sidebarURL": baseurl+"/sidebar.htm",
+ "shareURL": baseurl+"/rpost?f=&url=%{url}",
+
+ // status buttons are scheduled for Firefox 26 or 27
+ //"statusURL": baseurl+"/statusPanel.html",
+
+ // social bookmarks are available in Firefox 26
+ "markURL": baseurl+"/rbmark?f=&url=%{url}&title=%{title}",
+ // icons should be 32x32 pixels
+ // "markedIcon": baseurl+"/images/checkbox-checked-32.png",
+ // "unmarkedIcon": baseurl+"/images/checkbox-unchecked-32.png",
+ "unmarkedIcon": baseurl+"/images/hz-bookmark-32.png",
+
+ // should be available for display purposes
+ "description": "$description",
+ "author": "$author",
+ "homepageURL": "$homepage",
+
+ // optional
+ "version": "1.0"
+}
+
+function activate(node) {
+ var event = new CustomEvent("ActivateSocialFeature");
+ var jdata = JSON.stringify(data);
+ node.setAttribute("data-service", JSON.stringify(data));
+ node.dispatchEvent(event);
+}
+</script>
+
+<button onclick="activate(this)" title="$activate" class="btn btn-primary">$activate</button>
+
+EOT;
+
+return $s;
+
+}
diff --git a/mod/fhublocs.php b/mod/fhublocs.php
new file mode 100644
index 000000000..dce00e383
--- /dev/null
+++ b/mod/fhublocs.php
@@ -0,0 +1,80 @@
+<?php
+
+require_once('include/zot.php');
+require_once('include/crypto.php');
+
+/* fix missing or damaged hublocs */
+
+function fhublocs_content(&$a) {
+
+ if(! is_site_admin())
+ return;
+
+ $o = '';
+
+ $r = q("select * from channel where channel_removed = 0");
+ $sitekey = get_config('system','pubkey');
+
+ if($r) {
+ foreach($r as $rr) {
+ $found = false;
+ $primary_address = '';
+ $x = zot_get_hublocs($rr['channel_hash']);
+ if($x) {
+ foreach($x as $xx) {
+ if($xx['hubloc_url'] === z_root() && $xx['hubloc_sitekey'] === $sitekey) {
+ $found = true;
+ break;
+ }
+ }
+ if($found) {
+ $o .= 'Hubloc exists for ' . $rr['channel_name'] . EOL;
+ continue;
+ }
+ }
+ $y = q("select xchan_addr from xchan where xchan_hash = '%s' limit 1",
+ dbesc($rr['channel_hash'])
+ );
+ if($y)
+ $primary_address = $y[0]['xchan_addr'];
+
+ $hub_address = $rr['channel']['channel_address'] . '@' . get_app()->get_hostname();
+
+
+ $primary = (($hub_address === $primary_address) ? 1 : 0);
+ if(! $y)
+ $primary = 1;
+
+ $m = q("delete from hubloc where hubloc_hash = '%s' and hubloc_url = '%s' ",
+ dbesc($rr['channel_hash']),
+ dbesc(z_root())
+ );
+
+ // Create a verified hub location pointing to this site.
+
+ $h = q("insert into hubloc ( hubloc_guid, hubloc_guid_sig, hubloc_hash, hubloc_addr, hubloc_primary, hubloc_url, hubloc_url_sig, hubloc_host, hubloc_callback, hubloc_sitekey, hubloc_network )
+ values ( '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s' )",
+ dbesc($rr['channel_guid']),
+ dbesc($rr['channel_guid_sig']),
+ dbesc($rr['channel_hash']),
+ dbesc($rr['channel_address'] . '@' . get_app()->get_hostname()),
+ intval($primary),
+ dbesc(z_root()),
+ dbesc(base64url_encode(rsa_sign(z_root(),$rr['channel_prvkey']))),
+ dbesc(get_app()->get_hostname()),
+ dbesc(z_root() . '/post'),
+ dbesc($sitekey),
+ dbesc('zot')
+ );
+
+ if($h)
+ $o . 'local hubloc created for ' . $rr['channel_name'] . EOL;
+ else
+ $o .= 'DB update failed for ' . $rr['channel_name'] . EOL;
+
+ }
+
+ return $o;
+
+ }
+} \ No newline at end of file
diff --git a/mod/import.php b/mod/import.php
index 72d8f92e9..a33cf339b 100644
--- a/mod/import.php
+++ b/mod/import.php
@@ -9,11 +9,12 @@ require_once('include/identity.php');
require_once('include/import.php');
-function import_post(&$a) {
+function import_account(&$a, $account_id) {
- $account_id = get_account_id();
- if(! $account_id)
+ if(! $account_id){
+ logger("import_account: No account ID supplied");
return;
+ }
$max_identities = account_service_class_fetch($account_id,'total_identities');
$max_friends = account_service_class_fetch($account_id,'total_channels');
@@ -493,6 +494,15 @@ function import_post(&$a) {
}
+function import_post(&$a) {
+
+ $account_id = get_account_id();
+ if(! $account_id)
+ return;
+
+ import_account($a, $account_id);
+}
+
function import_content(&$a) {
if(! get_account_id()) {
diff --git a/mod/item.php b/mod/item.php
index 4dcf8edd7..5f45a248b 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -474,6 +474,7 @@ function item_post(&$a) {
if($uid && $uid == $profile_uid && feature_enabled($uid,'markdown')) {
require_once('include/bb2diaspora.php');
$body = escape_tags($body);
+ $body = str_replace("\n",'<br />', $body);
$body = preg_replace_callback('/\[share(.*?)\]/ism','share_shield',$body);
$body = diaspora2bb($body,true);
$body = preg_replace_callback('/\[share(.*?)\]/ism','share_unshield',$body);
@@ -607,6 +608,7 @@ function item_post(&$a) {
if(preg_match_all('/(\[attachment\](.*?)\[\/attachment\])/',$body,$match)) {
$attachments = array();
+ $i = 0;
foreach($match[2] as $mtch) {
$attach_link = '';
$hash = substr($mtch,0,strpos($mtch,','));
@@ -626,7 +628,8 @@ function item_post(&$a) {
$attach_link = '[audio]' . z_root() . '/attach/' . $r['data']['hash'] . '/' . $r['data']['revision'] . (($ext) ? $ext : '') . '[/audio]';
elseif(strpos($r['data']['filetype'],'video/') !== false)
$attach_link = '[video]' . z_root() . '/attach/' . $r['data']['hash'] . '/' . $r['data']['revision'] . (($ext) ? $ext : '') . '[/video]';
- $body = str_replace($match[1],$attach_link,$body);
+ $body = str_replace($match[1][$i],$attach_link,$body);
+ $i++;
}
}
diff --git a/mod/locs.php b/mod/locs.php
index 3c6a5da67..9f66e3263 100644
--- a/mod/locs.php
+++ b/mod/locs.php
@@ -35,6 +35,7 @@ function locs_post(&$a) {
}
}
+
if($_REQUEST['drop']) {
$hubloc_id = intval($_REQUEST['drop']);
@@ -85,6 +86,13 @@ function locs_content(&$a) {
$channel = $a->get_channel();
+ if($_REQUEST['sync']) {
+ proc_run('php','include/notifier.php','location',$channel['channel_id']);
+ info( t('Syncing locations') . EOL);
+ goaway(z_root() . '/locs');
+ }
+
+
$r = q("select * from hubloc where hubloc_hash = '%s'",
dbesc($channel['channel_hash'])
);
@@ -106,6 +114,10 @@ function locs_content(&$a) {
'$mkprm' => t('Primary Location'),
'$drop' => t('Drop location'),
'$submit' => t('Submit'),
+ '$sync' => t('Sync now'),
+ '$sync_text' => t('Please wait several minutes between consecutive operations.'),
+ '$drop_text' => t('When possible, drop a location by logging into that website/hub and removing your channel.'),
+ '$last_resort' => t('Use this form to drop the location if the hub is no longer operating.'),
'$hubs' => $r
));
diff --git a/mod/mail.php b/mod/mail.php
index 884c41565..536149a28 100644
--- a/mod/mail.php
+++ b/mod/mail.php
@@ -335,7 +335,7 @@ function mail_content(&$a) {
'recall' => t('Recall message'),
'can_recall' => (($channel['channel_hash'] == $message['from_xchan']) ? true : false),
'is_recalled' => (intval($message['mail_recalled']) ? t('Message has been recalled.') : ''),
- 'date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'],'D, d M Y - g:i A'),
+ 'date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'], 'c'),
);
$seen = $message['seen'];
diff --git a/mod/post.php b/mod/post.php
index 00e599b49..4c52de44a 100644
--- a/mod/post.php
+++ b/mod/post.php
@@ -663,16 +663,16 @@ function post_post(&$a) {
/* Check if the sender is already verified here */
- $hub = zot_gethub($sender);
+ $hubs = zot_gethub($sender,true);
- if (! $hub) {
+ if (! $hubs) {
/* Have never seen this guid or this guid coming from this location. Check it and register it. */
// (!!) this will validate the sender
$result = zot_register_hub($sender);
- if ((! $result['success']) || (! ($hub = zot_gethub($sender)))) {
+ if ((! $result['success']) || (! ($hubs = zot_gethub($sender,true)))) {
$ret['message'] = 'Hub not available.';
logger('mod_zot: no hub');
json_return_and_die($ret);
@@ -680,41 +680,62 @@ function post_post(&$a) {
}
- // Update our DB to show when we last communicated successfully with this hub
- // This will allow us to prune dead hubs from using up resources
+ foreach($hubs as $hub) {
- $r = q("update hubloc set hubloc_connected = '%s' where hubloc_id = %d",
- dbesc(datetime_convert()),
- intval($hub['hubloc_id'])
- );
+ $sitekey = $hub['hubloc_sitekey'];
- // a dead hub came back to life - reset any tombstones we might have
+ if(array_key_exists('sitekey',$sender) && $sender['sitekey']) {
- if(intval($hub['hubloc_error'])) {
- q("update hubloc set hubloc_error = 0 where hubloc_id = %d",
- intval($hub['hubloc_id'])
- );
- if(intval($r[0]['hubloc_orphancheck'])) {
- q("update hubloc set hubloc_orhpancheck = 0 where hubloc_id = %d",
- intval($hub['hubloc_id'])
+ /*
+ * This hub has now been proven to be valid.
+ * Any hub with the same URL and a different sitekey cannot be valid.
+ * Get rid of them (mark them deleted). There's a good chance they were re-installs.
+ */
+
+ q("update hubloc set hubloc_deleted = 1, hubloc_error = 1 where hubloc_url = '%s' and hubloc_sitekey != '%s' ",
+ dbesc($hub['hubloc_url']),
+ dbesc($sender['sitekey'])
);
+
+ $sitekey = $sender['sitekey'];
}
- q("update xchan set xchan_orphan = 0 where xchan_orphan = 1 and xchan_hash = '%s'",
- dbesc($hub['hubloc_hash'])
+
+ // $sender['sitekey'] is a new addition to the protcol to distinguish
+ // hublocs coming from re-installed sites. Older sites will not provide
+ // this field and we have to still mark them valid, since we can't tell
+ // if this hubloc has the same sitekey as the packet we received.
+
+
+ // Update our DB to show when we last communicated successfully with this hub
+ // This will allow us to prune dead hubs from using up resources
+
+ $r = q("update hubloc set hubloc_connected = '%s' where hubloc_id = %d and hubloc_sitekey = '%s' ",
+ dbesc(datetime_convert()),
+ intval($hub['hubloc_id']),
+ dbesc($sitekey)
);
- }
+ // a dead hub came back to life - reset any tombstones we might have
- /*
- * This hub has now been proven to be valid.
- * Any hub with the same URL and a different sitekey cannot be valid.
- * Get rid of them (mark them deleted). There's a good chance they were re-installs.
- */
+ if(intval($hub['hubloc_error'])) {
+ q("update hubloc set hubloc_error = 0 where hubloc_id = %d and hubloc_sitekey = '%s' ",
+ intval($hub['hubloc_id']),
+ dbesc($sitekey)
+ );
+ if(intval($r[0]['hubloc_orphancheck'])) {
+ q("update hubloc set hubloc_orhpancheck = 0 where hubloc_id = %d and hubloc_sitekey = '%s' ",
+ intval($hub['hubloc_id']),
+ dbesc($sitekey)
+ );
+ }
+ q("update xchan set xchan_orphan = 0 where xchan_orphan = 1 and xchan_hash = '%s'",
+ dbesc($hub['hubloc_hash'])
+ );
+ }
+
+ $connecting_url = $hub['hubloc_url'];
+ }
- q("update hubloc set hubloc_deleted = 1 where hubloc_url = '%s' and hubloc_sitekey != '%s' ",
- dbesc($hub['hubloc_url']),
- dbesc($hub['hubloc_sitekey'])
- );
/** @TODO check which hub is primary and take action if mismatched */
@@ -917,7 +938,7 @@ function post_post(&$a) {
if ($msgtype === 'notify') {
- logger('notify received from ' . $hub['hubloc_url']);
+ logger('notify received from ' . $connecting_url);
$async = get_config('system','queued_fetch');
diff --git a/mod/pubsites.php b/mod/pubsites.php
index 726c681fa..ae8601366 100644
--- a/mod/pubsites.php
+++ b/mod/pubsites.php
@@ -13,6 +13,8 @@ function pubsites_content(&$a) {
}
$url .= '/sites';
+ $o .= '<div class="generic-content-wrapper-styled">';
+
$o .= '<h1>' . t('Public Sites') . '</h1>';
$o .= '<div class="descriptive-text">' .
@@ -33,6 +35,9 @@ function pubsites_content(&$a) {
}
$o .= '</table>';
+
+ $o .= '</div>';
+
}
}
return $o;
diff --git a/mod/rbmark.php b/mod/rbmark.php
index cbd32098b..4401e3626 100644
--- a/mod/rbmark.php
+++ b/mod/rbmark.php
@@ -77,7 +77,9 @@ function rbmark_content(&$a) {
$channel = $a->get_channel();
- $m = menu_list($channel,'',MENU_BOOKMARK);
+
+ $m = menu_list($channel['channel_id'],'',MENU_BOOKMARK);
+
$menus = array();
if($m) {
$menus = array(0 => '');
diff --git a/mod/settings.php b/mod/settings.php
index 8bfff3765..9a18d8e48 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -218,7 +218,8 @@ function settings_post(&$a) {
check_form_security_token_redirectOnErr('/settings/account', 'settings_account');
- call_hooks('settings_account', $_POST);
+ call_hooks('account_settings_post', $_POST);
+// call_hooks('settings_account', $_POST);
$errs = array();
@@ -1102,12 +1103,13 @@ function settings_content(&$a) {
'$expert' => feature_enabled(local_channel(),'expert'),
'$hint' => t('Please enable expert mode (in <a href="settings/features">Settings > Additional features</a>) to adjust!'),
'$lbl_misc' => t('Miscellaneous Settings'),
- '$photo_path' => array('photo_path', t('Default photo upload folder'), get_pconfig(local_channel(),'system','photo_path'), '%Y - current year, %m - current month'),
- '$attach_path' => array('attach_path', t('Default file upload folder'), get_pconfig(local_channel(),'system','attach_path'), '%Y - current year, %m - current month'),
+ '$photo_path' => array('photo_path', t('Default photo upload folder'), get_pconfig(local_channel(),'system','photo_path'), t('%Y - current year, %m - current month')),
+ '$attach_path' => array('attach_path', t('Default file upload folder'), get_pconfig(local_channel(),'system','attach_path'), t('%Y - current year, %m - current month')),
'$menus' => $menu,
'$menu_desc' => t('Personal menu to display in your channel pages'),
'$removeme' => t('Remove Channel'),
'$removechannel' => t('Remove this channel.'),
+ '$firefoxshare' => t('Firefox Share $Projectname provider'),
));
call_hooks('settings_form',$o);
diff --git a/mod/share.php b/mod/share.php
index d5a389bdf..7ed6cf9a6 100644
--- a/mod/share.php
+++ b/mod/share.php
@@ -42,6 +42,12 @@ function share_init(&$a) {
xchan_query($r);
+ $is_photo = (($r[0]['obj_type'] === ACTIVITY_OBJ_PHOTO) ? true : false);
+ if($is_photo) {
+ $object = json_decode($r[0]['object'],true);
+ $photo_bb = $object['bbcode'];
+ }
+
if (strpos($r[0]['body'], "[/share]") !== false) {
$pos = strpos($r[0]['body'], "[share");
$o = substr($r[0]['body'], $pos);
@@ -53,9 +59,9 @@ function share_init(&$a) {
"' posted='".$r[0]['created'].
"' message_id='".$r[0]['mid']."']";
if($r[0]['title'])
- $o .= '[b]'.$r[0]['title'].'[/b]'."\n";
- $o .= $r[0]['body'];
- $o.= "[/share]";
+ $o .= '[b]'.$r[0]['title'].'[/b]'."\r\n";
+ $o .= (($is_photo) ? $photo_bb . "\r\n" . $r[0]['body'] : $r[0]['body']);
+ $o .= "[/share]";
}
if(local_channel()) {
diff --git a/mod/subthread.php b/mod/subthread.php
index 9cfe5c24d..162545a2f 100755
--- a/mod/subthread.php
+++ b/mod/subthread.php
@@ -11,9 +11,12 @@ function subthread_content(&$a) {
return;
}
- $activity = ACTIVITY_FOLLOW;
+ if(argv(1) === 'sub')
+ $activity = ACTIVITY_FOLLOW;
+ elseif(argv(1) === 'unsub')
+ $activity = ACTIVITY_UNFOLLOW;
- $item_id = ((argc() > 1) ? notags(trim(argv(1))) : 0);
+ $item_id = ((argc() > 2) ? notags(trim(argv(2))) : 0);
$r = q("SELECT * FROM `item` WHERE `parent` = '%s' OR `parent_mid` = '%s' and parent = id LIMIT 1",
dbesc($item_id),
@@ -67,6 +70,8 @@ function subthread_content(&$a) {
killme();
+
+
$mid = item_message_id();
$post_type = (($item['resource_type'] === 'photo') ? t('photo') : t('status'));
@@ -99,7 +104,10 @@ function subthread_content(&$a) {
if(! intval($item['item_thread_top']))
$post_type = 'comment';
- $bodyverb = t('%1$s is following %2$s\'s %3$s');
+ if($activity === ACTIVITY_FOLLOW)
+ $bodyverb = t('%1$s is following %2$s\'s %3$s');
+ if($activity === ACTIVITY_UNFOLLOW)
+ $bodyverb = t('%1$s stopped following %2$s\'s %3$s');
$arr = array();
@@ -144,100 +152,7 @@ function subthread_content(&$a) {
killme();
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $post_type = (($item['resource_id']) ? t('photo') : t('status'));
- $objtype = (($item['resource_id']) ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE );
-
- $link = xmlify('<link rel="alternate" type="text/html" href="' . $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . '" />' . "\n") ;
- $body = $item['body'];
-
- $obj = <<< EOT
-
- <object>
- <type>$objtype</type>
- <local>1</local>
- <id>{$item['mid']}</id>
- <link>$link</link>
- <title></title>
- <content>$body</content>
- </object>
-EOT;
-
- $arr = array();
-
- $arr['mid'] = $mid;
- $arr['uid'] = $owner_uid;
- $arr['contact-id'] = $contact['id'];
- $arr['type'] = 'activity';
- $arr['wall'] = $item['wall'];
- $arr['origin'] = 1;
- $arr['gravity'] = GRAVITY_LIKE;
- $arr['parent'] = $item['id'];
- $arr['parent-mid'] = $item['mid'];
- $arr['thr_parent'] = $item['mid'];
- $arr['owner-name'] = $remote_owner['name'];
- $arr['owner-link'] = $remote_owner['url'];
- $arr['owner-avatar'] = $remote_owner['thumb'];
- $arr['author-name'] = $contact['name'];
- $arr['author-link'] = $contact['url'];
- $arr['author-avatar'] = $contact['thumb'];
-
- $ulink = '[zrl=' . $contact['url'] . ']' . $contact['name'] . '[/zrl]';
- $alink = '[zrl=' . $item['author-link'] . ']' . $item['author-name'] . '[/zrl]';
- $plink = '[zrl=' . $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . ']' . $post_type . '[/zrl]';
- $arr['body'] = sprintf( $bodyverb, $ulink, $alink, $plink );
-
- $arr['verb'] = $activity;
- $arr['object-type'] = $objtype;
- $arr['object'] = $obj;
- $arr['allow_cid'] = $item['allow_cid'];
- $arr['allow_gid'] = $item['allow_gid'];
- $arr['deny_cid'] = $item['deny_cid'];
- $arr['deny_gid'] = $item['deny_gid'];
- $arr['visible'] = 1;
- $arr['unseen'] = 1;
- $arr['last-child'] = 0;
-
- $post = item_store($arr);
- $post_id = $post['item_id'];
-
- if(! $item['visible']) {
- $r = q("UPDATE `item` SET `visible` = 1 WHERE `id` = %d AND `uid` = %d",
- intval($item['id']),
- intval($owner_uid)
- );
- }
-
- $arr['id'] = $post_id;
-
- call_hooks('post_local_end', $arr);
-
- killme();
-
}
+