diff options
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r-- | Zotlabs/Module/Appman.php | 28 | ||||
-rw-r--r-- | Zotlabs/Module/Item.php | 7 | ||||
-rw-r--r-- | Zotlabs/Module/Like.php | 5 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Conversation.php | 19 | ||||
-rw-r--r-- | Zotlabs/Module/Sse.php | 63 |
5 files changed, 45 insertions, 77 deletions
diff --git a/Zotlabs/Module/Appman.php b/Zotlabs/Module/Appman.php index 5f72d771b..8a842feda 100644 --- a/Zotlabs/Module/Appman.php +++ b/Zotlabs/Module/Appman.php @@ -16,21 +16,21 @@ class Appman extends \Zotlabs\Web\Controller { if(isset($_POST['url']) && $_POST['url']) { $arr = array( 'uid' => intval($_REQUEST['uid']), - 'url' => escape_tags($_REQUEST['url']), - 'guid' => escape_tags($_REQUEST['guid']), - 'author' => escape_tags($_REQUEST['author']), - 'addr' => escape_tags($_REQUEST['addr']), - 'name' => escape_tags($_REQUEST['name']), - 'desc' => escape_tags($_REQUEST['desc']), - 'photo' => escape_tags($_REQUEST['photo']), - 'version' => escape_tags($_REQUEST['version']), - 'price' => escape_tags($_REQUEST['price']), - 'page' => escape_tags($_REQUEST['page']), - 'requires' => escape_tags($_REQUEST['requires']), + 'url' => escape_tags($_REQUEST['url'] ?? ''), + 'guid' => escape_tags($_REQUEST['guid'] ?? ''), + 'author' => escape_tags($_REQUEST['author'] ?? ''), + 'addr' => escape_tags($_REQUEST['addr'] ?? ''), + 'name' => escape_tags($_REQUEST['name'] ?? ''), + 'desc' => escape_tags($_REQUEST['desc'] ?? ''), + 'photo' => escape_tags($_REQUEST['photo'] ?? ''), + 'version' => escape_tags($_REQUEST['version'] ?? ''), + 'price' => escape_tags($_REQUEST['price'] ?? ''), + 'page' => escape_tags($_REQUEST['page'] ?? ''), + 'requires' => escape_tags($_REQUEST['requires'] ?? ''), 'system' => intval($_REQUEST['system']), - 'plugin' => escape_tags($_REQUEST['plugin']), - 'sig' => escape_tags($_REQUEST['sig']), - 'categories' => escape_tags($_REQUEST['categories']) + 'plugin' => escape_tags($_REQUEST['plugin'] ?? ''), + 'sig' => escape_tags($_REQUEST['sig'] ?? ''), + 'categories' => escape_tags($_REQUEST['categories'] ?? '') ); $_REQUEST['appid'] = Apps::app_install(local_channel(),$arr); diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 3d13655d2..5618137a1 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -837,8 +837,10 @@ class Item extends Controller { if ($results) { - // Set permissions based on tag replacements - set_linkified_perms($results, $str_contact_allow, $str_group_allow, $profile_uid, $private, $parent_item); + // Set permissions based on tag replacements only if not editing an existing post + if (!$orig_post) { + set_linkified_perms($results, $str_contact_allow, $str_group_allow, $profile_uid, $private, $parent_item); + } foreach ($results as $result) { $success = $result['success']; @@ -1429,7 +1431,6 @@ class Item extends Controller { require_once('include/items.php'); - $i = q("select id, uid, item_origin, author_xchan, owner_xchan, source_xchan, item_type from item where id = %d limit 1", intval(argv(2)) ); diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php index 4460900a8..d493742e7 100644 --- a/Zotlabs/Module/Like.php +++ b/Zotlabs/Module/Like.php @@ -569,6 +569,11 @@ class Like extends Controller { call_hooks('post_local_end', $arr); + if ($is_rsvp && in_array($verb, ['attendyes', 'attendmaybe'])) { + event_addtocal($item_id, local_channel()); + } + + $r = q("select * from item where id = %d", intval($post_id) ); diff --git a/Zotlabs/Module/Settings/Conversation.php b/Zotlabs/Module/Settings/Conversation.php index aa0ff6a7e..5f3d903a8 100644 --- a/Zotlabs/Module/Settings/Conversation.php +++ b/Zotlabs/Module/Settings/Conversation.php @@ -11,24 +11,19 @@ class Conversation { $module = substr(strrchr(strtolower(static::class), '\\'), 1); check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module); - + $features = get_module_features($module); process_module_features_post(local_channel(), $features, $_POST); - + Libsync::build_sync_packet(); - - if($_POST['aj']) { - if($_POST['auto_update'] == 1) - info(t('Settings saved.') . EOL); - else - info(t('Settings saved. Reload page please.') . EOL); + if($_POST['aj']) { killme(); } - else { - return; - } + + return; + } function get() { @@ -48,7 +43,7 @@ class Conversation { '$features' => process_module_features_get(local_channel(), $features), '$submit' => t('Submit') )); - + if($aj) { echo $o; killme(); diff --git a/Zotlabs/Module/Sse.php b/Zotlabs/Module/Sse.php index daf344f2d..fda2f2be4 100644 --- a/Zotlabs/Module/Sse.php +++ b/Zotlabs/Module/Sse.php @@ -19,13 +19,14 @@ class Sse extends Controller { function init() { + // This is important! + session_write_close(); + ignore_user_abort(true); + if((observer_prohibited(true))) { killme(); } - // this is important! - ignore_user_abort(true); - self::$uid = local_channel(); self::$ob_hash = get_observer_hash(); self::$sse_id = false; @@ -102,19 +103,9 @@ class Sse extends Controller { $lock = XConfig::Get(self::$ob_hash, 'sse', 'lock'); if (!$lock) { - $result_db = XConfig::Get(self::$ob_hash, 'sse', 'notifications', []); - } - - if (!empty($_SESSION['sysmsg'])) { - $result['notice']['notifications'] = $_SESSION['sysmsg']; + $result = XConfig::Get(self::$ob_hash, 'sse', 'notifications', []); } - if (!empty($_SESSION['sysmsg_info'])) { - $result['info']['notifications'] = $_SESSION['sysmsg_info']; - } - - $result = array_merge($result, $result_db); - // We do not have the local_channel in the addon. // Reset pubs here if the app is not installed. if (self::$uid && (!(self::$vnotify & VNOTIFY_PUBS) || !Apps::system_app_installed(self::$uid, 'Public Stream'))) { @@ -137,8 +128,9 @@ class Sse extends Controller { if (connection_status() != CONNECTION_NORMAL || connection_aborted()) { - // IMPORTANT: in case the channel was changed we need to reset the - // session here to it's current stored state. + // In case session_write_close() failed for some reason and + // the channel was changed we might need to reset the + // session to it's current stored state here. // Otherwise the uid might switch back to the previous value // in the background. @@ -147,9 +139,6 @@ class Sse extends Controller { XConfig::Set(self::$ob_hash, 'sse', 'timestamp', NULL_DATE); XConfig::Set(self::$ob_hash, 'sse', 'notifications', []); - $_SESSION['sysmsg'] = []; - $_SESSION['sysmsg_info'] = []; - if (ob_get_length() > 0) { ob_end_flush(); } @@ -168,12 +157,7 @@ class Sse extends Controller { usleep($sleep); if ($result) { - if ($result_db) { - XConfig::Set(self::$ob_hash, 'sse', 'notifications', []); - } - - $_SESSION['sysmsg'] = []; - $_SESSION['sysmsg_info'] = []; + XConfig::Set(self::$ob_hash, 'sse', 'notifications', []); } $i++; @@ -184,7 +168,7 @@ class Sse extends Controller { else { // Fallback to traditional polling - if(! self::$sse_id) { + if(!self::$sse_id) { // Update chat presence indication @@ -193,14 +177,14 @@ class Sse extends Controller { dbesc($_SERVER['REMOTE_ADDR']) ); $basic_presence = false; - if($r) { + if ($r) { $basic_presence = true; q("update chatpresence set cp_last = '%s' where cp_id = %d", dbesc(datetime_convert()), intval($r[0]['cp_id']) ); } - if(! $basic_presence) { + if (!$basic_presence) { q("insert into chatpresence ( cp_xchan, cp_last, cp_status, cp_client) values( '%s', '%s', '%s', '%s' ) ", dbesc(self::$ob_hash), @@ -212,34 +196,17 @@ class Sse extends Controller { } $result = []; - $result_db = []; XConfig::Load(self::$ob_hash); $lock = XConfig::Get(self::$ob_hash, 'sse', 'lock'); if (!$lock) { - $result_db = XConfig::Get(self::$ob_hash, 'sse', 'notifications', []); - } - - if (!empty($_SESSION['sysmsg'])) { - $result['notice']['notifications'] = $_SESSION['sysmsg']; - } - - if (!empty($_SESSION['sysmsg_info'])) { - $result['info']['notifications'] = $_SESSION['sysmsg_info']; + $result = XConfig::Get(self::$ob_hash, 'sse', 'notifications', []); } - $result = array_merge($result, $result_db); - - if($result) { - if ($result_db) { - XConfig::Set(self::$ob_hash, 'sse', 'notifications', []); - } - - $_SESSION['sysmsg'] = []; - $_SESSION['sysmsg_info'] = []; - + if ($result) { + XConfig::Set(self::$ob_hash, 'sse', 'notifications', []); json_return_and_die($result); } |