aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorsirius <sirius83@gmx.de>2014-04-16 00:40:01 +0200
committersirius <sirius83@gmx.de>2014-04-16 00:40:01 +0200
commitb0dc9f13edcbb705e1aa7d0af33bf0351f4d81f4 (patch)
tree32b053e3f2c95740e316e898d6a2e15688aa4d02 /include
parent8b8feea12f886a22f7eb66456be7828b7aef455e (diff)
parentefe80bb8e98b32b95d1380633e9ffd834fa82511 (diff)
downloadvolse-hubzilla-b0dc9f13edcbb705e1aa7d0af33bf0351f4d81f4.tar.gz
volse-hubzilla-b0dc9f13edcbb705e1aa7d0af33bf0351f4d81f4.tar.bz2
volse-hubzilla-b0dc9f13edcbb705e1aa7d0af33bf0351f4d81f4.zip
Merging in conflict
Diffstat (limited to 'include')
-rw-r--r--include/ConversationObject.php7
-rw-r--r--include/identity.php30
-rw-r--r--include/photo/photo_driver.php2
-rwxr-xr-xinclude/text.php14
-rw-r--r--include/widgets.php12
-rw-r--r--include/zot.php36
6 files changed, 64 insertions, 37 deletions
diff --git a/include/ConversationObject.php b/include/ConversationObject.php
index d97438a5d..9bf410358 100644
--- a/include/ConversationObject.php
+++ b/include/ConversationObject.php
@@ -181,6 +181,13 @@ class Conversation extends BaseObject {
$item->set_commentable(can_comment_on_post($this->observer['xchan_hash'],$item->data));
}
+ require_once('include/identity.php');
+ $sys = get_sys_channel();
+
+ if($sys && $item->get_data_value('uid') == $sys['channel_id']) {
+ $item->set_commentable(false);
+ }
+
$item->set_conversation($this);
$this->threads[] = $item;
return end($this->threads);
diff --git a/include/identity.php b/include/identity.php
index 66e572866..b66eaad51 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -583,14 +583,16 @@ function profile_load(&$a, $nickname, $profile = '') {
}
+ $a->profile = $p[0];
+ $a->profile_uid = $p[0]['profile_uid'];
+ $a->page['title'] = $a->profile['channel_name'] . " - " . $a->profile['channel_address'] . "@" . $a->get_hostname();
+
+ $a->profile['permission_to_view'] = $can_view_profile;
+
if($can_view_profile) {
- $a->profile = $p[0];
$online = get_online_status($nickname);
$a->profile['online_status'] = $online['result'];
- $a->profile_uid = $p[0]['profile_uid'];
-
- $a->page['title'] = $a->profile['channel_name'] . " - " . $a->profile['channel_address'] . "@" . $a->get_hostname();
}
if(local_user()) {
@@ -604,18 +606,12 @@ function profile_load(&$a, $nickname, $profile = '') {
$_SESSION['theme'] = $p[0]['channel_theme'];
- $a->set_template_engine(); // reset the template engine to the default in case the user's theme doesn't specify one
+// $a->set_template_engine(); // reset the template engine to the default in case the user's theme doesn't specify one
- $theme_info_file = "view/theme/".current_theme()."/php/theme.php";
- if (file_exists($theme_info_file)){
- require_once($theme_info_file);
- }
-
- if(! $can_view_profile) {
- // permission denied
- notice( t(' Sorry, you don\'t have the permission to view this profile. ') . EOL);
- return;
- }
+// $theme_info_file = "view/theme/".current_theme()."/php/theme.php";
+// if (file_exists($theme_info_file)){
+// require_once($theme_info_file);
+// }
return;
}
@@ -739,7 +735,7 @@ logger('online: ' . $profile['online']);
$block = true;
}
- if(($profile['hidewall'] || $block) && (! local_user()) && (! remote_user())) {
+ if(($profile['hidewall'] && (! local_user()) && (! remote_user())) || $block ) {
$location = $pdesc = $gender = $marital = $homepage = $online = False;
}
@@ -751,7 +747,7 @@ logger('online: ' . $profile['online']);
$channel_menu = false;
$menu = get_pconfig($profile['uid'],'system','channel_menu');
- if($menu) {
+ if($menu && ! $block) {
require_once('include/menu.php');
$m = menu_fetch($menu,$profile['uid'],$observer['xchan_hash']);
if($m)
diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php
index 484550cb7..f5e915402 100644
--- a/include/photo/photo_driver.php
+++ b/include/photo/photo_driver.php
@@ -616,7 +616,7 @@ function import_profile_photo($photo,$xchan,$thing = false) {
$type = 'image/jpeg';
}
- return(array($photo,$thumb,$micro,$type));
+ return(array($photo,$thumb,$micro,$type,$photo_failure));
}
diff --git a/include/text.php b/include/text.php
index 63fb76422..68542005b 100755
--- a/include/text.php
+++ b/include/text.php
@@ -707,11 +707,10 @@ function contact_block() {
if((! is_array($a->profile)) || ($a->profile['hide_friends']))
return $o;
- $r = q("SELECT COUNT(abook_id) AS total FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d and abook_flags = 0 and not (xchan_flags & %d) and not (xchan_flags & %d) and not (xchan_flags & %d)",
+ $r = q("SELECT COUNT(abook_id) AS total FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d and not ( abook_flags & %d ) and not (xchan_flags & %d)",
intval($a->profile['uid']),
- intval(XCHAN_FLAGS_HIDDEN),
- intval(XCHAN_FLAGS_ORPHAN),
- intval(XCHAN_FLAGS_DELETED)
+ intval(ABOOK_FLAG_HIDDEN|ABOOK_FLAG_PENDING|ABOOK_FLAG_SELF),
+ intval(XCHAN_FLAGS_HIDDEN|XCHAN_FLAGS_ORPHAN|XCHAN_FLAGS_DELETED)
);
if(count($r)) {
$total = intval($r[0]['total']);
@@ -722,11 +721,10 @@ function contact_block() {
} else {
- $r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash WHERE abook_channel = %d AND abook_flags = 0 and not (xchan_flags & %d ) and not (xchan_flags & %d ) and not (xchan_flags & %d ) ORDER BY RAND() LIMIT %d",
+ $r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash WHERE abook_channel = %d AND not ( abook_flags & %d) and not (xchan_flags & %d ) ORDER BY RAND() LIMIT %d",
intval($a->profile['uid']),
- intval(XCHAN_FLAGS_HIDDEN),
- intval(XCHAN_FLAGS_ORPHAN),
- intval(XCHAN_FLAGS_DELETED),
+ intval(ABOOK_FLAG_HIDDEN|ABOOK_FLAG_PENDING|ABOOK_FLAG_SELF),
+ intval(XCHAN_FLAGS_HIDDEN|XCHAN_FLAGS_ORPHAN|XCHAN_FLAGS_DELETED),
intval($shown)
);
diff --git a/include/widgets.php b/include/widgets.php
index 82769d925..678fed833 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -304,6 +304,9 @@ function widget_archive($arr) {
if(! feature_enabled($uid,'archives'))
return '';
+ if(! perm_is_allowed($uid,get_observer_hash(),'view_stream'))
+ return '';
+
$wall = ((array_key_exists('wall', $arr)) ? intval($arr['wall']) : 0);
$style = ((array_key_exists('style', $arr)) ? $arr['style'] : 'select');
@@ -338,6 +341,12 @@ function widget_fullprofile($arr) {
function widget_categories($arr) {
$a = get_app();
+
+
+ if($a->profile['profile_uid'] && (! perm_is_allowed($a->profile['profile_uid'],get_observer_hash(),'view_stream')))
+ return '';
+
+
$cat = ((x($_REQUEST,'cat')) ? htmlspecialchars($_REQUEST['cat'],ENT_COMPAT,'UTF-8') : '');
$srchurl = $a->query_string;
$srchurl = rtrim(preg_replace('/cat\=[^\&].*?(\&|$)/is','',$srchurl),'&');
@@ -350,6 +359,9 @@ function widget_tagcloud_wall($arr) {
$a = get_app();
if((! $a->profile['profile_uid']) || (! $a->profile['channel_hash']))
return '';
+ if(! perm_is_allowed($a->profile['profile_uid'],get_observer_hash(),'view_stream'))
+ return '';
+
$limit = ((array_key_exists('limit',$arr)) ? intval($arr['limit']) : 50);
if(feature_enabled($a->profile['profile_uid'],'tagadelic'))
return tagblock('search',$a->profile['profile_uid'],$limit,$a->profile['channel_hash'],ITEM_WALL);
diff --git a/include/zot.php b/include/zot.php
index c0916755f..c919b0981 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -728,7 +728,8 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED) {
z_root() . '/photo/profile/l/' . $local[0]['channel_id'],
z_root() . '/photo/profile/m/' . $local[0]['channel_id'],
z_root() . '/photo/profile/s/' . $local[0]['channel_id'],
- $arr['photo_mimetype']
+ $arr['photo_mimetype'],
+ false
);
}
}
@@ -736,16 +737,29 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED) {
$photos = import_profile_photo($arr['photo'],$xchan_hash);
}
if($photos) {
- $r = q("update xchan set xchan_photo_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s'
- where xchan_hash = '%s' limit 1",
- dbesc(datetime_convert('UTC','UTC',$arr['photo_updated'])),
- dbesc($photos[0]),
- dbesc($photos[1]),
- dbesc($photos[2]),
- dbesc($photos[3]),
- dbesc($xchan_hash)
- );
-
+ if($photos[4]) {
+ // importing the photo failed somehow. Leave the photo_date alone so we can try again at a later date.
+ // This often happens when somebody joins the matrix with a bad cert.
+ $r = q("update xchan set xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s'
+ where xchan_hash = '%s' limit 1",
+ dbesc($photos[0]),
+ dbesc($photos[1]),
+ dbesc($photos[2]),
+ dbesc($photos[3]),
+ dbesc($xchan_hash)
+ );
+ }
+ else {
+ $r = q("update xchan set xchan_photo_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s'
+ where xchan_hash = '%s' limit 1",
+ dbesc(datetime_convert('UTC','UTC',$arr['photo_updated'])),
+ dbesc($photos[0]),
+ dbesc($photos[1]),
+ dbesc($photos[2]),
+ dbesc($photos[3]),
+ dbesc($xchan_hash)
+ );
+ }
$what .= 'photo ';
$changed = true;
}