aboutsummaryrefslogtreecommitdiffstats
path: root/include/security.php
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-06-15 17:28:52 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-06-15 17:28:52 -0700
commit859a2ac8ef1c3ce234b894598be846cbc89cf54a (patch)
tree05993acfb095fa16db4145ad84f4db51f377213c /include/security.php
parent91d92fe6fcbd98e33fb6f76a63e91ebb086aeff0 (diff)
downloadvolse-hubzilla-859a2ac8ef1c3ce234b894598be846cbc89cf54a.tar.gz
volse-hubzilla-859a2ac8ef1c3ce234b894598be846cbc89cf54a.tar.bz2
volse-hubzilla-859a2ac8ef1c3ce234b894598be846cbc89cf54a.zip
DB changes for some channel flags
Diffstat (limited to 'include/security.php')
-rw-r--r--include/security.php24
1 files changed, 10 insertions, 14 deletions
diff --git a/include/security.php b/include/security.php
index 91683cc98..e1f6cd556 100644
--- a/include/security.php
+++ b/include/security.php
@@ -71,9 +71,8 @@ function authenticate_success($user_record, $login_initial = false, $interactive
/* This account has never created a channel. Send them to new_channel by default */
if($a->module === 'login') {
- $r = q("select count(channel_id) as total from channel where channel_account_id = %d and not ( channel_pageflags & %d)>0",
- intval($a->account['account_id']),
- intval(PAGE_REMOVED)
+ $r = q("select count(channel_id) as total from channel where channel_account_id = %d and channel_removed = 0 ",
+ intval($a->account['account_id'])
);
if(($r) && (! $r[0]['total']))
goaway(z_root() . '/new_channel');
@@ -94,20 +93,17 @@ function change_channel($change_channel) {
$ret = false;
if($change_channel) {
- $r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel_id = %d and channel_account_id = %d and not ( channel_pageflags & %d)>0 limit 1",
+ $r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel_id = %d and channel_account_id = %d and channel_removed = 0 limit 1",
intval($change_channel),
- intval(get_account_id()),
- intval(PAGE_REMOVED)
+ intval(get_account_id())
);
// It's not there. Is this an administrator, and is this the sys channel?
if (is_developer()) {
if (! $r) {
if (is_site_admin()) {
- $r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel_id = %d and ( channel_pageflags & %d) and not (channel_pageflags & %d )>0 limit 1",
- intval($change_channel),
- intval(PAGE_SYSTEM),
- intval(PAGE_REMOVED)
+ $r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel_id = %d and channel_system = 1 and channel_removed = 0 limit 1",
+ intval($change_channel)
);
}
}
@@ -404,9 +400,9 @@ function stream_perms_api_uids($perms = NULL, $limit = 0, $rand = 0 ) {
$random_sql = (($rand) ? " ORDER BY " . db_getfunc('RAND') . " " : '');
if(local_channel())
$ret[] = local_channel();
- $r = q("select channel_id from channel where channel_r_stream > 0 and ( channel_r_stream & %d )>0 and ( channel_pageflags & %d ) = 0 $random_sql $limit_sql ",
+ $r = q("select channel_id from channel where channel_r_stream > 0 and ( channel_r_stream & %d )>0 and ( channel_pageflags & %d ) = 0 and channel_system = 0 and channel_removed = 0 $random_sql $limit_sql ",
intval($perms),
- intval(PAGE_ADULT|PAGE_CENSORED|PAGE_SYSTEM|PAGE_REMOVED)
+ intval(PAGE_ADULT|PAGE_CENSORED)
);
if($r) {
foreach($r as $rr)
@@ -434,9 +430,9 @@ function stream_perms_xchans($perms = NULL ) {
if(local_channel())
$ret[] = get_observer_hash();
- $r = q("select channel_hash from channel where channel_r_stream > 0 and (channel_r_stream & %d)>0 and not (channel_pageflags & %d)>0",
+ $r = q("select channel_hash from channel where channel_r_stream > 0 and (channel_r_stream & %d)>0 and not (channel_pageflags & %d)>0 and channel_system = 0 and channel_removed = 0 ",
intval($perms),
- intval(PAGE_ADULT|PAGE_CENSORED|PAGE_SYSTEM|PAGE_REMOVED)
+ intval(PAGE_ADULT|PAGE_CENSORED)
);
if($r) {
foreach($r as $rr)