diff options
author | git-marijus <mario@mariovavti.com> | 2017-04-13 12:08:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-13 12:08:17 +0200 |
commit | 2aa69257a4a56b42004e6c758ded644e85071ad9 (patch) | |
tree | 107e61f6b8b665f51c8826151b675a34e7f4e4cd | |
parent | 7b173a75e47cfdf9f46b7d635df84b2be286b0e6 (diff) | |
parent | 9d425b472722e7ca33e93e09bb330763bed2d257 (diff) | |
download | volse-hubzilla-2aa69257a4a56b42004e6c758ded644e85071ad9.tar.gz volse-hubzilla-2aa69257a4a56b42004e6c758ded644e85071ad9.tar.bz2 volse-hubzilla-2aa69257a4a56b42004e6c758ded644e85071ad9.zip |
Merge pull request #715 from zotlabs/cpp
backend infrastructure for 'channel protection password'; which will …
-rwxr-xr-x | boot.php | 2 | ||||
-rw-r--r-- | include/channel.php | 6 | ||||
-rw-r--r-- | include/import.php | 2 | ||||
-rw-r--r-- | include/zot.php | 2 | ||||
-rw-r--r-- | install/schema_mysql.sql | 2 | ||||
-rw-r--r-- | install/schema_postgres.sql | 2 | ||||
-rw-r--r-- | install/update.php | 13 |
7 files changed, 25 insertions, 4 deletions
@@ -52,7 +52,7 @@ define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'STD_VERSION', '2.3.3' ); define ( 'ZOT_REVISION', '1.2' ); -define ( 'DB_UPDATE_VERSION', 1188 ); +define ( 'DB_UPDATE_VERSION', 1189 ); define ( 'PROJECT_BASE', __DIR__ ); diff --git a/include/channel.php b/include/channel.php index 1bdd5a478..0a4c9009a 100644 --- a/include/channel.php +++ b/include/channel.php @@ -537,6 +537,8 @@ function identity_basic_export($channel_id, $sections = null) { $ret['relocate'] = [ 'channel_address' => $r[0]['channel_address'], 'url' => z_root()]; if(in_array('channel',$sections)) { $ret['channel'] = $r[0]; + unset($ret['channel']['channel_password']); + unset($ret['channel']['channel_salt']); } } @@ -2020,7 +2022,9 @@ function channel_store_lowlevel($arr) { 'channel_deny_gid' => ((array_key_exists('channel_deny_gid',$arr)) ? $arr['channel_deny_gid'] : ''), 'channel_removed' => ((array_key_exists('channel_removed',$arr)) ? $arr['channel_removed'] : '0'), 'channel_system' => ((array_key_exists('channel_system',$arr)) ? $arr['channel_system'] : '0'), - 'channel_moved' => ((array_key_exists('channel_moved',$arr)) ? $arr['channel_moved'] : '') + 'channel_moved' => ((array_key_exists('channel_moved',$arr)) ? $arr['channel_moved'] : ''), + 'channel_password' => ((array_key_exists('channel_password',$arr)) ? $arr['channel_password'] : ''), + 'channel_salt' => ((array_key_exists('channel_salt',$arr)) ? $arr['channel_salt'] : '') ]; return create_table_from_array('channel',$store); diff --git a/include/import.php b/include/import.php index 9007dbe74..224bb1803 100644 --- a/include/import.php +++ b/include/import.php @@ -82,7 +82,7 @@ function import_channel($channel, $account_id, $seize) { 'channel_r_storage', 'channel_r_pages', 'channel_w_stream', 'channel_w_wall', 'channel_w_comment', 'channel_w_mail', 'channel_w_like', 'channel_w_tagwall', 'channel_w_chat', 'channel_w_storage', 'channel_w_pages', 'channel_a_republish', - 'channel_a_delegate', 'perm_limits' + 'channel_a_delegate', 'perm_limits', 'channel_password', 'channel_salt' ]; $clean = array(); diff --git a/include/zot.php b/include/zot.php index 3e1b27c83..20a25ce3b 100644 --- a/include/zot.php +++ b/include/zot.php @@ -2956,6 +2956,8 @@ function build_sync_packet($uid = 0, $packet = null, $groups_changed = false) { return; $channel = $r[0]; + unset($channel['channel_password']); + unset($channel['channel_salt']); translate_channel_perms_outbound($channel); if($packet && array_key_exists('abook',$packet) && $packet['abook']) { diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql index be5317722..e075006e1 100644 --- a/install/schema_mysql.sql +++ b/install/schema_mysql.sql @@ -287,6 +287,8 @@ CREATE TABLE IF NOT EXISTS `channel` ( `channel_removed` tinyint(1) NOT NULL DEFAULT '0', `channel_system` tinyint(1) NOT NULL DEFAULT '0', `channel_moved` char(255) NOT NULL DEFAULT '', + `channel_password` varchar(255) NOT NULL, + `channel_salt` varchar(255) NOT NULL, PRIMARY KEY (`channel_id`), UNIQUE KEY `channel_address_unique` (`channel_address`), KEY `channel_account_id` (`channel_account_id`), diff --git a/install/schema_postgres.sql b/install/schema_postgres.sql index e78425828..be72a85e1 100644 --- a/install/schema_postgres.sql +++ b/install/schema_postgres.sql @@ -280,6 +280,8 @@ CREATE TABLE "channel" ( "channel_removed" smallint NOT NULL DEFAULT '0', "channel_system" smallint NOT NULL DEFAULT '0', "channel_moved" text NOT NULL DEFAULT '', + "channel_password" varchar(255) NOT NULL, + "channel_salt" varchar(255) NOT NULL, PRIMARY KEY ("channel_id"), UNIQUE ("channel_address") ); diff --git a/install/update.php b/install/update.php index dd3a42c78..b37af9cef 100644 --- a/install/update.php +++ b/install/update.php @@ -1,6 +1,6 @@ <?php -define( 'UPDATE_VERSION' , 1188 ); +define( 'UPDATE_VERSION' , 1189 ); /** * @@ -2510,3 +2510,14 @@ function update_r1187() { } +function update_r1188() { + + $r1 = q("alter table channel add channel_password varchar(255) not null "); + $r2 = q("alter table channel add channel_salt varchar(255) not null "); + + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + |