From 191edfdaa137cc537f2a52929093bd6308b6a786 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 31 May 2018 21:05:09 -0700 Subject: [PATCH] more heavy lifting --- Zotlabs/Daemon/Cron.php | 5 ++-- Zotlabs/Daemon/Importfile.php | 4 ++- Zotlabs/Daemon/Notifier.php | 1 - Zotlabs/Daemon/Queue.php | 6 +--- Zotlabs/Daemon/Ratenotif.php | 3 -- Zotlabs/Lib/Activity.php | 5 ++-- Zotlabs/Lib/Apps.php | 6 ++-- Zotlabs/Lib/Chatroom.php | 4 ++- Zotlabs/Lib/Libzot.php | 43 +++++++++++++--------------- Zotlabs/Lib/ThreadStream.php | 1 - Zotlabs/Module/Block.php | 1 - Zotlabs/Module/Cal.php | 2 +- Zotlabs/Module/Channel.php | 1 - Zotlabs/Module/Chat.php | 4 ++- Zotlabs/Module/Connect.php | 2 -- Zotlabs/Module/Connedit.php | 4 +-- Zotlabs/Module/Defperms.php | 3 +- Zotlabs/Module/Display.php | 1 - Zotlabs/Module/Editpost.php | 1 - Zotlabs/Module/Events.php | 7 +++-- Zotlabs/Module/Feed.php | 2 -- Zotlabs/Module/File_upload.php | 6 ++-- Zotlabs/Module/Filer.php | 2 -- Zotlabs/Module/Filestorage.php | 5 +++- Zotlabs/Module/Follow.php | 4 ++- Zotlabs/Module/Group.php | 5 +++- Zotlabs/Module/Home.php | 3 +- Zotlabs/Module/Hq.php | 1 - Zotlabs/Module/Item.php | 13 ++++----- Zotlabs/Module/Like.php | 9 +++--- Zotlabs/Module/Mail.php | 4 +-- Zotlabs/Module/Moderate.php | 4 ++- Zotlabs/Module/Mood.php | 2 -- Zotlabs/Module/Network.php | 5 +--- Zotlabs/Module/Notes.php | 4 ++- Zotlabs/Module/Page.php | 2 +- Zotlabs/Module/Pconfig.php | 3 +- Zotlabs/Module/Pdledit.php | 3 +- Zotlabs/Module/Photos.php | 11 +++---- Zotlabs/Module/Poke.php | 2 -- Zotlabs/Module/Profile.php | 1 - Zotlabs/Module/Profile_photo.php | 7 +++-- Zotlabs/Module/Profiles.php | 4 ++- Zotlabs/Module/Rbmark.php | 1 - Zotlabs/Module/Search.php | 9 +++--- Zotlabs/Module/Settings/Channel.php | 4 ++- Zotlabs/Module/Settings/Display.php | 4 ++- Zotlabs/Module/Settings/Featured.php | 4 ++- Zotlabs/Module/Settings/Features.php | 3 +- Zotlabs/Module/Settings/Permcats.php | 5 ++-- Zotlabs/Module/Starred.php | 3 +- Zotlabs/Module/Subthread.php | 1 - Zotlabs/Module/Tagger.php | 6 ++-- Zotlabs/Module/Thing.php | 10 ++++--- Zotlabs/Module/Wall_attach.php | 4 ++- Zotlabs/Module/Zotfeed.php | 1 - Zotlabs/Storage/Directory.php | 9 +++--- Zotlabs/Storage/File.php | 7 +++-- Zotlabs/Zot6/Zot6Handler.php | 2 +- boot.php | 2 +- include/activities.php | 2 -- include/api.php | 2 -- include/attach.php | 8 +++--- include/channel.php | 4 +-- include/conversation.php | 2 -- include/group.php | 10 ++++--- include/items.php | 12 ++++---- include/menu.php | 5 +++- include/message.php | 7 +++-- include/photos.php | 1 - include/queue_fn.php | 7 +++-- util/connect | 4 ++- util/dmkdir | 5 +++- util/pconfig | 4 ++- 74 files changed, 190 insertions(+), 164 deletions(-) diff --git a/Zotlabs/Daemon/Cron.php b/Zotlabs/Daemon/Cron.php index 01c43262a..06ce2f86f 100644 --- a/Zotlabs/Daemon/Cron.php +++ b/Zotlabs/Daemon/Cron.php @@ -2,6 +2,8 @@ namespace Zotlabs\Daemon; +use Zotlabs\Lib\Libzot; + class Cron { static public function run($argc,$argv) { @@ -55,7 +57,6 @@ class Cron { db_utcnow() ); if($r) { - require_once('include/items.php'); foreach($r as $rr) drop_item($rr['id'],false); } @@ -110,7 +111,7 @@ class Cron { if($z) { xchan_query($z); $sync_item = fetch_post_tags($z); - build_sync_packet($sync_item[0]['uid'], + Libzot::build_sync_packet($sync_item[0]['uid'], [ 'item' => [ encode_item($sync_item[0],true) ] ] diff --git a/Zotlabs/Daemon/Importfile.php b/Zotlabs/Daemon/Importfile.php index c68ed21cf..4862b5553 100644 --- a/Zotlabs/Daemon/Importfile.php +++ b/Zotlabs/Daemon/Importfile.php @@ -2,6 +2,8 @@ namespace Zotlabs\Daemon; +use Zotlabs\Lib\Libzot; + class Importfile { static public function run($argc,$argv){ @@ -40,7 +42,7 @@ class Importfile { $sync = attach_export_data($channel,$hash); if($sync) - build_sync_packet($channel['channel_id'],array('file' => array($sync))); + Libzot::build_sync_packet($channel['channel_id'],array('file' => array($sync))); return; } diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php index 9a0b86c70..c5a79db8b 100644 --- a/Zotlabs/Daemon/Notifier.php +++ b/Zotlabs/Daemon/Notifier.php @@ -8,7 +8,6 @@ use Zotlabs\Lib\Libzot; require_once('include/queue_fn.php'); require_once('include/html2plain.php'); require_once('include/conversation.php'); -require_once('include/items.php'); require_once('include/bbcode.php'); diff --git a/Zotlabs/Daemon/Queue.php b/Zotlabs/Daemon/Queue.php index f5338d862..8fdddd23a 100644 --- a/Zotlabs/Daemon/Queue.php +++ b/Zotlabs/Daemon/Queue.php @@ -3,16 +3,12 @@ namespace Zotlabs\Daemon; require_once('include/queue_fn.php'); - +require_once('include/bbcode.php'); class Queue { static public function run($argc,$argv) { - require_once('include/items.php'); - require_once('include/bbcode.php'); - - if($argc > 1) $queue_id = $argv[1]; else diff --git a/Zotlabs/Daemon/Ratenotif.php b/Zotlabs/Daemon/Ratenotif.php index 271e4e5eb..8ecf25162 100644 --- a/Zotlabs/Daemon/Ratenotif.php +++ b/Zotlabs/Daemon/Ratenotif.php @@ -11,9 +11,6 @@ class Ratenotif { static public function run($argc,$argv) { - require_once("datetime.php"); - require_once('include/items.php'); - if($argc < 3) return; diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index ce6ad76cc..8c10ee48b 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -2,6 +2,7 @@ namespace Zotlabs\Lib; +use Zotlabs\Lib\Libzot; class Activity { @@ -602,7 +603,7 @@ class Activity { 'publicKeyPem' => $p['xchan_pubkey'] ]; - $locs = zot_encode_locations($c); + $locs = Libzot::encode_locations($c); if($locs) { $ret['nomadicLocations'] = []; foreach($locs as $loc) { @@ -902,7 +903,7 @@ class Activity { if($abconfig) $clone['abconfig'] = $abconfig; - build_sync_packet($channel['channel_id'], [ 'abook' => array($clone) ] ); + Libzot::build_sync_packet($channel['channel_id'], [ 'abook' => array($clone) ] ); } } diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 2dded1aaa..2c5adb45b 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -2,6 +2,8 @@ namespace Zotlabs\Lib; +use Zotlabs\Lib\Libzot; + /** * Apps * @@ -445,7 +447,7 @@ class Apps { intval(TERM_OBJ_APP), intval($r[0]['id']) ); - build_sync_packet($uid,array('app' => $r[0])); + Libzot::build_sync_packet($uid,array('app' => $r[0])); } } } @@ -483,7 +485,7 @@ class Apps { ); // we don't sync system apps - they may be completely different on the other system - build_sync_packet($uid,array('app' => $x)); + Libzot::build_sync_packet($uid,array('app' => $x)); } } else { diff --git a/Zotlabs/Lib/Chatroom.php b/Zotlabs/Lib/Chatroom.php index 882c846cd..2556509f3 100644 --- a/Zotlabs/Lib/Chatroom.php +++ b/Zotlabs/Lib/Chatroom.php @@ -1,6 +1,8 @@ $r)); + Libzot::build_sync_packet($channel['channel_id'],array('chatroom' => $r)); q("delete from chatroom where cr_id = %d", intval($r[0]['cr_id']) diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index f24f4c7cf..04597e1a0 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -9,7 +9,6 @@ namespace Zotlabs\Lib; */ require_once('include/crypto.php'); -require_once('include/items.php'); require_once('include/queue_fn.php'); @@ -112,14 +111,14 @@ class Libzot { 'type' => $type, 'sender' => [ 'id' => $channel['channel_guid'], - 'id_sig' => zot_sign($channel['channel_guid'],$channel['channel_prvkey'],$sig_method), + 'id_sig' => self::sign($channel['channel_guid'],$channel['channel_prvkey'],$sig_method), 'id_url' => z_root() . '/channel/' . $channel['channel_address'], 'location' => z_root(), - 'location_sig' => zot_sign(z_root(),$channel['channel_prvkey'],$sig_method), + 'location_sig' => self::sign(z_root(),$channel['channel_prvkey'],$sig_method), 'sitekey' => get_config('system','pubkey') ], 'callback' => '/zot', - 'version' => Zotlabs\Lib\System::get_zot_revision(), + 'version' => \Zotlabs\Lib\System::get_zot_revision(), 'encryption' => crypto_methods(), 'signing' => signing_methods() ]; @@ -390,7 +389,7 @@ class Libzot { else { // if we were just granted read stream permission and didn't have it before, try to pull in some posts if((! $old_read_stream_perm) && (intval($permissions['view_stream']))) - Zotlabs\Daemon\Master::Summon(array('Onepoll',$r[0]['abook_id'])); + \Zotlabs\Daemon\Master::Summon(array('Onepoll',$r[0]['abook_id'])); } } else { @@ -439,8 +438,8 @@ class Libzot { if($new_connection) { if(! \Zotlabs\Access\Permissions::PermsCompare($new_perms,$previous_perms)) - Zotlabs\Daemon\Master::Summon(array('Notifier','permission_create',$new_connection[0]['abook_id'])); - Zotlabs\Lib\Enotify::submit( + \Zotlabs\Daemon\Master::Summon(array('Notifier','permission_create',$new_connection[0]['abook_id'])); + \Zotlabs\Lib\Enotify::submit( [ 'type' => NOTIFY_INTRO, 'from_xchan' => $x['hash'], @@ -452,7 +451,7 @@ class Libzot { if(intval($permissions['view_stream'])) { if(intval(get_pconfig($channel['channel_id'],'perm_limits','send_stream') & PERMS_PENDING) || (! intval($new_connection[0]['abook_pending']))) - Zotlabs\Daemon\Master::Summon(array('Onepoll',$new_connection[0]['abook_id'])); + \Zotlabs\Daemon\Master::Summon(array('Onepoll',$new_connection[0]['abook_id'])); } @@ -1522,7 +1521,7 @@ class Libzot { // has a recipient, but in fact we don't require this, so it's technically // possible to send mail to anybody that's listening. - $recips = public_recips($msg); + $recips = self::public_recips($msg); if(! $recips) return $recips; @@ -1604,7 +1603,7 @@ class Libzot { foreach($deliveries as $d) { $local_public = $public; - $DR = new Zotlabs\Lib\DReport(z_root(),$sender['hash'],$d['hash'],$arr['mid']); + $DR = new \Zotlabs\Lib\DReport(z_root(),$sender['hash'],$d['hash'],$arr['mid']); $r = q("select * from channel where channel_hash = '%s' limit 1", dbesc($d['hash']) @@ -1718,7 +1717,7 @@ class Libzot { if((! $relay) && (! $request) && (! $local_public) && perm_is_allowed($channel['channel_id'],$sender['hash'],'send_stream')) { - Zotlabs\Daemon\Master::Summon(array('Notifier', 'request', $channel['channel_id'], $sender['hash'], $arr['parent_mid'])); + \Zotlabs\Daemon\Master::Summon(array('Notifier', 'request', $channel['channel_id'], $sender['hash'], $arr['parent_mid'])); } continue; } @@ -1790,7 +1789,7 @@ class Libzot { if($relay && $item_id) { logger('process_delivery: invoking relay'); - Zotlabs\Daemon\Master::Summon(array('Notifier','relay',intval($item_id))); + \Zotlabs\Daemon\Master::Summon(array('Notifier','relay',intval($item_id))); $DR->update('relayed'); $result[] = $DR->get(); } @@ -1900,7 +1899,7 @@ class Libzot { if($relay && $item_id) { logger('Invoking relay'); - Zotlabs\Daemon\Master::Summon(array('Notifier','relay',intval($item_id))); + \Zotlabs\Daemon\Master::Summon(array('Notifier','relay',intval($item_id))); $DR->addto_update('relayed'); $result[] = $DR->get(); } @@ -2095,8 +2094,6 @@ class Libzot { return false; } - require_once('include/items.php'); - if($item_found) { if(intval($r[0]['item_deleted'])) { logger('delete_imported_item: item was already deleted'); @@ -2140,7 +2137,7 @@ class Libzot { foreach($deliveries as $d) { - $DR = new Zotlabs\Lib\DReport(z_root(),$sender['hash'],$d['hash'],$arr['mid']); + $DR = new \Zotlabs\Lib\DReport(z_root(),$sender['hash'],$d['hash'],$arr['mid']); $r = q("select * from channel where channel_hash = '%s' limit 1", dbesc($d['hash']) @@ -3118,7 +3115,7 @@ class Libzot { $synchubs = array(); foreach($h as $x) { - if($x['hubloc_host'] == App::get_hostname()) + if($x['hubloc_host'] == \App::get_hostname()) continue; $y = q("select site_dead from site where site_url = '%s' limit 1", @@ -3226,7 +3223,7 @@ class Libzot { } - Zotlabs\Daemon\Master::Summon(array('Deliver', $hash)); + \Zotlabs\Daemon\Master::Summon(array('Deliver', $hash)); $total = $total - 1; if($interval && $total) @@ -3822,11 +3819,11 @@ class Libzot { // we should probably do this for all items, but usually we only send one. if(array_key_exists('item',$arr) && is_array($arr['item'][0])) { - $DR = new Zotlabs\Lib\DReport(z_root(),$d['hash'],$d['hash'],$arr['item'][0]['message_id'],'channel sync processed'); + $DR = new \Zotlabs\Lib\DReport(z_root(),$d['hash'],$d['hash'],$arr['item'][0]['message_id'],'channel sync processed'); $DR->addto_recipient($channel['channel_name'] . ' <' . channel_reddress($channel) . '>'); } else - $DR = new Zotlabs\Lib\DReport(z_root(),$d['hash'],$d['hash'],'sync packet','channel sync delivered'); + $DR = new \Zotlabs\Lib\DReport(z_root(),$d['hash'],$d['hash'],'sync packet','channel sync delivered'); $result[] = $DR->get(); } @@ -4229,7 +4226,7 @@ class Libzot { $ret['site']['encryption'] = crypto_methods(); - $ret['site']['zot'] = Zotlabs\Lib\System::get_zot_revision(); + $ret['site']['zot'] = \Zotlabs\Lib\System::get_zot_revision(); // hide detailed site information if you're off the grid @@ -4277,8 +4274,8 @@ class Libzot { $ret['site']['sellpage'] = get_config('system','sellpage'); $ret['site']['location'] = get_config('system','site_location'); $ret['site']['realm'] = get_directory_realm(); - $ret['site']['project'] = Zotlabs\Lib\System::get_platform_name() . ' ' . Zotlabs\Lib\System::get_server_role(); - $ret['site']['version'] = Zotlabs\Lib\System::get_project_version(); + $ret['site']['project'] = \Zotlabs\Lib\System::get_platform_name() . ' ' . \Zotlabs\Lib\System::get_server_role(); + $ret['site']['version'] = \Zotlabs\Lib\System::get_project_version(); } diff --git a/Zotlabs/Lib/ThreadStream.php b/Zotlabs/Lib/ThreadStream.php index d0c964149..99d19024d 100644 --- a/Zotlabs/Lib/ThreadStream.php +++ b/Zotlabs/Lib/ThreadStream.php @@ -4,7 +4,6 @@ namespace Zotlabs\Lib; require_once('boot.php'); require_once('include/text.php'); -require_once('include/items.php'); /** * A list of threads diff --git a/Zotlabs/Module/Block.php b/Zotlabs/Module/Block.php index d0fed44fe..9f175bb45 100644 --- a/Zotlabs/Module/Block.php +++ b/Zotlabs/Module/Block.php @@ -1,7 +1,6 @@ $x)); + Libzot::build_sync_packet(0, array('chatroom' => $x)); if($x) goaway(z_root() . '/chat/' . $channel['channel_address'] . '/' . $x[0]['cr_id']); diff --git a/Zotlabs/Module/Connect.php b/Zotlabs/Module/Connect.php index cd43ea290..9734b311f 100644 --- a/Zotlabs/Module/Connect.php +++ b/Zotlabs/Module/Connect.php @@ -4,8 +4,6 @@ namespace Zotlabs\Module; /** @file */ require_once('include/contact_widgets.php'); -require_once('include/items.php'); - class Connect extends \Zotlabs\Web\Controller { diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index 4d111236d..80f40ccf7 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -374,7 +374,7 @@ class Connedit extends \Zotlabs\Web\Controller { if($abconfig) $clone['abconfig'] = $abconfig; - build_sync_packet(0 /* use the current local_channel */, array('abook' => array($clone))); + Libzot::build_sync_packet(0 /* use the current local_channel */, array('abook' => array($clone))); } /* @brief Generate content of connection edit page @@ -546,7 +546,7 @@ class Connedit extends \Zotlabs\Web\Controller { // PLACEHOLDER contact_remove(local_channel(), $orig_record[0]['abook_id']); - build_sync_packet(0 /* use the current local_channel */, + Libzot::build_sync_packet(0 /* use the current local_channel */, array('abook' => array(array( 'abook_xchan' => $orig_record[0]['abook_xchan'], 'entry_deleted' => true)) diff --git a/Zotlabs/Module/Defperms.php b/Zotlabs/Module/Defperms.php index 97d9cfd1d..eae60d11f 100644 --- a/Zotlabs/Module/Defperms.php +++ b/Zotlabs/Module/Defperms.php @@ -1,6 +1,7 @@ array($clone))); + Libzot::build_sync_packet(0 /* use the current local_channel */, array('abook' => array($clone))); } /* @brief Generate content of connection default permissions page diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index a127ab196..dfeae9cad 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -5,7 +5,6 @@ require_once("include/bbcode.php"); require_once('include/security.php'); require_once('include/conversation.php'); require_once('include/acl_selectors.php'); -require_once('include/items.php'); class Display extends \Zotlabs\Web\Controller { diff --git a/Zotlabs/Module/Editpost.php b/Zotlabs/Module/Editpost.php index 45d8e7644..9e196db72 100644 --- a/Zotlabs/Module/Editpost.php +++ b/Zotlabs/Module/Editpost.php @@ -3,7 +3,6 @@ namespace Zotlabs\Module; /** @file */ require_once('include/acl_selectors.php'); require_once('include/crypto.php'); -require_once('include/items.php'); require_once('include/taxonomy.php'); require_once('include/conversation.php'); diff --git a/Zotlabs/Module/Events.php b/Zotlabs/Module/Events.php index 33c8b8249..1c030a732 100644 --- a/Zotlabs/Module/Events.php +++ b/Zotlabs/Module/Events.php @@ -1,11 +1,12 @@ array(encode_item($sync_item[0],true)),'event' => $z)); + Libzot::build_sync_packet($channel['channel_id'],array('event_item' => array(encode_item($sync_item[0],true)),'event' => $z)); } } } @@ -726,7 +727,7 @@ class Events extends \Zotlabs\Web\Controller { intval(local_channel()) ); $sync_event['event_deleted'] = 1; - build_sync_packet(0,array('event' => array($sync_event))); + Libzot::build_sync_packet(0,array('event' => array($sync_event))); info( t('Event removed') . EOL); } diff --git a/Zotlabs/Module/Feed.php b/Zotlabs/Module/Feed.php index 36869abbe..dd7691835 100644 --- a/Zotlabs/Module/Feed.php +++ b/Zotlabs/Module/Feed.php @@ -3,8 +3,6 @@ namespace Zotlabs\Module; -require_once('include/items.php'); - class Feed extends \Zotlabs\Web\Controller { function init() { diff --git a/Zotlabs/Module/File_upload.php b/Zotlabs/Module/File_upload.php index 4d1cc4cda..ab6761474 100644 --- a/Zotlabs/Module/File_upload.php +++ b/Zotlabs/Module/File_upload.php @@ -1,6 +1,8 @@ array($sync))); + Libzot::build_sync_packet($channel['channel_id'],array('file' => array($sync))); } goaway(z_root() . '/cloud/' . $channel['channel_address'] . '/' . $r['data']['display_path']); @@ -97,7 +99,7 @@ class File_upload extends \Zotlabs\Web\Controller { if($r['success']) { $sync = attach_export_data($channel,$r['data']['hash']); if($sync) - build_sync_packet($channel['channel_id'],array('file' => array($sync))); + Libzot::build_sync_packet($channel['channel_id'],array('file' => array($sync))); } } diff --git a/Zotlabs/Module/Filer.php b/Zotlabs/Module/Filer.php index af59f28fb..5414e07b2 100644 --- a/Zotlabs/Module/Filer.php +++ b/Zotlabs/Module/Filer.php @@ -3,8 +3,6 @@ namespace Zotlabs\Module; require_once('include/security.php'); require_once('include/bbcode.php'); -require_once('include/items.php'); - class Filer extends \Zotlabs\Web\Controller { diff --git a/Zotlabs/Module/Filestorage.php b/Zotlabs/Module/Filestorage.php index cd9ab601d..bba4eeaf1 100644 --- a/Zotlabs/Module/Filestorage.php +++ b/Zotlabs/Module/Filestorage.php @@ -5,6 +5,9 @@ namespace Zotlabs\Module; * */ + +use Zotlabs\Lib\Libzot; + class Filestorage extends \Zotlabs\Web\Controller { function post() { @@ -124,7 +127,7 @@ class Filestorage extends \Zotlabs\Web\Controller { if(! $admin_delete) { $sync = attach_export_data($channel, $f['hash'], true); if($sync) { - build_sync_packet($channel['channel_id'], array('file' => array($sync))); + Libzot::build_sync_packet($channel['channel_id'], array('file' => array($sync))); } } diff --git a/Zotlabs/Module/Follow.php b/Zotlabs/Module/Follow.php index 6d68d5881..e2e7af174 100644 --- a/Zotlabs/Module/Follow.php +++ b/Zotlabs/Module/Follow.php @@ -1,6 +1,8 @@ array($clone)), true); + Libzot::build_sync_packet(0 /* use the current local_channel */, array('abook' => array($clone)), true); $can_view_stream = their_perms_contains($channel['channel_id'],$clone['abook_xchan'],'view_stream'); diff --git a/Zotlabs/Module/Group.php b/Zotlabs/Module/Group.php index 93a089d02..ec7cfc778 100644 --- a/Zotlabs/Module/Group.php +++ b/Zotlabs/Module/Group.php @@ -1,6 +1,9 @@ 1); @@ -918,7 +918,7 @@ logger('linkify: ' . print_r($results,true)); if($r) { xchan_query($r); $sync_item = fetch_post_tags($r); - build_sync_packet($profile_uid,array('item' => array(encode_item($sync_item[0],true)))); + Libzot::build_sync_packet($profile_uid,array('item' => array(encode_item($sync_item[0],true)))); } } if(! $nopush) @@ -1027,7 +1027,7 @@ logger('linkify: ' . print_r($results,true)); if($r) { xchan_query($r); $sync_item = fetch_post_tags($r); - build_sync_packet($profile_uid,array('item' => array(encode_item($sync_item[0],true)))); + Libzot::build_sync_packet($profile_uid,array('item' => array(encode_item($sync_item[0],true)))); } } @@ -1073,9 +1073,6 @@ logger('linkify: ' . print_r($results,true)); if((argc() == 3) && (argv(1) === 'drop') && intval(argv(2))) { - 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)) ); @@ -1129,7 +1126,7 @@ logger('linkify: ' . print_r($results,true)); if($r) { xchan_query($r); $sync_item = fetch_post_tags($r); - build_sync_packet($i[0]['uid'],array('item' => array(encode_item($sync_item[0],true)))); + Libzot::build_sync_packet($i[0]['uid'],array('item' => array(encode_item($sync_item[0],true)))); } if($complex) { diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php index 4e216f08b..9efdb34da 100644 --- a/Zotlabs/Module/Like.php +++ b/Zotlabs/Module/Like.php @@ -1,10 +1,10 @@ $z)); + Libzot::build_sync_packet($ch[0]['channel_id'],array('likes' => $z)); q("delete from likes where id = %d", intval($z[0]['id']) @@ -342,7 +342,6 @@ class Like extends \Zotlabs\Web\Controller { if($r) { // already liked it. Drop that item. - require_once('include/items.php'); foreach($r as $rr) { drop_item($rr['id'],false,DROPITEM_PHASE1); // set the changed timestamp on the parent so we'll see the update without a page reload @@ -553,7 +552,7 @@ class Like extends \Zotlabs\Web\Controller { dbesc($obj_id) ); if($r) - build_sync_packet($ch[0]['channel_id'],array('likes' => $r)); + Libzot::build_sync_packet($ch[0]['channel_id'],array('likes' => $r)); } diff --git a/Zotlabs/Module/Mail.php b/Zotlabs/Module/Mail.php index 6cc878d16..f9753f201 100644 --- a/Zotlabs/Module/Mail.php +++ b/Zotlabs/Module/Mail.php @@ -110,7 +110,7 @@ class Mail extends \Zotlabs\Web\Controller { if($ret['success']) { xchan_mail_query($ret['mail']); - build_sync_packet(0,array('conv' => array($ret['conv']),'mail' => array(encode_mail($ret['mail'],true)))); + Libzot::build_sync_packet(0,array('conv' => array($ret['conv']),'mail' => array(encode_mail($ret['mail'],true)))); } else { notice($ret['message']); @@ -188,7 +188,7 @@ class Mail extends \Zotlabs\Web\Controller { intval(local_channel()) ); if($x) { - build_sync_packet(local_channel(),array('mail' => encode_mail($x[0],true))); + Libzot::build_sync_packet(local_channel(),array('mail' => encode_mail($x[0],true))); } \Zotlabs\Daemon\Master::Summon(array('Notifier','mail',intval(argv(3)))); diff --git a/Zotlabs/Module/Moderate.php b/Zotlabs/Module/Moderate.php index a7c98e05e..10de20b5d 100644 --- a/Zotlabs/Module/Moderate.php +++ b/Zotlabs/Module/Moderate.php @@ -2,6 +2,8 @@ namespace Zotlabs\Module; +use Zotlabs\Lib\Libzot; + require_once('include/conversation.php'); @@ -77,7 +79,7 @@ class Moderate extends \Zotlabs\Web\Controller { if($r) { xchan_query($r); $sync_item = fetch_post_tags($r); - build_sync_packet(local_channel(),array('item' => array(encode_item($sync_item[0],true)))); + Libzot::build_sync_packet(local_channel(),array('item' => array(encode_item($sync_item[0],true)))); } if($action === 'approve') { \Zotlabs\Daemon\Master::Summon(array('Notifier', 'comment-new', $post_id)); diff --git a/Zotlabs/Module/Mood.php b/Zotlabs/Module/Mood.php index ad29ec7e8..0b1567938 100644 --- a/Zotlabs/Module/Mood.php +++ b/Zotlabs/Module/Mood.php @@ -3,8 +3,6 @@ namespace Zotlabs\Module; require_once('include/security.php'); require_once('include/bbcode.php'); -require_once('include/items.php'); - class Mood extends \Zotlabs\Web\Controller { diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index ee3e839b1..5d509dde2 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -1,7 +1,6 @@ 1) && (argv(1) === 'sync')) { require_once('include/zot.php'); - build_sync_packet(); + Libzot::build_sync_packet(); } logger('notes saved.', LOGGER_DEBUG); diff --git a/Zotlabs/Module/Page.php b/Zotlabs/Module/Page.php index 5fdd32825..f4c166c70 100644 --- a/Zotlabs/Module/Page.php +++ b/Zotlabs/Module/Page.php @@ -1,7 +1,7 @@ array($sync))); + Libzot::build_sync_packet($page_owner_uid,array('file' => array($sync))); } } @@ -189,7 +190,7 @@ class Photos extends \Zotlabs\Web\Controller { $sync = attach_export_data(\App::$data['channel'],$r[0]['resource_id'], true); if($sync) - build_sync_packet($page_owner_uid,array('file' => array($sync))); + Libzot::build_sync_packet($page_owner_uid,array('file' => array($sync))); } elseif(is_site_admin()) { // If the admin deletes a photo, don't sync @@ -210,7 +211,7 @@ class Photos extends \Zotlabs\Web\Controller { $sync = attach_export_data(\App::$data['channel'],argv(2),true); if($sync) - build_sync_packet($page_owner_uid,array('file' => array($sync))); + Libzot::build_sync_packet($page_owner_uid,array('file' => array($sync))); if(! ($_POST['desc'] && $_POST['newtag'])) goaway(z_root() . '/' . $_SESSION['photo_return']); @@ -449,7 +450,7 @@ class Photos extends \Zotlabs\Web\Controller { $sync = attach_export_data(\App::$data['channel'],$resource_id); if($sync) - build_sync_packet($page_owner_uid,array('file' => array($sync))); + Libzot::build_sync_packet($page_owner_uid,array('file' => array($sync))); goaway(z_root() . '/' . $_SESSION['photo_return']); return; // NOTREACHED diff --git a/Zotlabs/Module/Poke.php b/Zotlabs/Module/Poke.php index d13ec5ced..c6902b6c0 100644 --- a/Zotlabs/Module/Poke.php +++ b/Zotlabs/Module/Poke.php @@ -15,8 +15,6 @@ namespace Zotlabs\Module; /** @file */ * */ -require_once('include/items.php'); - class Poke extends \Zotlabs\Web\Controller { diff --git a/Zotlabs/Module/Profile.php b/Zotlabs/Module/Profile.php index 4235f0b97..33340c9ec 100644 --- a/Zotlabs/Module/Profile.php +++ b/Zotlabs/Module/Profile.php @@ -2,7 +2,6 @@ namespace Zotlabs\Module; /** @file */ require_once('include/contact_widgets.php'); -require_once('include/items.php'); require_once("include/bbcode.php"); require_once('include/security.php'); require_once('include/conversation.php'); diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php index 751c4338f..84b467681 100644 --- a/Zotlabs/Module/Profile_photo.php +++ b/Zotlabs/Module/Profile_photo.php @@ -1,6 +1,9 @@ array($sync), 'profile' => $sync_profiles)); + Libzot::build_sync_packet($channel['channel_id'],array('file' => array($sync), 'profile' => $sync_profiles)); // Similarly, tell the nav bar to bypass the cache and update the avatar image. @@ -374,7 +377,7 @@ class Profile_photo extends \Zotlabs\Web\Controller { $sync = attach_export_data($channel,$resource_id); if($sync) - build_sync_packet($channel['channel_id'],array('file' => array($sync))); + Libzot::build_sync_packet($channel['channel_id'],array('file' => array($sync))); \Zotlabs\Daemon\Master::Summon(array('Directory',local_channel())); diff --git a/Zotlabs/Module/Profiles.php b/Zotlabs/Module/Profiles.php index 202ee462a..a486395b9 100644 --- a/Zotlabs/Module/Profiles.php +++ b/Zotlabs/Module/Profiles.php @@ -1,6 +1,8 @@ $r)); + Libzot::build_sync_packet(local_channel(),array('profile' => $r)); } $channel = \App::get_channel(); diff --git a/Zotlabs/Module/Rbmark.php b/Zotlabs/Module/Rbmark.php index 6a34e0a59..205a2d113 100644 --- a/Zotlabs/Module/Rbmark.php +++ b/Zotlabs/Module/Rbmark.php @@ -3,7 +3,6 @@ namespace Zotlabs\Module; /** @file */ require_once('include/acl_selectors.php'); require_once('include/crypto.php'); -require_once('include/items.php'); require_once('include/taxonomy.php'); require_once('include/conversation.php'); require_once('include/bookmarks.php'); diff --git a/Zotlabs/Module/Search.php b/Zotlabs/Module/Search.php index 3a552bb22..23e82dfbd 100644 --- a/Zotlabs/Module/Search.php +++ b/Zotlabs/Module/Search.php @@ -1,6 +1,10 @@ 3 && argv(3) === 'drop') { \Zotlabs\Lib\Permcat::delete(local_channel(),$name); - build_sync_packet(); + Libzot::build_sync_packet(); json_return_and_die([ 'success' => true ]); } diff --git a/Zotlabs/Module/Starred.php b/Zotlabs/Module/Starred.php index 8349ae25c..a8a03ed58 100644 --- a/Zotlabs/Module/Starred.php +++ b/Zotlabs/Module/Starred.php @@ -1,6 +1,7 @@ [ encode_item($sync_item[0],true) ] diff --git a/Zotlabs/Module/Subthread.php b/Zotlabs/Module/Subthread.php index 1a9caff6c..1520cb1e4 100644 --- a/Zotlabs/Module/Subthread.php +++ b/Zotlabs/Module/Subthread.php @@ -3,7 +3,6 @@ namespace Zotlabs\Module; require_once('include/security.php'); require_once('include/bbcode.php'); -require_once('include/items.php'); diff --git a/Zotlabs/Module/Tagger.php b/Zotlabs/Module/Tagger.php index 24adf1bde..d6aadadbb 100644 --- a/Zotlabs/Module/Tagger.php +++ b/Zotlabs/Module/Tagger.php @@ -1,9 +1,11 @@ [ encode_item($ret['activity'],true) ] ] diff --git a/Zotlabs/Module/Thing.php b/Zotlabs/Module/Thing.php index c3d8ff802..2bf4b5543 100644 --- a/Zotlabs/Module/Thing.php +++ b/Zotlabs/Module/Thing.php @@ -5,7 +5,9 @@ namespace Zotlabs\Module; -require_once('include/items.php'); + +use Zotlabs\Lib\Libzot; + require_once('include/security.php'); require_once('include/selectors.php'); require_once('include/acl_selectors.php'); @@ -124,7 +126,7 @@ class Thing extends \Zotlabs\Web\Controller { dbesc($term_hash) ); if($r) { - build_sync_packet(0, array('obj' => $r)); + Libzot::build_sync_packet(0, array('obj' => $r)); } return; @@ -180,7 +182,7 @@ class Thing extends \Zotlabs\Web\Controller { dbesc($hash) ); if($r) { - build_sync_packet(0, array('obj' => $r)); + Libzot::build_sync_packet(0, array('obj' => $r)); } if($activity) { @@ -353,7 +355,7 @@ class Thing extends \Zotlabs\Web\Controller { $r[0]['obj_deleted'] = 1; - build_sync_packet(0,array('obj' => $r)); + Libzot::build_sync_packet(0,array('obj' => $r)); return $o; } diff --git a/Zotlabs/Module/Wall_attach.php b/Zotlabs/Module/Wall_attach.php index 2250e6e44..2d48b333e 100644 --- a/Zotlabs/Module/Wall_attach.php +++ b/Zotlabs/Module/Wall_attach.php @@ -1,6 +1,8 @@ array($sync))); + Libzot::build_sync_packet($channel['channel_id'],array('file' => array($sync))); } if($using_api) diff --git a/Zotlabs/Module/Zotfeed.php b/Zotlabs/Module/Zotfeed.php index 4e4236964..1f0bf994f 100644 --- a/Zotlabs/Module/Zotfeed.php +++ b/Zotlabs/Module/Zotfeed.php @@ -1,7 +1,6 @@ folder_hash); if ($sync) - build_sync_packet($ch['channel_id'], array('file' => array($sync))); + Libzot::build_sync_packet($ch['channel_id'], array('file' => array($sync))); } $this->red_path = $new_path; @@ -368,7 +369,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo $sync = attach_export_data($c[0], $hash); if ($sync) - build_sync_packet($c[0]['channel_id'], array('file' => array($sync))); + Libzot::build_sync_packet($c[0]['channel_id'], array('file' => array($sync))); } /** @@ -401,7 +402,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo logger('createDirectory: attach_export_data returns $sync:' . print_r($sync, true), LOGGER_DEBUG); if($sync) { - build_sync_packet($r[0]['channel_id'], array('file' => array($sync))); + Libzot::build_sync_packet($r[0]['channel_id'], array('file' => array($sync))); } } else { @@ -432,7 +433,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo if ($ch) { $sync = attach_export_data($ch, $this->folder_hash, true); if ($sync) - build_sync_packet($ch['channel_id'], array('file' => array($sync))); + Libzot::build_sync_packet($ch['channel_id'], array('file' => array($sync))); } } diff --git a/Zotlabs/Storage/File.php b/Zotlabs/Storage/File.php index 4610aceb7..2ebec1b5d 100644 --- a/Zotlabs/Storage/File.php +++ b/Zotlabs/Storage/File.php @@ -3,6 +3,7 @@ namespace Zotlabs\Storage; use Sabre\DAV; +use Zotlabs\Lib\Libzot; /** * @brief This class represents a file in DAV. @@ -106,7 +107,7 @@ class File extends DAV\Node implements DAV\IFile { if($ch) { $sync = attach_export_data($ch,$this->data['hash']); if($sync) - build_sync_packet($ch['channel_id'],array('file' => array($sync))); + Libzot::build_sync_packet($ch['channel_id'],array('file' => array($sync))); } } @@ -254,7 +255,7 @@ class File extends DAV\Node implements DAV\IFile { $sync = attach_export_data($c[0],$this->data['hash']); if($sync) - build_sync_packet($c[0]['channel_id'],array('file' => array($sync))); + Libzot::build_sync_packet($c[0]['channel_id'],array('file' => array($sync))); } @@ -378,7 +379,7 @@ class File extends DAV\Node implements DAV\IFile { if($ch) { $sync = attach_export_data($ch, $this->data['hash'], true); if($sync) - build_sync_packet($ch['channel_id'], array('file' => array($sync))); + Libzot::build_sync_packet($ch['channel_id'], array('file' => array($sync))); } } } diff --git a/Zotlabs/Zot6/Zot6Handler.php b/Zotlabs/Zot6/Zot6Handler.php index 5d2cd4eb9..705a56b6c 100644 --- a/Zotlabs/Zot6/Zot6Handler.php +++ b/Zotlabs/Zot6/Zot6Handler.php @@ -191,7 +191,7 @@ class Zot6Handler implements IHandler { * invoke delivery to send out the notify packet */ - Zotlabs\Daemon\Master::Summon(array('Deliver', $hash)); + \Zotlabs\Daemon\Master::Summon(array('Deliver', $hash)); } } $ret['success'] = true; diff --git a/boot.php b/boot.php index 2dd0558e8..25f0f878e 100755 --- a/boot.php +++ b/boot.php @@ -50,7 +50,7 @@ require_once('include/xchan.php'); require_once('include/hubloc.php'); require_once('include/attach.php'); require_once('include/bbcode.php'); - +require_once('include/items.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); diff --git a/include/activities.php b/include/activities.php index 9b83f7a5c..22181c943 100644 --- a/include/activities.php +++ b/include/activities.php @@ -8,8 +8,6 @@ function profile_activity($changed, $value) { if(! get_pconfig(local_channel(),'system','post_profilechange')) return; - require_once('include/items.php'); - $self = App::get_channel(); if(! count($self)) diff --git a/include/api.php b/include/api.php index 6a05a40a5..afc182dc8 100644 --- a/include/api.php +++ b/include/api.php @@ -1,13 +1,11 @@ array($sync))); + Libzot::build_sync_packet($channel['channel_id'],array('file' => array($sync))); } if($notify) { @@ -1395,7 +1397,7 @@ function attach_change_permissions($channel_id, $resource, $allow_cid, $allow_gi $data = attach_export_data($channel,$resource); if($data) - build_sync_packet($channel['channel_id'],array('file' => array($data))); + Libzot::build_sync_packet($channel['channel_id'],array('file' => array($data))); } } @@ -1711,8 +1713,6 @@ function pipe_streams($in, $out, $bufsize = 16384) { */ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $verb, $notify) { - require_once('include/items.php'); - $poster = App::get_observer(); //if we got no object something went wrong diff --git a/include/channel.php b/include/channel.php index 5f13204a7..587ea298a 100644 --- a/include/channel.php +++ b/include/channel.php @@ -569,7 +569,7 @@ function change_channel_keys($channel) { } } - build_sync_packet($channel['channel_id'], [ 'keychange' => $stored ]); + Libzot::build_sync_packet($channel['channel_id'], [ 'keychange' => $stored ]); $a = q("select * from abook where abook_xchan = '%s' and abook_self = 1", dbesc($stored['old_hash']) @@ -2010,7 +2010,7 @@ function profiles_build_sync($channel_id,$send = true) { ); if($r) { if($send) { - build_sync_packet($channel_id,array('profile' => $r)); + Libzot::build_sync_packet($channel_id,array('profile' => $r)); } else { return $r; diff --git a/include/conversation.php b/include/conversation.php index 4a1cdc7da..a4af002dd 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1,7 +1,5 @@ array(encode_item($sync_item[0],true)))); + Libzot::build_sync_packet($channel_d,array('item' => array(encode_item($sync_item[0],true)))); } } @@ -4728,7 +4730,7 @@ function item_create_edit_activity($post) { if($r) { xchan_query($r); $sync_item = fetch_post_tags($r); - build_sync_packet($new_item['uid'],array('item' => array(encode_item($sync_item[0],true)))); + Libzot::build_sync_packet($new_item['uid'],array('item' => array(encode_item($sync_item[0],true)))); } } diff --git a/include/menu.php b/include/menu.php index 4add78c39..e8a4838e0 100644 --- a/include/menu.php +++ b/include/menu.php @@ -1,5 +1,8 @@ array(menu_element($c,$m)))); + Libzot::build_sync_packet($uid,array('menu' => array(menu_element($c,$m)))); } } } diff --git a/include/message.php b/include/message.php index 4a673b961..8d9781c16 100644 --- a/include/message.php +++ b/include/message.php @@ -2,6 +2,9 @@ /* Private Message backend API */ + +use Zotlabs\Lib\Libzot; + require_once('include/crypto.php'); require_once('include/attach.php'); @@ -493,7 +496,7 @@ function private_messages_drop($channel_id, $messageitem_id, $drop_conversation intval($channel_id) ); } - build_sync_packet($channel_id,$m); + Libzot::build_sync_packet($channel_id,$m); return true; } else { @@ -503,7 +506,7 @@ function private_messages_drop($channel_id, $messageitem_id, $drop_conversation intval($messageitem_id), intval($channel_id) ); - build_sync_packet($channel_id,array('mail' => array(encode_mail($x,true)))); + Libzot::build_sync_packet($channel_id,array('mail' => array(encode_mail($x,true)))); return true; } return false; diff --git a/include/photos.php b/include/photos.php index 9fb872700..a9a680506 100644 --- a/include/photos.php +++ b/include/photos.php @@ -5,7 +5,6 @@ */ require_once('include/permissions.php'); -require_once('include/items.php'); require_once('include/photo/photo_driver.php'); require_once('include/text.php'); diff --git a/include/queue_fn.php b/include/queue_fn.php index 0740ff095..d5f30741b 100644 --- a/include/queue_fn.php +++ b/include/queue_fn.php @@ -1,5 +1,8 @@ ') . PHP_EOL; exit(1); @@ -51,7 +53,7 @@ cli_startup(); $abconfig = load_abconfig($c['channel_id'],$clone['abook_xchan']); if($abconfig) $clone['abconfig'] = $abconfig; - build_sync_packet($c['channel_id'], array('abook' => array($clone)), true); + Libzot::build_sync_packet($c['channel_id'], array('abook' => array($clone)), true); $can_view_stream = their_perms_contains($c['channel_id'],$clone['abook_xchan'],'view_stream'); diff --git a/util/dmkdir b/util/dmkdir index 72ab22431..2eedc2404 100755 --- a/util/dmkdir +++ b/util/dmkdir @@ -1,6 +1,9 @@ #!/usr/bin/env php array($sync))); + Libzot::build_sync_packet($channel['channel_id'],array('file' => array($sync))); } } \ No newline at end of file diff --git a/util/pconfig b/util/pconfig index 36d894fb5..d18aee897 100755 --- a/util/pconfig +++ b/util/pconfig @@ -3,6 +3,8 @@ // Red pconfig utility +use Zotlabs\Lib\Libzot; + if(!file_exists('include/cli_startup.php')) { echo 'Run pconfig from the top level Hubzilla web directory, as util/pconfig ' . PHP_EOL; @@ -63,7 +65,7 @@ if($argc > 2 && strpos($argv[2],'.')) { if($argc > 4) { set_pconfig($argv[1],$argv[2],$argv[3],$argv[4]); - build_sync_packet($argv[1]); + Libzot::build_sync_packet($argv[1]); echo "pconfig[{$argv[1]}][{$argv[2]}][{$argv[3]}] = " . get_pconfig($argv[1],$argv[2],$argv[3]) . "\n"; }