diff options
author | Mario Vavti <mario@mariovavti.com> | 2024-09-22 17:24:28 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2024-09-22 17:24:28 +0200 |
commit | 3733a80c1de0e3bf69b91f1dc7ee217fd3e29fe5 (patch) | |
tree | ce80be6c736734ad960566434ebebd7b0d861371 /Zotlabs | |
parent | 220571d2a99b32ab4b73135400564812e13f6acf (diff) | |
download | volse-hubzilla-3733a80c1de0e3bf69b91f1dc7ee217fd3e29fe5.tar.gz volse-hubzilla-3733a80c1de0e3bf69b91f1dc7ee217fd3e29fe5.tar.bz2 volse-hubzilla-3733a80c1de0e3bf69b91f1dc7ee217fd3e29fe5.zip |
notes: make sure we set App::$profile_uid in the module - issue #1865 and minor code cleanup
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Module/Notes.php | 30 | ||||
-rw-r--r-- | Zotlabs/Widget/Notes.php | 9 |
2 files changed, 24 insertions, 15 deletions
diff --git a/Zotlabs/Module/Notes.php b/Zotlabs/Module/Notes.php index 2fd719f25..ba693e4f2 100644 --- a/Zotlabs/Module/Notes.php +++ b/Zotlabs/Module/Notes.php @@ -13,31 +13,34 @@ class Notes extends Controller { function post() { - if(! local_channel()) - return EMPTY_STR; + if(!local_channel()) { + return; + } - if(! Apps::system_app_installed(local_channel(), 'Notes')) - return EMPTY_STR; + if(!Apps::system_app_installed(local_channel(), 'Notes')) { + return; + } $ret = [ 'success' => false, 'html' => '' ]; - - if(array_key_exists('note_text',$_REQUEST)) { + if (array_key_exists('note_text',$_REQUEST)) { $body = escape_tags($_REQUEST['note_text']); // I've had my notes vanish into thin air twice in four years. // Provide a backup copy if there were contents previously // and there are none being saved now. - if(! $body) { - $old_text = get_pconfig(local_channel(),'notes','text'); - if($old_text) - set_pconfig(local_channel(),'notes','text.bak',$old_text); + if(!$body) { + $old_text = get_pconfig(local_channel(), 'notes', 'text'); + if ($old_text) { + set_pconfig(local_channel(), 'notes', 'text.bak', $old_text); + } } - set_pconfig(local_channel(),'notes','text',$body); + + set_pconfig(local_channel(), 'notes', 'text', $body); $ret['html'] = bbcode($body, ['tryoembed' => false]); $ret['success'] = true; @@ -55,8 +58,9 @@ class Notes extends Controller { } function get() { - if(! local_channel()) + if(!local_channel()) { return EMPTY_STR; + } if(! Apps::system_app_installed(local_channel(), 'Notes')) { //Do not display any associated widgets at this point @@ -65,6 +69,8 @@ class Notes extends Controller { return Apps::app_render($papp, 'module'); } + App::$profile_uid = local_channel(); + $w = new \Zotlabs\Widget\Notes; $arr = ['app' => true]; diff --git a/Zotlabs/Widget/Notes.php b/Zotlabs/Widget/Notes.php index 836159edd..be4ec64a6 100644 --- a/Zotlabs/Widget/Notes.php +++ b/Zotlabs/Widget/Notes.php @@ -16,14 +16,17 @@ use Zotlabs\Lib\Apps; class Notes { function widget($arr) { - if(! local_channel()) + if(!local_channel()) { return EMPTY_STR; + } - if(App::$profile_uid !== local_channel()) + if (App::$profile_uid !== local_channel()) { return EMPTY_STR; + } - if(! Apps::system_app_installed(local_channel(), 'Notes')) + if(!Apps::system_app_installed(local_channel(), 'Notes')) { return EMPTY_STR; + } $text = get_pconfig(local_channel(),'notes','text'); |