aboutsummaryrefslogtreecommitdiffstats
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
parent91d92fe6fcbd98e33fb6f76a63e91ebb086aeff0 (diff)
downloadvolse-hubzilla-859a2ac8ef1c3ce234b894598be846cbc89cf54a.tar.gz
volse-hubzilla-859a2ac8ef1c3ce234b894598be846cbc89cf54a.tar.bz2
volse-hubzilla-859a2ac8ef1c3ce234b894598be846cbc89cf54a.zip
DB changes for some channel flags
-rw-r--r--include/Contact.php21
-rw-r--r--include/RedDAV/RedDirectory.php20
-rw-r--r--include/RedDAV/RedFile.php5
-rwxr-xr-xinclude/diaspora.php5
-rw-r--r--include/enotify.php5
-rw-r--r--include/expire.php2
-rw-r--r--include/identity.php41
-rw-r--r--include/nav.php9
-rw-r--r--include/reddav.php3
-rw-r--r--include/security.php24
-rw-r--r--include/zot.php29
-rw-r--r--install/schema_mysql.sql4
-rw-r--r--mod/admin.php14
-rw-r--r--mod/manage.php10
-rw-r--r--mod/ping.php2
-rw-r--r--mod/post.php4
-rw-r--r--mod/receive.php5
-rw-r--r--mod/zfinger.php10
-rw-r--r--mod/zotfeed.php5
19 files changed, 87 insertions, 131 deletions
diff --git a/include/Contact.php b/include/Contact.php
index 7f02f04e4..e7aa4f861 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -49,25 +49,22 @@ function abook_self($channel_id) {
}
function channelx_by_nick($nick) {
- $r = q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_address = '%s' and not ( channel_pageflags & %d )>0 LIMIT 1",
- dbesc($nick),
- intval(PAGE_REMOVED)
+ $r = q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_address = '%s' and channel_removed = 0 LIMIT 1",
+ dbesc($nick)
);
return(($r) ? $r[0] : false);
}
function channelx_by_hash($hash) {
- $r = q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_hash = '%s' and not ( channel_pageflags & %d )>0 LIMIT 1",
- dbesc($hash),
- intval(PAGE_REMOVED)
+ $r = q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_hash = '%s' and channel_removed = 0 LIMIT 1",
+ dbesc($hash)
);
return(($r) ? $r[0] : false);
}
function channelx_by_n($id) {
- $r = q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_id = %d and not ( channel_pageflags & %d )>0 LIMIT 1",
- dbesc($id),
- intval(PAGE_REMOVED)
+ $r = q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_id = %d and channel_removed = 0 LIMIT 1",
+ dbesc($id)
);
return(($r) ? $r[0] : false);
}
@@ -289,13 +286,12 @@ function channel_remove($channel_id, $local = true, $unset_session=true) {
if(! $local) {
- $r = q("update channel set channel_deleted = '%s', channel_pageflags = (channel_pageflags | %d), channel_r_stream = 0, channel_r_profile = 0,
+ $r = q("update channel set channel_deleted = '%s', channel_removed = 1, channel_r_stream = 0, channel_r_profile = 0,
channel_r_photos = 0, channel_r_abook = 0, channel_w_stream = 0, channel_w_wall = 0, channel_w_tagwall = 0,
channel_w_comment = 0, channel_w_mail = 0, channel_w_photos = 0, channel_w_chat = 0, channel_a_delegate = 0,
channel_r_storage = 0, channel_w_storage = 0, channel_r_pages = 0, channel_w_pages = 0, channel_a_republish = 0
where channel_id = %d",
dbesc(datetime_convert()),
- intval(PAGE_REMOVED),
intval($channel_id)
);
@@ -331,9 +327,8 @@ function channel_remove($channel_id, $local = true, $unset_session=true) {
dbesc($channel['channel_hash'])
);
- $r = q("update channel set channel_deleted = '%s', channel_pageflags = (channel_pageflags | %d) where channel_id = %d",
+ $r = q("update channel set channel_deleted = '%s', channel_removed = 1 where channel_id = %d",
dbesc(datetime_convert()),
- intval(PAGE_REMOVED),
intval($channel_id)
);
diff --git a/include/RedDAV/RedDirectory.php b/include/RedDAV/RedDirectory.php
index 88a4647a4..dba857cdc 100644
--- a/include/RedDAV/RedDirectory.php
+++ b/include/RedDAV/RedDirectory.php
@@ -200,9 +200,8 @@ class RedDirectory extends DAV\Node implements DAV\ICollection, DAV\IQuota {
$mimetype = z_mime_content_type($name);
- $c = q("SELECT * FROM channel WHERE channel_id = %d AND NOT (channel_pageflags & %d)>0 LIMIT 1",
- intval($this->auth->owner_id),
- intval(PAGE_REMOVED)
+ $c = q("SELECT * FROM channel WHERE channel_id = %d AND channel_removed = 0 LIMIT 1",
+ intval($this->auth->owner_id)
);
if (! $c) {
@@ -318,9 +317,8 @@ class RedDirectory extends DAV\Node implements DAV\ICollection, DAV\IQuota {
throw new DAV\Exception\Forbidden('Permission denied.');
}
- $r = q("SELECT * FROM channel WHERE channel_id = %d AND NOT (channel_pageflags & %d)>0 LIMIT 1",
- intval($this->auth->owner_id),
- intval(PAGE_REMOVED)
+ $r = q("SELECT * FROM channel WHERE channel_id = %d AND channel_removed = 0 LIMIT 1",
+ intval($this->auth->owner_id)
);
if ($r) {
@@ -389,9 +387,8 @@ class RedDirectory extends DAV\Node implements DAV\ICollection, DAV\IQuota {
$channel_name = $path_arr[0];
- $r = q("SELECT channel_id FROM channel WHERE channel_address = '%s' AND NOT ( channel_pageflags & %d )>0 LIMIT 1",
- dbesc($channel_name),
- intval(PAGE_REMOVED)
+ $r = q("SELECT channel_id FROM channel WHERE channel_address = '%s' AND channel_removed = 0 LIMIT 1",
+ dbesc($channel_name)
);
if (! $r) {
@@ -467,9 +464,8 @@ class RedDirectory extends DAV\Node implements DAV\ICollection, DAV\IQuota {
$free = disk_free_space('store');
if ($this->auth->owner_id) {
- $c = q("select * from channel where channel_id = %d and not (channel_pageflags & %d)>0 limit 1",
- intval($this->auth->owner_id),
- intval(PAGE_REMOVED)
+ $c = q("select * from channel where channel_id = %d and channel_removed = 0 limit 1",
+ intval($this->auth->owner_id)
);
$ulimit = service_class_fetch($c[0]['channel_id'], 'attach_upload_limit');
diff --git a/include/RedDAV/RedFile.php b/include/RedDAV/RedFile.php
index 164498676..1fd2dab8f 100644
--- a/include/RedDAV/RedFile.php
+++ b/include/RedDAV/RedFile.php
@@ -97,9 +97,8 @@ class RedFile extends DAV\Node implements DAV\IFile {
$size = 0;
// @todo only 3 values are needed
- $c = q("SELECT * FROM channel WHERE channel_id = %d AND (channel_pageflags & %d) = 0 LIMIT 1",
- intval($this->auth->owner_id),
- intval(PAGE_REMOVED)
+ $c = q("SELECT * FROM channel WHERE channel_id = %d AND channel_removed = 0 LIMIT 1",
+ intval($this->auth->owner_id)
);
$is_photo = false;
diff --git a/include/diaspora.php b/include/diaspora.php
index fc3c6c2ce..18e131f8f 100755
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -24,9 +24,8 @@ function diaspora_dispatch_public($msg) {
// find everybody following or allowing this author
- $r = q("SELECT * from channel where channel_id in ( SELECT abook_channel from abook left join xchan on abook_xchan = xchan_hash WHERE xchan_network like '%%diaspora%%' and xchan_addr = '%s' ) and ( channel_pageflags & %d ) = 0 ",
- dbesc($msg['author']),
- intval(PAGE_REMOVED)
+ $r = q("SELECT * from channel where channel_id in ( SELECT abook_channel from abook left join xchan on abook_xchan = xchan_hash WHERE xchan_network like '%%diaspora%%' and xchan_addr = '%s' ) and channel_removed = 0 ",
+ dbesc($msg['author'])
);
// also need to look for those following public streams
diff --git a/include/enotify.php b/include/enotify.php
index cd49a9b34..d0228bf50 100644
--- a/include/enotify.php
+++ b/include/enotify.php
@@ -36,9 +36,8 @@ function notification($params) {
}
if ($params['to_xchan']) {
$y = q("select channel.*, account.* from channel left join account on channel_account_id = account_id
- where channel_hash = '%s' and not (channel_pageflags & %d)>0 limit 1",
- dbesc($params['to_xchan']),
- intval(PAGE_REMOVED)
+ where channel_hash = '%s' and channel_removed = 0 limit 1",
+ dbesc($params['to_xchan'])
);
}
if ($x & $y) {
diff --git a/include/expire.php b/include/expire.php
index 47cc04829..e75594b5f 100644
--- a/include/expire.php
+++ b/include/expire.php
@@ -45,7 +45,7 @@ function expire_run($argv, $argc){
foreach ($r as $rr) {
// expire the sys channel separately
- if ($rr['channel_pageflags'] & PAGE_SYSTEM)
+ if (intval($rr['channel_system']))
continue;
// service class default (if non-zero) over-rides the site default
diff --git a/include/identity.php b/include/identity.php
index 0555cf21d..184e9c308 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -24,9 +24,8 @@ require_once('include/crypto.php');
function identity_check_service_class($account_id) {
$ret = array('success' => false, 'message' => '');
- $r = q("select count(channel_id) as total from channel where channel_account_id = %d and not ( channel_pageflags & %d )>0 ",
- intval($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($account_id)
);
if(! ($r && count($r))) {
$ret['total_identities'] = 0;
@@ -98,7 +97,7 @@ function create_sys_channel() {
'account_id' => 'xxx', // This will create an identity with an (integer) account_id of 0, but account_id is required
'nickname' => 'sys',
'name' => 'System',
- 'pageflags' => PAGE_SYSTEM,
+ 'pageflags' => 0,
'publish' => 0,
'system' => 1
));
@@ -111,9 +110,7 @@ function create_sys_channel() {
* @return array|boolean
*/
function get_sys_channel() {
- $r = q("select * from channel left join xchan on channel_hash = xchan_hash where (channel_pageflags & %d)>0 limit 1",
- intval(PAGE_SYSTEM)
- );
+ $r = q("select * from channel left join xchan on channel_hash = xchan_hash where channel_system = 1 limit 1");
if ($r)
return $r[0];
@@ -129,11 +126,11 @@ function get_sys_channel() {
* @return boolean
*/
function is_sys_channel($channel_id) {
- $r = q("select channel_pageflags from channel where channel_id = %d limit 1",
+ $r = q("select channel_system from channel where channel_id = %d and channel_system = 1 limit 1",
intval($channel_id)
);
- if (($r) && ($r[0]['channel_pageflags'] & PAGE_SYSTEM))
+ if($r)
return true;
return false;
@@ -149,9 +146,7 @@ function is_sys_channel($channel_id) {
* on error returns boolean false
*/
function channel_total() {
- $r = q("select channel_id from channel where not ( channel_pageflags & %d )>0",
- intval(PAGE_REMOVED)
- );
+ $r = q("select channel_id from channel where channel_removed = 0");
if (is_array($r))
return count($r);
@@ -208,7 +203,7 @@ function create_identity($arr) {
return $ret;
}
- if($nick === 'sys' && (! ($pageflags & PAGE_SYSTEM))) {
+ if($nick === 'sys' && (! $system)) {
$ret['message'] = t('Reserved nickname. Please choose another.');
return $ret;
}
@@ -265,8 +260,8 @@ function create_identity($arr) {
$r = q("insert into channel ( channel_account_id, channel_primary,
channel_name, channel_address, channel_guid, channel_guid_sig,
- channel_hash, channel_prvkey, channel_pubkey, channel_pageflags, channel_expire_days, channel_timezone $perms_keys )
- values ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s' $perms_vals ) ",
+ channel_hash, channel_prvkey, channel_pubkey, channel_pageflags, channel_system, channel_expire_days, channel_timezone $perms_keys )
+ values ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, '%s' $perms_vals ) ",
intval($arr['account_id']),
intval($primary),
@@ -278,6 +273,7 @@ function create_identity($arr) {
dbesc($key['prvkey']),
dbesc($key['pubkey']),
intval($pageflags),
+ intval($system),
intval($expire),
dbesc($a->timezone)
);
@@ -619,9 +615,8 @@ function profile_load(&$a, $nickname, $profile = '') {
logger('profile_load: ' . $nickname . (($profile) ? ' profile: ' . $profile : ''));
- $user = q("select channel_id from channel where channel_address = '%s' and not ( channel_pageflags & %d ) > 0 limit 1",
- dbesc($nickname),
- intval(PAGE_REMOVED)
+ $user = q("select channel_id from channel where channel_address = '%s' and channel_removed = 0 limit 1",
+ dbesc($nickname)
);
if(! $user) {
@@ -664,10 +659,9 @@ function profile_load(&$a, $nickname, $profile = '') {
if(! $p) {
$p = q("SELECT profile.uid AS profile_uid, profile.*, channel.* FROM profile
LEFT JOIN channel ON profile.uid = channel.channel_id
- WHERE channel.channel_address = '%s' and not ( channel_pageflags & %d )>0
+ WHERE channel.channel_address = '%s' and channel_removed = 0
AND profile.is_default = 1 LIMIT 1",
- dbesc($nickname),
- intval(PAGE_REMOVED)
+ dbesc($nickname)
);
}
@@ -1457,9 +1451,8 @@ function get_channel_by_nick($nick) {
*/
function identity_selector() {
if (local_channel()) {
- $r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel.channel_account_id = %d and (channel_pageflags & %d) = 0 order by channel_name ",
- intval(get_account_id()),
- intval(PAGE_REMOVED)
+ $r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel.channel_account_id = %d and channel_removed = 0 order by channel_name ",
+ intval(get_account_id())
);
if (count($r) > 1) {
//$account = get_app()->get_account();
diff --git a/include/nav.php b/include/nav.php
index 77287c021..0ca554897 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -30,14 +30,9 @@ EOT;
intval($channel['channel_id'])
);
- $chans = q("select channel_name, channel_id from channel where channel_account_id = %d and not ( channel_pageflags & %d )>0 order by channel_name ",
- intval(get_account_id()),
- intval(PAGE_REMOVED)
+ $chans = q("select channel_name, channel_id from channel where channel_account_id = %d and channel_removed = 0 order by channel_name ",
+ intval(get_account_id())
);
-
-
-
-
}
elseif(remote_channel())
$observer = $a->get_observer();
diff --git a/include/reddav.php b/include/reddav.php
index e90543e27..5ecb10fb4 100644
--- a/include/reddav.php
+++ b/include/reddav.php
@@ -42,8 +42,7 @@ require_once('include/RedDAV/RedBasicAuth.php');
function RedChannelList(&$auth) {
$ret = array();
- $r = q("SELECT channel_id, channel_address FROM channel WHERE NOT (channel_pageflags & %d)>0 AND NOT (channel_pageflags & %d)>0",
- intval(PAGE_REMOVED),
+ $r = q("SELECT channel_id, channel_address FROM channel WHERE channel_removed = 0 AND channel_system = 0 AND NOT (channel_pageflags & %d)>0",
intval(PAGE_HIDDEN)
);
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)
diff --git a/include/zot.php b/include/zot.php
index afa60c92c..309df252d 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -1092,9 +1092,7 @@ function zot_import($arr, $sender_url) {
}
stringify_array_elms($recip_arr);
$recips = implode(',',$recip_arr);
- $r = q("select channel_hash as hash from channel where channel_hash in ( " . $recips . " ) and not ( channel_pageflags & %d ) > 0 ",
- intval(PAGE_REMOVED)
- );
+ $r = q("select channel_hash as hash from channel where channel_hash in ( " . $recips . " ) and channel_removed = 0 ");
if(! $r) {
logger('recips: no recipients on this site');
continue;
@@ -1308,13 +1306,13 @@ function public_recips($msg) {
or ( " . $col . " & " . intval(PERMS_PUBLIC) . ") > 0
or ( " . $col . " & " . intval(PERMS_AUTHED) . ") > 0 ) ";
} else {
- $sql = " where (( " . $col . " & " . intval(PERMS_NETWORK) . " ) > 0
- or ( " . $col . " & " . intval(PERMS_PUBLIC) . ") > 0
- or ( " . $col . " & " . intval(PERMS_AUTHED) . ") > 0 ) ";
+ $sql = " where ( " . $col . " = " . intval(PERMS_NETWORK) . "
+ or " . $col . " = " . intval(PERMS_PUBLIC) . "
+ or " . $col . " = " . intval(PERMS_AUTHED) . " ) ";
}
$r = q("select channel_hash as hash from channel $sql or channel_hash = '%s'
- and ( channel_pageflags & " . intval(PAGE_REMOVED) . " ) = 0 ",
+ and channel_removed = 0 ",
dbesc($msg['notify']['sender']['hash'])
);
@@ -1325,10 +1323,10 @@ function public_recips($msg) {
// and is allowing this sender at least at a high level.
$x = q("select channel_hash as hash from channel left join abook on abook_channel = channel_id
- where abook_xchan = '%s' and ( channel_pageflags & " . intval(PAGE_REMOVED) . " ) = 0
- and (( " . $col . " & " . intval(PERMS_SPECIFIC) . " ) > 0 and ( abook_my_perms & " . intval($field) . " ) > 0 )
- OR ( " . $col . " & " . intval(PERMS_PENDING) . " ) > 0
- OR (( " . $col . " & " . intval(PERMS_CONTACTS) . " ) > 0 and abook_pending = 0 )) ",
+ where abook_xchan = '%s' and channel_removed = 0
+ and (( " . $col . " = " . intval(PERMS_SPECIFIC) . " and ( abook_my_perms & " . intval($field) . " ) > 0 )
+ OR " . $col . " = " . intval(PERMS_PENDING) . "
+ OR ( " . $col . " = " . intval(PERMS_CONTACTS) . " and abook_pending = 0 )) ",
dbesc($msg['notify']['sender']['hash'])
);
@@ -1357,7 +1355,7 @@ function public_recips($msg) {
$address = basename($tag['url']);
if($address) {
$z = q("select channel_hash as hash from channel where channel_address = '%s'
- and ( channel_pageflags & " . intval(PAGE_REMOVED) . " ) = 0 limit 1",
+ and channel_removed = 0 limit 1",
dbesc($address)
);
if($z)
@@ -1461,9 +1459,8 @@ function allowed_public_recips($msg) {
$condensed_recips[] = $rr['hash'];
$results = array();
- $r = q("select channel_hash as hash from channel left join abook on abook_channel = channel_id where abook_xchan = '%s' and ( channel_pageflags & %d ) = 0 ",
- dbesc($hash),
- intval(PAGE_REMOVED)
+ $r = q("select channel_hash as hash from channel left join abook on abook_channel = channel_id where abook_xchan = '%s' and channel_removed = 0 ",
+ dbesc($hash)
);
if($r) {
foreach($r as $rr)
@@ -1517,7 +1514,7 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $
// for comments travelling upstream. Wait and catch them on the way down.
// They may have been blocked by the owner.
- if(($channel['channel_pageflags'] & PAGE_SYSTEM) && (! $arr['item_private']) && (! $relay)) {
+ if(intval($channel['channel_system']) && (! $arr['item_private']) && (! $relay)) {
$local_public = true;
$r = q("select xchan_selfcensored from xchan where xchan_hash = '%s' limit 1",
diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql
index 70d142f0c..c68261caf 100644
--- a/install/schema_mysql.sql
+++ b/install/schema_mysql.sql
@@ -221,6 +221,8 @@ CREATE TABLE IF NOT EXISTS `channel` (
`channel_w_pages` int(10) unsigned NOT NULL DEFAULT '0',
`channel_a_republish` int(10) unsigned NOT NULL DEFAULT '0',
`channel_w_like` int(10) unsigned NOT NULL DEFAULT '0',
+ `channel_removed` tinyint(1) NOT NULL DEFAULT '0',
+ `channel_system` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`channel_id`),
UNIQUE KEY `channel_address_unique` (`channel_address`),
KEY `channel_account_id` (`channel_account_id`),
@@ -257,6 +259,8 @@ CREATE TABLE IF NOT EXISTS `channel` (
KEY `channel_a_republish` (`channel_a_republish`),
KEY `channel_dirdate` (`channel_dirdate`),
KEY `channel_w_like` (`channel_w_like`),
+ KEY `channel_removed` (`channel_removed`),
+ KEY `channel_system` (`channel_system`),
KEY `channel_lastpost` (`channel_lastpost`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
diff --git a/mod/admin.php b/mod/admin.php
index eaaf67c8d..3b8cd2a95 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -211,9 +211,7 @@ function admin_page_summary(&$a) {
// available channels, primary and clones
$channels = array();
- $r = q("SELECT COUNT(*) AS total, COUNT(CASE WHEN channel_primary = 1 THEN 1 ELSE NULL END) AS main, COUNT(CASE WHEN channel_primary = 0 THEN 1 ELSE NULL END) AS clones FROM channel WHERE NOT (channel_pageflags & %d)>0",
- intval(PAGE_REMOVED)
- );
+ $r = q("SELECT COUNT(*) AS total, COUNT(CASE WHEN channel_primary = 1 THEN 1 ELSE NULL END) AS main, COUNT(CASE WHEN channel_primary = 0 THEN 1 ELSE NULL END) AS clones FROM channel WHERE channel_removed = 0");
if ($r) {
$channels['total'] = array('label' => t('# Channels'), 'val' => $r[0]['total']);
$channels['main'] = array('label' => t('# primary'), 'val' => $r[0]['main']);
@@ -788,11 +786,10 @@ function admin_page_users(&$a){
$users = q("SELECT `account_id` , `account_email`, `account_lastlog`, `account_created`, `account_expires`, " . "`account_service_class`, ( account_flags & %d )>0 as `blocked`, " .
"(SELECT %s FROM channel as ch " .
- "WHERE ch.channel_account_id = ac.account_id and not (ch.channel_pageflags & %d )>0) as `channels` " .
+ "WHERE ch.channel_account_id = ac.account_id and ch.channel_removed = 0 ) as `channels` " .
"FROM account as ac where true $serviceclass $order limit %d offset %d ",
intval(ACCOUNT_BLOCKED),
db_concat('ch.channel_address', ' '),
- intval(PAGE_REMOVED),
intval($a->pager['itemspage']),
intval($a->pager['start'])
);
@@ -950,9 +947,7 @@ function admin_page_channels(&$a){
/* get channels */
- $total = q("SELECT count(*) as total FROM channel where not (channel_pageflags & %d)>0",
- intval(PAGE_REMOVED|PAGE_SYSTEM)
- );
+ $total = q("SELECT count(*) as total FROM channel where channel_removed = 0 and channel_system = 0");
if($total) {
$a->set_pager_total($total[0]['total']);
$a->set_pager_itemspage(100);
@@ -960,8 +955,7 @@ function admin_page_channels(&$a){
$order = " order by channel_name asc ";
- $channels = q("SELECT * from channel where not ( channel_pageflags & %d )>0 $order limit %d offset %d ",
- intval(PAGE_REMOVED|PAGE_SYSTEM),
+ $channels = q("SELECT * from channel where channel_removed = 0 and channel_system = 0 $order limit %d offset %d ",
intval($a->pager['itemspage']),
intval($a->pager['start'])
);
diff --git a/mod/manage.php b/mod/manage.php
index c6b653ab6..c86db55e8 100644
--- a/mod/manage.php
+++ b/mod/manage.php
@@ -41,9 +41,8 @@ function manage_content(&$a) {
$channels = null;
if(local_channel()) {
- $r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel.channel_account_id = %d and not ( channel_pageflags & %d )>0 order by channel_name ",
- intval(get_account_id()),
- intval(PAGE_REMOVED)
+ $r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel.channel_account_id = %d and channel_removed = 0 order by channel_name ",
+ intval(get_account_id())
);
$account = get_app()->get_account();
@@ -124,9 +123,8 @@ function manage_content(&$a) {
}
}
- $r = q("select count(channel_id) as total from channel where channel_account_id = %d and not ( channel_pageflags & %d )>0",
- intval(get_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(get_account_id())
);
$limit = account_service_class_fetch(get_account_id(),'total_identities');
if($limit !== false) {
diff --git a/mod/ping.php b/mod/ping.php
index 16c72f5e6..b093c1cab 100644
--- a/mod/ping.php
+++ b/mod/ping.php
@@ -376,7 +376,7 @@ function ping_init(&$a) {
$t1 = dba_timer();
if($vnotify & (VNOTIFY_NETWORK|VNOTIFY_CHANNEL)) {
- $r = q("SELECT id, item_flags FROM item
+ $r = q("SELECT id, item_wall FROM item
WHERE item_unseen = 1 and uid = %d
$item_normal
and author_xchan != '%s'",
diff --git a/mod/post.php b/mod/post.php
index 66a354ead..dfda7db9d 100644
--- a/mod/post.php
+++ b/mod/post.php
@@ -103,9 +103,7 @@ function post_init(&$a) {
// Any channel will do, providing it's currently active. We just need to have an
// identity to attach to the packet we send back. So find one.
- $c = q("select * from channel where not ( channel_pageflags & %d )>0 limit 1",
- intval(PAGE_REMOVED)
- );
+ $c = q("select * from channel where channel_removed = 0 limit 1");
if (! $c) {
// nobody here
diff --git a/mod/receive.php b/mod/receive.php
index deaf8cb37..571f736ed 100644
--- a/mod/receive.php
+++ b/mod/receive.php
@@ -31,9 +31,8 @@ function receive_post(&$a) {
// Diaspora sites *may* provide a truncated guid.
- $r = q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_guid like '%s' AND (channel_pageflags & %d ) = 0 LIMIT 1",
- dbesc($guid . '%'),
- intval(PAGE_REMOVED)
+ $r = q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_guid like '%s' AND channel_removed = 0 LIMIT 1",
+ dbesc($guid . '%')
);
if(! $r)
http_status_exit(500);
diff --git a/mod/zfinger.php b/mod/zfinger.php
index 39c9ae9aa..8ddd92f3d 100644
--- a/mod/zfinger.php
+++ b/mod/zfinger.php
@@ -74,14 +74,10 @@ function zfinger_init(&$a) {
*/
$r = q("select channel.*, xchan.* from channel left join xchan on channel_hash = xchan_hash
- where ( channel_pageflags & %d )>0 order by channel_id limit 1",
- intval(PAGE_SYSTEM)
- );
+ where channel_system = 1 order by channel_id limit 1");
if(! $r) {
$r = q("select channel.*, xchan.* from channel left join xchan on channel_hash = xchan_hash
- where not ( channel_pageflags & %d )>0 order by channel_id limit 1",
- intval(PAGE_REMOVED)
- );
+ where channel_removed = 0 order by channel_id limit 1");
}
}
}
@@ -99,7 +95,7 @@ function zfinger_init(&$a) {
$id = $e['channel_id'];
- $sys_channel = (($e['channel_pageflags'] & PAGE_SYSTEM) ? true : false);
+ $sys_channel = (intval($e['channel_system']) ? true : false);
$special_channel = (($e['channel_pageflags'] & PAGE_PREMIUM) ? true : false);
$adult_channel = (($e['channel_pageflags'] & PAGE_ADULT) ? true : false);
$censored = (($e['channel_pageflags'] & PAGE_CENSORED) ? true : false);
diff --git a/mod/zotfeed.php b/mod/zotfeed.php
index 78a667330..b2f2e0465 100644
--- a/mod/zotfeed.php
+++ b/mod/zotfeed.php
@@ -21,9 +21,8 @@ function zotfeed_init(&$a) {
$channel_address = ((argc() > 1) ? argv(1) : '');
if($channel_address) {
- $r = q("select channel_id, channel_name from channel where channel_address = '%s' and not (channel_pageflags & %d) > 0 limit 1",
- dbesc(argv(1)),
- intval(PAGE_REMOVED)
+ $r = q("select channel_id, channel_name from channel where channel_address = '%s' and channel_removed = 0 limit 1",
+ dbesc(argv(1))
);
}
else {