From f28b21f99d563b08e9d0ddb4a27fb223ad1ce432 Mon Sep 17 00:00:00 2001 From: Michael Meer Date: Wed, 22 Jan 2014 09:16:22 +0100 Subject: start with hubloc ping --- mod/admin.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'mod') diff --git a/mod/admin.php b/mod/admin.php index 749b94de2..a373fa772 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -457,6 +457,15 @@ function admin_page_site(&$a) { } function admin_page_hubloc_post(&$a){ check_form_security_token_redirectOnErr('/admin/hubloc', 'admin_hubloc'); + + //prepare for ping + logger('POST input: '.$_POST , LOGGER_DEBUG); + //perform ping + //handle results and set the hubloc flags in db to make results visible + + //in case of repair store new pub key for tested hubloc (all channel with this hubloc) in db + //after repair set hubloc flags to 0 + goaway($a->get_baseurl(true) . '/admin/hubloc' ); return; } -- cgit v1.2.3 From ffabb4cc867f59d86380eced3253053d368327f2 Mon Sep 17 00:00:00 2001 From: Michael Meer Date: Wed, 22 Jan 2014 11:29:49 +0100 Subject: reorg formula data for hubloc checks --- mod/admin.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/admin.php b/mod/admin.php index a373fa772..57e285781 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -459,7 +459,16 @@ function admin_page_hubloc_post(&$a){ check_form_security_token_redirectOnErr('/admin/hubloc', 'admin_hubloc'); //prepare for ping - logger('POST input: '.$_POST , LOGGER_DEBUG); + logger('POST input: '. print_r($_POST,true), LOGGER_DEBUG); + + if ( $_POST['hublocid']) { + logger('hublocid is not empty: ' . $_POST['hublocid'], LOGGER_DEBUG); + } + + //if ( $_POST'' == "check" ) { + // //todo + //} + //perform ping //handle results and set the hubloc flags in db to make results visible -- cgit v1.2.3 From 524fff3a17fec184c87e855d09bf6a60f68e4e88 Mon Sep 17 00:00:00 2001 From: Michael Meer Date: Thu, 23 Jan 2014 12:09:35 +0100 Subject: preperation for ping, need training in SQL :( --- mod/admin.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/admin.php b/mod/admin.php index 57e285781..33b42d264 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -462,7 +462,12 @@ function admin_page_hubloc_post(&$a){ logger('POST input: '. print_r($_POST,true), LOGGER_DEBUG); if ( $_POST['hublocid']) { - logger('hublocid is not empty: ' . $_POST['hublocid'], LOGGER_DEBUG); + $hublocid = $_POST['hublocid']; + logger('hublocid is not empty: ' . $hublocid , LOGGER_DEBUG); + $hublocurl = q("SELECT hubloc_url FROM hubloc WHERE hubloc_id = %d ", + intval($hublocid) + ); + logger('hubloc_url : ' . print_r($hublocurl, true) , LOGGER_DEBUG); } //if ( $_POST'' == "check" ) { -- cgit v1.2.3 From a2b07ed2814972507bf971a5ac6ed09c399e29e7 Mon Sep 17 00:00:00 2001 From: Michael Meer Date: Thu, 23 Jan 2014 13:58:14 +0100 Subject: build url, deleted logger commands --- mod/admin.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'mod') diff --git a/mod/admin.php b/mod/admin.php index 33b42d264..fbd342425 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -459,15 +459,14 @@ function admin_page_hubloc_post(&$a){ check_form_security_token_redirectOnErr('/admin/hubloc', 'admin_hubloc'); //prepare for ping - logger('POST input: '. print_r($_POST,true), LOGGER_DEBUG); if ( $_POST['hublocid']) { $hublocid = $_POST['hublocid']; - logger('hublocid is not empty: ' . $hublocid , LOGGER_DEBUG); - $hublocurl = q("SELECT hubloc_url FROM hubloc WHERE hubloc_id = %d ", + $arrhublocurl = q("SELECT hubloc_url FROM hubloc WHERE hubloc_id = %d ", intval($hublocid) ); - logger('hubloc_url : ' . print_r($hublocurl, true) , LOGGER_DEBUG); + $hublocurl = $arrhublocurl[0]['hubloc_url'] . '/post'; + logger('hubloc_url : ' . $hublocurl , LOGGER_DEBUG); } //if ( $_POST'' == "check" ) { -- cgit v1.2.3 From 24bac92acdf04a49eb65fc947f25fafb2b2044fa Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 27 Jan 2014 15:25:04 -0800 Subject: after rposting - if there's no remote_return, go to your matrix page rather than leave you on a blank rpost page. --- mod/rpost.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/rpost.php b/mod/rpost.php index 8e01ef5d4..852a57d78 100644 --- a/mod/rpost.php +++ b/mod/rpost.php @@ -65,8 +65,10 @@ function rpost_content(&$a) { if($_REQUEST['remote_return']) { $_SESSION['remote_return'] = $_REQUEST['remote_return']; } - if(argc() > 1 && argv(1) === 'return' && $_SESSION['remote_return']) { - goaway($_SESSION['remote_return']); + if(argc() > 1 && argv(1) === 'return') { + if($_SESSION['remote_return']) + goaway($_SESSION['remote_return']); + goaway(z_root() . '/network'); } $plaintext = true; -- cgit v1.2.3 From 3100b5d93e9f440a17b99d2856ee022b29d73f80 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 27 Jan 2014 18:06:09 -0800 Subject: photo tagging still broken - but at least don't create a new linked item every time a photo is edited. --- mod/photos.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'mod') diff --git a/mod/photos.php b/mod/photos.php index 23733e121..c299fe778 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -778,6 +778,8 @@ function photos_content(&$a) { return; } + + $prevlink = ''; $nextlink = ''; @@ -898,6 +900,8 @@ function photos_content(&$a) { } } +// logger('mod_photo: link_item' . print_r($link_item,true)); + // FIXME - remove this when we move to conversation module $r = $r[0]['children']; -- cgit v1.2.3 From f104b4dc275891785ec03abd779d8aafe5163815 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 27 Jan 2014 23:49:42 -0800 Subject: preserve expiration when editing --- mod/editpost.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'mod') diff --git a/mod/editpost.php b/mod/editpost.php index 7cc33d60d..918a70d36 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -92,6 +92,11 @@ function editpost_content(&$a) { } + $cipher = get_pconfig(get_app()->profile['profile_uid'],'system','default_cipher'); + if(! $cipher) + $cipher = 'aes256'; + + $o .= replace_macros($tpl,array( '$return_path' => $_SESSION['return_url'], '$action' => 'item', @@ -128,11 +133,12 @@ function editpost_content(&$a) { '$jotplugins' => $jotplugins, '$sourceapp' => t($a->sourcename), '$catsenabled' => $catsenabled, - '$defexpire' => $itm[0]['expires'], - '$feature_expire' => 'none', + '$defexpire' => datetime_convert('UTC', date_default_timezone_get(),$itm[0]['expires']), + '$feature_expire' => ((feature_enabled(get_app()->profile['profile_uid'],'content_expire') && (! $webpage)) ? 'block' : 'none'), '$expires' => t('Set expiration date'), - '$feature_encrypt' => 'none', + '$feature_encrypt' => ((feature_enabled(get_app()->profile['profile_uid'],'content_encrypt') && (! $webpage)) ? 'block' : 'none'), '$encrypt' => t('Encrypt text'), + '$cipher' => $cipher, '$expiryModalOK' => t('OK'), '$expiryModalCANCEL' => t('Cancel'), )); -- cgit v1.2.3 From 6e22aa25cc941f542a192ef32a2e8ee4f23bb1c1 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 28 Jan 2014 15:52:54 -0800 Subject: basic presence indication --- mod/ping.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'mod') diff --git a/mod/ping.php b/mod/ping.php index dda87dec2..b9ecf9b41 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -43,6 +43,31 @@ function ping_init(&$a) { unset($_SESSION['sysmsg_info']); } + if(get_observer_hash() && (! $result['invalid'])) { + $r = q("select cp_id from chatpresence where cp_xchan = '%s'", + dbesc(get_observer_hash()) + ); + if($r) { + foreach($r as $rr) { + q("update chatpresence set cp_last = '%s' where cp_id = %d limit 1", + intval($rr['cp_id']) + ); + } + } + else { + q("insert into chatpresence ( cp_xchan, cp_last, cp_status, cp_client) + values( '%s', '%s', '%s', '%s' ) ", + dbesc(get_observer_hash()), + dbesc(datetime_convert()), + dbesc('online'), + dbesc($_SERVER['REMOTE_ADDR']) + ); + } + } + + q("delete from chatpresence where cp_last < UTC_TIMESTAMP() - INTERVAL 2 MINUTE"); + + if((! local_user()) || ($result['invalid'])) { echo json_encode($result); killme(); -- cgit v1.2.3 From 8efac0cfd6db063a469ada1db4e5767a5fd975c6 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 28 Jan 2014 16:16:55 -0800 Subject: fix sql query and provide setting to hide online status --- mod/ping.php | 2 +- mod/settings.php | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/ping.php b/mod/ping.php index b9ecf9b41..f067091da 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -50,6 +50,7 @@ function ping_init(&$a) { if($r) { foreach($r as $rr) { q("update chatpresence set cp_last = '%s' where cp_id = %d limit 1", + dbesc(datetime_convert()), intval($rr['cp_id']) ); } @@ -67,7 +68,6 @@ function ping_init(&$a) { q("delete from chatpresence where cp_last < UTC_TIMESTAMP() - INTERVAL 2 MINUTE"); - if((! local_user()) || ($result['invalid'])) { echo json_encode($result); killme(); diff --git a/mod/settings.php b/mod/settings.php index ee6ef45de..7ff76cd3e 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -266,6 +266,7 @@ function settings_post(&$a) { $expire_network_only = ((x($_POST,'expire_network_only'))? intval($_POST['expire_network_only']) : 0); $allow_location = (((x($_POST,'allow_location')) && (intval($_POST['allow_location']) == 1)) ? 1: 0); + $hide_presence = (((x($_POST,'hide_presence')) && (intval($_POST['hide_presence']) == 1)) ? 1: 0); $publish = (((x($_POST,'profile_in_directory')) && (intval($_POST['profile_in_directory']) == 1)) ? 1: 0); $page_flags = (((x($_POST,'page-flags')) && (intval($_POST['page-flags']))) ? intval($_POST['page-flags']) : 0); @@ -395,6 +396,7 @@ function settings_post(&$a) { set_pconfig(local_user(),'system','post_joingroup', $post_joingroup); set_pconfig(local_user(),'system','post_profilechange', $post_profilechange); set_pconfig(local_user(),'system','blocktags',$blocktags); + set_pconfig(local_user(),'system','hide_online_status',$hide_presence); $r = q("update channel set channel_name = '%s', channel_pageflags = %d, channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_max_anon_mail = %d, channel_max_friend_req = %d, channel_expire_days = %d, channel_default_group = '%s', channel_r_stream = %d, channel_r_profile = %d, channel_r_photos = %d, channel_r_abook = %d, channel_w_stream = %d, channel_w_wall = %d, channel_w_tagwall = %d, channel_w_comment = %d, channel_w_mail = %d, channel_w_photos = %d, channel_w_chat = %d, channel_a_delegate = %d, channel_r_storage = %d, channel_w_storage = %d, channel_r_pages = %d, channel_w_pages = %d, channel_a_republish = %d, channel_allow_cid = '%s', channel_allow_gid = '%s', channel_deny_cid = '%s', channel_deny_gid = '%s' where channel_id = %d limit 1", @@ -821,6 +823,9 @@ function settings_content(&$a) { $unkmail = $a->user['unkmail']; $cntunkmail = $a->user['cntunkmail']; + $hide_presence = intval(get_pconfig(local_user(), 'system','hide_online_status')); + + $expire_items = get_pconfig(local_user(), 'expire','items'); $expire_items = (($expire_items===false)? '1' : $expire_items); // default if not set: 1 @@ -918,6 +923,8 @@ function settings_content(&$a) { '$h_prv' => t('Security and Privacy Settings'), + '$hide_presence' => array('hide_presence', t('Hide my online presence'),$hide_presence, t('Prevents showing if you are available for chat')), + '$lbl_pmacro' => t('Quick Privacy Settings:'), '$pmacro3' => t('Very Public - extremely permissive'), '$pmacro2' => t('Typical - default public, privacy when desired'), -- cgit v1.2.3 From d970c69f91b96b3ef40752a95ecec8ca8b11b62a Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 28 Jan 2014 19:49:56 -0800 Subject: online indication to the directory popup --- mod/dirprofile.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'mod') diff --git a/mod/dirprofile.php b/mod/dirprofile.php index 1593b014a..d88144f52 100644 --- a/mod/dirprofile.php +++ b/mod/dirprofile.php @@ -74,6 +74,9 @@ function dirprofile_init(&$a) { $qrlink = zid($rr['url']); $connect_link = ((local_user()) ? z_root() . '/follow?f=&url=' . urlencode($rr['address']) : ''); + $online = remote_online_status($rr['address']); + + if(in_array($rr['hash'],$contacts)) $connect_link = ''; @@ -151,6 +154,7 @@ function dirprofile_init(&$a) { '$photo' => $rr['photo_l'], '$alttext' => $rr['name'] . ' ' . $rr['address'], '$name' => $rr['name'], + '$online' => (($online) ? t('Online Now') : ''), '$details' => $pdesc . $details, '$profile' => $profile, '$address' => $rr['address'], -- cgit v1.2.3 From 2822e6e70a15508e0626d5fe2eace87b5013b9b6 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 28 Jan 2014 20:15:57 -0800 Subject: missing file in checkin --- mod/online.php | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 mod/online.php (limited to 'mod') diff --git a/mod/online.php b/mod/online.php new file mode 100644 index 000000000..c6500347a --- /dev/null +++ b/mod/online.php @@ -0,0 +1,11 @@ + false); + if(argc() != 2) + json_return_and_die($ret); + + $ret = get_online_status(argv(1)); + json_return_and_die($ret); +} -- cgit v1.2.3 From 0013e59086080963737d6c864eca7ff852a1e9da Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 28 Jan 2014 20:19:16 -0800 Subject: chatpresence timing out too quickly --- mod/ping.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/ping.php b/mod/ping.php index f067091da..e205dbea7 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -66,7 +66,7 @@ function ping_init(&$a) { } } - q("delete from chatpresence where cp_last < UTC_TIMESTAMP() - INTERVAL 2 MINUTE"); + q("delete from chatpresence where cp_last < UTC_TIMESTAMP() - INTERVAL 3 MINUTE"); if((! local_user()) || ($result['invalid'])) { echo json_encode($result); -- cgit v1.2.3 From 10b51a9471bba2a1b058eee2d362d3d2189627be Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 29 Jan 2014 02:25:21 -0800 Subject: issues uncovered whilst testing the chatroom API --- mod/ping.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'mod') diff --git a/mod/ping.php b/mod/ping.php index e205dbea7..c3c81992f 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -44,18 +44,22 @@ function ping_init(&$a) { } if(get_observer_hash() && (! $result['invalid'])) { - $r = q("select cp_id from chatpresence where cp_xchan = '%s'", - dbesc(get_observer_hash()) + $r = q("select cp_id from chatpresence where cp_xchan = '%s' and cp_client = '%s'", + dbesc(get_observer_hash()), + dbesc($_SERVER['REMOTE_ADDR']) ); + $basic_presence = false; if($r) { foreach($r as $rr) { + if($rr['cp_id'] == 0) + $basic_presence = true; q("update chatpresence set cp_last = '%s' where cp_id = %d limit 1", dbesc(datetime_convert()), intval($rr['cp_id']) ); } } - else { + if(! $basic_presence) { q("insert into chatpresence ( cp_xchan, cp_last, cp_status, cp_client) values( '%s', '%s', '%s', '%s' ) ", dbesc(get_observer_hash()), -- cgit v1.2.3 From c95f65e092e3ea3e4d312976789597ef91037b25 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 29 Jan 2014 02:36:01 -0800 Subject: prevent runaway presence indication --- mod/ping.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/ping.php b/mod/ping.php index c3c81992f..2d5deb9ad 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -44,14 +44,14 @@ function ping_init(&$a) { } if(get_observer_hash() && (! $result['invalid'])) { - $r = q("select cp_id from chatpresence where cp_xchan = '%s' and cp_client = '%s'", + $r = q("select cp_id, cp_room from chatpresence where cp_xchan = '%s' and cp_client = '%s'", dbesc(get_observer_hash()), dbesc($_SERVER['REMOTE_ADDR']) ); $basic_presence = false; if($r) { foreach($r as $rr) { - if($rr['cp_id'] == 0) + if($rr['cp_room'] == 0) $basic_presence = true; q("update chatpresence set cp_last = '%s' where cp_id = %d limit 1", dbesc(datetime_convert()), -- cgit v1.2.3