diff options
-rw-r--r-- | include/RedDAV/RedBrowser.php | 9 | ||||
-rwxr-xr-x | include/items.php | 63 | ||||
-rw-r--r-- | mod/channel.php | 1 | ||||
-rw-r--r-- | mod/cloud.php | 9 | ||||
-rw-r--r-- | mod/connedit.php | 11 | ||||
-rw-r--r-- | mod/dav.php | 9 | ||||
-rw-r--r-- | mod/display.php | 1 | ||||
-rw-r--r-- | mod/home.php | 1 | ||||
-rw-r--r-- | mod/network.php | 1 | ||||
-rw-r--r-- | mod/photos.php | 2 | ||||
-rw-r--r-- | mod/profiles.php | 5 | ||||
-rw-r--r-- | mod/search.php | 1 | ||||
-rw-r--r-- | version.inc | 2 | ||||
-rwxr-xr-x | view/tpl/build_query.tpl | 2 |
14 files changed, 60 insertions, 57 deletions
diff --git a/include/RedDAV/RedBrowser.php b/include/RedDAV/RedBrowser.php index 709f6339b..9ea2b9808 100644 --- a/include/RedDAV/RedBrowser.php +++ b/include/RedDAV/RedBrowser.php @@ -267,6 +267,15 @@ class RedBrowser extends DAV\Browser\Plugin { get_app()->page['content'] = $html; load_pdl(get_app()); + + $theme_info_file = "view/theme/" . current_theme() . "/php/theme.php"; + if (file_exists($theme_info_file)){ + require_once($theme_info_file); + if (function_exists(str_replace('-', '_', current_theme()) . '_init')) { + $func = str_replace('-', '_', current_theme()) . '_init'; + $func(get_app()); + } + } construct_page(get_app()); } diff --git a/include/items.php b/include/items.php index 4c533aedc..dd9dbc7f9 100755 --- a/include/items.php +++ b/include/items.php @@ -3939,7 +3939,7 @@ function drop_items($items) { // $stage = 1 => set deleted flag on the item and perform intial notifications // $stage = 2 => perform low level delete at a later stage -function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL) { +function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL,$force = false) { $a = get_app(); @@ -3959,6 +3959,8 @@ function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL) { $item = $r[0]; + $linked_item = (($item['resource_id']) ? true : false); + $ok_to_delete = false; // system deletion @@ -3980,10 +3982,11 @@ function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL) { // hook calls a remote process which loops. We'll delete it properly in a second. $r = q("UPDATE item SET item_restrict = ( item_restrict | %d ) WHERE id = %d", - intval(ITEM_DELETED), + intval(($linked_item && ! $force) ? ITEM_HIDDEN : ITEM_DELETED), intval($item['id']) ); + $arr = array('item' => $item, 'interactive' => $interactive, 'stage' => $stage); call_hooks('drop_item', $arr ); @@ -3995,10 +3998,10 @@ function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL) { ); if($items) { foreach($items as $i) - delete_item_lowlevel($i,$stage); + delete_item_lowlevel($i,$stage,$force); } else - delete_item_lowlevel($item,$stage); + delete_item_lowlevel($item,$stage,$force); if(! $interactive) return 1; @@ -4030,8 +4033,9 @@ function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL) { // It merely destroys all resources associated with an item. // Please do not use without a suitable wrapper. -function delete_item_lowlevel($item,$stage = DROPITEM_NORMAL) { +function delete_item_lowlevel($item,$stage = DROPITEM_NORMAL,$force = false) { + $linked_item = (($item['resource_id']) ? true : false); switch($stage) { case DROPITEM_PHASE2: @@ -4047,7 +4051,7 @@ function delete_item_lowlevel($item,$stage = DROPITEM_NORMAL) { case DROPITEM_PHASE1: $r = q("UPDATE item SET item_restrict = ( item_restrict | %d ), changed = '%s', edited = '%s' WHERE id = %d", - intval(ITEM_DELETED), + intval(($linked_item && ! $force) ? ITEM_HIDDEN : ITEM_DELETED), dbesc(datetime_convert()), dbesc(datetime_convert()), intval($item['id']) @@ -4056,13 +4060,24 @@ function delete_item_lowlevel($item,$stage = DROPITEM_NORMAL) { case DROPITEM_NORMAL: default: - $r = q("UPDATE item SET item_restrict = ( item_restrict | %d ), body = '', title = '', - changed = '%s', edited = '%s' WHERE id = %d", - intval(ITEM_DELETED), - dbesc(datetime_convert()), - dbesc(datetime_convert()), - intval($item['id']) - ); + if($linked_item && ! $force) { + $r = q("UPDATE item SET item_restrict = ( item_restrict | %d ), + changed = '%s', edited = '%s' WHERE id = %d", + intval(ITEM_HIDDEN), + dbesc(datetime_convert()), + dbesc(datetime_convert()), + intval($item['id']) + ); + } + else { + $r = q("UPDATE item SET item_restrict = ( item_restrict | %d ), body = '', title = '', + changed = '%s', edited = '%s' WHERE id = %d", + intval(ITEM_DELETED), + dbesc(datetime_convert()), + dbesc(datetime_convert()), + intval($item['id']) + ); + } break; } @@ -4074,25 +4089,6 @@ function delete_item_lowlevel($item,$stage = DROPITEM_NORMAL) { intval($item['uid']) ); - // If item is a link to a photo/event resource, nuke all the associated photos/events - // This only applies to photos uploaded from the photos page. Photos inserted into a post do not - // generate a resource_id and therefore aren't intimately linked to the item. - - if(strlen($item['resource_id'])) { - if($item['resource_type'] === 'event') { - q("delete from event where event_hash = '%s' and uid = %d", - dbesc($item['resource_id']), - intval($item['uid']) - ); - } - elseif($item['resource_type'] === 'photo') { - q("DELETE FROM `photo` WHERE `resource_id` = '%s' AND `uid` = %d ", - dbesc($item['resource_id']), - intval($item['uid']) - ); - } - } - // network deletion request. Keep the message structure so that we can deliver delete notifications. // Come back after several days (or perhaps a month) to do the lowlevel delete (DROPITEM_PHASE2). @@ -4115,8 +4111,7 @@ function delete_item_lowlevel($item,$stage = DROPITEM_NORMAL) { intval(TERM_OBJ_POST) ); -// FIXME remove notifications for this item - + // FIXME remove notifications for this item return true; } diff --git a/mod/channel.php b/mod/channel.php index e819de0e0..c8ac83baf 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -286,6 +286,7 @@ function channel_content(&$a, $update = 0, $load = false) { '$cats' => (($category) ? $category : ''), '$tags' => (($hashtags) ? $hashtags : ''), '$mid' => $mid, + '$verb' => '', '$dend' => $datequery, '$dbegin' => $datequery2 )); diff --git a/mod/cloud.php b/mod/cloud.php index abeae88eb..3643e599c 100644 --- a/mod/cloud.php +++ b/mod/cloud.php @@ -41,15 +41,6 @@ if(! defined('TRINIDAD')) { * @param App &$a */ function cloud_init(&$a) { - // call ($currenttheme)_init since we're operating outside of index.php - $theme_info_file = "view/theme/" . current_theme() . "/php/theme.php"; - if (file_exists($theme_info_file)){ - require_once($theme_info_file); - if (function_exists(str_replace('-', '_', current_theme()) . '_init')) { - $func = str_replace('-', '_', current_theme()) . '_init'; - $func($a); - } - } require_once('include/reddav.php'); diff --git a/mod/connedit.php b/mod/connedit.php index 49aae6684..5c36c3184 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -55,6 +55,15 @@ function connedit_post(&$a) { if(! $contact_id) return; + // TODO if configured for hassle-free permissions, we'll post the form with ajax as soon as the + // connection enable is toggled to a special autopost url and set permissions immediately, leaving + // the other form elements alone pending a manual submit of the form. The downside is that there + // will be a window of opportunity when the permissions have been set but before you've had a chance + // to review and possibly restrict them. The upside is we won't have to warn you that your connection + // can't do anything until you save the bloody form. + + $autopost = (((argc() > 2) && (argv(2) === 'auto')) ? true : false); + $orig_record = q("SELECT * FROM abook WHERE abook_id = %d AND abook_channel = %d LIMIT 1", intval($contact_id), intval(local_user()) @@ -287,7 +296,7 @@ function connedit_content(&$a) { $o .= "\$('#me_id_perms_" . $p . "').attr('checked','checked'); \n"; } } - $o .= "abook_perms_msg(); }\n</script>\n"; + $o .= " }\n</script>\n"; } if(argc() == 3) { diff --git a/mod/dav.php b/mod/dav.php index 1bff5ffbc..e3719cb93 100644 --- a/mod/dav.php +++ b/mod/dav.php @@ -37,15 +37,6 @@ if (x($_SERVER, 'HTTP_AUTHORIZATION')) { * @param App &$a */ function dav_init(&$a) { - // call ($currenttheme)_init since we're operating outside of index.php - $theme_info_file = "view/theme/" . current_theme() . "/php/theme.php"; - if (file_exists($theme_info_file)){ - require_once($theme_info_file); - if (function_exists(str_replace('-', '_', current_theme()) . '_init')) { - $func = str_replace('-', '_', current_theme()) . '_init'; - $func($a); - } - } require_once('include/reddav.php'); diff --git a/mod/display.php b/mod/display.php index 7d7f4ca13..f14aca6da 100644 --- a/mod/display.php +++ b/mod/display.php @@ -136,6 +136,7 @@ function display_content(&$a, $update = 0, $load = false) { '$tags' => '', '$dend' => '', '$dbegin' => '', + '$verb' => '', '$mid' => $item_hash )); diff --git a/mod/home.php b/mod/home.php index b2538795f..e82aab385 100644 --- a/mod/home.php +++ b/mod/home.php @@ -144,6 +144,7 @@ function home_content(&$a, $update = 0, $load = false) { '$tags' => '', '$dend' => '', '$mid' => '', + '$verb' => '', '$dbegin' => '' )); } diff --git a/mod/network.php b/mod/network.php index d444dbd59..894ea9c10 100644 --- a/mod/network.php +++ b/mod/network.php @@ -251,6 +251,7 @@ function network_content(&$a, $update = 0, $load = false) { '$tags' => $hashtags, '$dend' => $datequery, '$mid' => '', + '$verb' => '', '$dbegin' => $datequery2 )); } diff --git a/mod/photos.php b/mod/photos.php index 3a7ef2d71..b2eb2847f 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -140,7 +140,7 @@ function photos_post(&$a) { ); if($r) { foreach($r as $i) { - drop_item($i['id'],false); + drop_item($i['id'],false,DROPITEM_PHASE1,true /* force removal of linked items */); if(! $item_restrict) proc_run('php','include/notifier.php','drop',$i['id']); } diff --git a/mod/profiles.php b/mod/profiles.php index 11cd86645..ef5f6b379 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -296,6 +296,8 @@ function profiles_post(&$a) { $work = fix_mce_lf(escape_tags(trim($_POST['work']))); $education = fix_mce_lf(escape_tags(trim($_POST['education']))); + $hide_friends = ((intval($_POST['hide_friends'])) ? 1: 0); + require_once('include/text.php'); linkify_tags($a, $likes, local_user()); linkify_tags($a, $dislikes, local_user()); @@ -312,7 +314,6 @@ function profiles_post(&$a) { linkify_tags($a, $work, local_user()); linkify_tags($a, $education, local_user()); - $hide_friends = (($_POST['hide_friends'] == 1) ? 1: 0); $with = ((x($_POST,'with')) ? escape_tags(trim($_POST['with'])) : ''); @@ -621,7 +622,7 @@ function profiles_content(&$a) { $opt_tpl = get_markup_template("profile_hide_friends.tpl"); $hide_friends = replace_macros($opt_tpl,array('$field' => array( - 'hide-friends', + 'hide_friends', t('Hide your contact/friend list from viewers of this profile?'), $r[0]['hide_friends'], '', diff --git a/mod/search.php b/mod/search.php index 6df9d631a..2ea6ad86f 100644 --- a/mod/search.php +++ b/mod/search.php @@ -109,6 +109,7 @@ function search_content(&$a,$update = 0, $load = false) { '$cats' => '', '$tags' => '', '$mid' => '', + '$verb' => '', '$dend' => '', '$dbegin' => '' )); diff --git a/version.inc b/version.inc index 117991bf8..5fc4bc7c6 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2015-01-11.916 +2015-01-12.917 diff --git a/view/tpl/build_query.tpl b/view/tpl/build_query.tpl index 8110b70b1..62f81b618 100755 --- a/view/tpl/build_query.tpl +++ b/view/tpl/build_query.tpl @@ -26,6 +26,7 @@ var bParam_dend = "{{$dend}}"; var bParam_dbegin = "{{$dbegin}}"; var bParam_mid = "{{$mid}}"; + var bParam_verb = "{{$verb}}"; function buildCmd() { var udargs = ((page_load) ? "/load" : ""); @@ -51,6 +52,7 @@ if(bParam_dend != "") bCmd = bCmd + "&dend=" + bParam_dend; if(bParam_dbegin != "") bCmd = bCmd + "&dbegin=" + bParam_dbegin; if(bParam_mid != "") bCmd = bCmd + "&mid=" + bParam_mid; + if(bParam_verb != "") bCmd = bCmd + "&verb=" + bParam_verb; if(bParam_page != 1) bCmd = bCmd + "&page=" + bParam_page; return(bCmd); } |