[DATABASE] Start transactions with START TRANSACTION
"BEGIN" is non-standard and unnecessary.
This commit is contained in:
parent
6ea0d441cd
commit
9ac632ca2d
|
@ -1,42 +1,38 @@
|
|||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Site access administration panel
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @category Settings
|
||||
* @package StatusNet
|
||||
* @package GNUsocial
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
/**
|
||||
* Administer site access settings
|
||||
*
|
||||
* @category Admin
|
||||
* @package StatusNet
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
* @category Admin
|
||||
* @package GNUsocial
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class AccessadminpanelAction extends AdminPanelAction
|
||||
{
|
||||
|
@ -45,7 +41,7 @@ class AccessadminpanelAction extends AdminPanelAction
|
|||
*
|
||||
* @return string page title
|
||||
*/
|
||||
function title()
|
||||
public function title()
|
||||
{
|
||||
// TRANS: Page title for Access admin panel that allows configuring site access.
|
||||
return _('Access');
|
||||
|
@ -56,7 +52,7 @@ class AccessadminpanelAction extends AdminPanelAction
|
|||
*
|
||||
* @return string instructions
|
||||
*/
|
||||
function getInstructions()
|
||||
public function getInstructions()
|
||||
{
|
||||
// TRANS: Page notice.
|
||||
return _('Site access settings');
|
||||
|
@ -67,7 +63,7 @@ class AccessadminpanelAction extends AdminPanelAction
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
function showForm()
|
||||
public function showForm()
|
||||
{
|
||||
$form = new AccessAdminPanelForm($this);
|
||||
$form->show();
|
||||
|
@ -79,7 +75,7 @@ class AccessadminpanelAction extends AdminPanelAction
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
function saveSettings()
|
||||
public function saveSettings()
|
||||
{
|
||||
static $booleans = array('site' => array('private', 'inviteonly', 'closed'),
|
||||
'public' => array('localonly'));
|
||||
|
@ -92,7 +88,7 @@ class AccessadminpanelAction extends AdminPanelAction
|
|||
|
||||
$config = new Config();
|
||||
|
||||
$config->query('BEGIN');
|
||||
$config->query('START TRANSACTION');
|
||||
|
||||
foreach ($booleans as $section => $parts) {
|
||||
foreach ($parts as $setting) {
|
||||
|
@ -113,7 +109,7 @@ class AccessAdminPanelForm extends AdminForm
|
|||
*
|
||||
* @return int ID of the form
|
||||
*/
|
||||
function id()
|
||||
public function id()
|
||||
{
|
||||
return 'form_site_admin_panel';
|
||||
}
|
||||
|
@ -123,7 +119,7 @@ class AccessAdminPanelForm extends AdminForm
|
|||
*
|
||||
* @return string class of the form
|
||||
*/
|
||||
function formClass()
|
||||
public function formClass()
|
||||
{
|
||||
return 'form_settings';
|
||||
}
|
||||
|
@ -133,7 +129,7 @@ class AccessAdminPanelForm extends AdminForm
|
|||
*
|
||||
* @return string URL of the action
|
||||
*/
|
||||
function action()
|
||||
public function action()
|
||||
{
|
||||
return common_local_url('accessadminpanel');
|
||||
}
|
||||
|
@ -143,7 +139,7 @@ class AccessAdminPanelForm extends AdminForm
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
function formData()
|
||||
public function formData()
|
||||
{
|
||||
$this->out->elementStart('fieldset', array('id' => 'settings_admin_account_access'));
|
||||
// TRANS: Form legend for registration form.
|
||||
|
@ -154,18 +150,24 @@ class AccessAdminPanelForm extends AdminForm
|
|||
// TRANS: Checkbox instructions for admin setting "Invite only".
|
||||
$instructions = _('Make registration invitation only.');
|
||||
// TRANS: Checkbox label for configuring site as invite only.
|
||||
$this->out->checkbox('inviteonly', _('Invite only'),
|
||||
(bool) $this->value('inviteonly'),
|
||||
$instructions);
|
||||
$this->out->checkbox(
|
||||
'inviteonly',
|
||||
_('Invite only'),
|
||||
(bool) $this->value('inviteonly'),
|
||||
$instructions
|
||||
);
|
||||
$this->unli();
|
||||
|
||||
$this->li();
|
||||
// TRANS: Checkbox instructions for admin setting "Closed" (no new registrations).
|
||||
$instructions = _('Disable new registrations.');
|
||||
// TRANS: Checkbox label for disabling new user registrations.
|
||||
$this->out->checkbox('closed', _('Closed'),
|
||||
(bool) $this->value('closed'),
|
||||
$instructions);
|
||||
$this->out->checkbox(
|
||||
'closed',
|
||||
_('Closed'),
|
||||
(bool) $this->value('closed'),
|
||||
$instructions
|
||||
);
|
||||
$this->unli();
|
||||
|
||||
$this->out->elementEnd('ul');
|
||||
|
@ -173,26 +175,32 @@ class AccessAdminPanelForm extends AdminForm
|
|||
|
||||
|
||||
// Public access settings (login requirements for feeds etc.)
|
||||
$this->out->elementStart('fieldset', array('id' => 'settings_admin_public_access'));
|
||||
// TRANS: Form legend for registration form.
|
||||
$this->out->elementStart('fieldset', ['id' => 'settings_admin_public_access']);
|
||||
// TRANS: Form legend for registration form.
|
||||
$this->out->element('legend', null, _('Feed access'));
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
$this->li();
|
||||
// TRANS: Checkbox instructions for admin setting "Private".
|
||||
$instructions = _('Prohibit anonymous users (not logged in) from viewing site?');
|
||||
// TRANS: Checkbox label for prohibiting anonymous users from viewing site.
|
||||
$this->out->checkbox('private', _m('LABEL', 'Private'),
|
||||
(bool) $this->value('private'),
|
||||
$instructions);
|
||||
$this->out->checkbox(
|
||||
'private',
|
||||
_m('LABEL', 'Private'),
|
||||
(bool) $this->value('private'),
|
||||
$instructions
|
||||
);
|
||||
$this->unli();
|
||||
|
||||
$this->li();
|
||||
// TRANS: Description of the full network notice stream views..
|
||||
$instructions = _('The full network view includes (public) remote notices which may be unrelated to local conversations.');
|
||||
// TRANS: Checkbox label for hiding remote network posts if they have not been interacted with locally.
|
||||
$this->out->checkbox('localonly', _('Restrict full network view to accounts'),
|
||||
(bool) $this->value('localonly', 'public'),
|
||||
$instructions);
|
||||
$this->out->checkbox(
|
||||
'localonly',
|
||||
_('Restrict full network view to accounts'),
|
||||
(bool) $this->value('localonly', 'public'),
|
||||
$instructions
|
||||
);
|
||||
$this->unli();
|
||||
|
||||
$this->out->elementEnd('ul');
|
||||
|
@ -204,7 +212,7 @@ class AccessAdminPanelForm extends AdminForm
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
function formActions()
|
||||
public function formActions()
|
||||
{
|
||||
// TRANS: Button title to save access settings in site admin panel.
|
||||
$title = _('Save access settings.');
|
||||
|
|
|
@ -1,44 +1,38 @@
|
|||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Update a group's profile
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @category API
|
||||
* @package StatusNet
|
||||
* @package GNUsocial
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
exit(1);
|
||||
}
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
/**
|
||||
* API analog to the group edit page
|
||||
*
|
||||
* @category API
|
||||
* @package StatusNet
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
* @category API
|
||||
* @package GNUsocial
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class ApiGroupProfileUpdateAction extends ApiAuthAction
|
||||
{
|
||||
|
@ -100,20 +94,21 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
|
|||
$this->clientError(_('You must be an admin to edit the group.'), 403);
|
||||
}
|
||||
|
||||
$this->group->query('BEGIN');
|
||||
$this->group->query('START TRANSACTION');
|
||||
|
||||
$orig = clone($this->group);
|
||||
|
||||
try {
|
||||
|
||||
if (common_config('profile', 'changenick') == true && $this->group->nickname !== $this->nickname) {
|
||||
try {
|
||||
$this->group->nickname = Nickname::normalize($this->nickname, true);
|
||||
} catch (NicknameException $e) {
|
||||
throw new ApiValidationException($e->getMessage());
|
||||
}
|
||||
$this->group->mainpage = common_local_url('showgroup',
|
||||
array('nickname' => $this->group->nickname));
|
||||
$this->group->mainpage = common_local_url(
|
||||
'showgroup',
|
||||
['nickname' => $this->group->nickname]
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($this->fullname)) {
|
||||
|
@ -135,7 +130,6 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
|
|||
$this->validateLocation();
|
||||
$this->group->location = $this->location;
|
||||
}
|
||||
|
||||
} catch (ApiValidationException $ave) {
|
||||
$this->clientError($ave->getMessage(), 400);
|
||||
}
|
||||
|
@ -167,7 +161,7 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
|
|||
|
||||
$this->group->query('COMMIT');
|
||||
|
||||
switch($this->format) {
|
||||
switch ($this->format) {
|
||||
case 'xml':
|
||||
$this->showSingleXmlGroup($this->group);
|
||||
break;
|
||||
|
@ -180,7 +174,7 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
|
|||
}
|
||||
}
|
||||
|
||||
function validateHomepage()
|
||||
public function validateHomepage()
|
||||
{
|
||||
if (!is_null($this->homepage)
|
||||
&& (strlen($this->homepage) > 0)
|
||||
|
@ -192,7 +186,7 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
|
|||
}
|
||||
}
|
||||
|
||||
function validateFullname()
|
||||
public function validateFullname()
|
||||
{
|
||||
if (!is_null($this->fullname) && mb_strlen($this->fullname) > 255) {
|
||||
throw new ApiValidationException(
|
||||
|
@ -202,19 +196,21 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
|
|||
}
|
||||
}
|
||||
|
||||
function validateDescription()
|
||||
public function validateDescription()
|
||||
{
|
||||
if (User_group::descriptionTooLong($this->description)) {
|
||||
// TRANS: API validation exception thrown when description does not validate.
|
||||
// TRANS: %d is the maximum description length and used for plural.
|
||||
throw new ApiValidationException(sprintf(_m('Description is too long (maximum %d character).',
|
||||
'Description is too long (maximum %d characters).',
|
||||
User_group::maxDescription()),
|
||||
User_group::maxDescription()));
|
||||
throw new ApiValidationException(sprintf(
|
||||
_m('Description is too long (maximum %d character).',
|
||||
'Description is too long (maximum %d characters).',
|
||||
User_group::maxDescription()),
|
||||
User_group::maxDescription()
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
function validateLocation()
|
||||
public function validateLocation()
|
||||
{
|
||||
if (!is_null($this->location) && mb_strlen($this->location) > 255) {
|
||||
throw new ApiValidationException(
|
||||
|
@ -224,11 +220,13 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
|
|||
}
|
||||
}
|
||||
|
||||
function validateAliases()
|
||||
public function validateAliases()
|
||||
{
|
||||
try {
|
||||
$aliases = array_map(array('Nickname', 'normalize'),
|
||||
array_unique(preg_split('/[\s,]+/', $this->aliasstring)));
|
||||
$aliases = array_map(
|
||||
['Nickname', 'normalize'],
|
||||
array_unique(preg_split('/[\s,]+/', $this->aliasstring))
|
||||
);
|
||||
} catch (NicknameException $e) {
|
||||
throw new ApiValidationException(sprintf('Error processing aliases: %s', $e->getMessage()));
|
||||
}
|
||||
|
@ -236,10 +234,12 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
|
|||
if (count($aliases) > common_config('group', 'maxaliases')) {
|
||||
// TRANS: API validation exception thrown when aliases do not validate.
|
||||
// TRANS: %d is the maximum number of aliases and used for plural.
|
||||
throw new ApiValidationException(sprintf(_m('Too many aliases! Maximum %d allowed.',
|
||||
'Too many aliases! Maximum %d allowed.',
|
||||
common_config('group', 'maxaliases')),
|
||||
common_config('group', 'maxaliases')));
|
||||
throw new ApiValidationException(sprintf(
|
||||
_m('Too many aliases! Maximum %d allowed.',
|
||||
'Too many aliases! Maximum %d allowed.',
|
||||
common_config('group', 'maxaliases')),
|
||||
common_config('group', 'maxaliases')
|
||||
));
|
||||
}
|
||||
|
||||
return $aliases;
|
||||
|
|
|
@ -1,33 +1,30 @@
|
|||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Confirm an address
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @category Confirm
|
||||
* @package StatusNet
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
/**
|
||||
* Confirm an address
|
||||
|
@ -36,11 +33,10 @@ if (!defined('GNUSOCIAL')) { exit(1); }
|
|||
* a confirmation code to make sure the owner of that address approves. This class
|
||||
* accepts those codes.
|
||||
*
|
||||
* @category Confirm
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
* @category Confirm
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class ConfirmaddressAction extends ManagedAction
|
||||
{
|
||||
|
@ -88,7 +84,7 @@ class ConfirmaddressAction extends ManagedAction
|
|||
|
||||
$cur = $this->scoped->getUser();
|
||||
|
||||
$cur->query('BEGIN');
|
||||
$cur->query('START TRANSACTION');
|
||||
if (in_array($type, array('email', 'sms'))) {
|
||||
common_debug("Confirming {$type} address for user {$this->scoped->getID()}");
|
||||
if ($cur->$type == $confirm->address) {
|
||||
|
@ -114,14 +110,12 @@ class ConfirmaddressAction extends ManagedAction
|
|||
if ($type == 'email') {
|
||||
$cur->emailChanged();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$user_im_prefs = new User_im_prefs();
|
||||
$user_im_prefs->transport = $confirm->address_type;
|
||||
$user_im_prefs->user_id = $cur->id;
|
||||
if ($user_im_prefs->find() && $user_im_prefs->fetch()) {
|
||||
if($user_im_prefs->screenname == $confirm->address){
|
||||
if ($user_im_prefs->screenname === $confirm->address) {
|
||||
// Already verified, so delete the confirm_address entry
|
||||
$confirm->delete();
|
||||
// TRANS: Client error for an already confirmed IM address.
|
||||
|
@ -135,7 +129,7 @@ class ConfirmaddressAction extends ManagedAction
|
|||
// TRANS: Server error displayed when updating IM preferences fails.
|
||||
throw new ServerException(_('Could not update user IM preferences.'));
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$user_im_prefs = new User_im_prefs();
|
||||
$user_im_prefs->screenname = $confirm->address;
|
||||
$user_im_prefs->transport = $confirm->address_type;
|
||||
|
@ -149,7 +143,6 @@ class ConfirmaddressAction extends ManagedAction
|
|||
throw new ServerException(_('Could not insert user IM preferences.'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$confirm->delete();
|
||||
|
@ -162,7 +155,7 @@ class ConfirmaddressAction extends ManagedAction
|
|||
*
|
||||
* @return string title
|
||||
*/
|
||||
function title()
|
||||
public function title()
|
||||
{
|
||||
// TRANS: Title for the contact address confirmation action.
|
||||
return _('Confirm address');
|
||||
|
@ -173,13 +166,17 @@ class ConfirmaddressAction extends ManagedAction
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
function showContent()
|
||||
public function showContent()
|
||||
{
|
||||
$this->element('p', null,
|
||||
// TRANS: Success message for the contact address confirmation action.
|
||||
// TRANS: %s can be 'email', 'jabber', or 'sms'.
|
||||
sprintf(_('The address "%s" has been '.
|
||||
'confirmed for your account.'),
|
||||
$this->address));
|
||||
$this->element(
|
||||
'p',
|
||||
null,
|
||||
// TRANS: Success message for the contact address confirmation action.
|
||||
// TRANS: %s can be 'email', 'jabber', or 'sms'.
|
||||
sprintf(
|
||||
_('The address "%s" has been confirmed for your account.'),
|
||||
$this->address
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,50 +1,44 @@
|
|||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Edit an existing group
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @category Group
|
||||
* @package StatusNet
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2008-2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET') && !defined('LACONICA') && !defined('GNUSOCIAL')) {
|
||||
exit(1);
|
||||
}
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
/**
|
||||
* Add a new group
|
||||
*
|
||||
* This is the form for adding a new group
|
||||
*
|
||||
* @category Group
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @author Alexei Sorokin <sor.alexei@meowr.ru>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
* @category Group
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @author Alexei Sorokin <sor.alexei@meowr.ru>
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class EditgroupAction extends GroupAction
|
||||
{
|
||||
|
@ -242,7 +236,7 @@ class EditgroupAction extends GroupAction
|
|||
return;
|
||||
}
|
||||
|
||||
$this->group->query('BEGIN');
|
||||
$this->group->query('START TRANSACTION');
|
||||
|
||||
$orig = clone($this->group);
|
||||
|
||||
|
|
|
@ -1,50 +1,46 @@
|
|||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Edit an existing group
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @category Group
|
||||
* @package StatusNet
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
* @package GNUsocial
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
exit(1);
|
||||
}
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
/**
|
||||
* Add a new group
|
||||
*
|
||||
* This is the form for adding a new group
|
||||
*
|
||||
* @category Group
|
||||
* @package StatusNet
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
* @category Group
|
||||
* @package GNUsocial
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
class EditpeopletagAction extends Action
|
||||
{
|
||||
var $msg, $confirm, $confirm_args=array();
|
||||
public $msg;
|
||||
public $confirm;
|
||||
public $confirm_args = [];
|
||||
|
||||
function title()
|
||||
public function title()
|
||||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST' && $this->boolean('delete')) {
|
||||
// TRANS: Title for edit list page after deleting a tag.
|
||||
|
@ -60,7 +56,7 @@ class EditpeopletagAction extends Action
|
|||
* Prepare to run
|
||||
*/
|
||||
|
||||
function prepare(array $args = array())
|
||||
public function prepare(array $args = [])
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
|
@ -135,7 +131,7 @@ class EditpeopletagAction extends Action
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
function handle()
|
||||
public function handle()
|
||||
{
|
||||
parent::handle();
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
|
@ -145,21 +141,30 @@ class EditpeopletagAction extends Action
|
|||
}
|
||||
}
|
||||
|
||||
function showConfirm($msg=null, $fwd=null)
|
||||
public function showConfirm($msg = null, $fwd = null)
|
||||
{
|
||||
$this->confirm = $msg;
|
||||
$this->confirm_args = $fwd;
|
||||
$this->showPage();
|
||||
}
|
||||
|
||||
function showConfirmForm()
|
||||
public function showConfirmForm()
|
||||
{
|
||||
$this->elementStart('form', array('id' => 'form_peopletag_edit_confirm',
|
||||
'class' => 'form_settings',
|
||||
'method' => 'post',
|
||||
'action' => common_local_url('editpeopletag',
|
||||
array('tagger' => $this->tagger->nickname,
|
||||
'tag' => $this->peopletag->tag))));
|
||||
$this->elementStart(
|
||||
'form',
|
||||
[
|
||||
'id' => 'form_peopletag_edit_confirm',
|
||||
'class' => 'form_settings',
|
||||
'method' => 'post',
|
||||
'action' => common_local_url(
|
||||
'editpeopletag',
|
||||
[
|
||||
'tagger' => $this->tagger->nickname,
|
||||
'tag' => $this->peopletag->tag,
|
||||
]
|
||||
),
|
||||
]
|
||||
);
|
||||
$this->elementStart('fieldset');
|
||||
$this->hidden('token', common_session_token());
|
||||
$this->hidden('id', $this->arg('id'));
|
||||
|
@ -168,31 +173,35 @@ class EditpeopletagAction extends Action
|
|||
$this->hidden($key, $val);
|
||||
}
|
||||
|
||||
$this->submit('form_action-no',
|
||||
_m('BUTTON','No'),
|
||||
'submit form_action-primary',
|
||||
'cancel');
|
||||
$this->submit('form_action-yes',
|
||||
_m('BUTTON','Yes'),
|
||||
'submit form_action-secondary',
|
||||
'confirm');
|
||||
$this->submit(
|
||||
'form_action-no',
|
||||
_m('BUTTON', 'No'),
|
||||
'submit form_action-primary',
|
||||
'cancel'
|
||||
);
|
||||
$this->submit(
|
||||
'form_action-yes',
|
||||
_m('BUTTON', 'Yes'),
|
||||
'submit form_action-secondary',
|
||||
'confirm'
|
||||
);
|
||||
$this->elementEnd('fieldset');
|
||||
$this->elementEnd('form');
|
||||
}
|
||||
|
||||
function showForm($msg=null)
|
||||
public function showForm($msg = null)
|
||||
{
|
||||
$this->msg = $msg;
|
||||
$this->showPage();
|
||||
}
|
||||
|
||||
function showObjectNav()
|
||||
public function showObjectNav()
|
||||
{
|
||||
$nav = new PeopletagGroupNav($this, $this->peopletag);
|
||||
$nav->show();
|
||||
}
|
||||
|
||||
function showContent()
|
||||
public function showContent()
|
||||
{
|
||||
if ($this->confirm) {
|
||||
$this->showConfirmForm();
|
||||
|
@ -205,26 +214,29 @@ class EditpeopletagAction extends Action
|
|||
$form->showProfileList();
|
||||
}
|
||||
|
||||
function showPageNotice()
|
||||
public function showPageNotice()
|
||||
{
|
||||
if ($this->msg) {
|
||||
$this->element('p', 'error', $this->msg);
|
||||
} else if ($this->confirm) {
|
||||
} elseif ($this->confirm) {
|
||||
$this->element('p', 'instructions', $this->confirm);
|
||||
} else {
|
||||
$this->element('p', 'instructions',
|
||||
// TRANS: Form instruction for edit list form.
|
||||
_('Use this form to edit the list.'));
|
||||
$this->element(
|
||||
'p',
|
||||
'instructions',
|
||||
// TRANS: Form instruction for edit list form.
|
||||
_('Use this form to edit the list.')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function showScripts()
|
||||
public function showScripts()
|
||||
{
|
||||
parent::showScripts();
|
||||
$this->autofocus('tag');
|
||||
}
|
||||
|
||||
function trySave()
|
||||
public function trySave()
|
||||
{
|
||||
$tag = common_canonical_tag($this->trimmed('tag'));
|
||||
$description = $this->trimmed('description');
|
||||
|
@ -247,25 +259,26 @@ class EditpeopletagAction extends Action
|
|||
'all its subscription and membership records. ' .
|
||||
'Do you still want to continue?'), array('delete' => 1));
|
||||
return;
|
||||
} else if (common_valid_tag($tag)) {
|
||||
} elseif (common_valid_tag($tag)) {
|
||||
// TRANS: Form validation error displayed if a given tag is invalid.
|
||||
$this->showForm(_('Invalid tag.'));
|
||||
return;
|
||||
} else if ($tag != $this->peopletag->tag && $this->tagExists($tag)) {
|
||||
} elseif ($tag != $this->peopletag->tag && $this->tagExists($tag)) {
|
||||
// TRANS: Form validation error displayed if a given tag is already present.
|
||||
// TRANS: %s is the already present tag.
|
||||
$this->showForm(sprintf(_('You already have a tag named %s.'), $tag));
|
||||
return;
|
||||
} else if (Profile_list::descriptionTooLong($description)) {
|
||||
} elseif (Profile_list::descriptionTooLong($description)) {
|
||||
$this->showForm(sprintf(
|
||||
// TRANS: Client error shown when providing too long a description when editing a list.
|
||||
// TRANS: %d is the maximum number of allowed characters.
|
||||
_m('Description is too long (maximum %d character).',
|
||||
'Description is too long (maximum %d characters).',
|
||||
Profile_list::maxDescription()),
|
||||
Profile_list::maxDescription()));
|
||||
// TRANS: Client error shown when providing too long a description when editing a list.
|
||||
// TRANS: %d is the maximum number of allowed characters.
|
||||
_m('Description is too long (maximum %d character).',
|
||||
'Description is too long (maximum %d characters).',
|
||||
Profile_list::maxDescription()),
|
||||
Profile_list::maxDescription()
|
||||
));
|
||||
return;
|
||||
} else if ($set_private && !$confirm && !$cancel) {
|
||||
} elseif ($set_private && !$confirm && !$cancel) {
|
||||
$fwd = array('tag' => $tag,
|
||||
'description' => $description,
|
||||
'private' => (int) $private);
|
||||
|
@ -285,7 +298,7 @@ class EditpeopletagAction extends Action
|
|||
common_redirect(common_local_url('all', array('nickname' => $this->tagger->getNickname())), 303);
|
||||
}
|
||||
|
||||
$this->peopletag->query('BEGIN');
|
||||
$this->peopletag->query('START TRANSACTION');
|
||||
|
||||
$orig = clone($this->peopletag);
|
||||
|
||||
|
@ -310,17 +323,23 @@ class EditpeopletagAction extends Action
|
|||
}
|
||||
|
||||
if ($tag != $orig->tag) {
|
||||
common_redirect(common_local_url('editpeopletag',
|
||||
array('tagger' => $this->tagger->nickname,
|
||||
'tag' => $tag)),
|
||||
303);
|
||||
common_redirect(
|
||||
common_local_url(
|
||||
'editpeopletag',
|
||||
[
|
||||
'tagger' => $this->tagger->nickname,
|
||||
'tag' => $tag,
|
||||
]
|
||||
),
|
||||
303
|
||||
);
|
||||
} else {
|
||||
// TRANS: Edit list form success message.
|
||||
$this->showForm(_('Options saved.'));
|
||||
}
|
||||
}
|
||||
|
||||
function tagExists($tag)
|
||||
public function tagExists($tag)
|
||||
{
|
||||
$args = array('tagger' => $this->tagger->id, 'tag' => $tag);
|
||||
$ptag = Profile_list::pkeyGet($args);
|
||||
|
|
|
@ -302,7 +302,7 @@ class EmailsettingsAction extends SettingsAction
|
|||
$emailpost = $this->boolean('emailpost');
|
||||
|
||||
$user = $this->scoped->getUser();
|
||||
$user->query('BEGIN');
|
||||
$user->query('START TRANSACTION');
|
||||
$original = clone($user);
|
||||
|
||||
$user->emailnotifysub = $emailnotifysub;
|
||||
|
|
|
@ -1,44 +1,25 @@
|
|||
<?php
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Settings for Jabber/XMPP integration
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @category Settings
|
||||
* @package StatusNet
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
/**
|
||||
* Settings for Jabber/XMPP integration
|
||||
*
|
||||
* @category Settings
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
* @category Settings
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*
|
||||
* @see SettingsAction
|
||||
* @see SettingsAction
|
||||
*/
|
||||
|
||||
class ImsettingsAction extends SettingsAction
|
||||
|
@ -48,7 +29,7 @@ class ImsettingsAction extends SettingsAction
|
|||
*
|
||||
* @return string Title of the page
|
||||
*/
|
||||
function title()
|
||||
public function title()
|
||||
{
|
||||
// TRANS: Title for Instant Messaging settings.
|
||||
return _('IM settings');
|
||||
|
@ -59,7 +40,7 @@ class ImsettingsAction extends SettingsAction
|
|||
*
|
||||
* @return instructions for use
|
||||
*/
|
||||
function getInstructions()
|
||||
public function getInstructions()
|
||||
{
|
||||
// TRANS: Instant messaging settings page instructions.
|
||||
// TRANS: [instant messages] is link text, "(%%doc.im%%)" is the link.
|
||||
|
@ -78,94 +59,112 @@ class ImsettingsAction extends SettingsAction
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
function showContent()
|
||||
public function showContent()
|
||||
{
|
||||
$transports = array();
|
||||
Event::handle('GetImTransports', array(&$transports));
|
||||
if (! $transports) {
|
||||
$this->element('div', array('class' => 'error'),
|
||||
// TRANS: Message given in the IM settings if IM is not enabled on the site.
|
||||
_('IM is not available.'));
|
||||
$this->element(
|
||||
'div',
|
||||
['class' => 'error'],
|
||||
// TRANS: Message given in the IM settings if IM is not enabled on the site.
|
||||
_('IM is not available.')
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
$user = common_current_user();
|
||||
|
||||
$user_im_prefs_by_transport = array();
|
||||
|
||||
foreach($transports as $transport=>$transport_info)
|
||||
{
|
||||
$this->elementStart('form', array('method' => 'post',
|
||||
'id' => 'form_settings_im',
|
||||
'class' => 'form_settings',
|
||||
'action' =>
|
||||
common_local_url('imsettings')));
|
||||
|
||||
foreach ($transports as $transport => $transport_info) {
|
||||
$this->elementStart(
|
||||
'form',
|
||||
[
|
||||
'method' => 'post',
|
||||
'id' => 'form_settings_im',
|
||||
'class' => 'form_settings',
|
||||
'action' => common_local_url('imsettings'),
|
||||
]
|
||||
);
|
||||
$this->elementStart('fieldset', array('id' => 'settings_im_address'));
|
||||
// TRANS: Form legend for IM settings form.
|
||||
$this->element('legend', null, $transport_info['display']);
|
||||
$this->hidden('token', common_session_token());
|
||||
$this->hidden('transport', $transport);
|
||||
|
||||
if ($user_im_prefs = User_im_prefs::pkeyGet( array('transport' => $transport, 'user_id' => $user->id) )) {
|
||||
if ($user_im_prefs = User_im_prefs::pkeyGet(['transport' => $transport, 'user_id' => $user->id])) {
|
||||
$user_im_prefs_by_transport[$transport] = $user_im_prefs;
|
||||
$this->element('p', 'form_confirmed', $user_im_prefs->screenname);
|
||||
$this->element('p', 'form_note',
|
||||
// TRANS: Form note in IM settings form. %s is the type of IM address that was confirmed.
|
||||
sprintf(_('Current confirmed %s address.'),$transport_info['display']));
|
||||
$this->element(
|
||||
'p',
|
||||
'form_note',
|
||||
// TRANS: Form note in IM settings form. %s is the type of IM address that was confirmed.
|
||||
sprintf(_('Current confirmed %s address.'), $transport_info['display'])
|
||||
);
|
||||
$this->hidden('screenname', $user_im_prefs->screenname);
|
||||
// TRANS: Button label to remove a confirmed IM address.
|
||||
$this->submit('remove', _m('BUTTON','Remove'));
|
||||
$this->submit('remove', _m('BUTTON', 'Remove'));
|
||||
} else {
|
||||
try {
|
||||
$confirm = $this->getConfirmation($transport);
|
||||
$this->element('p', 'form_unconfirmed', $confirm->address);
|
||||
// TRANS: Form note in IM settings form.
|
||||
$this->element('p', 'form_note',
|
||||
// TRANS: Form note in IM settings form.
|
||||
// TRANS: %s is the IM service name, %2$s is the IM address set.
|
||||
sprintf(_('Awaiting confirmation on this address. '.
|
||||
'Check your %1$s account for a '.
|
||||
'message with further instructions. '.
|
||||
'(Did you add %2$s to your buddy list?)'),
|
||||
$transport_info['display'],
|
||||
$transport_info['daemonScreenname']));
|
||||
$this->element(
|
||||
'p',
|
||||
'form_note',
|
||||
// TRANS: Form note in IM settings form.
|
||||
// TRANS: %s is the IM service name, %2$s is the IM address set.
|
||||
sprintf(
|
||||
_('Awaiting confirmation on this address. '
|
||||
. 'Check your %1$s account for a '
|
||||
. 'message with further instructions. '
|
||||
. '(Did you add %2$s to your buddy list?)'),
|
||||
$transport_info['display'],
|
||||
$transport_info['daemonScreenname']
|
||||
)
|
||||
);
|
||||
$this->hidden('screenname', $confirm->address);
|
||||
// TRANS: Button label to cancel an IM address confirmation procedure.
|
||||
$this->submit('cancel', _m('BUTTON','Cancel'));
|
||||
$this->submit('cancel', _m('BUTTON', 'Cancel'));
|
||||
} catch (NoResultException $e) {
|
||||
$this->elementStart('ul', 'form_data');
|
||||
$this->elementStart('li');
|
||||
// TRANS: Field label for IM address.
|
||||
$this->input('screenname', _('IM address'),
|
||||
($this->arg('screenname')) ? $this->arg('screenname') : null,
|
||||
// TRANS: Field title for IM address. %s is the IM service name.
|
||||
sprintf(_('%s screenname.'),
|
||||
$transport_info['display']));
|
||||
$this->input(
|
||||
'screenname',
|
||||
_('IM address'),
|
||||
($this->arg('screenname')) ? $this->arg('screenname') : null,
|
||||
// TRANS: Field title for IM address. %s is the IM service name.
|
||||
sprintf(_('%s screenname.'), $transport_info['display'])
|
||||
);
|
||||
$this->elementEnd('li');
|
||||
$this->elementEnd('ul');
|
||||
// TRANS: Button label for adding an IM address in IM settings form.
|
||||
$this->submit('add', _m('BUTTON','Add'));
|
||||
$this->submit('add', _m('BUTTON', 'Add'));
|
||||
}
|
||||
}
|
||||
$this->elementEnd('fieldset');
|
||||
$this->elementEnd('form');
|
||||
}
|
||||
|
||||
if($user_im_prefs_by_transport)
|
||||
{
|
||||
$this->elementStart('form', array('method' => 'post',
|
||||
'id' => 'form_settings_im',
|
||||
'class' => 'form_settings',
|
||||
'action' =>
|
||||
common_local_url('imsettings')));
|
||||
if ($user_im_prefs_by_transport) {
|
||||
$this->elementStart(
|
||||
'form',
|
||||
[
|
||||
'method' => 'post',
|
||||
'id' => 'form_settings_im',
|
||||
'class' => 'form_settings',
|
||||
'action' => common_local_url('imsettings'),
|
||||
]
|
||||
);
|
||||
$this->elementStart('fieldset', array('id' => 'settings_im_preferences'));
|
||||
// TRANS: Header for IM preferences form.
|
||||
$this->element('legend', null, _('IM Preferences'));
|
||||
$this->hidden('token', common_session_token());
|
||||
$this->elementStart('table');
|
||||
$this->elementStart('tr');
|
||||
foreach($user_im_prefs_by_transport as $transport=>$user_im_prefs)
|
||||
{
|
||||
foreach ($user_im_prefs_by_transport as $transport => $user_im_prefs) {
|
||||
$this->element('th', null, $transports[$transport]['display']);
|
||||
}
|
||||
$this->elementEnd('tr');
|
||||
|
@ -178,23 +177,23 @@ class ImsettingsAction extends SettingsAction
|
|||
array('name'=>'replies', 'description'=>_('Send me replies '.
|
||||
'from people I\'m not subscribed to.')),
|
||||
);
|
||||
foreach($preferences as $preference)
|
||||
{
|
||||
foreach ($preferences as $preference) {
|
||||
$this->elementStart('tr');
|
||||
foreach($user_im_prefs_by_transport as $transport=>$user_im_prefs)
|
||||
{
|
||||
foreach ($user_im_prefs_by_transport as $transport => $user_im_prefs) {
|
||||
$preference_name = $preference['name'];
|
||||
$this->elementStart('td');
|
||||
$this->checkbox($transport . '_' . $preference['name'],
|
||||
$preference['description'],
|
||||
$user_im_prefs->$preference_name);
|
||||
$this->checkbox(
|
||||
$transport . '_' . $preference['name'],
|
||||
$preference['description'],
|
||||
$user_im_prefs->$preference_name
|
||||
);
|
||||
$this->elementEnd('td');
|
||||
}
|
||||
$this->elementEnd('tr');
|
||||
}
|
||||
$this->elementEnd('table');
|
||||
// TRANS: Button label to save IM preferences.
|
||||
$this->submit('save', _m('BUTTON','Save'));
|
||||
$this->submit('save', _m('BUTTON', 'Save'));
|
||||
$this->elementEnd('fieldset');
|
||||
$this->elementEnd('form');
|
||||
}
|
||||
|
@ -205,7 +204,7 @@ class ImsettingsAction extends SettingsAction
|
|||
*
|
||||
* @return Confirm_address address object for this user
|
||||
*/
|
||||
function getConfirmation($transport)
|
||||
public function getConfirmation($transport)
|
||||
{
|
||||
$confirm = new Confirm_address();
|
||||
|
||||
|
@ -223,11 +222,11 @@ class ImsettingsAction extends SettingsAction
|
|||
{
|
||||
if ($this->arg('save')) {
|
||||
return $this->savePreferences();
|
||||
} else if ($this->arg('add')) {
|
||||
} elseif ($this->arg('add')) {
|
||||
return $this->addAddress();
|
||||
} else if ($this->arg('cancel')) {
|
||||
} elseif ($this->arg('cancel')) {
|
||||
return $this->cancelConfirmation();
|
||||
} else if ($this->arg('remove')) {
|
||||
} elseif ($this->arg('remove')) {
|
||||
return $this->removeAddress();
|
||||
}
|
||||
// TRANS: Message given submitting a form with an unknown action in Instant Messaging settings.
|
||||
|
@ -242,20 +241,17 @@ class ImsettingsAction extends SettingsAction
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
function savePreferences()
|
||||
public function savePreferences()
|
||||
{
|
||||
$user_im_prefs = new User_im_prefs();
|
||||
$user_im_prefs->query('BEGIN');
|
||||
$user_im_prefs->query('START TRANSACTION');
|
||||
$user_im_prefs->user_id = $this->scoped->getID();
|
||||
if($user_im_prefs->find() && $user_im_prefs->fetch())
|
||||
{
|
||||
if ($user_im_prefs->find() && $user_im_prefs->fetch()) {
|
||||
$preferences = array('notify', 'updatefrompresence', 'replies');
|
||||
do
|
||||
{
|
||||
do {
|
||||
$original = clone($user_im_prefs);
|
||||
$new = clone($user_im_prefs);
|
||||
foreach($preferences as $preference)
|
||||
{
|
||||
foreach ($preferences as $preference) {
|
||||
$new->$preference = $this->boolean($new->transport . '_' . $preference);
|
||||
}
|
||||
$result = $new->update($original);
|
||||
|
@ -265,7 +261,7 @@ class ImsettingsAction extends SettingsAction
|
|||
// TRANS: Server error thrown on database error updating IM preferences.
|
||||
throw new ServerException(_('Could not update IM preferences.'));
|
||||
}
|
||||
}while($user_im_prefs->fetch());
|
||||
} while ($user_im_prefs->fetch());
|
||||
}
|
||||
$user_im_prefs->query('COMMIT');
|
||||
// TRANS: Confirmation message for successful IM preferences save.
|
||||
|
@ -280,7 +276,7 @@ class ImsettingsAction extends SettingsAction
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
function addAddress()
|
||||
public function addAddress()
|
||||
{
|
||||
$screenname = $this->trimmed('screenname');
|
||||
$transport = $this->trimmed('transport');
|
||||
|
@ -308,7 +304,7 @@ class ImsettingsAction extends SettingsAction
|
|||
if (!$valid) {
|
||||
// TRANS: Message given saving IM address that not valid.
|
||||
throw new ClientException(_('Not a valid screenname.'));
|
||||
} else if ($this->screennameExists($transport, $screenname)) {
|
||||
} elseif ($this->screennameExists($transport, $screenname)) {
|
||||
// TRANS: Message given saving IM address that is already set for another user.
|
||||
throw new ClientException(_('Screenname already belongs to another user.'));
|
||||
}
|
||||
|
@ -343,7 +339,7 @@ class ImsettingsAction extends SettingsAction
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
function cancelConfirmation()
|
||||
public function cancelConfirmation()
|
||||
{
|
||||
$screenname = $this->trimmed('screenname');
|
||||
$transport = $this->trimmed('transport');
|
||||
|
@ -372,7 +368,7 @@ class ImsettingsAction extends SettingsAction
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
function removeAddress()
|
||||
public function removeAddress()
|
||||
{
|
||||
$screenname = $this->trimmed('screenname');
|
||||
$transport = $this->trimmed('transport');
|
||||
|
@ -413,7 +409,7 @@ class ImsettingsAction extends SettingsAction
|
|||
* @return boolean whether the screenname exists
|
||||
*/
|
||||
|
||||
function screennameExists($transport, $screenname)
|
||||
public function screennameExists($transport, $screenname)
|
||||
{
|
||||
$user_im_prefs = new User_im_prefs();
|
||||
$user_im_prefs->transport = $transport;
|
||||
|
|
|
@ -1,44 +1,38 @@
|
|||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* License administration panel
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General< |