Merge branch 'dev' into perms

This commit is contained in:
redmatrix
2016-07-17 21:40:04 -07:00
43 changed files with 2703 additions and 2707 deletions

View File

@@ -1,63 +0,0 @@
<?php
function perm_limits_upgrade($channel) {
set_pconfig($channel['channel_id'],'perm_limits','view_stream',$channel['channel_r_stream']);
set_pconfig($channel['channel_id'],'perm_limits','view_profile',$channel['channel_r_profile']);
set_pconfig($channel['channel_id'],'perm_limits','view_contacts',$channel['channel_r_abook']);
set_pconfig($channel['channel_id'],'perm_limits','view_storage',$channel['channel_r_storage']);
set_pconfig($channel['channel_id'],'perm_limits','view_pages',$channel['channel_r_pages']);
set_pconfig($channel['channel_id'],'perm_limits','send_stream',$channel['channel_w_stream']);
set_pconfig($channel['channel_id'],'perm_limits','post_wall',$channel['channel_w_wall']);
set_pconfig($channel['channel_id'],'perm_limits','post_comments',$channel['channel_w_comment']);
set_pconfig($channel['channel_id'],'perm_limits','post_mail',$channel['channel_w_mail']);
set_pconfig($channel['channel_id'],'perm_limits','post_like',$channel['channel_w_like']);
set_pconfig($channel['channel_id'],'perm_limits','tag_deliver',$channel['channel_w_tagwall']);
set_pconfig($channel['channel_id'],'perm_limits','chat',$channel['channel_w_chat']);
set_pconfig($channel['channel_id'],'perm_limits','write_storage',$channel['channel_w_storage']);
set_pconfig($channel['channel_id'],'perm_limits','write_pages',$channel['channel_w_pages']);
set_pconfig($channel['channel_id'],'perm_limits','republish',$channel['channel_a_republish']);
set_pconfig($channel['channel_id'],'perm_limits','delegate',$channel['channel_a_delegate']);
}
function perm_abook_upgrade($abook) {
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'their_perms','view_stream',intval(($abook['abook_their_perms'] & PERMS_R_STREAM)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'their_perms','view_profile',intval(($abook['abook_their_perms'] & PERMS_R_PROFILE)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'their_perms','view_contacts',intval(($abook['abook_their_perms'] & PERMS_R_ABOOK)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'their_perms','view_storage',intval(($abook['abook_their_perms'] & PERMS_R_STORAGE)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'their_perms','view_pages',intval(($abook['abook_their_perms'] & PERMS_R_PAGES)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'their_perms','send_stream',intval(($abook['abook_their_perms'] & PERMS_W_STREAM)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'their_perms','post_wall',intval(($abook['abook_their_perms'] & PERMS_W_WALL)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'their_perms','post_comments',intval(($abook['abook_their_perms'] & PERMS_W_COMMENT)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'their_perms','post_mail',intval(($abook['abook_their_perms'] & PERMS_W_MAIL)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'their_perms','post_like',intval(($abook['abook_their_perms'] & PERMS_W_LIKE)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'their_perms','tag_deliver',intval(($abook['abook_their_perms'] & PERMS_W_TAGWALL)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'their_perms','chat',intval(($abook['abook_their_perms'] & PERMS_W_CHAT)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'their_perms','write_storage',intval(($abook['abook_their_perms'] & PERMS_W_STORAGE)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'their_perms','write_pages',intval(($abook['abook_their_perms'] & PERMS_W_PAGES)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'their_perms','republish',intval(($abook['abook_their_perms'] & PERMS_A_REPUBLISH)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'their_perms','delegate',intval(($abook['abook_their_perms'] & PERMS_A_DELEGATE)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'my_perms','view_stream',intval(($abook['abook_my_perms'] & PERMS_R_STREAM)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'my_perms','view_profile',intval(($abook['abook_my_perms'] & PERMS_R_PROFILE)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'my_perms','view_contacts',intval(($abook['abook_my_perms'] & PERMS_R_ABOOK)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'my_perms','view_storage',intval(($abook['abook_my_perms'] & PERMS_R_STORAGE)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'my_perms','view_pages',intval(($abook['abook_my_perms'] & PERMS_R_PAGES)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'my_perms','send_stream',intval(($abook['abook_my_perms'] & PERMS_W_STREAM)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'my_perms','post_wall',intval(($abook['abook_my_perms'] & PERMS_W_WALL)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'my_perms','post_comments',intval(($abook['abook_my_perms'] & PERMS_W_COMMENT)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'my_perms','post_mail',intval(($abook['abook_my_perms'] & PERMS_W_MAIL)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'my_perms','post_like',intval(($abook['abook_my_perms'] & PERMS_W_LIKE)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'my_perms','tag_deliver',intval(($abook['abook_my_perms'] & PERMS_W_TAGWALL)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'my_perms','chat',intval(($abook['abook_my_perms'] & PERMS_W_CHAT)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'my_perms','write_storage',intval(($abook['abook_my_perms'] & PERMS_W_STORAGE)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'my_perms','write_pages',intval(($abook['abook_my_perms'] & PERMS_W_PAGES)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'my_perms','republish',intval(($abook['abook_my_perms'] & PERMS_A_REPUBLISH)? 1 : 0));
set_abconfig($abook['abook_channel'],$abook['abook_xchan'],'my_perms','delegate',intval(($abook['abook_my_perms'] & PERMS_A_DELEGATE)? 1 : 0));
}

View File

@@ -141,6 +141,23 @@ CREATE TABLE IF NOT EXISTS `app` (
KEY `app_edited` (`app_edited`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `atoken` (
`atoken_id` int(11) NOT NULL AUTO_INCREMENT,
`atoken_aid` int(11) NOT NULL DEFAULT 0,
`atoken_uid` int(11) NOT NULL DEFAULT 0,
`atoken_name` char(255) NOT NULL DEFAULT '',
`atoken_token` char(255) NOT NULL DEFAULT '',
`atoken_expires` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`atoken_id`),
KEY `atoken_aid` (`atoken_aid`),
KEY `atoken_uid` (`atoken_uid`),
KEY `atoken_uid_2` (`atoken_uid`),
KEY `atoken_name` (`atoken_name`),
KEY `atoken_token` (`atoken_token`),
KEY `atoken_expires` (`atoken_expires`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `attach` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`aid` int(10) unsigned NOT NULL DEFAULT '0',

View File

@@ -137,6 +137,21 @@ create index "app_created" on app ("app_created");
create index "app_edited" on app ("app_edited");
create index "app_deleted" on app ("app_deleted");
create index "app_system" on app ("app_system");
CREATE TABLE "atoken" (
"atoken_id" serial NOT NULL,
"atoken_aid" bigint NOT NULL DEFAULT 0,
"atoken_uid" bigint NOT NULL DEFAULT 0,
"atoken_name" varchar(255) NOT NULL DEFAULT '',
"atoken_token" varchar(255) NOT NULL DEFAULT '',
"atoken_expires" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
PRIMARY KEY ("atoken_id"));
create index atoken_aid on atoken (atoken_aid);
create index atoken_uid on atoken (atoken_uid);
create index atoken_name on atoken (atoken_name);
create index atoken_token on atoken (atoken_token);
create index atoken_expires on atoken (atoken_expires);
CREATE TABLE "attach" (
"id" serial NOT NULL,
"aid" bigint NOT NULL DEFAULT '0',

View File

@@ -1,6 +1,6 @@
<?php
define( 'UPDATE_VERSION' , 1180 );
define( 'UPDATE_VERSION' , 1181 );
/**
*
@@ -2364,7 +2364,49 @@ function update_r1178() {
function update_r1179() {
require_once('install/perm_upgrade.php');
if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
$r1 = q("CREATE TABLE atoken (
atoken_id serial NOT NULL,
atoken_aid bigint NOT NULL DEFAULT 0,
atoken_uid bigint NOT NULL DEFAULT 0,
atoken_name varchar(255) NOT NULL DEFAULT '',
atoken_token varchar(255) NOT NULL DEFAULT '',
atoken_expires timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
PRIMARY KEY (atoken_id)) ");
$r2 = q("create index atoken_aid on atoken (atoken_aid)");
$r3 = q("create index atoken_uid on atoken (atoken_uid)");
$r4 = q("create index atoken_name on atoken (atoken_name)");
$r5 = q("create index atoken_token on atoken (atoken_token)");
$r6 = q("create index atoken_expires on atoken (atoken_expires)");
$r = $r1 && $r2 && $r3 && $r4 && $r5 && $r6;
}
else {
$r = q("CREATE TABLE IF NOT EXISTS `atoken` (
`atoken_id` int(11) NOT NULL AUTO_INCREMENT,
`atoken_aid` int(11) NOT NULL DEFAULT 0,
`atoken_uid` int(11) NOT NULL DEFAULT 0,
`atoken_name` char(255) NOT NULL DEFAULT '',
`atoken_token` char(255) NOT NULL DEFAULT '',
`atoken_expires` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`atoken_id`),
KEY `atoken_aid` (`atoken_aid`),
KEY `atoken_uid` (`atoken_uid`),
KEY `atoken_name` (`atoken_name`),
KEY `atoken_token` (`atoken_token`),
KEY `atoken_expires` (`atoken_expires`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ");
}
if($r)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
function update_r1180() {
require_once('include/perm_upgrade.php');
$r1 = q("select * from channel where true");
if($r1) {
@@ -2384,6 +2426,5 @@ function update_r1179() {
if($r)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
}