aboutsummaryrefslogtreecommitdiffstats
path: root/mod/notes.php
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-04-03 19:34:19 -0700
committerredmatrix <git@macgirvin.com>2016-04-03 19:34:19 -0700
commit2e7d2a63c33bc3047b9d743d965fbe3f51c56c3b (patch)
treee58b9eac5f21d486e6000cb373a19f28912734d2 /mod/notes.php
parenta703835b5cdbe737be98374a51363426083fee8f (diff)
downloadvolse-hubzilla-2e7d2a63c33bc3047b9d743d965fbe3f51c56c3b.tar.gz
volse-hubzilla-2e7d2a63c33bc3047b9d743d965fbe3f51c56c3b.tar.bz2
volse-hubzilla-2e7d2a63c33bc3047b9d743d965fbe3f51c56c3b.zip
provide a backup copy of prior notes widget content if the contents were just nuked.
Diffstat (limited to 'mod/notes.php')
-rw-r--r--mod/notes.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/mod/notes.php b/mod/notes.php
index 4bb97fc9e..9bf37d0f9 100644
--- a/mod/notes.php
+++ b/mod/notes.php
@@ -6,8 +6,18 @@ function notes_init(&$a) {
return;
$ret = array('success' => true);
- if($_REQUEST['note_text'] || $_REQUEST['note_text'] == '') {
+ 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);
+ }
set_pconfig(local_channel(),'notes','text',$body);
}