diff options
-rw-r--r-- | include/zot.php | 24 | ||||
-rw-r--r-- | index.php | 2 | ||||
-rw-r--r-- | mod/post.php | 9 |
3 files changed, 29 insertions, 6 deletions
diff --git a/include/zot.php b/include/zot.php index 78978bbf9..5fab76932 100644 --- a/include/zot.php +++ b/include/zot.php @@ -523,9 +523,26 @@ function import_xchan($arr) { } else { $import_photos = true; + + $dirmode = get_config('system','directory_mode'); + + if((($arr['site']['directory_mode'] === 'standalone') || ($dirmode & DIRECTORY_MODE_STANDALONE)) +&& ($arr['site']['url'] != z_root())) + $arr['searchable'] = false; + + $hidden = (1 - intval($arr['searchable'])); + + if($hidden) + $new_flags = XCHAN_FLAGS_HIDDEN; + else + $new_flags = 0; + + + + $x = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_pubkey, xchan_photo_mimetype, - xchan_photo_l, xchan_addr, xchan_url, xchan_connurl, xchan_name, xchan_network, xchan_photo_date, xchan_name_date) - values ( '%s', '%s', '%s', '%s' , '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') ", + xchan_photo_l, xchan_addr, xchan_url, xchan_connurl, xchan_name, xchan_network, xchan_photo_date, xchan_name_date, xchan_flags) + values ( '%s', '%s', '%s', '%s' , '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d) ", dbesc($xchan_hash), dbesc($arr['guid']), dbesc($arr['guid_sig']), @@ -538,7 +555,8 @@ function import_xchan($arr) { dbesc($arr['name']), dbesc('zot'), dbesc($arr['photo_updated']), - dbesc($arr['name_updated']) + dbesc($arr['name_updated']), + intval($new_flags) ); update_modtime($xchan_hash); $changed = true; @@ -288,7 +288,7 @@ if($a->module_loaded) { // If $aside_default is not False after the theme _aside() function, run the // module's _aside() function too // - // This gives themes more control over how the left sidebar looks + // This gives themes more control over how the sidebar looks $aside_default = true; call_hooks($a->module . '_mod_aside',$placeholder); diff --git a/mod/post.php b/mod/post.php index e5c68d4bd..5b002eb36 100644 --- a/mod/post.php +++ b/mod/post.php @@ -10,9 +10,9 @@ require_once('include/zot.php'); function post_init(&$a) { - // All other access to this endpoint is via the post method. + // Most access to this endpoint is via the post method. // Here we will pick out the magic auth params which arrive - // as a get request. + // as a get request, and the only communications to arrive this way. if(argc() > 1) { @@ -150,6 +150,11 @@ function post_post(&$a) { logger('mod_zot: data: ' . print_r($data,true), LOGGER_DATA); + /** + * Many message packets will arrive encrypted. The existence of an 'iv' element + * tells us we need to unencapsulate the AES-256-CBC content using the site private key + */ + if(array_key_exists('iv',$data)) { $data = aes_unencapsulate($data,get_config('system','prvkey')); logger('mod_zot: decrypt1: ' . $data, LOGGER_DATA); |