aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/RedDAV/RedBrowser.php9
-rw-r--r--include/identity.php14
-rwxr-xr-xinclude/items.php71
-rw-r--r--include/text.php10
4 files changed, 48 insertions, 56 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/identity.php b/include/identity.php
index 2f400520f..d98f39cb7 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -1205,21 +1205,9 @@ function advanced_profile(&$a) {
if($txt = prepare_text($a->profile['dislikes'])) $profile['dislikes'] = array( t('Dislikes:'), $txt);
-
if($txt = prepare_text($a->profile['contact'])) $profile['contact'] = array( t('Contact information and Social Networks:'), $txt);
- // Support tags in the other channels field (probably want to restrict it to channels only?)
- $txt = $a->profile['channels'];
- $matches = get_tags($txt);
- $access_tag = '';
- $str_tags = '';
- foreach($matches as $m) {
- $success = handle_tag($a, $txt, $access_tag, $str_tags, $a->profile_uid, $m); // Use uid of the profile maker
- }
-
- if($txt = prepare_text($txt)) {
- $profile['channels'] = array( t('My other channels:'), $txt);
- }
+ if($txt = prepare_text($a->profile['channels'])) $profile['channels'] = array( t('My other channels:'), $txt);
if($txt = prepare_text($a->profile['music'])) $profile['music'] = array( t('Musical interests:'), $txt);
diff --git a/include/items.php b/include/items.php
index 4c533aedc..5812efa90 100755
--- a/include/items.php
+++ b/include/items.php
@@ -2673,7 +2673,7 @@ function tag_deliver($uid,$item_id) {
* Fetch stuff we need - a channel and an item
*/
- $u = q("select * from channel where channel_id = %d limit 1",
+ $u = q("select * from channel left join xchan on channel_hash = xchan_hash where channel_id = %d limit 1",
intval($uid)
);
if(! $u)
@@ -2811,7 +2811,7 @@ function tag_deliver($uid,$item_id) {
if($terms)
logger('tag_deliver: post mentions: ' . print_r($terms,true), LOGGER_DATA);
- $link = normalise_link($a->get_baseurl() . '/channel/' . $u[0]['channel_address']);
+ $link = normalise_link($u[0]['xchan_url']);
if($terms) {
foreach($terms as $term) {
@@ -2952,7 +2952,7 @@ function tgroup_check($uid,$item) {
if(! perm_is_allowed($uid,$item['author_xchan'],'tag_deliver'))
return false;
- $u = q("select * from channel where channel_id = %d limit 1",
+ $u = q("select * from channel left join xchan on channel_hash = xchan_hash where channel_id = %d limit 1",
intval($uid)
);
@@ -2964,7 +2964,7 @@ function tgroup_check($uid,$item) {
if($terms)
logger('tgroup_check: post mentions: ' . print_r($terms,true), LOGGER_DATA);
- $link = normalise_link($a->get_baseurl() . '/channel/' . $u[0]['channel_address']);
+ $link = normalise_link($u[0]['xchan_url']);
if($terms) {
foreach($terms as $term) {
@@ -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/include/text.php b/include/text.php
index 035c092a6..18ef22d28 100644
--- a/include/text.php
+++ b/include/text.php
@@ -92,10 +92,10 @@ function z_input_filter($channel_id,$s,$type = 'text/bbcode') {
return escape_tags($s);
if($type == 'text/plain')
return escape_tags($s);
- $r = q("select account_id, account_roles from account left join channel on channel_account_id = account_id where channel_id = %d limit 1",
+ $r = q("select account_id, account_roles, channel_pageflags from account left join channel on channel_account_id = account_id where channel_id = %d limit 1",
intval($channel_id)
);
- if($r && ($r[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE)) {
+ if($r && (($r[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE) || ($r[0]['channel_pageflags'] & PAGE_ALLOWCODE))) {
if(local_user() && (get_account_id() == $r[0]['account_id'])) {
return $s;
}
@@ -1584,13 +1584,13 @@ function mimetype_select($channel_id, $current = 'text/bbcode') {
'text/plain'
);
- $r = q("select account_id, account_roles from account left join channel on account_id = channel_account_id where
+ $r = q("select account_id, account_roles, channel_pageflags from account left join channel on account_id = channel_account_id where
channel_id = %d limit 1",
intval($channel_id)
);
if($r) {
- if($r[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE) {
+ if(($r[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE) || ($r[0]['channel_pageflags'] & PAGE_ALLOWCODE)) {
if(local_user() && get_account_id() == $r[0]['account_id'])
$x[] = 'application/x-php';
}
@@ -2351,7 +2351,7 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) {
return array('replaced' => $replaced, 'termtype' => $termtype, 'term' => $newname, 'url' => $url, 'contact' => $r[0]);
}
-function linkify_tags($a, &$body, $uid, $profile_uid) {
+function linkify_tags($a, &$body, $uid) {
$str_tags = '';
$tagged = array();
$result = array();