aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorWave <wave72@users.noreply.github.com>2015-11-06 09:09:58 +0100
committerWave <wave72@users.noreply.github.com>2015-11-06 09:09:58 +0100
commit30d083ac3cbdf36171cfee7b892271b9b587325c (patch)
treef2f63728f86f8336330d31ee8edf2fcd742dc71e /mod
parent50cf095c000813d0b1408d929c1fa7422b131a3d (diff)
parent4ca0c2cfd14df5e2b6e9c7f59a10628f7653d6a4 (diff)
downloadvolse-hubzilla-30d083ac3cbdf36171cfee7b892271b9b587325c.tar.gz
volse-hubzilla-30d083ac3cbdf36171cfee7b892271b9b587325c.tar.bz2
volse-hubzilla-30d083ac3cbdf36171cfee7b892271b9b587325c.zip
Merge pull request #2 from redmatrix/master
Update to latest hubzilla
Diffstat (limited to 'mod')
-rw-r--r--mod/admin.php29
-rw-r--r--mod/connedit.php27
-rw-r--r--mod/dirsearch.php4
-rw-r--r--mod/editpost.php3
-rw-r--r--mod/ffsapi.php65
-rw-r--r--mod/fhublocs.php80
-rw-r--r--mod/item.php7
-rw-r--r--mod/locs.php12
-rw-r--r--mod/mail.php2
-rw-r--r--mod/photos.php15
-rw-r--r--mod/post.php81
-rw-r--r--mod/pubsites.php9
-rw-r--r--mod/rbmark.php4
-rw-r--r--mod/search.php4
-rw-r--r--mod/settings.php8
-rw-r--r--mod/share.php12
-rwxr-xr-xmod/subthread.php109
-rw-r--r--mod/zfinger.php1
18 files changed, 313 insertions, 159 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/connedit.php b/mod/connedit.php
index 6170d05a8..877c12dc7 100644
--- a/mod/connedit.php
+++ b/mod/connedit.php
@@ -190,7 +190,7 @@ function connedit_post(&$a) {
}
}
- $abook_pending = (($new_friend) ? 0 : $orig_record[0]['abook_pending'];
+ $abook_pending = (($new_friend) ? 0 : $orig_record[0]['abook_pending']);
$r = q("UPDATE abook SET abook_profile = '%s', abook_my_perms = %d , abook_closeness = %d, abook_pending = %d,
abook_incl = '%s', abook_excl = '%s'
@@ -652,12 +652,31 @@ 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(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 +687,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/dirsearch.php b/mod/dirsearch.php
index ec730b28d..937564a79 100644
--- a/mod/dirsearch.php
+++ b/mod/dirsearch.php
@@ -436,9 +436,9 @@ function list_public_sites() {
$register = 'closed';
if(strpos($rr['site_url'],'https://') !== false)
- $ret['sites'][] = array('url' => $rr['site_url'], 'access' => $access, 'register' => $register, 'sellpage' => $rr['site_sellpage'], 'location' => $rr['site_location']);
+ $ret['sites'][] = array('url' => $rr['site_url'], 'access' => $access, 'register' => $register, 'sellpage' => $rr['site_sellpage'], 'location' => $rr['site_location'], 'project' => $rr['site_project']);
else
- $insecure[] = array('url' => $rr['site_url'], 'access' => $access, 'register' => $register, 'sellpage' => $rr['site_sellpage'], 'location' => $rr['site_location']);
+ $insecure[] = array('url' => $rr['site_url'], 'access' => $access, 'register' => $register, 'sellpage' => $rr['site_sellpage'], 'location' => $rr['site_location'], 'project' => $rr['site_project']);
}
if($insecure) {
$ret['sites'] = array_merge($ret['sites'],$insecure);
diff --git a/mod/editpost.php b/mod/editpost.php
index d4dc35ef8..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']) {
@@ -129,7 +128,7 @@ function editpost_content(&$a) {
'$consensus' => intval($itm[0]['item_consensus']),
'$wait' => t('Please wait'),
'$permset' => t('Permission settings'),
- '$ptyp' => $itm[0]['type'],
+ '$ptyp' => $itm[0]['obj_type'],
'$content' => undo_post_tagging($itm[0]['body']),
'$post_id' => $post_id,
'$parent' => (($itm[0]['parent'] != $itm[0]['id']) ? $itm[0]['parent'] : ''),
diff --git a/mod/ffsapi.php b/mod/ffsapi.php
new file mode 100644
index 000000000..f4033e63b
--- /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 the demo provider" 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/item.php b/mod/item.php
index 7488e709b..591dc8407 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -96,7 +96,7 @@ function item_post(&$a) {
$owner_hash = null;
$message_id = ((x($_REQUEST,'message_id') && $api_source) ? strip_tags($_REQUEST['message_id']) : '');
- $created = ((x($_REQUEST,'created')) ? datetime_convert('UTC','UTC',$_REQUEST['created']) : datetime_convert());
+ $created = ((x($_REQUEST,'created')) ? datetime_convert(date_default_timezone_get(),'UTC',$_REQUEST['created']) : datetime_convert());
$post_id = ((x($_REQUEST,'post_id')) ? intval($_REQUEST['post_id']) : 0);
$app = ((x($_REQUEST,'source')) ? strip_tags($_REQUEST['source']) : '');
$return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : '');
@@ -107,7 +107,6 @@ function item_post(&$a) {
$layout_mid = ((x($_REQUEST,'layout_mid')) ? escape_tags($_REQUEST['layout_mid']): '');
$plink = ((x($_REQUEST,'permalink')) ? escape_tags($_REQUEST['permalink']) : '');
$obj_type = ((x($_REQUEST,'obj_type')) ? escape_tags($_REQUEST['obj_type']) : ACTIVITY_OBJ_NOTE);
-
// allow API to bulk load a bunch of imported items with sending out a bunch of posts.
$nopush = ((x($_REQUEST,'nopush')) ? intval($_REQUEST['nopush']) : 0);
@@ -608,6 +607,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,','));
@@ -627,7 +627,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/photos.php b/mod/photos.php
index 0442a5d24..33a895fdf 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -183,17 +183,14 @@ function photos_post(&$a) {
);
if($r) {
-
- /* this happens in attach_delete
+/*
q("DELETE FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s'",
intval($page_owner_uid),
dbesc($r[0]['resource_id'])
);
- */
-
+*/
attach_delete($page_owner_uid, $r[0]['resource_id'], 1 );
-
- /* this happens in attach_delete
+/*
$i = q("SELECT * FROM `item` WHERE `resource_id` = '%s' AND resource_type = 'photo' and `uid` = %d LIMIT 1",
dbesc($r[0]['resource_id']),
intval($page_owner_uid)
@@ -202,7 +199,7 @@ function photos_post(&$a) {
drop_item($i[0]['id'],true,DROPITEM_PHASE1);
$url = $a->get_baseurl();
}
- */
+*/
}
goaway($a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . $_SESSION['album_return']);
@@ -626,7 +623,9 @@ function photos_content(&$a) {
'$nickname' => $a->data['channel']['channel_address'],
'$newalbum_label' => t('Enter an album name'),
'$newalbum_placeholder' => t('or select an existing album (doubleclick)'),
- '$visible' => array('visible', t('Create a status post for this upload'), 0, '', array(t('No'), t('Yes'))),
+ '$visible' => array('visible', t('Create a status post for this upload'), 0,'', array(t('No'), t('Yes')), 'onclick="showHideBodyTextarea();"'),
+ '$caption' => array('description', t('Caption (optional):')),
+ '$body' => array('body', t('Description (optional):'),'', 'Description will only appear in the status post'),
'$albums' => $albums['albums'],
'$selname' => $selname,
'$permissions' => t('Permissions'),
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 62990c70c..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">' .
@@ -23,16 +25,19 @@ function pubsites_content(&$a) {
$j = json_decode($ret['body'],true);
if($j) {
$rate_meta = ((local_channel()) ? '<td>' . t('Rate this hub') . '</td>' : '');
- $o .= '<table border="1"><tr><td>' . t('Site URL') . '</td><td>' . t('Access Type') . '</td><td>' . t('Registration Policy') . '</td><td>' . t('Location') . '</td><td>' . t('View hub ratings') . '</td>' . $rate_meta . '</tr>';
+ $o .= '<table border="1"><tr><td>' . t('Site URL') . '</td><td>' . t('Access Type') . '</td><td>' . t('Registration Policy') . '</td><td>' . t('Location') . '</td><td>' . t('Project') . '</td><td>' . t('View hub ratings') . '</td>' . $rate_meta . '</tr>';
if($j['sites']) {
foreach($j['sites'] as $jj) {
$host = strtolower(substr($jj['url'],strpos($jj['url'],'://')+3));
$rate_links = ((local_channel()) ? '<td><a href="rate?f=&target=' . $host . '" class="btn-btn-default"><i class="icon-check"></i> ' . t('Rate') . '</a></td>' : '');
- $o .= '<tr><td>' . '<a href="'. (($jj['sellpage']) ? $jj['sellpage'] : $jj['url'] . '/register' ) . '" >' . $jj['url'] . '</a>' . '</td><td>' . $jj['access'] . '</td><td>' . $jj['register'] . '</td><td>' . $jj['location'] . '</td><td><a href="ratings/' . $host . '" class="btn-btn-default"><i class="icon-eye-open"></i> ' . t('View ratings') . '</a></td>' . $rate_links . '</tr>';
+ $o .= '<tr><td>' . '<a href="'. (($jj['sellpage']) ? $jj['sellpage'] : $jj['url'] . '/register' ) . '" >' . $jj['url'] . '</a>' . '</td><td>' . $jj['access'] . '</td><td>' . $jj['register'] . '</td><td>' . $jj['location'] . '</td><td>' . $jj['project'] . '</td><td><a href="ratings/' . $host . '" class="btn-btn-default"><i class="icon-eye-open"></i> ' . t('View ratings') . '</a></td>' . $rate_links . '</tr>';
}
}
$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/search.php b/mod/search.php
index ce8357fb9..a0085fca9 100644
--- a/mod/search.php
+++ b/mod/search.php
@@ -35,6 +35,8 @@ function search_content(&$a,$update = 0, $load = false) {
$o = '<div id="live-search"></div>' . "\r\n";
+ $o = '<div class="generic-content-wrapper-styled">' . "\r\n";
+
$o .= '<h3>' . t('Search') . '</h3>';
if(x($a->data,'search'))
@@ -212,6 +214,8 @@ function search_content(&$a,$update = 0, $load = false) {
$o .= conversation($a,$items,'search',$update,'client');
+ $o .= '</div>';
+
return $o;
}
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();
-
}
+
diff --git a/mod/zfinger.php b/mod/zfinger.php
index fb3333280..fff7c9e1b 100644
--- a/mod/zfinger.php
+++ b/mod/zfinger.php
@@ -9,5 +9,4 @@ function zfinger_init(&$a) {
$x = zotinfo($_REQUEST);
json_return_and_die($x);
-
}