aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Contact.php79
-rwxr-xr-xinclude/text.php2
-rw-r--r--include/zot.php16
3 files changed, 17 insertions, 80 deletions
diff --git a/include/Contact.php b/include/Contact.php
index fcc5019e7..5725e06f0 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -489,62 +489,6 @@ function unmark_for_death($contact) {
);
}}
-if(! function_exists('contact_photo_menu')){
-function contact_photo_menu($contact) {
-
- $a = get_app();
-
- $contact_url="";
- $pm_url="";
- $status_link="";
- $photos_link="";
- $posts_link="";
- $poke_link="";
-
- $sparkle = false;
- if($contact['xchan_network'] === NETWORK_ZOT) {
- $sparkle = true;
- $profile_link = $a->get_baseurl() . '/magic?f=&id=' . $contact['abook_id'];
- }
- else
- $profile_link = $contact['xchan_url'];
-
- if($sparkle) {
- $status_link = $profile_link . "&url=status";
- $photos_link = $profile_link . "&url=photos";
- $profile_link = $profile_link . "&url=profile";
- $pm_url = $a->get_baseurl() . '/message/new/' . $contact['xchan_hash'];
- }
-
- $poke_link = $a->get_baseurl() . '/poke/?f=&c=' . $contact['abook_id'];
- $contact_url = $a->get_baseurl() . '/connections/' . $contact['abook_id'];
- $posts_link = $a->get_baseurl() . '/network/?cid=' . $contact['abook_id'];
-
- $menu = Array(
- t("Poke") => $poke_link,
- t("View Status") => $status_link,
- t("View Profile") => $profile_link,
- t("View Photos") => $photos_link,
- t("Network Posts") => $posts_link,
- t("Edit Contact") => $contact_url,
- t("Send PM") => $pm_url,
- );
-
-
- $args = array('contact' => $contact, 'menu' => &$menu);
-
- call_hooks('contact_photo_menu', $args);
-
- $o = "";
- foreach($menu as $k=>$v){
- if ($v!="") {
- $o .= "<li><a href=\"$v\">$k</a></li>\n";
- }
- }
- return $o;
-}}
-
-
function random_profile() {
$r = q("select xchan_url from xchan where 1 order by rand() limit 1");
if($r)
@@ -553,26 +497,3 @@ function random_profile() {
}
-function contacts_not_grouped($uid,$start = 0,$count = 0) {
-
- if(! $count) {
- $r = q("select count(*) as total from contact where uid = %d and self = 0 and id not in (select distinct(`contact-id`) from group_member where uid = %d) ",
- intval($uid),
- intval($uid)
- );
-
- return $r;
-
-
- }
-
- $r = q("select * from contact where uid = %d and self = 0 and id not in (select distinct(`contact-id`) from group_member where uid = %d) and blocked = 0 and pending = 0 limit %d, %d",
- intval($uid),
- intval($uid),
- intval($start),
- intval($count)
- );
-
- return $r;
-}
-
diff --git a/include/text.php b/include/text.php
index 3d15a5c6b..ff695062f 100755
--- a/include/text.php
+++ b/include/text.php
@@ -1084,7 +1084,7 @@ function format_categories(&$item,$writeable) {
if(! trim($term))
continue;
$removelink = (($writeable) ? z_root() . '/filerm/' . $item['id'] . '?f=&cat=' . urlencode($t['term']) : '');
- $categories[] = array('term' => $term, 'writeable' => $writeable, 'removelink' => $removelink, 'url' => $t['url']);
+ $categories[] = array('term' => $term, 'writeable' => $writeable, 'removelink' => $removelink, 'url' => zid($t['url']));
}
}
$s = replace_macros(get_markup_template('item_categories.tpl'),array(
diff --git a/include/zot.php b/include/zot.php
index 9777f7ae4..124fe7fd6 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -691,6 +691,16 @@ function import_xchan($arr,$ud_flags = 1) {
dbesc($xchan_hash)
);
+ // See if a primary is specified
+
+ $has_primary = false;
+ foreach($arr['locations'] as $location) {
+ if($location['primary']) {
+ $has_primary = true;
+ break;
+ }
+ }
+
foreach($arr['locations'] as $location) {
if(! rsa_verify($location['url'],base64url_decode($location['url_sig']),$arr['key'])) {
logger('import_xchan: Unable to verify site signature for ' . $location['url']);
@@ -698,6 +708,12 @@ function import_xchan($arr,$ud_flags = 1) {
continue;
}
+ // Ensure that they have one primary hub
+
+ if(! $has_primary)
+ $location['primary'] = true;
+
+
for($x = 0; $x < count($xisting); $x ++) {
if(($xisting[$x]['hubloc_url'] === $location['url']) && ($xisting[$x]['hubloc_sitekey'] === $location['sitekey'])) {
$xisting[$x]['updated'] = true;