diff options
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Module/Network.php | 3 | ||||
-rw-r--r-- | Zotlabs/Module/New_channel.php | 11 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Oauth2.php | 29 | ||||
-rw-r--r-- | Zotlabs/Update/_1213.php | 28 | ||||
-rw-r--r-- | Zotlabs/Update/_1214.php | 57 | ||||
-rw-r--r-- | Zotlabs/Widget/Settings_menu.php | 2 |
6 files changed, 110 insertions, 20 deletions
diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index 2d6307eb1..82c88e565 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -185,7 +185,8 @@ class Network extends \Zotlabs\Web\Controller { 'editor_autocomplete' => true, 'bbco_autocomplete' => 'bbcode', 'bbcode' => true, - 'jotnets' => true + 'jotnets' => true, + 'reset' => t('Reset form') ); if($deftag) $x['pretext'] = $deftag; diff --git a/Zotlabs/Module/New_channel.php b/Zotlabs/Module/New_channel.php index df7da2fe8..c946961bc 100644 --- a/Zotlabs/Module/New_channel.php +++ b/Zotlabs/Module/New_channel.php @@ -137,16 +137,19 @@ class New_channel extends \Zotlabs\Web\Controller { } } - $name_help = (($default_role) + $name_help = '<span id="name_help_loading" style="display:none">' . t('Loading') . '</span><span id="name_help_text">'; + $name_help .= (($default_role) ? t('Your real name is recommended.') : t('Examples: "Bob Jameson", "Lisa and her Horses", "Soccer", "Aviation Group"') - ); - - $nick_help = t('This will be used to create a unique network address (like an email address).'); + ); + $name_help .= '</span>'; + $nick_help = '<span id="nick_help_loading" style="display:none">' . t('Loading') . '</span><span id="nick_help_text">'; + $nick_help .= t('This will be used to create a unique network address (like an email address).'); if(! get_config('system','unicode_usernames')) { $nick_help .= ' ' . t('Allowed characters are a-z 0-9, - and _'); } + $nick_help .= '<span>'; $privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : "" ); diff --git a/Zotlabs/Module/Settings/Oauth2.php b/Zotlabs/Module/Settings/Oauth2.php index 88bbea3b8..985095115 100644 --- a/Zotlabs/Module/Settings/Oauth2.php +++ b/Zotlabs/Module/Settings/Oauth2.php @@ -14,7 +14,8 @@ class Oauth2 { $key = $_POST['remove']; q("DELETE FROM tokens WHERE id='%s' AND uid=%d", dbesc($key), - local_channel()); + intval(local_channel()) + ); goaway(z_root()."/settings/oauth2/"); return; } @@ -43,24 +44,24 @@ class Oauth2 { redirect_uri = '%s', grant_types = '%s', scope = '%s', - user_id = '%s' + user_id = %d WHERE client_id='%s'", dbesc($name), dbesc($secret), dbesc($redirect), dbesc($grant), dbesc($scope), - dbesc(local_channel()), + intval(local_channel()), dbesc($name)); } else { $r = q("INSERT INTO oauth_clients (client_id, client_secret, redirect_uri, grant_types, scope, user_id) - VALUES ('%s','%s','%s','%s','%s','%s')", + VALUES ('%s','%s','%s','%s','%s',%d)", dbesc($name), dbesc($secret), dbesc($redirect), dbesc($grant), dbesc($scope), - dbesc(local_channel()) + intval(local_channel()) ); $r = q("INSERT INTO xperm (xp_client, xp_channel, xp_perm) VALUES ('%s', %d, '%s') ", dbesc($name), @@ -93,9 +94,9 @@ class Oauth2 { } if((argc() > 3) && (argv(2) === 'edit')) { - $r = q("SELECT * FROM oauth_clients WHERE client_id='%s' AND user_id= '%s'", + $r = q("SELECT * FROM oauth_clients WHERE client_id='%s' AND user_id= %d", dbesc(argv(3)), - dbesc(local_channel()) + intval(local_channel()) ); if (! $r){ @@ -123,21 +124,21 @@ class Oauth2 { if((argc() > 3) && (argv(2) === 'delete')) { check_form_security_token_redirectOnErr('/settings/oauth2', 'settings_oauth2', 't'); - $r = q("DELETE FROM oauth_clients WHERE client_id = '%s' AND user_id = '%s'", + $r = q("DELETE FROM oauth_clients WHERE client_id = '%s' AND user_id = %d", dbesc(argv(3)), - dbesc(local_channel()) + intval(local_channel()) ); goaway(z_root()."/settings/oauth2/"); return; } - $r = q("SELECT oauth_clients.*, oauth_access_tokens.access_token as oauth_token, (oauth_clients.user_id = '%s') AS my + $r = q("SELECT oauth_clients.*, oauth_access_tokens.access_token as oauth_token, (oauth_clients.user_id = %d) AS my FROM oauth_clients LEFT JOIN oauth_access_tokens ON oauth_clients.client_id=oauth_access_tokens.client_id - WHERE oauth_clients.user_id IN ('%s',0)", - dbesc(local_channel()), - dbesc(local_channel()) + WHERE oauth_clients.user_id IN (%d,0)", + intval(local_channel()), + intval(local_channel()) ); $tpl = get_markup_template("settings_oauth2.tpl"); @@ -157,4 +158,4 @@ class Oauth2 { } -}
\ No newline at end of file +} diff --git a/Zotlabs/Update/_1213.php b/Zotlabs/Update/_1213.php new file mode 100644 index 000000000..d396829a6 --- /dev/null +++ b/Zotlabs/Update/_1213.php @@ -0,0 +1,28 @@ +<?php + +namespace Zotlabs\Update; + +class _1213 { + + function run() { + if(ACTIVE_DBTYPE == DBTYPE_MYSQL) { + q("START TRANSACTION"); + + $r = q("ALTER TABLE abconfig + DROP INDEX chan, + DROP INDEX xchan, + ADD INDEX chan_xchan (chan, xchan) + "); + + if($r) { + q("COMMIT"); + return UPDATE_SUCCESS; + } + else { + q("ROLLBACK"); + return UPDATE_FAILED; + } + } + } + +} diff --git a/Zotlabs/Update/_1214.php b/Zotlabs/Update/_1214.php new file mode 100644 index 000000000..06e5d96ed --- /dev/null +++ b/Zotlabs/Update/_1214.php @@ -0,0 +1,57 @@ +<?php + +namespace Zotlabs\Update; + +class _1214 { + + function run() { + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + q("START TRANSACTION"); + + $r1 = q("ALTER TABLE oauth_clients ALTER COLUMN user_id TYPE bigint USING user_id::bigint"); + $r2 = q("ALTER TABLE oauth_clients ALTER COLUMN user_id SET NOT NULL"); + $r3 = q("ALTER TABLE oauth_clients ALTER COLUMN user_id SET DEFAULT 0"); + + $r4 = q("ALTER TABLE oauth_access_tokens ALTER COLUMN user_id TYPE bigint USING user_id::bigint"); + $r5 = q("ALTER TABLE oauth_access_tokens ALTER COLUMN user_id SET NOT NULL"); + $r6 = q("ALTER TABLE oauth_access_tokens ALTER COLUMN user_id SET DEFAULT 0"); + + $r7 = q("ALTER TABLE oauth_authorization_codes ALTER COLUMN user_id TYPE bigint USING user_id::bigint"); + $r8 = q("ALTER TABLE oauth_authorization_codes ALTER COLUMN user_id SET NOT NULL"); + $r9 = q("ALTER TABLE oauth_authorization_codes ALTER COLUMN user_id SET DEFAULT 0"); + + $r10 = q("ALTER TABLE oauth_refresh_tokens ALTER COLUMN user_id TYPE bigint USING user_id::bigint"); + $r11 = q("ALTER TABLE oauth_refresh_tokens ALTER COLUMN user_id SET NOT NULL"); + $r12 = q("ALTER TABLE oauth_refresh_tokens ALTER COLUMN user_id SET DEFAULT 0"); + + + if($r1 && $r2 && $r3 && $r4 && $r5 && $r6 && $r7 && $r8 && $r9 && $r10 && $r11 && $r12) { + q("COMMIT"); + return UPDATE_SUCCESS; + } + else { + q("ROLLBACK"); + return UPDATE_FAILED; + } + } + else { + q("START TRANSACTION"); + + $r1 = q("ALTER TABLE oauth_clients MODIFY COLUMN user_id int(10) unsigned NOT NULL DEFAULT 0"); + $r2 = q("ALTER TABLE oauth_access_tokens MODIFY COLUMN user_id int(10) unsigned NOT NULL DEFAULT 0"); + $r3 = q("ALTER TABLE oauth_authorization_codes MODIFY COLUMN user_id int(10) unsigned NOT NULL DEFAULT 0"); + $r4 = q("ALTER TABLE oauth_refresh_tokens MODIFY COLUMN user_id int(10) unsigned NOT NULL DEFAULT 0"); + + if($r1 && $r2 && $r3 && $r4) { + q("COMMIT"); + return UPDATE_SUCCESS; + } + else { + q("ROLLBACK"); + return UPDATE_FAILED; + } + + } + } + +} diff --git a/Zotlabs/Widget/Settings_menu.php b/Zotlabs/Widget/Settings_menu.php index 9574becc3..f35d6f147 100644 --- a/Zotlabs/Widget/Settings_menu.php +++ b/Zotlabs/Widget/Settings_menu.php @@ -105,7 +105,7 @@ class Settings_menu { if(feature_enabled(local_channel(),'permcats')) { $tabs[] = array( - 'label' => t('Permission Groups'), + 'label' => t('Permission Categories'), 'url' => z_root() . '/settings/permcats', 'selected' => ((argv(1) === 'permcats') ? 'active' : ''), ); |