aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-09-15 03:48:43 -0700
committerfriendica <info@friendica.com>2013-09-15 03:48:43 -0700
commit129a119c84d87bffe099cea7ac5b0ed511c26f80 (patch)
tree831b0d681e2748aded17bc59ee4580a72ecd5cd5 /include
parentaefb0f823353d15a281d3c94ec6fc044e1b62580 (diff)
downloadvolse-hubzilla-129a119c84d87bffe099cea7ac5b0ed511c26f80.tar.gz
volse-hubzilla-129a119c84d87bffe099cea7ac5b0ed511c26f80.tar.bz2
volse-hubzilla-129a119c84d87bffe099cea7ac5b0ed511c26f80.zip
implement what I hope will now be the server side of directory sync, add viewsrc to item_photo_menu, and log what changed in import_xchan update objects so we can find out why there are so many updates when nothing _obvious_ has changed that should trigger it.
Diffstat (limited to 'include')
-rw-r--r--include/conversation.php20
-rw-r--r--include/zot.php17
2 files changed, 24 insertions, 13 deletions
diff --git a/include/conversation.php b/include/conversation.php
index 0c1479356..e7c7831c0 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -876,6 +876,12 @@ function item_photo_menu($item){
$ssl_state = false;
+ $sub_link="";
+ $poke_link="";
+ $contact_url="";
+ $pm_url="";
+ $vsrc_link = "";
+
if(local_user()) {
$ssl_state = true;
if(! count($a->contacts))
@@ -884,14 +890,11 @@ function item_photo_menu($item){
$channel_hash = (($channel) ? $channel['channel_hash'] : '');
}
- $sub_link="";
- $poke_link="";
- $contact_url="";
- $pm_url="";
-
- if((local_user()) && local_user() == $item['uid'] && $item['parent'] == $item['id']
- && $channel && ($channel_hash != $item['author_xchan'])) {
- $sub_link = 'javascript:dosubthread(' . $item['id'] . '); return false;';
+ if((local_user()) && local_user() == $item['uid']) {
+ $vsrc_link = $a->get_baseurl() . '/viewsrc/' . $item['id'];
+ if($item['parent'] == $item['id'] && $channel && ($channel_hash != $item['author_xchan'])) {
+ $sub_link = 'javascript:dosubthread(' . $item['id'] . '); return false;';
+ }
}
$profile_link = z_root() . "/chanview/?f=&hash=" . $item['author_xchan'];
@@ -910,6 +913,7 @@ function item_photo_menu($item){
}
$menu = Array(
+ t("View Source") => $vsrc_link,
t("Follow Thread") => $sub_link,
t("View Status") => $status_link,
t("View Profile") => $profile_link,
diff --git a/include/zot.php b/include/zot.php
index 53031a6c5..c461486f0 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -417,6 +417,7 @@ function import_xchan($arr) {
$dirmode = intval(get_config('system','directory_mode'));
$changed = false;
+ $what = '';
if(! (is_array($arr) && array_key_exists('success',$arr) && $arr['success'])) {
logger('import_xchan: invalid data packet: ' . print_r($arr,true));
@@ -492,7 +493,7 @@ function import_xchan($arr) {
logger('import_xchan: existing: ' . print_r($r[0],true), LOGGER_DATA);
logger('import_xchan: new: ' . print_r($arr,true), LOGGER_DATA);
-
+ $what .= 'xchan ';
$changed = true;
}
}
@@ -532,6 +533,7 @@ function import_xchan($arr) {
intval($new_flags)
);
+ $what .= 'new_xchan';
$changed = true;
}
@@ -552,7 +554,7 @@ function import_xchan($arr) {
dbesc($xchan_hash)
);
-
+ $what .= 'photo ';
$changed = true;
}
@@ -605,6 +607,7 @@ function import_xchan($arr) {
dbesc(datetime_convert()),
intval($r[0]['hubloc_id'])
);
+ $what = 'primary_hub ';
$changed = true;
}
continue;
@@ -644,7 +647,7 @@ function import_xchan($arr) {
dbesc(datetime_convert()),
dbesc(datetime_convert())
);
-
+ $what .= 'newhub ';
$changed = true;
}
@@ -656,7 +659,7 @@ function import_xchan($arr) {
$r = q("delete from hubloc where hubloc_id = %d limit 1",
intval($x['hubloc_id'])
);
-
+ $what .= 'removed_hub';
$changed = true;
}
}
@@ -670,7 +673,7 @@ function import_xchan($arr) {
if(array_key_exists('profile',$arr) && is_array($arr['profile'])) {
$profile_changed = import_directory_profile($xchan_hash,$arr['profile']);
if($profile_changed) {
-
+ $what .= 'profile ';
$changed = true;
}
}
@@ -689,6 +692,7 @@ function import_xchan($arr) {
if(array_key_exists('site',$arr) && is_array($arr['site'])) {
$profile_changed = import_site($arr['site'],$arr['key']);
if($profile_changed) {
+ $what .= 'site ';
$changed = true;
}
}
@@ -698,6 +702,7 @@ function import_xchan($arr) {
if($changed) {
$guid = random_string() . '@' . get_app()->get_hostname();
update_modtime($xchan_hash,$guid);
+ logger('import_xchan: changed: ' . $what,LOGGER_DEBUG);
}
if(! x($ret,'message')) {
@@ -1396,6 +1401,7 @@ function import_directory_profile($hash,$profile) {
$update = false;
foreach($r[0] as $k => $v) {
if((array_key_exists($k,$arr)) && ($arr[$k] != $v)) {
+ logger('import_directory_profile: update' . $k . ' => ' . $arr[$k]);
$update = true;
break;
}
@@ -1431,6 +1437,7 @@ function import_directory_profile($hash,$profile) {
}
else {
$update = true;
+ logger('import_directory_profile: new profile');
$x = q("insert into xprof (xprof_hash, xprof_desc, xprof_dob, xprof_age, xprof_gender, xprof_marital, xprof_sexual, xprof_locale, xprof_region, xprof_postcode, xprof_country, xprof_keywords) values ('%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') ",
dbesc($arr['xprof_hash']),
dbesc($arr['xprof_desc']),