From a7d2f9b53005f0c27ddfe1ef32fab78591c5374f Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 15 Nov 2018 15:35:06 -0800 Subject: remove checkjs and nojs --- Zotlabs/Module/Nojs.php | 15 --------------- Zotlabs/Web/CheckJS.php | 50 ------------------------------------------------- 2 files changed, 65 deletions(-) delete mode 100644 Zotlabs/Module/Nojs.php delete mode 100644 Zotlabs/Web/CheckJS.php diff --git a/Zotlabs/Module/Nojs.php b/Zotlabs/Module/Nojs.php deleted file mode 100644 index 5f3d80ecd..000000000 --- a/Zotlabs/Module/Nojs.php +++ /dev/null @@ -1,15 +0,0 @@ - 1) ? intval(argv(1)) : 1); - setcookie('jsdisabled', $n, 0, '/'); - $p = hex2bin($_GET['redir']); - $hasq = strpbrk($p,'?&'); - goaway(z_root() . (($p) ? '/' . $p : '') . (($hasq) ? '' : '?f=' ) . '&jsdisabled=' . $n); - - } -} diff --git a/Zotlabs/Web/CheckJS.php b/Zotlabs/Web/CheckJS.php deleted file mode 100644 index e83ccf27b..000000000 --- a/Zotlabs/Web/CheckJS.php +++ /dev/null @@ -1,50 +0,0 @@ -jsdisabled = 1; - else - $this->jsdisabled = 0; - if(intval($_COOKIE['jsdisabled'])) - $this->jsdisabled = 1; - else - $this->jsdisabled = 0; - - $page = bin2hex(\App::$query_string); - - if(! $this->jsdisabled) { - if($test) { - $this->jsdisabled = 1; - if(array_key_exists('jsdisabled',$_COOKIE)) - $this->jsdisabled = $_COOKIE['jsdisabled']; - - if(! array_key_exists('jsdisabled',$_COOKIE)) { - \App::$page['htmlhead'] .= "\r\n" . '' . "\r\n"; - /* emulate JS cookie if cookies are not accepted */ - if (array_key_exists('jsdisabled',$_GET)) { - $_COOKIE['jsdisabled'] = $_GET['jsdisabled']; - } - } - } - else { - \App::$page['htmlhead'] .= "\r\n" . '' . "\r\n"; - } - } - - } - - function disabled() { - return $this->jsdisabled; - } - - -} - - -- cgit v1.2.3 From 8d2f4d9dfd90d218a68e0e36ccf537d800b09755 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 15 Nov 2018 16:02:29 -0800 Subject: mid -> uuid conversions for basic reactions --- Zotlabs/Module/Like.php | 6 ++++-- Zotlabs/Module/React.php | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php index 4e216f08b..c39726b88 100644 --- a/Zotlabs/Module/Like.php +++ b/Zotlabs/Module/Like.php @@ -371,10 +371,13 @@ class Like extends \Zotlabs\Web\Controller { } } - $mid = item_message_id(); + $uuid = item_message_id(); $arr = array(); + $arr['uuid'] = $uuid; + $arr['mid'] = z_root() . '/item/' . $uuid; + if($extended_like) { $arr['item_thread_top'] = 1; $arr['item_origin'] = 1; @@ -476,7 +479,6 @@ class Like extends \Zotlabs\Web\Controller { } - $arr['mid'] = $mid; $arr['aid'] = (($extended_like) ? $ch[0]['channel_account_id'] : $owner_aid); $arr['uid'] = $owner_uid; diff --git a/Zotlabs/Module/React.php b/Zotlabs/Module/React.php index fbb760786..3920301f5 100644 --- a/Zotlabs/Module/React.php +++ b/Zotlabs/Module/React.php @@ -44,6 +44,7 @@ class React extends \Zotlabs\Web\Controller { return; } + $uuid = item_message_id(); $n = array(); $n['aid'] = $channel['channel_account_id']; @@ -52,7 +53,8 @@ class React extends \Zotlabs\Web\Controller { $n['item_type'] = $i[0]['item_type']; $n['parent'] = $postid; $n['parent_mid'] = $i[0]['mid']; - $n['mid'] = item_message_id(); + $n['uuid'] = $uuid; + $n['mid'] = z_root() . '/item/' . $uuid; $n['verb'] = ACTIVITY_REACT . '#' . $emoji; $n['body'] = "\n\n[zmg=32x32]" . z_root() . '/images/emoji/' . $emoji . '.png[/zmg]' . "\n\n"; $n['author_xchan'] = $channel['channel_hash']; -- cgit v1.2.3 From 39d914c9dfe87021351cb2aad9feedd381e791ec Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 15 Nov 2018 16:34:09 -0800 Subject: add item.uuid to relevant places --- Zotlabs/Lib/NativeWiki.php | 17 ++++------------- Zotlabs/Module/Impel.php | 8 +++++--- Zotlabs/Module/Mood.php | 4 +++- Zotlabs/Module/Subthread.php | 6 ++++-- include/activities.php | 3 ++- include/attach.php | 14 +++++++++----- include/event.php | 7 +++++-- include/help.php | 3 ++- include/import.php | 3 ++- include/items.php | 3 ++- include/photos.php | 8 ++++++-- 11 files changed, 44 insertions(+), 32 deletions(-) diff --git a/Zotlabs/Lib/NativeWiki.php b/Zotlabs/Lib/NativeWiki.php index cdabbc3e9..e2bd07c0d 100644 --- a/Zotlabs/Lib/NativeWiki.php +++ b/Zotlabs/Lib/NativeWiki.php @@ -40,26 +40,17 @@ class NativeWiki { function create_wiki($channel, $observer_hash, $wiki, $acl) { - // Generate unique resource_id using the same method as item_message_id() - do { - $dups = false; - $resource_id = random_string(); - $r = q("SELECT mid FROM item WHERE resource_id = '%s' AND resource_type = '%s' AND uid = %d LIMIT 1", - dbesc($resource_id), - dbesc(NWIKI_ITEM_RESOURCE_TYPE), - intval($channel['channel_id']) - ); - if($r) - $dups = true; - } while($dups == true); + $resource_id = new_uuid(); + $uuid = new_uuid(); $ac = $acl->get(); - $mid = item_message_id(); + $mid = z_root() . '/item/' . $uuid; $arr = array(); // Initialize the array of parameters for the post $item_hidden = ((intval($wiki['postVisible']) === 0) ? 1 : 0); $wiki_url = z_root() . '/wiki/' . $channel['channel_address'] . '/' . $wiki['urlName']; $arr['aid'] = $channel['channel_account_id']; + $arr['uuid'] = $uuid; $arr['uid'] = $channel['channel_id']; $arr['mid'] = $mid; $arr['parent_mid'] = $mid; diff --git a/Zotlabs/Module/Impel.php b/Zotlabs/Module/Impel.php index 0c372bd96..e05027d9f 100644 --- a/Zotlabs/Module/Impel.php +++ b/Zotlabs/Module/Impel.php @@ -133,9 +133,11 @@ class Impel extends \Zotlabs\Web\Controller { $arr['author_xchan'] = (($j['author_xchan']) ? $j['author_xchan'] : get_observer_hash()); $arr['mimetype'] = (($j['mimetype']) ? $j['mimetype'] : 'text/bbcode'); - if(! $j['mid']) - $j['mid'] = item_message_id(); - + if(! $j['mid']) { + $j['uuid'] = item_message_id(); + $j['mid'] = z_root() . '/item/' . $j['uuid']; + } + $arr['uuid'] = $j['uuid']; $arr['mid'] = $arr['parent_mid'] = $j['mid']; diff --git a/Zotlabs/Module/Mood.php b/Zotlabs/Module/Mood.php index 16ef0b171..453f08f9f 100644 --- a/Zotlabs/Module/Mood.php +++ b/Zotlabs/Module/Mood.php @@ -70,7 +70,8 @@ class Mood extends Controller { $poster = App::get_observer(); - $mid = item_message_id(); + $uuid = item_message_id(); + $mid = z_root() . '/item/' . $uuid; $action = sprintf( t('%1$s is %2$s','mood'), '[zrl=' . $poster['xchan_url'] . ']' . $poster['xchan_name'] . '[/zrl]' , $verbs[$verb]); @@ -78,6 +79,7 @@ class Mood extends Controller { $arr['aid'] = get_account_id(); $arr['uid'] = $uid; + $arr['uuid'] = $uuid; $arr['mid'] = $mid; $arr['parent_mid'] = (($parent_mid) ? $parent_mid : $mid); $arr['author_xchan'] = $poster['xchan_hash']; diff --git a/Zotlabs/Module/Subthread.php b/Zotlabs/Module/Subthread.php index 1a9caff6c..54343fdfa 100644 --- a/Zotlabs/Module/Subthread.php +++ b/Zotlabs/Module/Subthread.php @@ -106,8 +106,9 @@ class Subthread extends \Zotlabs\Web\Controller { - $mid = item_message_id(); - + $uuid = item_message_id(); + $mid = z_root() . '/item/' . $uuid; + $post_type = (($item['resource_type'] === 'photo') ? t('photo') : t('status')); $links = array(array('rel' => 'alternate','type' => 'text/html', 'href' => $item['plink'])); @@ -145,6 +146,7 @@ class Subthread extends \Zotlabs\Web\Controller { $arr = array(); + $arr['uuid'] = $uuid; $arr['mid'] = $mid; $arr['aid'] = $owner_aid; $arr['uid'] = $owner_uid; diff --git a/include/activities.php b/include/activities.php index 9b83f7a5c..68c995338 100644 --- a/include/activities.php +++ b/include/activities.php @@ -16,7 +16,8 @@ function profile_activity($changed, $value) { return; $arr = array(); - $arr['mid'] = $arr['parent_mid'] = item_message_id(); + $arr['uuid'] = item_message_id(); + $arr['mid'] = $arr['parent_mid'] = z_root() . '/item/' . $arr['uuid']; $arr['uid'] = local_channel(); $arr['aid'] = $self['channel_account_id']; $arr['owner_xchan'] = $arr['author_xchan'] = $self['xchan_hash']; diff --git a/include/attach.php b/include/attach.php index 4db5bc435..6b0d3fb3b 100644 --- a/include/attach.php +++ b/include/attach.php @@ -1759,16 +1759,18 @@ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid, $arr_allow_cid = check_list_permissions($channel_id, $arr_allow_cid, 'view_storage'); } - $mid = item_message_id(); + $uuid = item_message_id(); + $mid = z_root() . '/item/' . $uuid; $objtype = ACTIVITY_OBJ_FILE; $arr = array(); $arr['aid'] = get_account_id(); $arr['uid'] = $channel_id; - $arr['item_wall'] = 1; - $arr['item_origin'] = 1; - $arr['item_unseen'] = 1; + $arr['uuid'] = $uuid; + $arr['item_wall'] = 1; + $arr['item_origin'] = 1; + $arr['item_unseen'] = 1; $arr['author_xchan'] = $poster['xchan_hash']; $arr['owner_xchan'] = $poster['xchan_hash']; $arr['title'] = ''; @@ -1813,8 +1815,10 @@ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid, $private = (($u_arr_allow_cid[0] || $u_arr_allow_gid[0] || $u_arr_deny_cid[0] || $u_arr_deny_gid[0]) ? 1 : 0); - $u_mid = item_message_id(); + $uuid = item_message_id(); + $u_mid = z_root() . '/item/' . $uuid; + $arr['uuid'] = $uuid; $arr['mid'] = $u_mid; $arr['parent_mid'] = $u_mid; $arr['allow_cid'] = perms2str($u_arr_allow_cid); diff --git a/include/event.php b/include/event.php index 84a16e8be..a34250e7a 100644 --- a/include/event.php +++ b/include/event.php @@ -1125,11 +1125,14 @@ function event_store_item($arr, $event) { } } - if(! $arr['mid']) - $arr['mid'] = item_message_id(); + if(! $arr['mid']) { + $arr['uuid'] = item_message_id(); + $arr['mid'] = z_root() . '/item/' . $arr['uuid']; + } $item_arr['aid'] = $z[0]['channel_account_id']; $item_arr['uid'] = $arr['uid']; + $item_arr['uuid'] = $arr['uuid']; $item_arr['author_xchan'] = $arr['event_xchan']; $item_arr['mid'] = $arr['mid']; $item_arr['parent_mid'] = $arr['mid']; diff --git a/include/help.php b/include/help.php index 3b56a7238..f2aa4add3 100644 --- a/include/help.php +++ b/include/help.php @@ -351,7 +351,8 @@ function store_doc_file($s) { $x = item_store_update($item); } else { - $item['mid'] = $item['parent_mid'] = item_message_id(); + $item['uuid'] = $item_message_id(); + $item['mid'] = $item['parent_mid'] = z_root() . '/item/' . $item['uuid']; $x = item_store($item); } diff --git a/include/import.php b/include/import.php index 6476aa688..53b21c317 100644 --- a/include/import.php +++ b/include/import.php @@ -1520,7 +1520,8 @@ function import_webpage_element($element, $channel, $type) { } else { // otherwise, generate the creation times and unique id $arr['created'] = datetime_convert('UTC', 'UTC'); - $arr['mid'] = $arr['parent_mid'] = item_message_id(); + $arr['uuid'] = item_message_id(); + $arr['mid'] = $arr['parent_mid'] = z_root() . '/item/' . $arr['uuid']; } // Update the edited time whether or not the element already exists $arr['edited'] = datetime_convert('UTC', 'UTC'); diff --git a/include/items.php b/include/items.php index 3d707a492..2baad3d04 100755 --- a/include/items.php +++ b/include/items.php @@ -4765,7 +4765,8 @@ function item_create_edit_activity($post) { $new_item['id'] = 0; $new_item['parent'] = 0; - $new_item['mid'] = item_message_id(); + $new_item['uuid'] = item_message_id(); + $new_item['mid'] = z_root() . '/item/' . $new_item['uuid']; $new_item['body'] = sprintf( t('[Edited %s]'), (($update_item['item_thread_top']) ? t('Post','edit_activity') : t('Comment','edit_activity'))); diff --git a/include/photos.php b/include/photos.php index d5553b495..ae51703e0 100644 --- a/include/photos.php +++ b/include/photos.php @@ -441,11 +441,13 @@ function photo_upload($channel, $observer, $args) { } } else { - $mid = item_message_id(); + $uuid = item_message_id(); + $mid = z_root() . '/item/' . $uuid; $arr = [ 'aid' => $account_id, 'uid' => $channel_id, + 'uuid' => $uuid, 'mid' => $mid, 'parent_mid' => $mid, 'item_hidden' => $item_hidden, @@ -827,12 +829,14 @@ function photos_create_item($channel, $creator_hash, $photo, $visible = false) { $item_hidden = (($visible) ? 0 : 1 ); - $mid = item_message_id(); + $uuid = item_message_id(); + $mid = z_root() . '/item/' . $uuid; $arr = array(); $arr['aid'] = $channel['channel_account_id']; $arr['uid'] = $channel['channel_id']; + $arr['uuid'] = $uuid; $arr['mid'] = $mid; $arr['parent_mid'] = $mid; $arr['item_wall'] = 1; -- cgit v1.2.3 From 5162459e4a77ccd1e4a4a68a2deae2a231947f62 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 15 Nov 2018 18:07:58 -0800 Subject: delivery report issue --- include/zot.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/zot.php b/include/zot.php index 580220182..9208a6a99 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1121,12 +1121,13 @@ function zot_process_response($hub, $arr, $outq) { } foreach($x['delivery_report'] as $xx) { - call_hooks('dreport_process',$xx); + call_hooks('dreport_process',$xx); if(is_array($xx) && array_key_exists('message_id',$xx) && DReport::is_storable($xx)) { - q("insert into dreport ( dreport_mid, dreport_site, dreport_recip, dreport_result, dreport_time, dreport_xchan ) values ( '%s', '%s','%s','%s','%s','%s' ) ", + q("insert into dreport ( dreport_mid, dreport_site, dreport_recip, dreport_name, dreport_result, dreport_time, dreport_xchan ) values ( '%s', '%s','%s','%s','%s','%s','%s' ) ", dbesc($xx['message_id']), dbesc($xx['location']), dbesc($xx['recipient']), + dbesc($xx['name']), dbesc($xx['status']), dbesc(datetime_convert($xx['date'])), dbesc($xx['sender']) -- cgit v1.2.3 From e42a401987bb34eed4d90bf22e36652fc907b063 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 15 Nov 2018 20:50:47 -0800 Subject: more work on the mid/uuid conversion --- Zotlabs/Module/Item.php | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 464daa516..1d64ef60c 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -2,6 +2,16 @@ namespace Zotlabs\Module; +use Zotlabs\Lib\IConfig; +use Zotlabs\Lib\Enotify; +use Zotlabs\Web\Controller; +use Zotlabs\Daemon\Master; + +require_once('include/crypto.php'); +require_once('include/items.php'); +require_once('include/security.php'); + + /** * * This is the POST destination for most all locally posted @@ -17,16 +27,8 @@ namespace Zotlabs\Module; * */ -require_once('include/crypto.php'); -require_once('include/items.php'); -require_once('include/attach.php'); -require_once('include/bbcode.php'); -require_once('include/security.php'); - - -use \Zotlabs\Lib as Zlib; -class Item extends \Zotlabs\Web\Controller { +class Item extends Controller { function post() { @@ -911,12 +913,12 @@ class Item extends \Zotlabs\Web\Controller { $datarray['title'] = mb_substr($datarray['title'],0,191); if($webpage) { - Zlib\IConfig::Set($datarray,'system', webpage_to_namespace($webpage), - (($pagetitle) ? $pagetitle : substr($datarray['mid'],0,16)),true); + IConfig::Set($datarray,'system', webpage_to_namespace($webpage), + (($pagetitle) ? $pagetitle : basename($datarray['mid'])), true); } elseif($namespace) { - Zlib\IConfig::Set($datarray,'system', $namespace, - (($remote_id) ? $remote_id : substr($datarray['mid'],0,16)),true); + IConfig::Set($datarray,'system', $namespace, + (($remote_id) ? $remote_id : basename($datarray['mid'])), true); } @@ -948,7 +950,7 @@ class Item extends \Zotlabs\Web\Controller { } } if(! $nopush) - \Zotlabs\Daemon\Master::Summon(array('Notifier', 'edit_post', $post_id)); + Master::Summon([ 'Notifier', 'edit_post', $post_id ]); if($api_source) @@ -983,7 +985,7 @@ class Item extends \Zotlabs\Web\Controller { // otherwise it will happen during delivery if(($datarray['owner_xchan'] != $datarray['author_xchan']) && (intval($parent_item['item_wall']))) { - Zlib\Enotify::submit(array( + Enotify::submit(array( 'type' => NOTIFY_COMMENT, 'from_xchan' => $datarray['author_xchan'], 'to_xchan' => $datarray['owner_xchan'], @@ -1001,7 +1003,7 @@ class Item extends \Zotlabs\Web\Controller { $parent = $post_id; if(($datarray['owner_xchan'] != $datarray['author_xchan']) && ($datarray['item_type'] == ITEM_TYPE_POST)) { - Zlib\Enotify::submit(array( + Enotify::submit(array( 'type' => NOTIFY_WALL, 'from_xchan' => $datarray['author_xchan'], 'to_xchan' => $datarray['owner_xchan'], @@ -1063,7 +1065,7 @@ class Item extends \Zotlabs\Web\Controller { call_hooks('post_local_end', $datarray); if(! $nopush) - \Zotlabs\Daemon\Master::Summon(array('Notifier', $notify_type, $post_id)); + Master::Summon([ 'Notifier', $notify_type, $post_id ]); logger('post_complete'); -- cgit v1.2.3 From b0689614bff4272f90b0c3f064ca91b16cb392e0 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 15 Nov 2018 21:14:14 -0800 Subject: datetime_convert wrong args --- Zotlabs/Lib/Libzot.php | 2 +- include/zot.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index 010735487..70f013eb7 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -1006,7 +1006,7 @@ logger('4'); dbesc($xx['recipient']), dbesc($xx['name']), dbesc($xx['status']), - dbesc(datetime_convert($xx['date'])), + dbesc(datetime_convert('UTC','UTC',$xx['date'])), dbesc($xx['sender']) ); } diff --git a/include/zot.php b/include/zot.php index 9208a6a99..d031b4a96 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1129,7 +1129,7 @@ function zot_process_response($hub, $arr, $outq) { dbesc($xx['recipient']), dbesc($xx['name']), dbesc($xx['status']), - dbesc(datetime_convert($xx['date'])), + dbesc(datetime_convert('UTC','UTC',$xx['date'])), dbesc($xx['sender']) ); } -- cgit v1.2.3