[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
|
<?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
|
* 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
|
* @category Settings
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Zach Copley <zach@status.net>
|
* @author Zach Copley <zach@status.net>
|
||||||
* @copyright 2010 StatusNet, Inc.
|
* @copyright 2010 StatusNet, Inc.
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
defined('GNUSOCIAL') || die();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Administer site access settings
|
* Administer site access settings
|
||||||
*
|
*
|
||||||
* @category Admin
|
* @category Admin
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Zach Copley <zach@status.net>
|
* @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
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
class AccessadminpanelAction extends AdminPanelAction
|
class AccessadminpanelAction extends AdminPanelAction
|
||||||
{
|
{
|
||||||
@ -45,7 +41,7 @@ class AccessadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return string page title
|
* @return string page title
|
||||||
*/
|
*/
|
||||||
function title()
|
public function title()
|
||||||
{
|
{
|
||||||
// TRANS: Page title for Access admin panel that allows configuring site access.
|
// TRANS: Page title for Access admin panel that allows configuring site access.
|
||||||
return _('Access');
|
return _('Access');
|
||||||
@ -56,7 +52,7 @@ class AccessadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return string instructions
|
* @return string instructions
|
||||||
*/
|
*/
|
||||||
function getInstructions()
|
public function getInstructions()
|
||||||
{
|
{
|
||||||
// TRANS: Page notice.
|
// TRANS: Page notice.
|
||||||
return _('Site access settings');
|
return _('Site access settings');
|
||||||
@ -67,7 +63,7 @@ class AccessadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showForm()
|
public function showForm()
|
||||||
{
|
{
|
||||||
$form = new AccessAdminPanelForm($this);
|
$form = new AccessAdminPanelForm($this);
|
||||||
$form->show();
|
$form->show();
|
||||||
@ -79,7 +75,7 @@ class AccessadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function saveSettings()
|
public function saveSettings()
|
||||||
{
|
{
|
||||||
static $booleans = array('site' => array('private', 'inviteonly', 'closed'),
|
static $booleans = array('site' => array('private', 'inviteonly', 'closed'),
|
||||||
'public' => array('localonly'));
|
'public' => array('localonly'));
|
||||||
@ -92,7 +88,7 @@ class AccessadminpanelAction extends AdminPanelAction
|
|||||||
|
|
||||||
$config = new Config();
|
$config = new Config();
|
||||||
|
|
||||||
$config->query('BEGIN');
|
$config->query('START TRANSACTION');
|
||||||
|
|
||||||
foreach ($booleans as $section => $parts) {
|
foreach ($booleans as $section => $parts) {
|
||||||
foreach ($parts as $setting) {
|
foreach ($parts as $setting) {
|
||||||
@ -113,7 +109,7 @@ class AccessAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return int ID of the form
|
* @return int ID of the form
|
||||||
*/
|
*/
|
||||||
function id()
|
public function id()
|
||||||
{
|
{
|
||||||
return 'form_site_admin_panel';
|
return 'form_site_admin_panel';
|
||||||
}
|
}
|
||||||
@ -123,7 +119,7 @@ class AccessAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return string class of the form
|
* @return string class of the form
|
||||||
*/
|
*/
|
||||||
function formClass()
|
public function formClass()
|
||||||
{
|
{
|
||||||
return 'form_settings';
|
return 'form_settings';
|
||||||
}
|
}
|
||||||
@ -133,7 +129,7 @@ class AccessAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return string URL of the action
|
* @return string URL of the action
|
||||||
*/
|
*/
|
||||||
function action()
|
public function action()
|
||||||
{
|
{
|
||||||
return common_local_url('accessadminpanel');
|
return common_local_url('accessadminpanel');
|
||||||
}
|
}
|
||||||
@ -143,7 +139,7 @@ class AccessAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function formData()
|
public function formData()
|
||||||
{
|
{
|
||||||
$this->out->elementStart('fieldset', array('id' => 'settings_admin_account_access'));
|
$this->out->elementStart('fieldset', array('id' => 'settings_admin_account_access'));
|
||||||
// TRANS: Form legend for registration form.
|
// TRANS: Form legend for registration form.
|
||||||
@ -154,18 +150,24 @@ class AccessAdminPanelForm extends AdminForm
|
|||||||
// TRANS: Checkbox instructions for admin setting "Invite only".
|
// TRANS: Checkbox instructions for admin setting "Invite only".
|
||||||
$instructions = _('Make registration invitation only.');
|
$instructions = _('Make registration invitation only.');
|
||||||
// TRANS: Checkbox label for configuring site as invite only.
|
// TRANS: Checkbox label for configuring site as invite only.
|
||||||
$this->out->checkbox('inviteonly', _('Invite only'),
|
$this->out->checkbox(
|
||||||
(bool) $this->value('inviteonly'),
|
'inviteonly',
|
||||||
$instructions);
|
_('Invite only'),
|
||||||
|
(bool) $this->value('inviteonly'),
|
||||||
|
$instructions
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
// TRANS: Checkbox instructions for admin setting "Closed" (no new registrations).
|
// TRANS: Checkbox instructions for admin setting "Closed" (no new registrations).
|
||||||
$instructions = _('Disable new registrations.');
|
$instructions = _('Disable new registrations.');
|
||||||
// TRANS: Checkbox label for disabling new user registrations.
|
// TRANS: Checkbox label for disabling new user registrations.
|
||||||
$this->out->checkbox('closed', _('Closed'),
|
$this->out->checkbox(
|
||||||
(bool) $this->value('closed'),
|
'closed',
|
||||||
$instructions);
|
_('Closed'),
|
||||||
|
(bool) $this->value('closed'),
|
||||||
|
$instructions
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->out->elementEnd('ul');
|
$this->out->elementEnd('ul');
|
||||||
@ -173,26 +175,32 @@ class AccessAdminPanelForm extends AdminForm
|
|||||||
|
|
||||||
|
|
||||||
// Public access settings (login requirements for feeds etc.)
|
// Public access settings (login requirements for feeds etc.)
|
||||||
$this->out->elementStart('fieldset', array('id' => 'settings_admin_public_access'));
|
$this->out->elementStart('fieldset', ['id' => 'settings_admin_public_access']);
|
||||||
// TRANS: Form legend for registration form.
|
// TRANS: Form legend for registration form.
|
||||||
$this->out->element('legend', null, _('Feed access'));
|
$this->out->element('legend', null, _('Feed access'));
|
||||||
$this->out->elementStart('ul', 'form_data');
|
$this->out->elementStart('ul', 'form_data');
|
||||||
$this->li();
|
$this->li();
|
||||||
// TRANS: Checkbox instructions for admin setting "Private".
|
// TRANS: Checkbox instructions for admin setting "Private".
|
||||||
$instructions = _('Prohibit anonymous users (not logged in) from viewing site?');
|
$instructions = _('Prohibit anonymous users (not logged in) from viewing site?');
|
||||||
// TRANS: Checkbox label for prohibiting anonymous users from viewing site.
|
// TRANS: Checkbox label for prohibiting anonymous users from viewing site.
|
||||||
$this->out->checkbox('private', _m('LABEL', 'Private'),
|
$this->out->checkbox(
|
||||||
(bool) $this->value('private'),
|
'private',
|
||||||
$instructions);
|
_m('LABEL', 'Private'),
|
||||||
|
(bool) $this->value('private'),
|
||||||
|
$instructions
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
// TRANS: Description of the full network notice stream views..
|
// 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.');
|
$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.
|
// 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'),
|
$this->out->checkbox(
|
||||||
(bool) $this->value('localonly', 'public'),
|
'localonly',
|
||||||
$instructions);
|
_('Restrict full network view to accounts'),
|
||||||
|
(bool) $this->value('localonly', 'public'),
|
||||||
|
$instructions
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->out->elementEnd('ul');
|
$this->out->elementEnd('ul');
|
||||||
@ -204,7 +212,7 @@ class AccessAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function formActions()
|
public function formActions()
|
||||||
{
|
{
|
||||||
// TRANS: Button title to save access settings in site admin panel.
|
// TRANS: Button title to save access settings in site admin panel.
|
||||||
$title = _('Save access settings.');
|
$title = _('Save access settings.');
|
||||||
|
@ -1,44 +1,38 @@
|
|||||||
<?php
|
<?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
|
* 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
|
* @category API
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Zach Copley <zach@status.net>
|
* @author Zach Copley <zach@status.net>
|
||||||
* @copyright 2010 StatusNet, Inc.
|
* @copyright 2010 StatusNet, Inc.
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET')) {
|
defined('GNUSOCIAL') || die();
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API analog to the group edit page
|
* API analog to the group edit page
|
||||||
*
|
*
|
||||||
* @category API
|
* @category API
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Zach Copley <zach@status.net>
|
* @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
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
class ApiGroupProfileUpdateAction extends ApiAuthAction
|
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->clientError(_('You must be an admin to edit the group.'), 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->group->query('BEGIN');
|
$this->group->query('START TRANSACTION');
|
||||||
|
|
||||||
$orig = clone($this->group);
|
$orig = clone($this->group);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (common_config('profile', 'changenick') == true && $this->group->nickname !== $this->nickname) {
|
if (common_config('profile', 'changenick') == true && $this->group->nickname !== $this->nickname) {
|
||||||
try {
|
try {
|
||||||
$this->group->nickname = Nickname::normalize($this->nickname, true);
|
$this->group->nickname = Nickname::normalize($this->nickname, true);
|
||||||
} catch (NicknameException $e) {
|
} catch (NicknameException $e) {
|
||||||
throw new ApiValidationException($e->getMessage());
|
throw new ApiValidationException($e->getMessage());
|
||||||
}
|
}
|
||||||
$this->group->mainpage = common_local_url('showgroup',
|
$this->group->mainpage = common_local_url(
|
||||||
array('nickname' => $this->group->nickname));
|
'showgroup',
|
||||||
|
['nickname' => $this->group->nickname]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($this->fullname)) {
|
if (!empty($this->fullname)) {
|
||||||
@ -135,7 +130,6 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
|
|||||||
$this->validateLocation();
|
$this->validateLocation();
|
||||||
$this->group->location = $this->location;
|
$this->group->location = $this->location;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (ApiValidationException $ave) {
|
} catch (ApiValidationException $ave) {
|
||||||
$this->clientError($ave->getMessage(), 400);
|
$this->clientError($ave->getMessage(), 400);
|
||||||
}
|
}
|
||||||
@ -167,7 +161,7 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
|
|||||||
|
|
||||||
$this->group->query('COMMIT');
|
$this->group->query('COMMIT');
|
||||||
|
|
||||||
switch($this->format) {
|
switch ($this->format) {
|
||||||
case 'xml':
|
case 'xml':
|
||||||
$this->showSingleXmlGroup($this->group);
|
$this->showSingleXmlGroup($this->group);
|
||||||
break;
|
break;
|
||||||
@ -180,7 +174,7 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateHomepage()
|
public function validateHomepage()
|
||||||
{
|
{
|
||||||
if (!is_null($this->homepage)
|
if (!is_null($this->homepage)
|
||||||
&& (strlen($this->homepage) > 0)
|
&& (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) {
|
if (!is_null($this->fullname) && mb_strlen($this->fullname) > 255) {
|
||||||
throw new ApiValidationException(
|
throw new ApiValidationException(
|
||||||
@ -202,19 +196,21 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateDescription()
|
public function validateDescription()
|
||||||
{
|
{
|
||||||
if (User_group::descriptionTooLong($this->description)) {
|
if (User_group::descriptionTooLong($this->description)) {
|
||||||
// TRANS: API validation exception thrown when description does not validate.
|
// TRANS: API validation exception thrown when description does not validate.
|
||||||
// TRANS: %d is the maximum description length and used for plural.
|
// TRANS: %d is the maximum description length and used for plural.
|
||||||
throw new ApiValidationException(sprintf(_m('Description is too long (maximum %d character).',
|
throw new ApiValidationException(sprintf(
|
||||||
'Description is too long (maximum %d characters).',
|
_m('Description is too long (maximum %d character).',
|
||||||
User_group::maxDescription()),
|
'Description is too long (maximum %d characters).',
|
||||||
User_group::maxDescription()));
|
User_group::maxDescription()),
|
||||||
|
User_group::maxDescription()
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateLocation()
|
public function validateLocation()
|
||||||
{
|
{
|
||||||
if (!is_null($this->location) && mb_strlen($this->location) > 255) {
|
if (!is_null($this->location) && mb_strlen($this->location) > 255) {
|
||||||
throw new ApiValidationException(
|
throw new ApiValidationException(
|
||||||
@ -224,11 +220,13 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateAliases()
|
public function validateAliases()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$aliases = array_map(array('Nickname', 'normalize'),
|
$aliases = array_map(
|
||||||
array_unique(preg_split('/[\s,]+/', $this->aliasstring)));
|
['Nickname', 'normalize'],
|
||||||
|
array_unique(preg_split('/[\s,]+/', $this->aliasstring))
|
||||||
|
);
|
||||||
} catch (NicknameException $e) {
|
} catch (NicknameException $e) {
|
||||||
throw new ApiValidationException(sprintf('Error processing aliases: %s', $e->getMessage()));
|
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')) {
|
if (count($aliases) > common_config('group', 'maxaliases')) {
|
||||||
// TRANS: API validation exception thrown when aliases do not validate.
|
// TRANS: API validation exception thrown when aliases do not validate.
|
||||||
// TRANS: %d is the maximum number of aliases and used for plural.
|
// TRANS: %d is the maximum number of aliases and used for plural.
|
||||||
throw new ApiValidationException(sprintf(_m('Too many aliases! Maximum %d allowed.',
|
throw new ApiValidationException(sprintf(
|
||||||
'Too many aliases! Maximum %d allowed.',
|
_m('Too many aliases! Maximum %d allowed.',
|
||||||
common_config('group', 'maxaliases')),
|
'Too many aliases! Maximum %d allowed.',
|
||||||
common_config('group', 'maxaliases')));
|
common_config('group', 'maxaliases')),
|
||||||
|
common_config('group', 'maxaliases')
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $aliases;
|
return $aliases;
|
||||||
|
@ -1,33 +1,30 @@
|
|||||||
<?php
|
<?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
|
* 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
|
* @category Confirm
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @author Evan Prodromou <evan@status.net>
|
||||||
* @copyright 2008-2009 StatusNet, Inc.
|
* @copyright 2008-2009 StatusNet, Inc.
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
defined('GNUSOCIAL') || die();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Confirm an address
|
* 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
|
* a confirmation code to make sure the owner of that address approves. This class
|
||||||
* accepts those codes.
|
* accepts those codes.
|
||||||
*
|
*
|
||||||
* @category Confirm
|
* @category Confirm
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @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
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
class ConfirmaddressAction extends ManagedAction
|
class ConfirmaddressAction extends ManagedAction
|
||||||
{
|
{
|
||||||
@ -88,7 +84,7 @@ class ConfirmaddressAction extends ManagedAction
|
|||||||
|
|
||||||
$cur = $this->scoped->getUser();
|
$cur = $this->scoped->getUser();
|
||||||
|
|
||||||
$cur->query('BEGIN');
|
$cur->query('START TRANSACTION');
|
||||||
if (in_array($type, array('email', 'sms'))) {
|
if (in_array($type, array('email', 'sms'))) {
|
||||||
common_debug("Confirming {$type} address for user {$this->scoped->getID()}");
|
common_debug("Confirming {$type} address for user {$this->scoped->getID()}");
|
||||||
if ($cur->$type == $confirm->address) {
|
if ($cur->$type == $confirm->address) {
|
||||||
@ -114,14 +110,12 @@ class ConfirmaddressAction extends ManagedAction
|
|||||||
if ($type == 'email') {
|
if ($type == 'email') {
|
||||||
$cur->emailChanged();
|
$cur->emailChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$user_im_prefs = new User_im_prefs();
|
$user_im_prefs = new User_im_prefs();
|
||||||
$user_im_prefs->transport = $confirm->address_type;
|
$user_im_prefs->transport = $confirm->address_type;
|
||||||
$user_im_prefs->user_id = $cur->id;
|
$user_im_prefs->user_id = $cur->id;
|
||||||
if ($user_im_prefs->find() && $user_im_prefs->fetch()) {
|
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
|
// Already verified, so delete the confirm_address entry
|
||||||
$confirm->delete();
|
$confirm->delete();
|
||||||
// TRANS: Client error for an already confirmed IM address.
|
// 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.
|
// TRANS: Server error displayed when updating IM preferences fails.
|
||||||
throw new ServerException(_('Could not update user IM preferences.'));
|
throw new ServerException(_('Could not update user IM preferences.'));
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
$user_im_prefs = new User_im_prefs();
|
$user_im_prefs = new User_im_prefs();
|
||||||
$user_im_prefs->screenname = $confirm->address;
|
$user_im_prefs->screenname = $confirm->address;
|
||||||
$user_im_prefs->transport = $confirm->address_type;
|
$user_im_prefs->transport = $confirm->address_type;
|
||||||
@ -149,7 +143,6 @@ class ConfirmaddressAction extends ManagedAction
|
|||||||
throw new ServerException(_('Could not insert user IM preferences.'));
|
throw new ServerException(_('Could not insert user IM preferences.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$confirm->delete();
|
$confirm->delete();
|
||||||
@ -162,7 +155,7 @@ class ConfirmaddressAction extends ManagedAction
|
|||||||
*
|
*
|
||||||
* @return string title
|
* @return string title
|
||||||
*/
|
*/
|
||||||
function title()
|
public function title()
|
||||||
{
|
{
|
||||||
// TRANS: Title for the contact address confirmation action.
|
// TRANS: Title for the contact address confirmation action.
|
||||||
return _('Confirm address');
|
return _('Confirm address');
|
||||||
@ -173,13 +166,17 @@ class ConfirmaddressAction extends ManagedAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showContent()
|
public function showContent()
|
||||||
{
|
{
|
||||||
$this->element('p', null,
|
$this->element(
|
||||||
// TRANS: Success message for the contact address confirmation action.
|
'p',
|
||||||
// TRANS: %s can be 'email', 'jabber', or 'sms'.
|
null,
|
||||||
sprintf(_('The address "%s" has been '.
|
// TRANS: Success message for the contact address confirmation action.
|
||||||
'confirmed for your account.'),
|
// TRANS: %s can be 'email', 'jabber', or 'sms'.
|
||||||
$this->address));
|
sprintf(
|
||||||
|
_('The address "%s" has been confirmed for your account.'),
|
||||||
|
$this->address
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,50 +1,44 @@
|
|||||||
<?php
|
<?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
|
* 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
|
* @category Group
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @author Evan Prodromou <evan@status.net>
|
||||||
* @author Sarven Capadisli <csarven@status.net>
|
* @author Sarven Capadisli <csarven@status.net>
|
||||||
* @author Zach Copley <zach@status.net>
|
* @author Zach Copley <zach@status.net>
|
||||||
* @copyright 2008-2011 StatusNet, Inc.
|
* @copyright 2008-2011 StatusNet, Inc.
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET') && !defined('LACONICA') && !defined('GNUSOCIAL')) {
|
defined('GNUSOCIAL') || die();
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new group
|
* Add a new group
|
||||||
*
|
*
|
||||||
* This is the form for adding a new group
|
* This is the form for adding a new group
|
||||||
*
|
*
|
||||||
* @category Group
|
* @category Group
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @author Evan Prodromou <evan@status.net>
|
||||||
* @author Zach Copley <zach@status.net>
|
* @author Zach Copley <zach@status.net>
|
||||||
* @author Alexei Sorokin <sor.alexei@meowr.ru>
|
* @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
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
class EditgroupAction extends GroupAction
|
class EditgroupAction extends GroupAction
|
||||||
{
|
{
|
||||||
@ -242,7 +236,7 @@ class EditgroupAction extends GroupAction
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->group->query('BEGIN');
|
$this->group->query('START TRANSACTION');
|
||||||
|
|
||||||
$orig = clone($this->group);
|
$orig = clone($this->group);
|
||||||
|
|
||||||
|
@ -1,50 +1,46 @@
|
|||||||
<?php
|
<?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
|
* 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
|
* @category Group
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET') && !defined('LACONICA')) {
|
defined('GNUSOCIAL') || die();
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new group
|
* Add a new group
|
||||||
*
|
*
|
||||||
* This is the form for adding a new group
|
* This is the form for adding a new group
|
||||||
*
|
*
|
||||||
* @category Group
|
* @category Group
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class EditpeopletagAction extends Action
|
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')) {
|
if ($_SERVER['REQUEST_METHOD'] == 'POST' && $this->boolean('delete')) {
|
||||||
// TRANS: Title for edit list page after deleting a tag.
|
// TRANS: Title for edit list page after deleting a tag.
|
||||||
@ -60,7 +56,7 @@ class EditpeopletagAction extends Action
|
|||||||
* Prepare to run
|
* Prepare to run
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare(array $args = array())
|
public function prepare(array $args = [])
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
|
||||||
@ -135,7 +131,7 @@ class EditpeopletagAction extends Action
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
parent::handle();
|
parent::handle();
|
||||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
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 = $msg;
|
||||||
$this->confirm_args = $fwd;
|
$this->confirm_args = $fwd;
|
||||||
$this->showPage();
|
$this->showPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
function showConfirmForm()
|
public function showConfirmForm()
|
||||||
{
|
{
|
||||||
$this->elementStart('form', array('id' => 'form_peopletag_edit_confirm',
|
$this->elementStart(
|
||||||
'class' => 'form_settings',
|
'form',
|
||||||
'method' => 'post',
|
[
|
||||||
'action' => common_local_url('editpeopletag',
|
'id' => 'form_peopletag_edit_confirm',
|
||||||
array('tagger' => $this->tagger->nickname,
|
'class' => 'form_settings',
|
||||||
'tag' => $this->peopletag->tag))));
|
'method' => 'post',
|
||||||
|
'action' => common_local_url(
|
||||||
|
'editpeopletag',
|
||||||
|
[
|
||||||
|
'tagger' => $this->tagger->nickname,
|
||||||
|
'tag' => $this->peopletag->tag,
|
||||||
|
]
|
||||||
|
),
|
||||||
|
]
|
||||||
|
);
|
||||||
$this->elementStart('fieldset');
|
$this->elementStart('fieldset');
|
||||||
$this->hidden('token', common_session_token());
|
$this->hidden('token', common_session_token());
|
||||||
$this->hidden('id', $this->arg('id'));
|
$this->hidden('id', $this->arg('id'));
|
||||||
@ -168,31 +173,35 @@ class EditpeopletagAction extends Action
|
|||||||
$this->hidden($key, $val);
|
$this->hidden($key, $val);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->submit('form_action-no',
|
$this->submit(
|
||||||
_m('BUTTON','No'),
|
'form_action-no',
|
||||||
'submit form_action-primary',
|
_m('BUTTON', 'No'),
|
||||||
'cancel');
|
'submit form_action-primary',
|
||||||
$this->submit('form_action-yes',
|
'cancel'
|
||||||
_m('BUTTON','Yes'),
|
);
|
||||||
'submit form_action-secondary',
|
$this->submit(
|
||||||
'confirm');
|
'form_action-yes',
|
||||||
|
_m('BUTTON', 'Yes'),
|
||||||
|
'submit form_action-secondary',
|
||||||
|
'confirm'
|
||||||
|
);
|
||||||
$this->elementEnd('fieldset');
|
$this->elementEnd('fieldset');
|
||||||
$this->elementEnd('form');
|
$this->elementEnd('form');
|
||||||
}
|
}
|
||||||
|
|
||||||
function showForm($msg=null)
|
public function showForm($msg = null)
|
||||||
{
|
{
|
||||||
$this->msg = $msg;
|
$this->msg = $msg;
|
||||||
$this->showPage();
|
$this->showPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
function showObjectNav()
|
public function showObjectNav()
|
||||||
{
|
{
|
||||||
$nav = new PeopletagGroupNav($this, $this->peopletag);
|
$nav = new PeopletagGroupNav($this, $this->peopletag);
|
||||||
$nav->show();
|
$nav->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
function showContent()
|
public function showContent()
|
||||||
{
|
{
|
||||||
if ($this->confirm) {
|
if ($this->confirm) {
|
||||||
$this->showConfirmForm();
|
$this->showConfirmForm();
|
||||||
@ -205,26 +214,29 @@ class EditpeopletagAction extends Action
|
|||||||
$form->showProfileList();
|
$form->showProfileList();
|
||||||
}
|
}
|
||||||
|
|
||||||
function showPageNotice()
|
public function showPageNotice()
|
||||||
{
|
{
|
||||||
if ($this->msg) {
|
if ($this->msg) {
|
||||||
$this->element('p', 'error', $this->msg);
|
$this->element('p', 'error', $this->msg);
|
||||||
} else if ($this->confirm) {
|
} elseif ($this->confirm) {
|
||||||
$this->element('p', 'instructions', $this->confirm);
|
$this->element('p', 'instructions', $this->confirm);
|
||||||
} else {
|
} else {
|
||||||
$this->element('p', 'instructions',
|
$this->element(
|
||||||
// TRANS: Form instruction for edit list form.
|
'p',
|
||||||
_('Use this form to edit the list.'));
|
'instructions',
|
||||||
|
// TRANS: Form instruction for edit list form.
|
||||||
|
_('Use this form to edit the list.')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showScripts()
|
public function showScripts()
|
||||||
{
|
{
|
||||||
parent::showScripts();
|
parent::showScripts();
|
||||||
$this->autofocus('tag');
|
$this->autofocus('tag');
|
||||||
}
|
}
|
||||||
|
|
||||||
function trySave()
|
public function trySave()
|
||||||
{
|
{
|
||||||
$tag = common_canonical_tag($this->trimmed('tag'));
|
$tag = common_canonical_tag($this->trimmed('tag'));
|
||||||
$description = $this->trimmed('description');
|
$description = $this->trimmed('description');
|
||||||
@ -247,25 +259,26 @@ class EditpeopletagAction extends Action
|
|||||||
'all its subscription and membership records. ' .
|
'all its subscription and membership records. ' .
|
||||||
'Do you still want to continue?'), array('delete' => 1));
|
'Do you still want to continue?'), array('delete' => 1));
|
||||||
return;
|
return;
|
||||||
} else if (common_valid_tag($tag)) {
|
} elseif (common_valid_tag($tag)) {
|
||||||
// TRANS: Form validation error displayed if a given tag is invalid.
|
// TRANS: Form validation error displayed if a given tag is invalid.
|
||||||
$this->showForm(_('Invalid tag.'));
|
$this->showForm(_('Invalid tag.'));
|
||||||
return;
|
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: Form validation error displayed if a given tag is already present.
|
||||||
// TRANS: %s is the already present tag.
|
// TRANS: %s is the already present tag.
|
||||||
$this->showForm(sprintf(_('You already have a tag named %s.'), $tag));
|
$this->showForm(sprintf(_('You already have a tag named %s.'), $tag));
|
||||||
return;
|
return;
|
||||||
} else if (Profile_list::descriptionTooLong($description)) {
|
} elseif (Profile_list::descriptionTooLong($description)) {
|
||||||
$this->showForm(sprintf(
|
$this->showForm(sprintf(
|
||||||
// TRANS: Client error shown when providing too long a description when editing a list.
|
// TRANS: Client error shown when providing too long a description when editing a list.
|
||||||
// TRANS: %d is the maximum number of allowed characters.
|
// TRANS: %d is the maximum number of allowed characters.
|
||||||
_m('Description is too long (maximum %d character).',
|
_m('Description is too long (maximum %d character).',
|
||||||
'Description is too long (maximum %d characters).',
|
'Description is too long (maximum %d characters).',
|
||||||
Profile_list::maxDescription()),
|
Profile_list::maxDescription()),
|
||||||
Profile_list::maxDescription()));
|
Profile_list::maxDescription()
|
||||||
|
));
|
||||||
return;
|
return;
|
||||||
} else if ($set_private && !$confirm && !$cancel) {
|
} elseif ($set_private && !$confirm && !$cancel) {
|
||||||
$fwd = array('tag' => $tag,
|
$fwd = array('tag' => $tag,
|
||||||
'description' => $description,
|
'description' => $description,
|
||||||
'private' => (int) $private);
|
'private' => (int) $private);
|
||||||
@ -285,7 +298,7 @@ class EditpeopletagAction extends Action
|
|||||||
common_redirect(common_local_url('all', array('nickname' => $this->tagger->getNickname())), 303);
|
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);
|
$orig = clone($this->peopletag);
|
||||||
|
|
||||||
@ -310,17 +323,23 @@ class EditpeopletagAction extends Action
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($tag != $orig->tag) {
|
if ($tag != $orig->tag) {
|
||||||
common_redirect(common_local_url('editpeopletag',
|
common_redirect(
|
||||||
array('tagger' => $this->tagger->nickname,
|
common_local_url(
|
||||||
'tag' => $tag)),
|
'editpeopletag',
|
||||||
303);
|
[
|
||||||
|
'tagger' => $this->tagger->nickname,
|
||||||
|
'tag' => $tag,
|
||||||
|
]
|
||||||
|
),
|
||||||
|
303
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
// TRANS: Edit list form success message.
|
// TRANS: Edit list form success message.
|
||||||
$this->showForm(_('Options saved.'));
|
$this->showForm(_('Options saved.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function tagExists($tag)
|
public function tagExists($tag)
|
||||||
{
|
{
|
||||||
$args = array('tagger' => $this->tagger->id, 'tag' => $tag);
|
$args = array('tagger' => $this->tagger->id, 'tag' => $tag);
|
||||||
$ptag = Profile_list::pkeyGet($args);
|
$ptag = Profile_list::pkeyGet($args);
|
||||||
|
@ -302,7 +302,7 @@ class EmailsettingsAction extends SettingsAction
|
|||||||
$emailpost = $this->boolean('emailpost');
|
$emailpost = $this->boolean('emailpost');
|
||||||
|
|
||||||
$user = $this->scoped->getUser();
|
$user = $this->scoped->getUser();
|
||||||
$user->query('BEGIN');
|
$user->query('START TRANSACTION');
|
||||||
$original = clone($user);
|
$original = clone($user);
|
||||||
|
|
||||||
$user->emailnotifysub = $emailnotifysub;
|
$user->emailnotifysub = $emailnotifysub;
|
||||||
|
@ -1,44 +1,25 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* StatusNet, the distributed open-source microblogging tool
|
|
||||||
*
|
|
||||||
* Settings for Jabber/XMPP integration
|
* 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
|
* @category Settings
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @author Evan Prodromou <evan@status.net>
|
||||||
* @copyright 2008-2009 StatusNet, Inc.
|
* @copyright 2008-2009 StatusNet, Inc.
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
defined('GNUSOCIAL') || die();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings for Jabber/XMPP integration
|
* Settings for Jabber/XMPP integration
|
||||||
*
|
*
|
||||||
* @category Settings
|
* @category Settings
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @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
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*
|
*
|
||||||
* @see SettingsAction
|
* @see SettingsAction
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ImsettingsAction extends SettingsAction
|
class ImsettingsAction extends SettingsAction
|
||||||
@ -48,7 +29,7 @@ class ImsettingsAction extends SettingsAction
|
|||||||
*
|
*
|
||||||
* @return string Title of the page
|
* @return string Title of the page
|
||||||
*/
|
*/
|
||||||
function title()
|
public function title()
|
||||||
{
|
{
|
||||||
// TRANS: Title for Instant Messaging settings.
|
// TRANS: Title for Instant Messaging settings.
|
||||||
return _('IM settings');
|
return _('IM settings');
|
||||||
@ -59,7 +40,7 @@ class ImsettingsAction extends SettingsAction
|
|||||||
*
|
*
|
||||||
* @return instructions for use
|
* @return instructions for use
|
||||||
*/
|
*/
|
||||||
function getInstructions()
|
public function getInstructions()
|
||||||
{
|
{
|
||||||
// TRANS: Instant messaging settings page instructions.
|
// TRANS: Instant messaging settings page instructions.
|
||||||
// TRANS: [instant messages] is link text, "(%%doc.im%%)" is the link.
|
// TRANS: [instant messages] is link text, "(%%doc.im%%)" is the link.
|
||||||
@ -78,14 +59,17 @@ class ImsettingsAction extends SettingsAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showContent()
|
public function showContent()
|
||||||
{
|
{
|
||||||
$transports = array();
|
$transports = array();
|
||||||
Event::handle('GetImTransports', array(&$transports));
|
Event::handle('GetImTransports', array(&$transports));
|
||||||
if (! $transports) {
|
if (! $transports) {
|
||||||
$this->element('div', array('class' => 'error'),
|
$this->element(
|
||||||
// TRANS: Message given in the IM settings if IM is not enabled on the site.
|
'div',
|
||||||
_('IM is not available.'));
|
['class' => 'error'],
|
||||||
|
// TRANS: Message given in the IM settings if IM is not enabled on the site.
|
||||||
|
_('IM is not available.')
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,79 +77,94 @@ class ImsettingsAction extends SettingsAction
|
|||||||
|
|
||||||
$user_im_prefs_by_transport = array();
|
$user_im_prefs_by_transport = array();
|
||||||
|
|
||||||
foreach($transports as $transport=>$transport_info)
|
foreach ($transports as $transport => $transport_info) {
|
||||||
{
|
$this->elementStart(
|
||||||
$this->elementStart('form', array('method' => 'post',
|
'form',
|
||||||
'id' => 'form_settings_im',
|
[
|
||||||
'class' => 'form_settings',
|
'method' => 'post',
|
||||||
'action' =>
|
'id' => 'form_settings_im',
|
||||||
common_local_url('imsettings')));
|
'class' => 'form_settings',
|
||||||
|
'action' => common_local_url('imsettings'),
|
||||||
|
]
|
||||||
|
);
|
||||||
$this->elementStart('fieldset', array('id' => 'settings_im_address'));
|
$this->elementStart('fieldset', array('id' => 'settings_im_address'));
|
||||||
// TRANS: Form legend for IM settings form.
|
// TRANS: Form legend for IM settings form.
|
||||||
$this->element('legend', null, $transport_info['display']);
|
$this->element('legend', null, $transport_info['display']);
|
||||||
$this->hidden('token', common_session_token());
|
$this->hidden('token', common_session_token());
|
||||||
$this->hidden('transport', $transport);
|
$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;
|
$user_im_prefs_by_transport[$transport] = $user_im_prefs;
|
||||||
$this->element('p', 'form_confirmed', $user_im_prefs->screenname);
|
$this->element('p', 'form_confirmed', $user_im_prefs->screenname);
|
||||||
$this->element('p', 'form_note',
|
$this->element(
|
||||||
// TRANS: Form note in IM settings form. %s is the type of IM address that was confirmed.
|
'p',
|
||||||
sprintf(_('Current confirmed %s address.'),$transport_info['display']));
|
'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);
|
$this->hidden('screenname', $user_im_prefs->screenname);
|
||||||
// TRANS: Button label to remove a confirmed IM address.
|
// TRANS: Button label to remove a confirmed IM address.
|
||||||
$this->submit('remove', _m('BUTTON','Remove'));
|
$this->submit('remove', _m('BUTTON', 'Remove'));
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
$confirm = $this->getConfirmation($transport);
|
$confirm = $this->getConfirmation($transport);
|
||||||
$this->element('p', 'form_unconfirmed', $confirm->address);
|
$this->element('p', 'form_unconfirmed', $confirm->address);
|
||||||
// TRANS: Form note in IM settings form.
|
// TRANS: Form note in IM settings form.
|
||||||
$this->element('p', 'form_note',
|
$this->element(
|
||||||
// TRANS: Form note in IM settings form.
|
'p',
|
||||||
// TRANS: %s is the IM service name, %2$s is the IM address set.
|
'form_note',
|
||||||
sprintf(_('Awaiting confirmation on this address. '.
|
// TRANS: Form note in IM settings form.
|
||||||
'Check your %1$s account for a '.
|
// TRANS: %s is the IM service name, %2$s is the IM address set.
|
||||||
'message with further instructions. '.
|
sprintf(
|
||||||
'(Did you add %2$s to your buddy list?)'),
|
_('Awaiting confirmation on this address. '
|
||||||
$transport_info['display'],
|
. 'Check your %1$s account for a '
|
||||||
$transport_info['daemonScreenname']));
|
. 'message with further instructions. '
|
||||||
|
. '(Did you add %2$s to your buddy list?)'),
|
||||||
|
$transport_info['display'],
|
||||||
|
$transport_info['daemonScreenname']
|
||||||
|
)
|
||||||
|
);
|
||||||
$this->hidden('screenname', $confirm->address);
|
$this->hidden('screenname', $confirm->address);
|
||||||
// TRANS: Button label to cancel an IM address confirmation procedure.
|
// 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) {
|
} catch (NoResultException $e) {
|
||||||
$this->elementStart('ul', 'form_data');
|
$this->elementStart('ul', 'form_data');
|
||||||
$this->elementStart('li');
|
$this->elementStart('li');
|
||||||
// TRANS: Field label for IM address.
|
// TRANS: Field label for IM address.
|
||||||
$this->input('screenname', _('IM address'),
|
$this->input(
|
||||||
($this->arg('screenname')) ? $this->arg('screenname') : null,
|
'screenname',
|
||||||
// TRANS: Field title for IM address. %s is the IM service name.
|
_('IM address'),
|
||||||
sprintf(_('%s screenname.'),
|
($this->arg('screenname')) ? $this->arg('screenname') : null,
|
||||||
$transport_info['display']));
|
// TRANS: Field title for IM address. %s is the IM service name.
|
||||||
|
sprintf(_('%s screenname.'), $transport_info['display'])
|
||||||
|
);
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
$this->elementEnd('ul');
|
$this->elementEnd('ul');
|
||||||
// TRANS: Button label for adding an IM address in IM settings form.
|
// 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('fieldset');
|
||||||
$this->elementEnd('form');
|
$this->elementEnd('form');
|
||||||
}
|
}
|
||||||
|
|
||||||
if($user_im_prefs_by_transport)
|
if ($user_im_prefs_by_transport) {
|
||||||
{
|
$this->elementStart(
|
||||||
$this->elementStart('form', array('method' => 'post',
|
'form',
|
||||||
'id' => 'form_settings_im',
|
[
|
||||||
'class' => 'form_settings',
|
'method' => 'post',
|
||||||
'action' =>
|
'id' => 'form_settings_im',
|
||||||
common_local_url('imsettings')));
|
'class' => 'form_settings',
|
||||||
|
'action' => common_local_url('imsettings'),
|
||||||
|
]
|
||||||
|
);
|
||||||
$this->elementStart('fieldset', array('id' => 'settings_im_preferences'));
|
$this->elementStart('fieldset', array('id' => 'settings_im_preferences'));
|
||||||
// TRANS: Header for IM preferences form.
|
// TRANS: Header for IM preferences form.
|
||||||
$this->element('legend', null, _('IM Preferences'));
|
$this->element('legend', null, _('IM Preferences'));
|
||||||
$this->hidden('token', common_session_token());
|
$this->hidden('token', common_session_token());
|
||||||
$this->elementStart('table');
|
$this->elementStart('table');
|
||||||
$this->elementStart('tr');
|
$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->element('th', null, $transports[$transport]['display']);
|
||||||
}
|
}
|
||||||
$this->elementEnd('tr');
|
$this->elementEnd('tr');
|
||||||
@ -178,23 +177,23 @@ class ImsettingsAction extends SettingsAction
|
|||||||
array('name'=>'replies', 'description'=>_('Send me replies '.
|
array('name'=>'replies', 'description'=>_('Send me replies '.
|
||||||
'from people I\'m not subscribed to.')),
|
'from people I\'m not subscribed to.')),
|
||||||
);
|
);
|
||||||
foreach($preferences as $preference)
|
foreach ($preferences as $preference) {
|
||||||
{
|
|
||||||
$this->elementStart('tr');
|
$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'];
|
$preference_name = $preference['name'];
|
||||||
$this->elementStart('td');
|
$this->elementStart('td');
|
||||||
$this->checkbox($transport . '_' . $preference['name'],
|
$this->checkbox(
|
||||||
$preference['description'],
|
$transport . '_' . $preference['name'],
|
||||||
$user_im_prefs->$preference_name);
|
$preference['description'],
|
||||||
|
$user_im_prefs->$preference_name
|
||||||
|
);
|
||||||
$this->elementEnd('td');
|
$this->elementEnd('td');
|
||||||
}
|
}
|
||||||
$this->elementEnd('tr');
|
$this->elementEnd('tr');
|
||||||
}
|
}
|
||||||
$this->elementEnd('table');
|
$this->elementEnd('table');
|
||||||
// TRANS: Button label to save IM preferences.
|
// TRANS: Button label to save IM preferences.
|
||||||
$this->submit('save', _m('BUTTON','Save'));
|
$this->submit('save', _m('BUTTON', 'Save'));
|
||||||
$this->elementEnd('fieldset');
|
$this->elementEnd('fieldset');
|
||||||
$this->elementEnd('form');
|
$this->elementEnd('form');
|
||||||
}
|
}
|
||||||
@ -205,7 +204,7 @@ class ImsettingsAction extends SettingsAction
|
|||||||
*
|
*
|
||||||
* @return Confirm_address address object for this user
|
* @return Confirm_address address object for this user
|
||||||
*/
|
*/
|
||||||
function getConfirmation($transport)
|
public function getConfirmation($transport)
|
||||||
{
|
{
|
||||||
$confirm = new Confirm_address();
|
$confirm = new Confirm_address();
|
||||||
|
|
||||||
@ -223,11 +222,11 @@ class ImsettingsAction extends SettingsAction
|
|||||||
{
|
{
|
||||||
if ($this->arg('save')) {
|
if ($this->arg('save')) {
|
||||||
return $this->savePreferences();
|
return $this->savePreferences();
|
||||||
} else if ($this->arg('add')) {
|
} elseif ($this->arg('add')) {
|
||||||
return $this->addAddress();
|
return $this->addAddress();
|
||||||
} else if ($this->arg('cancel')) {
|
} elseif ($this->arg('cancel')) {
|
||||||
return $this->cancelConfirmation();
|
return $this->cancelConfirmation();
|
||||||
} else if ($this->arg('remove')) {
|
} elseif ($this->arg('remove')) {
|
||||||
return $this->removeAddress();
|
return $this->removeAddress();
|
||||||
}
|
}
|
||||||
// TRANS: Message given submitting a form with an unknown action in Instant Messaging settings.
|
// TRANS: Message given submitting a form with an unknown action in Instant Messaging settings.
|
||||||
@ -242,20 +241,17 @@ class ImsettingsAction extends SettingsAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function savePreferences()
|
public function savePreferences()
|
||||||
{
|
{
|
||||||
$user_im_prefs = new User_im_prefs();
|
$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();
|
$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');
|
$preferences = array('notify', 'updatefrompresence', 'replies');
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
$original = clone($user_im_prefs);
|
$original = clone($user_im_prefs);
|
||||||
$new = clone($user_im_prefs);
|
$new = clone($user_im_prefs);
|
||||||
foreach($preferences as $preference)
|
foreach ($preferences as $preference) {
|
||||||
{
|
|
||||||
$new->$preference = $this->boolean($new->transport . '_' . $preference);
|
$new->$preference = $this->boolean($new->transport . '_' . $preference);
|
||||||
}
|
}
|
||||||
$result = $new->update($original);
|
$result = $new->update($original);
|
||||||
@ -265,7 +261,7 @@ class ImsettingsAction extends SettingsAction
|
|||||||
// TRANS: Server error thrown on database error updating IM preferences.
|
// TRANS: Server error thrown on database error updating IM preferences.
|
||||||
throw new ServerException(_('Could not update 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');
|
$user_im_prefs->query('COMMIT');
|
||||||
// TRANS: Confirmation message for successful IM preferences save.
|
// TRANS: Confirmation message for successful IM preferences save.
|
||||||
@ -280,7 +276,7 @@ class ImsettingsAction extends SettingsAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function addAddress()
|
public function addAddress()
|
||||||
{
|
{
|
||||||
$screenname = $this->trimmed('screenname');
|
$screenname = $this->trimmed('screenname');
|
||||||
$transport = $this->trimmed('transport');
|
$transport = $this->trimmed('transport');
|
||||||
@ -308,7 +304,7 @@ class ImsettingsAction extends SettingsAction
|
|||||||
if (!$valid) {
|
if (!$valid) {
|
||||||
// TRANS: Message given saving IM address that not valid.
|
// TRANS: Message given saving IM address that not valid.
|
||||||
throw new ClientException(_('Not a valid screenname.'));
|
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.
|
// TRANS: Message given saving IM address that is already set for another user.
|
||||||
throw new ClientException(_('Screenname already belongs to another user.'));
|
throw new ClientException(_('Screenname already belongs to another user.'));
|
||||||
}
|
}
|
||||||
@ -343,7 +339,7 @@ class ImsettingsAction extends SettingsAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function cancelConfirmation()
|
public function cancelConfirmation()
|
||||||
{
|
{
|
||||||
$screenname = $this->trimmed('screenname');
|
$screenname = $this->trimmed('screenname');
|
||||||
$transport = $this->trimmed('transport');
|
$transport = $this->trimmed('transport');
|
||||||
@ -372,7 +368,7 @@ class ImsettingsAction extends SettingsAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function removeAddress()
|
public function removeAddress()
|
||||||
{
|
{
|
||||||
$screenname = $this->trimmed('screenname');
|
$screenname = $this->trimmed('screenname');
|
||||||
$transport = $this->trimmed('transport');
|
$transport = $this->trimmed('transport');
|
||||||
@ -413,7 +409,7 @@ class ImsettingsAction extends SettingsAction
|
|||||||
* @return boolean whether the screenname exists
|
* @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 = new User_im_prefs();
|
||||||
$user_im_prefs->transport = $transport;
|
$user_im_prefs->transport = $transport;
|
||||||
|
@ -1,44 +1,38 @@
|
|||||||
<?php
|
<?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
|
* 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 Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* @category Settings
|
* @category Settings
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Zach Copley <zach@status.net>
|
* @author Zach Copley <zach@status.net>
|
||||||
* @copyright 2010 StatusNet, Inc.
|
* @copyright 2010 StatusNet, Inc.
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET')) {
|
defined('GNUSOCIAL') || die();
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* License settings
|
* License settings
|
||||||
*
|
*
|
||||||
* @category Admin
|
* @category Admin
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Zach Copley <zach@status.net>
|
* @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
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
class LicenseadminpanelAction extends AdminPanelAction
|
class LicenseadminpanelAction extends AdminPanelAction
|
||||||
{
|
{
|
||||||
@ -48,7 +42,7 @@ class LicenseadminpanelAction extends AdminPanelAction
|
|||||||
* @return string page title
|
* @return string page title
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function title()
|
public function title()
|
||||||
{
|
{
|
||||||
// TRANS: User admin panel title
|
// TRANS: User admin panel title
|
||||||
return _m('TITLE', 'License');
|
return _m('TITLE', 'License');
|
||||||
@ -59,7 +53,7 @@ class LicenseadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return string instructions
|
* @return string instructions
|
||||||
*/
|
*/
|
||||||
function getInstructions()
|
public function getInstructions()
|
||||||
{
|
{
|
||||||
// TRANS: Form instructions for the site license admin panel.
|
// TRANS: Form instructions for the site license admin panel.
|
||||||
return _('License for this StatusNet site');
|
return _('License for this StatusNet site');
|
||||||
@ -70,7 +64,7 @@ class LicenseadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showForm()
|
public function showForm()
|
||||||
{
|
{
|
||||||
$form = new LicenseAdminPanelForm($this);
|
$form = new LicenseAdminPanelForm($this);
|
||||||
$form->show();
|
$form->show();
|
||||||
@ -82,7 +76,7 @@ class LicenseadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function saveSettings()
|
public function saveSettings()
|
||||||
{
|
{
|
||||||
static $settings = array(
|
static $settings = array(
|
||||||
'license' => array('type', 'owner', 'url', 'title', 'image')
|
'license' => array('type', 'owner', 'url', 'title', 'image')
|
||||||
@ -104,7 +98,7 @@ class LicenseadminpanelAction extends AdminPanelAction
|
|||||||
|
|
||||||
$config = new Config();
|
$config = new Config();
|
||||||
|
|
||||||
$config->query('BEGIN');
|
$config->query('START TRANSACTION');
|
||||||
|
|
||||||
foreach ($settings as $section => $parts) {
|
foreach ($settings as $section => $parts) {
|
||||||
foreach ($parts as $setting) {
|
foreach ($parts as $setting) {
|
||||||
@ -124,7 +118,7 @@ class LicenseadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return nothing
|
* @return nothing
|
||||||
*/
|
*/
|
||||||
function validate(&$values)
|
public function validate(&$values)
|
||||||
{
|
{
|
||||||
// Validate license type (shouldn't have to do it, but just in case)
|
// Validate license type (shouldn't have to do it, but just in case)
|
||||||
|
|
||||||
@ -195,7 +189,7 @@ class LicenseAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return int ID of the form
|
* @return int ID of the form
|
||||||
*/
|
*/
|
||||||
function id()
|
public function id()
|
||||||
{
|
{
|
||||||
return 'licenseadminpanel';
|
return 'licenseadminpanel';
|
||||||
}
|
}
|
||||||
@ -205,7 +199,7 @@ class LicenseAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return string class of the form
|
* @return string class of the form
|
||||||
*/
|
*/
|
||||||
function formClass()
|
public function formClass()
|
||||||
{
|
{
|
||||||
return 'form_settings';
|
return 'form_settings';
|
||||||
}
|
}
|
||||||
@ -216,7 +210,7 @@ class LicenseAdminPanelForm extends AdminForm
|
|||||||
* @return string URL of the action
|
* @return string URL of the action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function action()
|
public function action()
|
||||||
{
|
{
|
||||||
return common_local_url('licenseadminpanel');
|
return common_local_url('licenseadminpanel');
|
||||||
}
|
}
|
||||||
@ -227,10 +221,11 @@ class LicenseAdminPanelForm extends AdminForm
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formData()
|
public function formData()
|
||||||
{
|
{
|
||||||
$this->out->elementStart(
|
$this->out->elementStart(
|
||||||
'fieldset', array('id' => 'settings_license-selection')
|
'fieldset',
|
||||||
|
['id' => 'settings_license-selection']
|
||||||
);
|
);
|
||||||
// TRANS: Form legend in the license admin panel.
|
// TRANS: Form legend in the license admin panel.
|
||||||
$this->out->element('legend', null, _('License selection'));
|
$this->out->element('legend', null, _('License selection'));
|
||||||
@ -307,7 +302,8 @@ class LicenseAdminPanelForm extends AdminForm
|
|||||||
$this->li();
|
$this->li();
|
||||||
$this->input(
|
$this->input(
|
||||||
// TRANS: Field label in the license admin panel.
|
// TRANS: Field label in the license admin panel.
|
||||||
'image', _('License Image URL'),
|
'image',
|
||||||
|
_('License Image URL'),
|
||||||
// TRANS: Field title in the license admin panel.
|
// TRANS: Field title in the license admin panel.
|
||||||
_('URL for an image to display with the license.'),
|
_('URL for an image to display with the license.'),
|
||||||
'license'
|
'license'
|
||||||
@ -323,12 +319,12 @@ class LicenseAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function formActions()
|
public function formActions()
|
||||||
{
|
{
|
||||||
$this->out->submit(
|
$this->out->submit(
|
||||||
'submit',
|
'submit',
|
||||||
// TRANS: Button text in the license admin panel.
|
// TRANS: Button text in the license admin panel.
|
||||||
_m('BUTTON','Save'),
|
_m('BUTTON', 'Save'),
|
||||||
'submit',
|
'submit',
|
||||||
null,
|
null,
|
||||||
// TRANS: Button title in the license admin panel.
|
// TRANS: Button title in the license admin panel.
|
||||||
|
@ -1,49 +1,45 @@
|
|||||||
<?php
|
<?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
|
|
||||||
*
|
|
||||||
* Register a new OAuth Application
|
* Register a new OAuth Application
|
||||||
*
|
*
|
||||||
* 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 Applications
|
* @category Applications
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Zach Copley <zach@status.net>
|
* @author Zach Copley <zach@status.net>
|
||||||
* @copyright 2008-2011 StatusNet, Inc.
|
* @copyright 2008-2011 StatusNet, Inc.
|
||||||
* @copyright 2013 Free Software Foundation, Inc.
|
* @copyright 2013 Free Software Foundation, Inc http://www.fsf.org
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
defined('GNUSOCIAL') || die();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new application
|
* Add a new application
|
||||||
*
|
*
|
||||||
* This is the form for adding a new application
|
* This is the form for adding a new application
|
||||||
*
|
*
|
||||||
* @category Application
|
* @category Application
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Zach Copley <zach@status.net>
|
* @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
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
class NewApplicationAction extends SettingsAction
|
class NewApplicationAction extends SettingsAction
|
||||||
{
|
{
|
||||||
function title()
|
public function title()
|
||||||
{
|
{
|
||||||
// TRANS: This is the title of the form for adding a new application.
|
// TRANS: This is the title of the form for adding a new application.
|
||||||
return _('New application');
|
return _('New application');
|
||||||
@ -87,7 +83,7 @@ class NewApplicationAction extends SettingsAction
|
|||||||
if (empty($name)) {
|
if (empty($name)) {
|
||||||
// TRANS: Validation error shown when not providing a name in the "New application" form.
|
// TRANS: Validation error shown when not providing a name in the "New application" form.
|
||||||
$this->clientError(_('Name is required.'));
|
$this->clientError(_('Name is required.'));
|
||||||
} else if ($this->nameExists($name)) {
|
} elseif ($this->nameExists($name)) {
|
||||||
// TRANS: Validation error shown when providing a name for an application that already exists in the "New application" form.
|
// TRANS: Validation error shown when providing a name for an application that already exists in the "New application" form.
|
||||||
$this->clientError(_('Name already in use. Try another one.'));
|
$this->clientError(_('Name already in use. Try another one.'));
|
||||||
} elseif (mb_strlen($name) > 255) {
|
} elseif (mb_strlen($name) > 255) {
|
||||||
@ -103,7 +99,8 @@ class NewApplicationAction extends SettingsAction
|
|||||||
_m('Description is too long (maximum %d character).',
|
_m('Description is too long (maximum %d character).',
|
||||||
'Description is too long (maximum %d characters).',
|
'Description is too long (maximum %d characters).',
|
||||||
Oauth_application::maxDesc()),
|
Oauth_application::maxDesc()),
|
||||||
Oauth_application::maxDesc()));
|
Oauth_application::maxDesc()
|
||||||
|
));
|
||||||
} elseif (empty($source_url)) {
|
} elseif (empty($source_url)) {
|
||||||
// TRANS: Validation error shown when not providing a source URL in the "New application" form.
|
// TRANS: Validation error shown when not providing a source URL in the "New application" form.
|
||||||
$this->clientError(_('Source URL is required.'));
|
$this->clientError(_('Source URL is required.'));
|
||||||
@ -135,7 +132,7 @@ class NewApplicationAction extends SettingsAction
|
|||||||
|
|
||||||
$app = new Oauth_application();
|
$app = new Oauth_application();
|
||||||
|
|
||||||
$app->query('BEGIN');
|
$app->query('START TRANSACTION');
|
||||||
|
|
||||||
$app->name = $name;
|
$app->name = $name;
|
||||||
$app->owner = $this->scoped->getID();
|
$app->owner = $this->scoped->getID();
|
||||||
@ -205,7 +202,7 @@ class NewApplicationAction extends SettingsAction
|
|||||||
*
|
*
|
||||||
* @return boolean true if the name already exists
|
* @return boolean true if the name already exists
|
||||||
*/
|
*/
|
||||||
function nameExists($name)
|
public function nameExists($name)
|
||||||
{
|
{
|
||||||
$app = Oauth_application::getKV('name', $name);
|
$app = Oauth_application::getKV('name', $name);
|
||||||
return !empty($app);
|
return !empty($app);
|
||||||
|
@ -1,48 +1,42 @@
|
|||||||
<?php
|
<?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
|
|
||||||
*
|
|
||||||
* Paths administration panel
|
* Paths 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
|
* @category Settings
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @author Evan Prodromou <evan@status.net>
|
||||||
* @author Zach Copley <zach@status.net>
|
* @author Zach Copley <zach@status.net>
|
||||||
* @author Sarven Capadisli <csarven@status.net>
|
* @author Sarven Capadisli <csarven@status.net>
|
||||||
* @copyright 2008-2011 StatusNet, Inc.
|
* @copyright 2008-2011 StatusNet, Inc.
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET')) {
|
defined('GNUSOCIAL') || die();
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Paths settings
|
* Paths settings
|
||||||
*
|
*
|
||||||
* @category Admin
|
* @category Admin
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @author Evan Prodromou <evan@status.net>
|
||||||
* @author Zach Copley <zach@status.net>
|
* @author Zach Copley <zach@status.net>
|
||||||
* @author Sarven Capadisli <csarven@status.net>
|
* @author Sarven Capadisli <csarven@status.net>
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
class PathsadminpanelAction extends AdminPanelAction
|
class PathsadminpanelAction extends AdminPanelAction
|
||||||
{
|
{
|
||||||
@ -52,7 +46,7 @@ class PathsadminpanelAction extends AdminPanelAction
|
|||||||
* @return string page title
|
* @return string page title
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function title()
|
public function title()
|
||||||
{
|
{
|
||||||
// TRANS: Title for Paths admin panel.
|
// TRANS: Title for Paths admin panel.
|
||||||
return _('Paths');
|
return _('Paths');
|
||||||
@ -63,7 +57,7 @@ class PathsadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return string instructions
|
* @return string instructions
|
||||||
*/
|
*/
|
||||||
function getInstructions()
|
public function getInstructions()
|
||||||
{
|
{
|
||||||
// TRANS: Form instructions for Path admin panel.
|
// TRANS: Form instructions for Path admin panel.
|
||||||
return _('Path and server settings for this StatusNet site');
|
return _('Path and server settings for this StatusNet site');
|
||||||
@ -74,7 +68,7 @@ class PathsadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showForm()
|
public function showForm()
|
||||||
{
|
{
|
||||||
$form = new PathsAdminPanelForm($this);
|
$form = new PathsAdminPanelForm($this);
|
||||||
$form->show();
|
$form->show();
|
||||||
@ -86,14 +80,14 @@ class PathsadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function saveSettings()
|
public function saveSettings()
|
||||||
{
|
{
|
||||||
static $settings = array(
|
static $settings = [
|
||||||
'site' => array('path', 'locale_path', 'ssl', 'sslserver'),
|
'site' => ['path', 'locale_path', 'ssl', 'sslserver'],
|
||||||
'theme' => array('server', 'dir', 'path', 'sslserver', 'sslpath'),
|
'theme' => ['server', 'dir', 'path', 'sslserver', 'sslpath'],
|
||||||
'avatar' => array('server', 'dir', 'path'),
|
'avatar' => ['server', 'dir', 'path'],
|
||||||
'attachments' => array('server', 'dir', 'path', 'sslserver', 'sslpath')
|
'attachments' => ['server', 'dir', 'path', 'sslserver', 'sslpath'],
|
||||||
);
|
];
|
||||||
|
|
||||||
// XXX: If we're only going to have one boolean on thi page we
|
// XXX: If we're only going to have one boolean on thi page we
|
||||||
// can remove some of the boolean processing code --Z
|
// can remove some of the boolean processing code --Z
|
||||||
@ -120,7 +114,7 @@ class PathsadminpanelAction extends AdminPanelAction
|
|||||||
|
|
||||||
$config = new Config();
|
$config = new Config();
|
||||||
|
|
||||||
$config->query('BEGIN');
|
$config->query('START TRANSACTION');
|
||||||
|
|
||||||
foreach ($settings as $section => $parts) {
|
foreach ($settings as $section => $parts) {
|
||||||
foreach ($parts as $setting) {
|
foreach ($parts as $setting) {
|
||||||
@ -144,7 +138,7 @@ class PathsadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function validate(&$values)
|
public function validate(&$values)
|
||||||
{
|
{
|
||||||
// Validate theme dir
|
// Validate theme dir
|
||||||
|
|
||||||
@ -189,7 +183,7 @@ class PathsAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return int ID of the form
|
* @return int ID of the form
|
||||||
*/
|
*/
|
||||||
function id()
|
public function id()
|
||||||
{
|
{
|
||||||
return 'form_paths_admin_panel';
|
return 'form_paths_admin_panel';
|
||||||
}
|
}
|
||||||
@ -199,7 +193,7 @@ class PathsAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return string class of the form
|
* @return string class of the form
|
||||||
*/
|
*/
|
||||||
function formClass()
|
public function formClass()
|
||||||
{
|
{
|
||||||
return 'form_settings';
|
return 'form_settings';
|
||||||
}
|
}
|
||||||
@ -209,7 +203,7 @@ class PathsAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return string URL of the action
|
* @return string URL of the action
|
||||||
*/
|
*/
|
||||||
function action()
|
public function action()
|
||||||
{
|
{
|
||||||
return common_local_url('pathsadminpanel');
|
return common_local_url('pathsadminpanel');
|
||||||
}
|
}
|
||||||
@ -219,7 +213,7 @@ class PathsAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function formData()
|
public function formData()
|
||||||
{
|
{
|
||||||
$this->out->elementStart('fieldset', array('id' => 'settings_paths_locale'));
|
$this->out->elementStart('fieldset', array('id' => 'settings_paths_locale'));
|
||||||
// TRANS: Fieldset legend in Paths admin panel.
|
// TRANS: Fieldset legend in Paths admin panel.
|
||||||
@ -227,37 +221,45 @@ class PathsAdminPanelForm extends AdminForm
|
|||||||
$this->out->elementStart('ul', 'form_data');
|
$this->out->elementStart('ul', 'form_data');
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input('server',
|
$this->input(
|
||||||
// TRANS: Field label in Paths admin panel.
|
'server',
|
||||||
_('Server'),
|
// TRANS: Field label in Paths admin panel.
|
||||||
// TRANS: Field title in Paths admin panel.
|
_('Server'),
|
||||||
_('Site\'s server hostname.'));
|
// TRANS: Field title in Paths admin panel.
|
||||||
|
_('Site\'s server hostname.')
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input('path',
|
$this->input(
|
||||||
// TRANS: Field label in Paths admin panel.
|
'path',
|
||||||
_('Path'),
|
// TRANS: Field label in Paths admin panel.
|
||||||
// TRANS: Field title in Paths admin panel.
|
_('Path'),
|
||||||
_('Site path.'));
|
// TRANS: Field title in Paths admin panel.
|
||||||
|
_('Site path.')
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input('locale_path',
|
$this->input(
|
||||||
// TRANS: Field label in Paths admin panel.
|
'locale_path',
|
||||||
_('Locale directory'),
|
// TRANS: Field label in Paths admin panel.
|
||||||
// TRANS: Field title in Paths admin panel.
|
_('Locale directory'),
|
||||||
_('Directory path to locales.'),
|
// TRANS: Field title in Paths admin panel.
|
||||||
'site');
|
_('Directory path to locales.'),
|
||||||
|
'site'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->out->checkbox('fancy',
|
$this->out->checkbox(
|
||||||
// TRANS: Checkbox label in Paths admin panel.
|
'fancy',
|
||||||
_('Fancy URLs'),
|
// TRANS: Checkbox label in Paths admin panel.
|
||||||
(bool) $this->value('fancy'),
|
_('Fancy URLs'),
|
||||||
// TRANS: Field title in Paths admin panel.
|
(bool) $this->value('fancy'),
|
||||||
_('Use fancy URLs (more readable and memorable)?'));
|
// TRANS: Field title in Paths admin panel.
|
||||||
|
_('Use fancy URLs (more readable and memorable)?')
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->out->elementEnd('ul');
|
$this->out->elementEnd('ul');
|
||||||
@ -265,145 +267,176 @@ class PathsAdminPanelForm extends AdminForm
|
|||||||
|
|
||||||
$this->out->elementStart('fieldset', array('id' => 'settings_paths_theme'));
|
$this->out->elementStart('fieldset', array('id' => 'settings_paths_theme'));
|
||||||
// TRANS: Fieldset legend in Paths admin panel.
|
// TRANS: Fieldset legend in Paths admin panel.
|
||||||
$this->out->element('legend', null, _m('LEGEND','Theme'));
|
$this->out->element('legend', null, _m('LEGEND', 'Theme'));
|
||||||
|
|
||||||
$this->out->elementStart('ul', 'form_data');
|
$this->out->elementStart('ul', 'form_data');
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input('server',
|
$this->input(
|
||||||
// TRANS: Field label in Paths admin panel.
|
'server',
|
||||||
_('Server'),
|
// TRANS: Field label in Paths admin panel.
|
||||||
// TRANS: Tooltip for field label in Paths admin panel.
|
_('Server'),
|
||||||
_('Server for themes.'),
|
// TRANS: Tooltip for field label in Paths admin panel.
|
||||||
'theme');
|
_('Server for themes.'),
|
||||||
|
'theme'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input('path',
|
$this->input(
|
||||||
// TRANS: Field label in Paths admin panel.
|
'path',
|
||||||
_('Path'),
|
// TRANS: Field label in Paths admin panel.
|
||||||
// TRANS: Tooltip for field label in Paths admin panel.
|
_('Path'),
|
||||||
_('Web path to themes.'),
|
// TRANS: Tooltip for field label in Paths admin panel.
|
||||||
'theme');
|
_('Web path to themes.'),
|
||||||
|
'theme'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input('sslserver',
|
$this->input(
|
||||||
// TRANS: Field label in Paths admin panel.
|
'sslserver',
|
||||||
_('SSL server'),
|
// TRANS: Field label in Paths admin panel.
|
||||||
// TRANS: Tooltip for field label in Paths admin panel.
|
_('SSL server'),
|
||||||
_('SSL server for themes (default: SSL server).'),
|
// TRANS: Tooltip for field label in Paths admin panel.
|
||||||
'theme');
|
_('SSL server for themes (default: SSL server).'),
|
||||||
|
'theme'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input('sslpath',
|
$this->input(
|
||||||
// TRANS: Field label in Paths admin panel.
|
'sslpath',
|
||||||
_('SSL path'),
|
// TRANS: Field label in Paths admin panel.
|
||||||
// TRANS: Tooltip for field label in Paths admin panel.
|
_('SSL path'),
|
||||||
_('SSL path to themes (default: /theme/).'),
|
// TRANS: Tooltip for field label in Paths admin panel.
|
||||||
'theme');
|
_('SSL path to themes (default: /theme/).'),
|
||||||
|
'theme'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input('dir',
|
$this->input(
|
||||||
// TRANS: Field label in Paths admin panel.
|
'dir',
|
||||||
_('Directory'),
|
// TRANS: Field label in Paths admin panel.
|
||||||
// TRANS: Tooltip for field label in Paths admin panel.
|
_('Directory'),
|
||||||
_('Directory where themes are located.'),
|
// TRANS: Tooltip for field label in Paths admin panel.
|
||||||
'theme');
|
_('Directory where themes are located.'),
|
||||||
|
'theme'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->out->elementEnd('ul');
|
$this->out->elementEnd('ul');
|
||||||
|
|
||||||
$this->out->elementEnd('fieldset');
|
$this->out->elementEnd('fieldset');
|
||||||
$this->out->elementStart('fieldset', array('id' => 'settings_avatar-paths'));
|
$this->out->elementStart(
|
||||||
|
'fieldset',
|
||||||
|
['id' => 'settings_avatar-paths']
|
||||||
|
);
|
||||||
// TRANS: Fieldset legend in Paths admin panel.
|
// TRANS: Fieldset legend in Paths admin panel.
|
||||||
$this->out->element('legend', null, _('Avatars'));
|
$this->out->element('legend', null, _('Avatars'));
|
||||||
|
|
||||||
$this->out->elementStart('ul', 'form_data');
|
$this->out->elementStart('ul', 'form_data');
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input('server',
|
$this->input(
|
||||||
// TRANS: Field label in Paths admin panel.
|
'server',
|
||||||
_('Avatar server'),
|
// TRANS: Field label in Paths admin panel.
|
||||||
// TRANS: Tooltip for field label in Paths admin panel.
|
_('Avatar server'),
|
||||||
_('Server for avatars.'),
|
// TRANS: Tooltip for field label in Paths admin panel.
|
||||||
'avatar');
|
_('Server for avatars.'),
|
||||||
|
'avatar'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input('path',
|
$this->input(
|
||||||
// TRANS: Field label in Paths admin panel.
|
'path',
|
||||||
_('Avatar path'),
|
// TRANS: Field label in Paths admin panel.
|
||||||
// TRANS: Tooltip for field label in Paths admin panel.
|
_('Avatar path'),
|
||||||
_('Web path to avatars.'),
|
// TRANS: Tooltip for field label in Paths admin panel.
|
||||||
'avatar');
|
_('Web path to avatars.'),
|
||||||
|
'avatar'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input('dir',
|
$this->input(
|
||||||
// TRANS: Field label in Paths admin panel.
|
'dir',
|
||||||
_('Avatar directory'),
|
// TRANS: Field label in Paths admin panel.
|
||||||
// TRANS: Tooltip for field label in Paths admin panel.
|
_('Avatar directory'),
|
||||||
_('Directory where avatars are located.'),
|
// TRANS: Tooltip for field label in Paths admin panel.
|
||||||
'avatar');
|
_('Directory where avatars are located.'),
|
||||||
|
'avatar'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->out->elementEnd('ul');
|
$this->out->elementEnd('ul');
|
||||||
|
|
||||||
$this->out->elementEnd('fieldset');
|
$this->out->elementEnd('fieldset');
|
||||||
|
|
||||||
$this->out->elementStart('fieldset', array('id' =>
|
$this->out->elementStart(
|
||||||
'settings_attachments-paths'));
|
'fieldset',
|
||||||
|
['id' => 'settings_attachments-paths']
|
||||||
|
);
|
||||||
|
|
||||||
// TRANS: Fieldset legens in Paths admin panel.
|
// TRANS: Fieldset legens in Paths admin panel.
|
||||||
$this->out->element('legend', null, _('Attachments'));
|
$this->out->element('legend', null, _('Attachments'));
|
||||||
$this->out->elementStart('ul', 'form_data');
|
$this->out->elementStart('ul', 'form_data');
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input('server',
|
$this->input(
|
||||||
// TRANS: Field label in Paths admin panel.
|
'server',
|
||||||
_('Server'),
|
// TRANS: Field label in Paths admin panel.
|
||||||
// TRANS: Tooltip for field label in Paths admin panel.
|
_('Server'),
|
||||||
_('Server for attachments.'),
|
// TRANS: Tooltip for field label in Paths admin panel.
|
||||||
'attachments');
|
_('Server for attachments.'),
|
||||||
|
'attachments'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input('path',
|
$this->input(
|
||||||
// TRANS: Field label in Paths admin panel.
|
'path',
|
||||||
_('Path'),
|
// TRANS: Field label in Paths admin panel.
|
||||||
// TRANS: Tooltip for field label in Paths admin panel.
|
_('Path'),
|
||||||
_('Web path to attachments.'),
|
// TRANS: Tooltip for field label in Paths admin panel.
|
||||||
'attachments');
|
_('Web path to attachments.'),
|
||||||
|
'attachments'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input('sslserver',
|
$this->input(
|
||||||
// TRANS: Field label in Paths admin panel.
|
'sslserver',
|
||||||
_('SSL server'),
|
// TRANS: Field label in Paths admin panel.
|
||||||
// TRANS: Tooltip for field label in Paths admin panel.
|
_('SSL server'),
|
||||||
_('Server for attachments on SSL pages.'),
|
// TRANS: Tooltip for field label in Paths admin panel.
|
||||||
'attachments');
|
_('Server for attachments on SSL pages.'),
|
||||||
|
'attachments'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input('sslpath',
|
$this->input(
|
||||||
// TRANS: Field label in Paths admin panel.
|
'sslpath',
|
||||||
_('SSL path'),
|
// TRANS: Field label in Paths admin panel.
|
||||||
// TRANS: Tooltip for field label in Paths admin panel.
|
_('SSL path'),
|
||||||
_('Web path to attachments on SSL pages.'),
|
// TRANS: Tooltip for field label in Paths admin panel.
|
||||||
'attachments');
|
_('Web path to attachments on SSL pages.'),
|
||||||
|
'attachments'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input('dir',
|
$this->input(
|
||||||
// TRANS: Field label in Paths admin panel.
|
'dir',
|
||||||
_('Directory'),
|
// TRANS: Field label in Paths admin panel.
|
||||||
// TRANS: Tooltip for field label in Paths admin panel.
|
_('Directory'),
|
||||||
_('Directory where attachments are located.'),
|
// TRANS: Tooltip for field label in Paths admin panel.
|
||||||
'attachments');
|
_('Directory where attachments are located.'),
|
||||||
|
'attachments'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->out->elementEnd('ul');
|
$this->out->elementEnd('ul');
|
||||||
@ -411,31 +444,38 @@ class PathsAdminPanelForm extends AdminForm
|
|||||||
|
|
||||||
$this->out->elementStart('fieldset', array('id' => 'settings_admin_ssl'));
|
$this->out->elementStart('fieldset', array('id' => 'settings_admin_ssl'));
|
||||||
// TRANS: Fieldset legend in Paths admin panel.
|
// TRANS: Fieldset legend in Paths admin panel.
|
||||||
$this->out->element('legend', null, _m('LEGEND','SSL'));
|
$this->out->element('legend', null, _m('LEGEND', 'SSL'));
|
||||||
$this->out->elementStart('ul', 'form_data');
|
$this->out->elementStart('ul', 'form_data');
|
||||||
$this->li();
|
$this->li();
|
||||||
|
|
||||||
// TRANS: Drop down option in Paths admin panel (option for "When to use SSL").
|
// TRANS: Drop down option in Paths admin panel (option for "When to use SSL").
|
||||||
$ssl = array('never' => _('Never'),
|
$ssl = [
|
||||||
// TRANS: Drop down option in Paths admin panel (option for "When to use SSL").
|
'never' => _('Never'),
|
||||||
'always' => _('Always'));
|
// TRANS: Drop down option in Paths admin panel (option for "When to use SSL").
|
||||||
|
'always' => _('Always'),
|
||||||
|
];
|
||||||
|
|
||||||
$this->out->dropdown('site-ssl',
|
$this->out->dropdown(
|
||||||
// TRANS: Drop down label in Paths admin panel.
|
'site-ssl',
|
||||||
_('Use SSL'),
|
// TRANS: Drop down label in Paths admin panel.
|
||||||
// TRANS: Tooltip for field label in Paths admin panel.
|
_('Use SSL'),
|
||||||
$ssl, _('When to use SSL.'),
|
// TRANS: Tooltip for field label in Paths admin panel.
|
||||||
false,
|
$ssl,
|
||||||
$this->value('ssl', 'site'));
|
_('When to use SSL.'),
|
||||||
|
false,
|
||||||
|
$this->value('ssl', 'site')
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input('sslserver',
|
$this->input(
|
||||||
// TRANS: Field label in Paths admin panel.
|
'sslserver',
|
||||||
_('SSL server'),
|
// TRANS: Field label in Paths admin panel.
|
||||||
// TRANS: Tooltip for field label in Paths admin panel.
|
_('SSL server'),
|
||||||
_('Server to direct SSL requests to.'),
|
// TRANS: Tooltip for field label in Paths admin panel.
|
||||||
'site');
|
_('Server to direct SSL requests to.'),
|
||||||
|
'site'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
$this->out->elementEnd('ul');
|
$this->out->elementEnd('ul');
|
||||||
$this->out->elementEnd('fieldset');
|
$this->out->elementEnd('fieldset');
|
||||||
@ -446,12 +486,17 @@ class PathsAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function formActions()
|
public function formActions()
|
||||||
{
|
{
|
||||||
// TRANS: Button text to store form data in the Paths admin panel.
|
// TRANS: Button text to store form data in the Paths admin panel.
|
||||||
$this->out->submit('save', _m('BUTTON','Save'), 'submit',
|
$this->out->submit(
|
||||||
// TRANS: Button title text to store form data in the Paths admin panel.
|
'save',
|
||||||
'save', _('Save path settings.'));
|
_m('BUTTON', 'Save'),
|
||||||
|
'submit',
|
||||||
|
// TRANS: Button title text to store form data in the Paths admin panel.
|
||||||
|
'save',
|
||||||
|
_('Save path settings.')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -467,7 +512,7 @@ class PathsAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function input($setting, $title, $instructions, $section='site')
|
public function input($setting, $title, $instructions, $section='site')
|
||||||
{
|
{
|
||||||
$this->out->input("$section-$setting", $title, $this->value($setting, $section), $instructions);
|
$this->out->input("$section-$setting", $title, $this->value($setting, $section), $instructions);
|
||||||
}
|
}
|
||||||
|
@ -345,7 +345,7 @@ class ProfilesettingsAction extends SettingsAction
|
|||||||
}
|
}
|
||||||
|
|
||||||
$user = $this->scoped->getUser();
|
$user = $this->scoped->getUser();
|
||||||
$user->query('BEGIN');
|
$user->query('START TRANSACTION');
|
||||||
|
|
||||||
// Only allow setting private_stream if site policy allows it
|
// Only allow setting private_stream if site policy allows it
|
||||||
// (or user already _has_ a private stream, then you can unset it)
|
// (or user already _has_ a private stream, then you can unset it)
|
||||||
|
@ -1,44 +1,38 @@
|
|||||||
<?php
|
<?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
|
|
||||||
*
|
|
||||||
* Sessions administration panel
|
* Sessions 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
|
* @category Settings
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Zach Copley <zach@status.net>
|
* @author Zach Copley <zach@status.net>
|
||||||
* @copyright 2010 StatusNet, Inc.
|
* @copyright 2010 StatusNet, Inc.
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET')) {
|
defined('GNUSOCIAL') || die();
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Admin site sessions
|
* Admin site sessions
|
||||||
*
|
*
|
||||||
* @category Admin
|
* @category Admin
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Zach Copley <zach@status.net>
|
* @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
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
class SessionsadminpanelAction extends AdminPanelAction
|
class SessionsadminpanelAction extends AdminPanelAction
|
||||||
{
|
{
|
||||||
@ -47,10 +41,10 @@ class SessionsadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return string page title
|
* @return string page title
|
||||||
*/
|
*/
|
||||||
function title()
|
public function title()
|
||||||
{
|
{
|
||||||
// TRANS: Title for the sessions administration panel.
|
// TRANS: Title for the sessions administration panel.
|
||||||
return _m('TITLE','Sessions');
|
return _m('TITLE', 'Sessions');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,7 +52,7 @@ class SessionsadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return string instructions
|
* @return string instructions
|
||||||
*/
|
*/
|
||||||
function getInstructions()
|
public function getInstructions()
|
||||||
{
|
{
|
||||||
// TRANS: Instructions for the sessions administration panel.
|
// TRANS: Instructions for the sessions administration panel.
|
||||||
return _('Session settings for this StatusNet site');
|
return _('Session settings for this StatusNet site');
|
||||||
@ -69,7 +63,7 @@ class SessionsadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showForm()
|
public function showForm()
|
||||||
{
|
{
|
||||||
$form = new SessionsAdminPanelForm($this);
|
$form = new SessionsAdminPanelForm($this);
|
||||||
$form->show();
|
$form->show();
|
||||||
@ -81,7 +75,7 @@ class SessionsadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function saveSettings()
|
public function saveSettings()
|
||||||
{
|
{
|
||||||
static $booleans = array('sessions' => array('handle', 'debug'));
|
static $booleans = array('sessions' => array('handle', 'debug'));
|
||||||
|
|
||||||
@ -101,7 +95,7 @@ class SessionsadminpanelAction extends AdminPanelAction
|
|||||||
|
|
||||||
$config = new Config();
|
$config = new Config();
|
||||||
|
|
||||||
$config->query('BEGIN');
|
$config->query('START TRANSACTION');
|
||||||
|
|
||||||
foreach ($booleans as $section => $parts) {
|
foreach ($booleans as $section => $parts) {
|
||||||
foreach ($parts as $setting) {
|
foreach ($parts as $setting) {
|
||||||
@ -114,7 +108,7 @@ class SessionsadminpanelAction extends AdminPanelAction
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function validate(&$values)
|
public function validate(&$values)
|
||||||
{
|
{
|
||||||
// stub
|
// stub
|
||||||
}
|
}
|
||||||
@ -128,7 +122,7 @@ class SessionsAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return int ID of the form
|
* @return int ID of the form
|
||||||
*/
|
*/
|
||||||
function id()
|
public function id()
|
||||||
{
|
{
|
||||||
return 'sessionsadminpanel';
|
return 'sessionsadminpanel';
|
||||||
}
|
}
|
||||||
@ -138,7 +132,7 @@ class SessionsAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return string class of the form
|
* @return string class of the form
|
||||||
*/
|
*/
|
||||||
function formClass()
|
public function formClass()
|
||||||
{
|
{
|
||||||
return 'form_settings';
|
return 'form_settings';
|
||||||
}
|
}
|
||||||
@ -148,7 +142,7 @@ class SessionsAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return string URL of the action
|
* @return string URL of the action
|
||||||
*/
|
*/
|
||||||
function action()
|
public function action()
|
||||||
{
|
{
|
||||||
return common_local_url('sessionsadminpanel');
|
return common_local_url('sessionsadminpanel');
|
||||||
}
|
}
|
||||||
@ -158,31 +152,37 @@ class SessionsAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function formData()
|
public function formData()
|
||||||
{
|
{
|
||||||
$this->out->elementStart('fieldset', array('id' => 'settings_user_sessions'));
|
$this->out->elementStart('fieldset', array('id' => 'settings_user_sessions'));
|
||||||
// TRANS: Fieldset legend on the sessions administration panel.
|
// TRANS: Fieldset legend on the sessions administration panel.
|
||||||
$this->out->element('legend', null, _m('LEGEND','Sessions'));
|
$this->out->element('legend', null, _m('LEGEND', 'Sessions'));
|
||||||
|
|
||||||
$this->out->elementStart('ul', 'form_data');
|
$this->out->elementStart('ul', 'form_data');
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
// TRANS: Checkbox title on the sessions administration panel.
|
// TRANS: Checkbox title on the sessions administration panel.
|
||||||
// TRANS: Indicates if StatusNet should handle session administration.
|
// TRANS: Indicates if StatusNet should handle session administration.
|
||||||
$this->out->checkbox('handle', _('Handle sessions'),
|
$this->out->checkbox(
|
||||||
(bool) $this->value('handle', 'sessions'),
|
'handle',
|
||||||
// TRANS: Checkbox title on the sessions administration panel.
|
_('Handle sessions'),
|
||||||
// TRANS: Indicates if StatusNet should handle session administration.
|
(bool) $this->value('handle', 'sessions'),
|
||||||
_('Handle sessions ourselves.'));
|
// TRANS: Checkbox title on the sessions administration panel.
|
||||||
|
// TRANS: Indicates if StatusNet should handle session administration.
|
||||||
|
_('Handle sessions ourselves.')
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
// TRANS: Checkbox label on the sessions administration panel.
|
// TRANS: Checkbox label on the sessions administration panel.
|
||||||
// TRANS: Indicates if StatusNet should write session debugging output.
|
// TRANS: Indicates if StatusNet should write session debugging output.
|
||||||
$this->out->checkbox('debug', _('Session debugging'),
|
$this->out->checkbox(
|
||||||
(bool) $this->value('debug', 'sessions'),
|
'debug',
|
||||||
// TRANS: Checkbox title on the sessions administration panel.
|
_('Session debugging'),
|
||||||
_('Enable debugging output for sessions.'));
|
(bool) $this->value('debug', 'sessions'),
|
||||||
|
// TRANS: Checkbox title on the sessions administration panel.
|
||||||
|
_('Enable debugging output for sessions.')
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->out->elementEnd('ul');
|
$this->out->elementEnd('ul');
|
||||||
@ -195,14 +195,16 @@ class SessionsAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function formActions()
|
public function formActions()
|
||||||
{
|
{
|
||||||
$this->out->submit('submit',
|
$this->out->submit(
|
||||||
// TRANS: Submit button text on the sessions administration panel.
|
'submit',
|
||||||
_m('BUTTON','Save'),
|
// TRANS: Submit button text on the sessions administration panel.
|
||||||
'submit',
|
_m('BUTTON', 'Save'),
|
||||||
null,
|
'submit',
|
||||||
// TRANS: Title for submit button on the sessions administration panel.
|
null,
|
||||||
_('Save session settings'));
|
// TRANS: Title for submit button on the sessions administration panel.
|
||||||
|
_('Save session settings')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,60 +1,54 @@
|
|||||||
<?php
|
<?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
|
|
||||||
*
|
|
||||||
* Show an OAuth application
|
* Show an OAuth application
|
||||||
*
|
*
|
||||||
* 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 Application
|
* @category Application
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Zach Copley <zach@status.net>
|
* @author Zach Copley <zach@status.net>
|
||||||
* @copyright 2008-2011 StatusNet, Inc.
|
* @copyright 2008-2011 StatusNet, Inc.
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET') && !defined('LACONICA')) {
|
defined('GNUSOCIAL') || die();
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show an OAuth application
|
* Show an OAuth application
|
||||||
*
|
*
|
||||||
* @category Application
|
* @category Application
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Zach Copley <zach@status.net>
|
* @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
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
class ShowApplicationAction extends Action
|
class ShowApplicationAction extends Action
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Application to show
|
* Application to show
|
||||||
*/
|
*/
|
||||||
var $application = null;
|
public $application = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User who owns the app
|
* User who owns the app
|
||||||
*/
|
*/
|
||||||
var $owner = null;
|
public $owner = null;
|
||||||
|
|
||||||
var $msg = null;
|
public $msg = null;
|
||||||
|
|
||||||
var $success = null;
|
public $success = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load attributes based on database arguments
|
* Load attributes based on database arguments
|
||||||
@ -65,7 +59,7 @@ class ShowApplicationAction extends Action
|
|||||||
*
|
*
|
||||||
* @return success flag
|
* @return success flag
|
||||||
*/
|
*/
|
||||||
function prepare(array $args = array())
|
public function prepare(array $args = [])
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
|
||||||
@ -101,7 +95,7 @@ class ShowApplicationAction extends Action
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
parent::handle();
|
parent::handle();
|
||||||
|
|
||||||
@ -127,21 +121,21 @@ class ShowApplicationAction extends Action
|
|||||||
*
|
*
|
||||||
* @return string title of the page
|
* @return string title of the page
|
||||||
*/
|
*/
|
||||||
function title()
|
public function title()
|
||||||
{
|
{
|
||||||
if (!empty($this->application->name)) {
|
if (!empty($this->application->name)) {
|
||||||
return 'Application: ' . $this->application->name;
|
return 'Application: ' . $this->application->name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showPageNotice()
|
public function showPageNotice()
|
||||||
{
|
{
|
||||||
if (!empty($this->msg)) {
|
if (!empty($this->msg)) {
|
||||||
$this->element('div', ($this->success) ? 'success' : 'error', $this->msg);
|
$this->element('div', ($this->success) ? 'success' : 'error', $this->msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showContent()
|
public function showContent()
|
||||||
{
|
{
|
||||||
$cur = common_current_user();
|
$cur = common_current_user();
|
||||||
|
|
||||||
@ -151,21 +145,38 @@ class ShowApplicationAction extends Action
|
|||||||
// TRANS: Header on the OAuth application page.
|
// TRANS: Header on the OAuth application page.
|
||||||
$this->element('h2', null, _('Application profile'));
|
$this->element('h2', null, _('Application profile'));
|
||||||
if (!empty($this->application->icon)) {
|
if (!empty($this->application->icon)) {
|
||||||
$this->element('img', array('src' => $this->application->icon,
|
$this->element(
|
||||||
'class' => 'u-photo logo entity_depiction'));
|
'img',
|
||||||
|
[
|
||||||
|
'src' => $this->application->icon,
|
||||||
|
'class' => 'u-photo logo entity_depiction',
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->element('a', array('href' => $this->application->source_url,
|
$this->element(
|
||||||
'class' => 'u-url p-name entity_fn'),
|
'a',
|
||||||
$this->application->name);
|
[
|
||||||
|
'href' => $this->application->source_url,
|
||||||
|
'class' => 'u-url p-name entity_fn',
|
||||||
|
],
|
||||||
|
$this->application->name
|
||||||
|
);
|
||||||
|
|
||||||
$this->element('a', array('href' => $this->application->homepage,
|
$this->element(
|
||||||
'class' => 'u-url entity_org'),
|
'a',
|
||||||
$this->application->organization);
|
[
|
||||||
|
'href' => $this->application->homepage,
|
||||||
|
'class' => 'u-url entity_org',
|
||||||
|
],
|
||||||
|
$this->application->organization
|
||||||
|
);
|
||||||
|
|
||||||
$this->element('div',
|
$this->element(
|
||||||
'note entity_note',
|
'div',
|
||||||
$this->application->description);
|
'note entity_note',
|
||||||
|
$this->application->description
|
||||||
|
);
|
||||||
|
|
||||||
$this->elementStart('div', 'entity_statistics');
|
$this->elementStart('div', 'entity_statistics');
|
||||||
$defaultAccess = ($this->application->access_type & Oauth_application::$writeAccess)
|
$defaultAccess = ($this->application->access_type & Oauth_application::$writeAccess)
|
||||||
@ -183,10 +194,10 @@ class ShowApplicationAction extends Action
|
|||||||
_m('Created by %1$s - %2$s access by default - %3$d user',
|
_m('Created by %1$s - %2$s access by default - %3$d user',
|
||||||
'Created by %1$s - %2$s access by default - %3$d users',
|
'Created by %1$s - %2$s access by default - %3$d users',
|
||||||
$userCnt),
|
$userCnt),
|
||||||
$profile->getBestName(),
|
$profile->getBestName(),
|
||||||
$defaultAccess,
|
$defaultAccess,
|
||||||
$userCnt
|
$userCnt
|
||||||
));
|
));
|
||||||
$this->elementEnd('div');
|
$this->elementEnd('div');
|
||||||
|
|
||||||
$this->elementEnd('div');
|
$this->elementEnd('div');
|
||||||
@ -196,47 +207,70 @@ class ShowApplicationAction extends Action
|
|||||||
$this->element('h2', null, _('Application actions'));
|
$this->element('h2', null, _('Application actions'));
|
||||||
$this->elementStart('ul');
|
$this->elementStart('ul');
|
||||||
$this->elementStart('li', 'entity_edit');
|
$this->elementStart('li', 'entity_edit');
|
||||||
$this->element('a',
|
$this->element(
|
||||||
array('href' => common_local_url('editapplication',
|
'a',
|
||||||
array('id' => $this->application->id))),
|
[
|
||||||
// TRANS: Link text to edit application on the OAuth application page.
|
'href' => common_local_url(
|
||||||
_m('EDITAPP','Edit'));
|
'editapplication',
|
||||||
|
['id' => $this->application->id]
|
||||||
|
)
|
||||||
|
],
|
||||||
|
// TRANS: Link text to edit application on the OAuth application page.
|
||||||
|
_m('EDITAPP', 'Edit')
|
||||||
|
);
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
|
|
||||||
$this->elementStart('li', 'entity_reset_keysecret');
|
$this->elementStart('li', 'entity_reset_keysecret');
|
||||||
$this->elementStart('form', array(
|
$this->elementStart(
|
||||||
'id' => 'form_reset_key',
|
'form',
|
||||||
'class' => 'form_reset_key',
|
[
|
||||||
'method' => 'POST',
|
'id' => 'form_reset_key',
|
||||||
'action' => common_local_url('showapplication',
|
'class' => 'form_reset_key',
|
||||||
array('id' => $this->application->id))));
|
'method' => 'POST',
|
||||||
|
'action' => common_local_url(
|
||||||
|
'showapplication',
|
||||||
|
['id' => $this->application->id]
|
||||||
|
),
|
||||||
|
]
|
||||||
|
);
|
||||||
$this->elementStart('fieldset');
|
$this->elementStart('fieldset');
|
||||||
$this->hidden('token', common_session_token());
|
$this->hidden('token', common_session_token());
|
||||||
|
|
||||||
$this->element('input', array('type' => 'submit',
|
$this->element(
|
||||||
'id' => 'reset',
|
'input',
|
||||||
'name' => 'reset',
|
[
|
||||||
'class' => 'submit',
|
'type' => 'submit',
|
||||||
// TRANS: Button text on the OAuth application page.
|
'id' => 'reset',
|
||||||
// TRANS: Resets the OAuth consumer key and secret.
|
'name' => 'reset',
|
||||||
'value' => _('Reset key & secret'),
|
'class' => 'submit',
|
||||||
'onClick' => 'return confirmReset()'));
|
// TRANS: Button text on the OAuth application page.
|
||||||
|
// TRANS: Resets the OAuth consumer key and secret.
|
||||||
|
'value' => _('Reset key & secret'),
|
||||||
|
'onClick' => 'return confirmReset()',
|
||||||
|
]
|
||||||
|
);
|
||||||
$this->elementEnd('fieldset');
|
$this->elementEnd('fieldset');
|
||||||
$this->elementEnd('form');
|
$this->elementEnd('form');
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
|
|
||||||
$this->elementStart('li', 'entity_delete');
|
$this->elementStart('li', 'entity_delete');
|
||||||
$this->elementStart('form', array(
|
$this->elementStart(
|
||||||
'id' => 'form_delete_application',
|
'form',
|
||||||
'class' => 'form_delete_application',
|
[
|
||||||
'method' => 'POST',
|
'id' => 'form_delete_application',
|
||||||
'action' => common_local_url('deleteapplication',
|
'class' => 'form_delete_application',
|
||||||
array('id' => $this->application->id))));
|
'method' => 'POST',
|
||||||
|
'action' => common_local_url(
|
||||||
|
'deleteapplication',
|
||||||
|
['id' => $this->application->id]
|
||||||
|
),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
$this->elementStart('fieldset');
|
$this->elementStart('fieldset');
|
||||||
$this->hidden('token', common_session_token());
|
$this->hidden('token', common_session_token());
|
||||||
// TRANS: Submit button text the OAuth application page to delete an application.
|
// TRANS: Submit button text the OAuth application page to delete an application.
|
||||||
$this->submit('delete', _m('BUTTON','Delete'));
|
$this->submit('delete', _m('BUTTON', 'Delete'));
|
||||||
$this->elementEnd('fieldset');
|
$this->elementEnd('fieldset');
|
||||||
$this->elementEnd('form');
|
$this->elementEnd('form');
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
@ -266,16 +300,23 @@ class ShowApplicationAction extends Action
|
|||||||
$this->element('dd', null, common_local_url('ApiOAuthAuthorize'));
|
$this->element('dd', null, common_local_url('ApiOAuthAuthorize'));
|
||||||
$this->elementEnd('dl');
|
$this->elementEnd('dl');
|
||||||
|
|
||||||
$this->element('p', 'note',
|
$this->element(
|
||||||
|
'p',
|
||||||
|
'note',
|
||||||
// TRANS: Note on the OAuth application page about signature support.
|
// TRANS: Note on the OAuth application page about signature support.
|
||||||
_('Note: HMAC-SHA1 signatures are supported. The plaintext signature method is not supported.'));
|
_('Note: HMAC-SHA1 signatures are supported. The plaintext signature method is not supported.')
|
||||||
|
);
|
||||||
$this->elementEnd('div');
|
$this->elementEnd('div');
|
||||||
|
|
||||||
$this->elementStart('p', array('id' => 'application_action'));
|
$this->elementStart('p', array('id' => 'application_action'));
|
||||||
$this->element('a',
|
$this->element(
|
||||||
array('href' => common_local_url('oauthappssettings'),
|
'a',
|
||||||
'class' => 'more'),
|
[
|
||||||
'View your applications');
|
'href' => common_local_url('oauthappssettings'),
|
||||||
|
'class' => 'more',
|
||||||
|
],
|
||||||
|
'View your applications'
|
||||||
|
);
|
||||||
$this->elementEnd('p');
|
$this->elementEnd('p');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,7 +325,7 @@ class ShowApplicationAction extends Action
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showScripts()
|
public function showScripts()
|
||||||
{
|
{
|
||||||
parent::showScripts();
|
parent::showScripts();
|
||||||
|
|
||||||
@ -305,9 +346,9 @@ class ShowApplicationAction extends Action
|
|||||||
* XXX: Should this be moved to its own page with a confirm?
|
* XXX: Should this be moved to its own page with a confirm?
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function resetKey()
|
public function resetKey()
|
||||||
{
|
{
|
||||||
$this->application->query('BEGIN');
|
$this->application->query('START TRANSACTION');
|
||||||
|
|
||||||
$oauser = new Oauth_application_user();
|
$oauser = new Oauth_application_user();
|
||||||
$oauser->application_id = $this->application->id;
|
$oauser->application_id = $this->application->id;
|
||||||
|
@ -1,48 +1,42 @@
|
|||||||
<?php
|
<?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 administration panel
|
* Site 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
|
* @category Settings
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @author Evan Prodromou <evan@status.net>
|
||||||
* @author Zach Copley <zach@status.net>
|
* @author Zach Copley <zach@status.net>
|
||||||
* @author Sarven Capadisli <csarven@status.net>
|
* @author Sarven Capadisli <csarven@status.net>
|
||||||
* @copyright 2008-2011 StatusNet, Inc.
|
* @copyright 2008-2011 StatusNet, Inc.
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET')) {
|
defined('GNUSOCIAL') || die();
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Administer site settings
|
* Administer site settings
|
||||||
*
|
*
|
||||||
* @category Admin
|
* @category Admin
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @author Evan Prodromou <evan@status.net>
|
||||||
* @author Zach Copley <zach@status.net>
|
* @author Zach Copley <zach@status.net>
|
||||||
* @author Sarven Capadisli <csarven@status.net>
|
* @author Sarven Capadisli <csarven@status.net>
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
class SiteadminpanelAction extends AdminPanelAction
|
class SiteadminpanelAction extends AdminPanelAction
|
||||||
{
|
{
|
||||||
@ -51,10 +45,10 @@ class SiteadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return string page title
|
* @return string page title
|
||||||
*/
|
*/
|
||||||
function title()
|
public function title()
|
||||||
{
|
{
|
||||||
// TRANS: Title for site administration panel.
|
// TRANS: Title for site administration panel.
|
||||||
return _m('TITLE','Site');
|
return _m('TITLE', 'Site');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -62,7 +56,7 @@ class SiteadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return string instructions
|
* @return string instructions
|
||||||
*/
|
*/
|
||||||
function getInstructions()
|
public function getInstructions()
|
||||||
{
|
{
|
||||||
// TRANS: Instructions for site administration panel.
|
// TRANS: Instructions for site administration panel.
|
||||||
return _m('Basic settings for this StatusNet site');
|
return _m('Basic settings for this StatusNet site');
|
||||||
@ -73,7 +67,7 @@ class SiteadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showForm()
|
public function showForm()
|
||||||
{
|
{
|
||||||
$form = new SiteAdminPanelForm($this);
|
$form = new SiteAdminPanelForm($this);
|
||||||
$form->show();
|
$form->show();
|
||||||
@ -85,7 +79,7 @@ class SiteadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function saveSettings()
|
public function saveSettings()
|
||||||
{
|
{
|
||||||
static $settings = array(
|
static $settings = array(
|
||||||
'site' => array(
|
'site' => array(
|
||||||
@ -119,7 +113,7 @@ class SiteadminpanelAction extends AdminPanelAction
|
|||||||
|
|
||||||
$config = new Config();
|
$config = new Config();
|
||||||
|
|
||||||
$config->query('BEGIN');
|
$config->query('START TRANSACTION');
|
||||||
|
|
||||||
foreach ($settings as $section => $parts) {
|
foreach ($settings as $section => $parts) {
|
||||||
foreach ($parts as $setting) {
|
foreach ($parts as $setting) {
|
||||||
@ -132,7 +126,7 @@ class SiteadminpanelAction extends AdminPanelAction
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function validate(&$values)
|
public function validate(&$values)
|
||||||
{
|
{
|
||||||
// Validate site name
|
// Validate site name
|
||||||
|
|
||||||
@ -208,7 +202,7 @@ class SiteAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return int ID of the form
|
* @return int ID of the form
|
||||||
*/
|
*/
|
||||||
function id()
|
public function id()
|
||||||
{
|
{
|
||||||
return 'form_site_admin_panel';
|
return 'form_site_admin_panel';
|
||||||
}
|
}
|
||||||
@ -218,7 +212,7 @@ class SiteAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return string class of the form
|
* @return string class of the form
|
||||||
*/
|
*/
|
||||||
function formClass()
|
public function formClass()
|
||||||
{
|
{
|
||||||
return 'form_settings';
|
return 'form_settings';
|
||||||
}
|
}
|
||||||
@ -228,7 +222,7 @@ class SiteAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return string URL of the action
|
* @return string URL of the action
|
||||||
*/
|
*/
|
||||||
function action()
|
public function action()
|
||||||
{
|
{
|
||||||
return common_local_url('siteadminpanel');
|
return common_local_url('siteadminpanel');
|
||||||
}
|
}
|
||||||
@ -238,37 +232,49 @@ class SiteAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function formData()
|
public function formData()
|
||||||
{
|
{
|
||||||
$this->out->elementStart('fieldset', array('id' => 'settings_admin_general'));
|
$this->out->elementStart('fieldset', array('id' => 'settings_admin_general'));
|
||||||
// TRANS: Fieldset legend on site settings panel.
|
// TRANS: Fieldset legend on site settings panel.
|
||||||
$this->out->element('legend', null, _m('LEGEND','General'));
|
$this->out->element('legend', null, _m('LEGEND', 'General'));
|
||||||
$this->out->elementStart('ul', 'form_data');
|
$this->out->elementStart('ul', 'form_data');
|
||||||
$this->li();
|
$this->li();
|
||||||
// TRANS: Field label on site settings panel.
|
// TRANS: Field label on site settings panel.
|
||||||
$this->input('name', _m('LABEL','Site name'),
|
$this->input(
|
||||||
// TRANS: Field title on site settings panel.
|
'name',
|
||||||
_m('The name of your site, like "Yourcompany Microblog".'));
|
_m('LABEL', 'Site name'),
|
||||||
|
// TRANS: Field title on site settings panel.
|
||||||
|
_m('The name of your site, like "Yourcompany Microblog".')
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
// TRANS: Field label on site settings panel.
|
// TRANS: Field label on site settings panel.
|
||||||
$this->input('broughtby', _m('Brought by'),
|
$this->input(
|
||||||
// TRANS: Field title on site settings panel.
|
'broughtby',
|
||||||
_m('Text used for credits link in footer of each page.'));
|
_m('Brought by'),
|
||||||
|
// TRANS: Field title on site settings panel.
|
||||||
|
_m('Text used for credits link in footer of each page.')
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
// TRANS: Field label on site settings panel.
|
// TRANS: Field label on site settings panel.
|
||||||
$this->input('broughtbyurl', _m('Brought by URL'),
|
$this->input(
|
||||||
// TRANS: Field title on site settings panel.
|
'broughtbyurl',
|
||||||
_m('URL used for credits link in footer of each page.'));
|
_m('Brought by URL'),
|
||||||
|
// TRANS: Field title on site settings panel.
|
||||||
|
_m('URL used for credits link in footer of each page.')
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
$this->li();
|
$this->li();
|
||||||
// TRANS: Field label on site settings panel.
|
// TRANS: Field label on site settings panel.
|
||||||
$this->input('email', _m('Email'),
|
$this->input(
|
||||||
// TRANS: Field title on site settings panel.
|
'email',
|
||||||
_m('Contact email address for your site.'));
|
_m('Email'),
|
||||||
|
// TRANS: Field title on site settings panel.
|
||||||
|
_m('Contact email address for your site.')
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
$this->out->elementEnd('ul');
|
$this->out->elementEnd('ul');
|
||||||
$this->out->elementEnd('fieldset');
|
$this->out->elementEnd('fieldset');
|
||||||
@ -277,7 +283,7 @@ class SiteAdminPanelForm extends AdminForm
|
|||||||
|
|
||||||
$this->out->elementStart('fieldset', array('id' => 'settings_admin_local'));
|
$this->out->elementStart('fieldset', array('id' => 'settings_admin_local'));
|
||||||
// TRANS: Fieldset legend on site settings panel.
|
// TRANS: Fieldset legend on site settings panel.
|
||||||
$this->out->element('legend', null, _m('LEGEND','Local'));
|
$this->out->element('legend', null, _m('LEGEND', 'Local'));
|
||||||
$this->out->elementStart('ul', 'form_data');
|
$this->out->elementStart('ul', 'form_data');
|
||||||
$timezones = [];
|
$timezones = [];
|
||||||
|
|
||||||
@ -289,20 +295,28 @@ class SiteAdminPanelForm extends AdminForm
|
|||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
// TRANS: Dropdown label on site settings panel.
|
// TRANS: Dropdown label on site settings panel.
|
||||||
$this->out->dropdown('timezone', _m('Default timezone'),
|
$this->out->dropdown(
|
||||||
// TRANS: Dropdown title on site settings panel.
|
'timezone',
|
||||||
$timezones, _m('Default timezone for the site; usually UTC.'),
|
_m('Default timezone'),
|
||||||
true, $this->value('timezone'));
|
// TRANS: Dropdown title on site settings panel.
|
||||||
|
$timezones,
|
||||||
|
_m('Default timezone for the site; usually UTC.'),
|
||||||
|
true,
|
||||||
|
$this->value('timezone')
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->out->dropdown('language',
|
$this->out->dropdown(
|
||||||
// TRANS: Dropdown label on site settings panel.
|
'language',
|
||||||
_m('Default language'),
|
// TRANS: Dropdown label on site settings panel.
|
||||||
get_nice_language_list(),
|
_m('Default language'),
|
||||||
// TRANS: Dropdown title on site settings panel.
|
get_nice_language_list(),
|
||||||
_m('The site language when autodetection from browser settings is not available.'),
|
// TRANS: Dropdown title on site settings panel.
|
||||||
false, $this->value('language'));
|
_m('The site language when autodetection from browser settings is not available.'),
|
||||||
|
false,
|
||||||
|
$this->value('language')
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->out->elementEnd('ul');
|
$this->out->elementEnd('ul');
|
||||||
@ -310,28 +324,32 @@ class SiteAdminPanelForm extends AdminForm
|
|||||||
|
|
||||||
$this->out->elementStart('fieldset', array('id' => 'settings_admin_limits'));
|
$this->out->elementStart('fieldset', array('id' => 'settings_admin_limits'));
|
||||||
// TRANS: Fieldset legend on site settings panel.
|
// TRANS: Fieldset legend on site settings panel.
|
||||||
$this->out->element('legend', null, _m('LEGEND','Limits'));
|
$this->out->element('legend', null, _m('LEGEND', 'Limits'));
|
||||||
$this->out->elementStart('ul', 'form_data');
|
$this->out->elementStart('ul', 'form_data');
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input('textlimit',
|
$this->input(
|
||||||
// TRANS: Field label on site settings panel.
|
'textlimit',
|
||||||
_m('Text limit'),
|
// TRANS: Field label on site settings panel.
|
||||||
// TRANS: Field title on site settings panel.
|
_m('Text limit'),
|
||||||
_m('Maximum number of characters for notices.'));
|
// TRANS: Field title on site settings panel.
|
||||||
|
_m('Maximum number of characters for notices.')
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input('dupelimit',
|
$this->input(
|
||||||
// TRANS: Field label on site settings panel.
|
'dupelimit',
|
||||||
_m('Dupe limit'),
|
// TRANS: Field label on site settings panel.
|
||||||
// TRANS: Field title on site settings panel.
|
_m('Dupe limit'),
|
||||||
_m('How long users must wait (in seconds) to post the same thing again.'));
|
// TRANS: Field title on site settings panel.
|
||||||
|
_m('How long users must wait (in seconds) to post the same thing again.')
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
$this->out->elementEnd('ul');
|
$this->out->elementEnd('ul');
|
||||||
$this->out->elementEnd('fieldset');
|
$this->out->elementEnd('fieldset');
|
||||||
}
|
}
|
||||||
|
|
||||||
function showLogo()
|
public function showLogo()
|
||||||
{
|
{
|
||||||
$this->out->elementStart('fieldset', ['id' => 'settings_site_logo']);
|
$this->out->elementStart('fieldset', ['id' => 'settings_site_logo']);
|
||||||
// TRANS: Fieldset legend for form to change logo.
|
// TRANS: Fieldset legend for form to change logo.
|
||||||
@ -340,19 +358,23 @@ class SiteAdminPanelForm extends AdminForm
|
|||||||
$this->out->elementStart('ul', 'form_data');
|
$this->out->elementStart('ul', 'form_data');
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input('logo',
|
$this->input(
|
||||||
// TRANS: Field label for GNU social site logo.
|
'logo',
|
||||||
_m('Site logo'),
|
// TRANS: Field label for GNU social site logo.
|
||||||
// TRANS: Title for field label for GNU social site logo.
|
_m('Site logo'),
|
||||||
'Logo for the site (full URL).');
|
// TRANS: Title for field label for GNU social site logo.
|
||||||
|
'Logo for the site (full URL).'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input('ssllogo',
|
$this->input(
|
||||||
// TRANS: Field label for SSL GNU social site logo.
|
'ssllogo',
|
||||||
_m('SSL logo'),
|
// TRANS: Field label for SSL GNU social site logo.
|
||||||
// TRANS: Title for field label for SSL GNU social site logo.
|
_m('SSL logo'),
|
||||||
'Logo to show on SSL pages (full URL).');
|
// TRANS: Title for field label for SSL GNU social site logo.
|
||||||
|
'Logo to show on SSL pages (full URL).'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->out->elementEnd('ul');
|
$this->out->elementEnd('ul');
|
||||||
@ -365,14 +387,16 @@ class SiteAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function formActions()
|
public function formActions()
|
||||||
{
|
{
|
||||||
$this->out->submit('submit',
|
$this->out->submit(
|
||||||
// TRANS: Button text for saving site settings.
|
'submit',
|
||||||
_m('BUTTON','Save'),
|
// TRANS: Button text for saving site settings.
|
||||||
'submit',
|
_m('BUTTON', 'Save'),
|
||||||
null,
|
'submit',
|
||||||
// TRANS: Button title for saving site settings.
|
null,
|
||||||
_m('Save the site settings.'));
|
// TRANS: Button title for saving site settings.
|
||||||
|
_m('Save the site settings.')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ defined('GNUSOCIAL') || die();
|
|||||||
* @copyright 2008-2009 StatusNet, Inc.
|
* @copyright 2008-2009 StatusNet, Inc.
|
||||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
*
|
*
|
||||||
* @see SettingsAction
|
* @see SettingsAction
|
||||||
*/
|
*/
|
||||||
class SmssettingsAction extends SettingsAction
|
class SmssettingsAction extends SettingsAction
|
||||||
{
|
{
|
||||||
@ -279,7 +279,7 @@ class SmssettingsAction extends SettingsAction
|
|||||||
{
|
{
|
||||||
$user = $this->scoped->getUser();
|
$user = $this->scoped->getUser();
|
||||||
|
|
||||||
$user->query('BEGIN');
|
$user->query('START TRANSACTION');
|
||||||
|
|
||||||
$original = clone($user);
|
$original = clone($user);
|
||||||
|
|
||||||
|
@ -1,46 +1,42 @@
|
|||||||
<?php
|
<?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
|
|
||||||
*
|
|
||||||
* Miscellaneous settings
|
* Miscellaneous settings
|
||||||
*
|
*
|
||||||
* 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
|
* @category Settings
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Robin Millette <millette@status.net>
|
* @author Robin Millette <millette@status.net>
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @author Evan Prodromou <evan@status.net>
|
||||||
* @copyright 2008-2009 StatusNet, Inc.
|
* @copyright 2008-2009 StatusNet, Inc.
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
defined('GNUSOCIAL') || die();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Miscellaneous settings actions
|
* Miscellaneous settings actions
|
||||||
*
|
*
|
||||||
* Currently this just manages URL shortening.
|
* Currently this just manages URL shortening.
|
||||||
*
|
*
|
||||||
* @category Settings
|
* @category Settings
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Robin Millette <millette@status.net>
|
* @author Robin Millette <millette@status.net>
|
||||||
* @author Zach Copley <zach@status.net>
|
* @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
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
class UrlsettingsAction extends SettingsAction
|
class UrlsettingsAction extends SettingsAction
|
||||||
{
|
{
|
||||||
@ -49,7 +45,7 @@ class UrlsettingsAction extends SettingsAction
|
|||||||
*
|
*
|
||||||
* @return string Title of the page
|
* @return string Title of the page
|
||||||
*/
|
*/
|
||||||
function title()
|
public function title()
|
||||||
{
|
{
|
||||||
// TRANS: Title of URL settings tab in profile settings.
|
// TRANS: Title of URL settings tab in profile settings.
|
||||||
return _('URL settings');
|
return _('URL settings');
|
||||||
@ -60,13 +56,13 @@ class UrlsettingsAction extends SettingsAction
|
|||||||
*
|
*
|
||||||
* @return instructions for use
|
* @return instructions for use
|
||||||
*/
|
*/
|
||||||
function getInstructions()
|
public function getInstructions()
|
||||||
{
|
{
|
||||||
// TRANS: Instructions for tab "Other" in user profile settings.
|
// TRANS: Instructions for tab "Other" in user profile settings.
|
||||||
return _('Manage various other options.');
|
return _('Manage various other options.');
|
||||||
}
|
}
|
||||||
|
|
||||||
function showScripts()
|
public function showScripts()
|
||||||
{
|
{
|
||||||
parent::showScripts();
|
parent::showScripts();
|
||||||
$this->autofocus('urlshorteningservice');
|
$this->autofocus('urlshorteningservice');
|
||||||
@ -79,7 +75,7 @@ class UrlsettingsAction extends SettingsAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showContent()
|
public function showContent()
|
||||||
{
|
{
|
||||||
$user = $this->scoped->getUser();
|
$user = $this->scoped->getUser();
|
||||||
|
|
||||||
@ -98,8 +94,7 @@ class UrlsettingsAction extends SettingsAction
|
|||||||
|
|
||||||
$services = array();
|
$services = array();
|
||||||
|
|
||||||
foreach ($shorteners as $name => $value)
|
foreach ($shorteners as $name => $value) {
|
||||||
{
|
|
||||||
$services[$name] = $name;
|
$services[$name] = $name;
|
||||||
if ($value['freeService']) {
|
if ($value['freeService']) {
|
||||||
// TRANS: Used as a suffix for free URL shorteners in a dropdown list in the tab "Other" of a
|
// TRANS: Used as a suffix for free URL shorteners in a dropdown list in the tab "Other" of a
|
||||||
@ -121,33 +116,40 @@ class UrlsettingsAction extends SettingsAction
|
|||||||
|
|
||||||
$this->elementStart('li');
|
$this->elementStart('li');
|
||||||
// TRANS: Label for dropdown with URL shortener services.
|
// TRANS: Label for dropdown with URL shortener services.
|
||||||
$this->dropdown('urlshorteningservice', _('Shorten URLs with'),
|
$this->dropdown(
|
||||||
// TRANS: Tooltip for for dropdown with URL shortener services.
|
'urlshorteningservice',
|
||||||
$services, _('Automatic shortening service to use.'),
|
_('Shorten URLs with'),
|
||||||
false, $user->urlshorteningservice);
|
// TRANS: Tooltip for for dropdown with URL shortener services.
|
||||||
|
$services,
|
||||||
|
_('Automatic shortening service to use.'),
|
||||||
|
false,
|
||||||
|
$user->urlshorteningservice
|
||||||
|
);
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
}
|
}
|
||||||
$this->elementStart('li');
|
$this->elementStart('li');
|
||||||
$this->input('maxurllength',
|
$this->input(
|
||||||
// TRANS: Field label in URL settings in profile.
|
'maxurllength',
|
||||||
_('URL longer than'),
|
// TRANS: Field label in URL settings in profile.
|
||||||
(!is_null($this->arg('maxurllength'))) ?
|
_('URL longer than'),
|
||||||
$this->arg('maxurllength') : User_urlshortener_prefs::maxUrlLength($user),
|
($this->arg('maxurllength') ?? User_urlshortener_prefs::maxUrlLength($user)),
|
||||||
// TRANS: Field title in URL settings in profile.
|
// TRANS: Field title in URL settings in profile.
|
||||||
_('URLs longer than this will be shortened, -1 means never shorten because a URL is long.'));
|
_('URLs longer than this will be shortened, -1 means never shorten because a URL is long.')
|
||||||
|
);
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
$this->elementStart('li');
|
$this->elementStart('li');
|
||||||
$this->input('maxnoticelength',
|
$this->input(
|
||||||
// TRANS: Field label in URL settings in profile.
|
'maxnoticelength',
|
||||||
_('Text longer than'),
|
// TRANS: Field label in URL settings in profile.
|
||||||
(!is_null($this->arg('maxnoticelength'))) ?
|
_('Text longer than'),
|
||||||
$this->arg('maxnoticelength') : User_urlshortener_prefs::maxNoticeLength($user),
|
($this->arg('maxnoticelength') ?? User_urlshortener_prefs::maxNoticeLength($user)),
|
||||||
// TRANS: Field title in URL settings in profile.
|
// TRANS: Field title in URL settings in profile.
|
||||||
_('URLs in notices longer than this will always be shortened, -1 means only shorten if the full post exceeds maximum length.'));
|
_('URLs in notices longer than this will always be shortened, -1 means only shorten if the full post exceeds maximum length.')
|
||||||
|
);
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
$this->elementEnd('ul');
|
$this->elementEnd('ul');
|
||||||
// TRANS: Button text for saving "Other settings" in profile.
|
// TRANS: Button text for saving "Other settings" in profile.
|
||||||
$this->submit('save', _m('BUTTON','Save'));
|
$this->submit('save', _m('BUTTON', 'Save'));
|
||||||
$this->elementEnd('fieldset');
|
$this->elementEnd('fieldset');
|
||||||
$this->elementEnd('form');
|
$this->elementEnd('form');
|
||||||
}
|
}
|
||||||
@ -177,7 +179,7 @@ class UrlsettingsAction extends SettingsAction
|
|||||||
|
|
||||||
$user = $this->scoped->getUser();
|
$user = $this->scoped->getUser();
|
||||||
|
|
||||||
$user->query('BEGIN');
|
$user->query('START TRANSACTION');
|
||||||
|
|
||||||
$original = clone($user);
|
$original = clone($user);
|
||||||
|
|
||||||
|
@ -1,49 +1,42 @@
|
|||||||
<?php
|
<?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
|
|
||||||
*
|
|
||||||
* User administration panel
|
* User 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
|
* @category Settings
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @author Evan Prodromou <evan@status.net>
|
||||||
* @author Zach Copley <zach@status.net>
|
* @author Zach Copley <zach@status.net>
|
||||||
* @author Sarven Capadisli <csarven@status.net>
|
* @author Sarven Capadisli <csarven@status.net>
|
||||||
* @copyright 2008-2010 StatusNet, Inc.
|
* @copyright 2008-2010 StatusNet, Inc.
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET')) {
|
defined('GNUSOCIAL') || die();
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Administer user settings
|
* Administer user settings
|
||||||
*
|
*
|
||||||
* @category Admin
|
* @category Admin
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @author Evan Prodromou <evan@status.net>
|
||||||
* @author Zach Copley <zach@status.net>
|
* @author Zach Copley <zach@status.net>
|
||||||
* @author Sarven Capadisli <csarven@status.net>
|
* @author Sarven Capadisli <csarven@status.net>
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
class UseradminpanelAction extends AdminPanelAction
|
class UseradminpanelAction extends AdminPanelAction
|
||||||
{
|
{
|
||||||
@ -52,7 +45,7 @@ class UseradminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return string page title
|
* @return string page title
|
||||||
*/
|
*/
|
||||||
function title()
|
public function title()
|
||||||
{
|
{
|
||||||
// TRANS: User admin panel title.
|
// TRANS: User admin panel title.
|
||||||
return _m('TITLE', 'User');
|
return _m('TITLE', 'User');
|
||||||
@ -63,7 +56,7 @@ class UseradminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return string instructions
|
* @return string instructions
|
||||||
*/
|
*/
|
||||||
function getInstructions()
|
public function getInstructions()
|
||||||
{
|
{
|
||||||
// TRANS: Instruction for user admin panel.
|
// TRANS: Instruction for user admin panel.
|
||||||
return _('User settings for this StatusNet site');
|
return _('User settings for this StatusNet site');
|
||||||
@ -74,7 +67,7 @@ class UseradminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showForm()
|
public function showForm()
|
||||||
{
|
{
|
||||||
$form = new UserAdminPanelForm($this);
|
$form = new UserAdminPanelForm($this);
|
||||||
$form->show();
|
$form->show();
|
||||||
@ -86,7 +79,7 @@ class UseradminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function saveSettings()
|
public function saveSettings()
|
||||||
{
|
{
|
||||||
static $settings = array(
|
static $settings = array(
|
||||||
'profile' => array('biolimit'),
|
'profile' => array('biolimit'),
|
||||||
@ -119,7 +112,7 @@ class UseradminpanelAction extends AdminPanelAction
|
|||||||
|
|
||||||
$config = new Config();
|
$config = new Config();
|
||||||
|
|
||||||
$config->query('BEGIN');
|
$config->query('START TRANSACTION');
|
||||||
|
|
||||||
foreach ($settings as $section => $parts) {
|
foreach ($settings as $section => $parts) {
|
||||||
foreach ($parts as $setting) {
|
foreach ($parts as $setting) {
|
||||||
@ -138,7 +131,7 @@ class UseradminpanelAction extends AdminPanelAction
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function validate(&$values)
|
public function validate(&$values)
|
||||||
{
|
{
|
||||||
// Validate biolimit
|
// Validate biolimit
|
||||||
|
|
||||||
@ -180,7 +173,7 @@ class UserAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return int ID of the form
|
* @return int ID of the form
|
||||||
*/
|
*/
|
||||||
function id()
|
public function id()
|
||||||
{
|
{
|
||||||
return 'useradminpanel';
|
return 'useradminpanel';
|
||||||
}
|
}
|
||||||
@ -190,7 +183,7 @@ class UserAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return string class of the form
|
* @return string class of the form
|
||||||
*/
|
*/
|
||||||
function formClass()
|
public function formClass()
|
||||||
{
|
{
|
||||||
return 'form_settings';
|
return 'form_settings';
|
||||||
}
|
}
|
||||||
@ -200,7 +193,7 @@ class UserAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return string URL of the action
|
* @return string URL of the action
|
||||||
*/
|
*/
|
||||||
function action()
|
public function action()
|
||||||
{
|
{
|
||||||
return common_local_url('useradminpanel');
|
return common_local_url('useradminpanel');
|
||||||
}
|
}
|
||||||
@ -210,19 +203,22 @@ class UserAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function formData()
|
public function formData()
|
||||||
{
|
{
|
||||||
$this->out->elementStart('fieldset', array('id' => 'settings_user-profile'));
|
$this->out->elementStart('fieldset', array('id' => 'settings_user-profile'));
|
||||||
// TRANS: Fieldset legend in user administration panel.
|
// TRANS: Fieldset legend in user administration panel.
|
||||||
$this->out->element('legend', null, _m('LEGEND','Profile'));
|
$this->out->element('legend', null, _m('LEGEND', 'Profile'));
|
||||||
$this->out->elementStart('ul', 'form_data');
|
$this->out->elementStart('ul', 'form_data');
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
// TRANS: Field label in user admin panel for setting the character limit for the bio field.
|
// TRANS: Field label in user admin panel for setting the character limit for the bio field.
|
||||||
$this->input('biolimit', _('Bio Limit'),
|
$this->input(
|
||||||
// TRANS: Tooltip in user admin panel for setting the character limit for the bio field.
|
'biolimit',
|
||||||
_('Maximum length of a profile bio in characters.'),
|
_('Bio Limit'),
|
||||||
'profile');
|
// TRANS: Tooltip in user admin panel for setting the character limit for the bio field.
|
||||||
|
_('Maximum length of a profile bio in characters.'),
|
||||||
|
'profile'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->out->elementEnd('ul');
|
$this->out->elementEnd('ul');
|
||||||
@ -235,18 +231,24 @@ class UserAdminPanelForm extends AdminForm
|
|||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
// TRANS: Field label in user admin panel for setting new user welcome text.
|
// TRANS: Field label in user admin panel for setting new user welcome text.
|
||||||
$this->input('welcome', _('New user welcome'),
|
$this->input(
|
||||||
// TRANS: Tooltip in user admin panel for setting new user welcome text.
|
'welcome',
|
||||||
_('Welcome text for new users (maximum 255 characters).'),
|
_('New user welcome'),
|
||||||
'newuser');
|
// TRANS: Tooltip in user admin panel for setting new user welcome text.
|
||||||
|
_('Welcome text for new users (maximum 255 characters).'),
|
||||||
|
'newuser'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
// TRANS: Field label in user admin panel for setting default subscription for new users.
|
// TRANS: Field label in user admin panel for setting default subscription for new users.
|
||||||
$this->input('default', _('Default subscription'),
|
$this->input(
|
||||||
// TRANS: Tooltip in user admin panel for setting default subscription for new users.
|
'default',
|
||||||
_('Automatically subscribe new users to this user.'),
|
_('Default subscription'),
|
||||||
'newuser');
|
// TRANS: Tooltip in user admin panel for setting default subscription for new users.
|
||||||
|
_('Automatically subscribe new users to this user.'),
|
||||||
|
'newuser'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->out->elementEnd('ul');
|
$this->out->elementEnd('ul');
|
||||||
@ -261,10 +263,13 @@ class UserAdminPanelForm extends AdminForm
|
|||||||
$this->li();
|
$this->li();
|
||||||
|
|
||||||
// TRANS: Field label for checkbox in user admin panel for allowing users to invite friend using site e-mail.
|
// TRANS: Field label for checkbox in user admin panel for allowing users to invite friend using site e-mail.
|
||||||
$this->out->checkbox('invite-enabled', _('Invitations enabled'),
|
$this->out->checkbox(
|
||||||
(bool) $this->value('enabled', 'invite'),
|
'invite-enabled',
|
||||||
// TRANS: Tooltip for checkbox in user admin panel for allowing users to invite friend using site e-mail.
|
_('Invitations enabled'),
|
||||||
_('Whether to allow users to invite new users.'));
|
(bool) $this->value('enabled', 'invite'),
|
||||||
|
// TRANS: Tooltip for checkbox in user admin panel for allowing users to invite friend using site e-mail.
|
||||||
|
_('Whether to allow users to invite new users.')
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->out->elementEnd('ul');
|
$this->out->elementEnd('ul');
|
||||||
@ -283,7 +288,7 @@ class UserAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function input($setting, $title, $instructions, $section='site')
|
public function input($setting, $title, $instructions, $section='site')
|
||||||
{
|
{
|
||||||
$this->out->input("$section-$setting", $title, $this->value($setting, $section), $instructions);
|
$this->out->input("$section-$setting", $title, $this->value($setting, $section), $instructions);
|
||||||
}
|
}
|
||||||
@ -293,14 +298,16 @@ class UserAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function formActions()
|
public function formActions()
|
||||||
{
|
{
|
||||||
$this->out->submit('submit',
|
$this->out->submit(
|
||||||
// TRANS: Button text to save user settings in user admin panel.
|
'submit',
|
||||||
_m('BUTTON','Save'),
|
// TRANS: Button text to save user settings in user admin panel.
|
||||||
'submit',
|
_m('BUTTON', 'Save'),
|
||||||
null,
|
'submit',
|
||||||
// TRANS: Button title to save user settings in user admin panel.
|
null,
|
||||||
_('Save user settings.'));
|
// TRANS: Button title to save user settings in user admin panel.
|
||||||
|
_('Save user settings.')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,29 @@
|
|||||||
<?php
|
<?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/>.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table Definition for group_block
|
* Table Definition for group_block
|
||||||
*
|
*
|
||||||
* StatusNet - the distributed open-source microblogging tool
|
* @package GNUsocial
|
||||||
* Copyright (C) 2008, 2009, StatusNet, Inc.
|
* @author Evan Prodromou <evan@status.net>
|
||||||
*
|
* @copyright 2008, 2009 StatusNet, Inc.
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* 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/>.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
|
defined('GNUSOCIAL') || die();
|
||||||
|
|
||||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||||
|
|
||||||
@ -55,20 +59,22 @@ class Group_block extends Managed_DataObject
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static function isBlocked($group, $profile)
|
public static function isBlocked($group, $profile)
|
||||||
{
|
{
|
||||||
$block = Group_block::pkeyGet(array('group_id' => $group->id,
|
$block = Group_block::pkeyGet([
|
||||||
'blocked' => $profile->id));
|
'group_id' => $group->id,
|
||||||
|
'blocked' => $profile->id,
|
||||||
|
]);
|
||||||
return !empty($block);
|
return !empty($block);
|
||||||
}
|
}
|
||||||
|
|
||||||
static function blockProfile($group, $profile, $blocker)
|
public static function blockProfile($group, $profile, $blocker)
|
||||||
{
|
{
|
||||||
// Insert the block
|
// Insert the block
|
||||||
|
|
||||||
$block = new Group_block();
|
$block = new Group_block();
|
||||||
|
|
||||||
$block->query('BEGIN');
|
$block->query('START TRANSACTION');
|
||||||
|
|
||||||
$block->group_id = $group->id;
|
$block->group_id = $group->id;
|
||||||
$block->blocked = $profile->id;
|
$block->blocked = $profile->id;
|
||||||
@ -103,7 +109,7 @@ class Group_block extends Managed_DataObject
|
|||||||
return $block;
|
return $block;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function unblockProfile($group, $profile)
|
public static function unblockProfile($group, $profile)
|
||||||
{
|
{
|
||||||
$block = Group_block::pkeyGet(array('group_id' => $group->id,
|
$block = Group_block::pkeyGet(array('group_id' => $group->id,
|
||||||
'blocked' => $profile->id));
|
'blocked' => $profile->id));
|
||||||
|
@ -546,7 +546,7 @@ abstract class Managed_DataObject extends Memcached_DataObject
|
|||||||
$this->onUpdateKeys($orig);
|
$this->onUpdateKeys($orig);
|
||||||
|
|
||||||
// do it in a transaction
|
// do it in a transaction
|
||||||
$this->query('BEGIN');
|
$this->query('START TRANSACTION');
|
||||||
|
|
||||||
$parts = [];
|
$parts = [];
|
||||||
foreach ($this->keys() as $k) {
|
foreach ($this->keys() as $k) {
|
||||||
|
@ -609,7 +609,7 @@ class Profile_list extends Managed_DataObject
|
|||||||
|
|
||||||
$ptag = new Profile_list();
|
$ptag = new Profile_list();
|
||||||
|
|
||||||
$ptag->query('BEGIN');
|
$ptag->query('START TRANSACTION');
|
||||||
|
|
||||||
if (empty($tagger)) {
|
if (empty($tagger)) {
|
||||||
// TRANS: Server exception saving new tag without having a tagger specified.
|
// TRANS: Server exception saving new tag without having a tagger specified.
|
||||||
|
@ -197,7 +197,7 @@ class Profile_tag extends Managed_DataObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$plist = new Profile_list();
|
$plist = new Profile_list();
|
||||||
$plist->query('BEGIN');
|
$plist->query('START TRANSACTION');
|
||||||
|
|
||||||
$profile_list = Profile_list::ensureTag($tagger, $tag, $desc, $private);
|
$profile_list = Profile_list::ensureTag($tagger, $tag, $desc, $private);
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ class User extends Managed_DataObject
|
|||||||
$user->created = common_sql_now();
|
$user->created = common_sql_now();
|
||||||
|
|
||||||
if (Event::handle('StartUserRegister', array($profile))) {
|
if (Event::handle('StartUserRegister', array($profile))) {
|
||||||
$profile->query('BEGIN');
|
$profile->query('START TRANSACTION');
|
||||||
|
|
||||||
$id = $profile->insert();
|
$id = $profile->insert();
|
||||||
if ($id === false) {
|
if ($id === false) {
|
||||||
@ -504,9 +504,7 @@ class User extends Managed_DataObject
|
|||||||
|
|
||||||
$block = new Profile_block();
|
$block = new Profile_block();
|
||||||
|
|
||||||
// Begin a transaction
|
$block->query('START TRANSACTION');
|
||||||
|
|
||||||
$block->query('BEGIN');
|
|
||||||
|
|
||||||
$block->blocker = $this->id;
|
$block->blocker = $this->id;
|
||||||
$block->blocked = $other->id;
|
$block->blocked = $other->id;
|
||||||
@ -842,7 +840,7 @@ class User extends Managed_DataObject
|
|||||||
{
|
{
|
||||||
$qry =
|
$qry =
|
||||||
'SELECT u.* ' .
|
'SELECT u.* ' .
|
||||||
'FROM oauth_application_user u, oauth_application a ' .
|
'FROM oauth_application_user AS u, oauth_application AS a ' .
|
||||||
'WHERE u.profile_id = %d ' .
|
'WHERE u.profile_id = %d ' .
|
||||||
'AND a.id = u.application_id ' .
|
'AND a.id = u.application_id ' .
|
||||||
'AND u.access_type > 0 ' .
|
'AND u.access_type > 0 ' .
|
||||||
|
@ -639,7 +639,7 @@ class User_group extends Managed_DataObject
|
|||||||
$group->mainpage = $profile->profileurl;
|
$group->mainpage = $profile->profileurl;
|
||||||
$group->created = $profile->created;
|
$group->created = $profile->created;
|
||||||
|
|
||||||
$profile->query('BEGIN');
|
$profile->query('START TRANSACTION');
|
||||||
$id = $profile->insert();
|
$id = $profile->insert();
|
||||||
if ($id === false) {
|
if ($id === false) {
|
||||||
$profile->query('ROLLBACK');
|
$profile->query('ROLLBACK');
|
||||||
|
@ -1,34 +1,30 @@
|
|||||||
<?php
|
<?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
|
|
||||||
*
|
|
||||||
* Database schema utilities
|
* Database schema utilities
|
||||||
*
|
*
|
||||||
* 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 Database
|
* @category Database
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @author Evan Prodromou <evan@status.net>
|
||||||
* @copyright 2009 StatusNet, Inc.
|
* @copyright 2009 StatusNet, Inc.
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
defined('GNUSOCIAL') || die();
|
||||||
|
|
||||||
class SchemaUpdater
|
class SchemaUpdater
|
||||||
{
|
{
|
||||||
@ -64,13 +60,13 @@ class SchemaUpdater
|
|||||||
$checksum = $this->checksum($def);
|
$checksum = $this->checksum($def);
|
||||||
if (empty($checksums[$table])) {
|
if (empty($checksums[$table])) {
|
||||||
common_log(LOG_DEBUG, "No previous schema_version for $table: updating to $checksum");
|
common_log(LOG_DEBUG, "No previous schema_version for $table: updating to $checksum");
|
||||||
} else if ($checksums[$table] == $checksum) {
|
} elseif ($checksums[$table] === $checksum) {
|
||||||
common_log(LOG_DEBUG, "Last schema_version for $table up to date: $checksum");
|
common_log(LOG_DEBUG, "Last schema_version for $table up to date: $checksum");
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
common_log(LOG_DEBUG, "Last schema_version for $table is {$checksums[$table]}: updating to $checksum");
|
common_log(LOG_DEBUG, "Last schema_version for $table is {$checksums[$table]}: updating to $checksum");
|
||||||
}
|
}
|
||||||
//$this->conn->query('BEGIN');
|
//$this->conn->query('START TRANSACTION');
|
||||||
$this->schema->ensureTable($table, $def);
|
$this->schema->ensureTable($table, $def);
|
||||||
$this->saveChecksum($table, $checksum);
|
$this->saveChecksum($table, $checksum);
|
||||||
//$this->conn->commit();
|
//$this->conn->commit();
|
||||||
|
@ -386,7 +386,7 @@ function common_rememberme($user=null)
|
|||||||
|
|
||||||
// Wrap the insert in some good ol' fashioned transaction code
|
// Wrap the insert in some good ol' fashioned transaction code
|
||||||
|
|
||||||
$rm->query('BEGIN');
|
$rm->query('START TRANSACTION');
|
||||||
|
|
||||||
$result = $rm->insert();
|
$result = $rm->insert();
|
||||||
|
|
||||||
|
@ -1,44 +1,38 @@
|
|||||||
<?php
|
<?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
|
|
||||||
*
|
|
||||||
* Admin panel for plugin to use bit.ly URL shortening services.
|
* Admin panel for plugin to use bit.ly URL shortening services.
|
||||||
*
|
*
|
||||||
* 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
|
* @category Settings
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Brion Vibber <brion@status.net>
|
* @author Brion Vibber <brion@status.net>
|
||||||
* @copyright 2010 StatusNet, Inc.
|
* @copyright 2010 StatusNet, Inc.
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET')) {
|
defined('GNUSOCIAL') || die();
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Administer global bit.ly URL shortener settings
|
* Administer global bit.ly URL shortener settings
|
||||||
*
|
*
|
||||||
* @category Admin
|
* @category Admin
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Brion Vibber <brion@status.net>
|
* @author Brion Vibber <brion@status.net>
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
class BitlyadminpanelAction extends AdminPanelAction
|
class BitlyadminpanelAction extends AdminPanelAction
|
||||||
{
|
{
|
||||||
@ -47,7 +41,7 @@ class BitlyadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return string page title
|
* @return string page title
|
||||||
*/
|
*/
|
||||||
function title()
|
public function title()
|
||||||
{
|
{
|
||||||
// TRANS: Title of administration panel.
|
// TRANS: Title of administration panel.
|
||||||
return _m('bit.ly URL shortening');
|
return _m('bit.ly URL shortening');
|
||||||
@ -58,7 +52,7 @@ class BitlyadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return string instructions
|
* @return string instructions
|
||||||
*/
|
*/
|
||||||
function getInstructions()
|
public function getInstructions()
|
||||||
{
|
{
|
||||||
// TRANS: Instructions for administration panel.
|
// TRANS: Instructions for administration panel.
|
||||||
// TRANS: This message contains Markdown links in the form [decsription](link).
|
// TRANS: This message contains Markdown links in the form [decsription](link).
|
||||||
@ -73,7 +67,7 @@ class BitlyadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showForm()
|
public function showForm()
|
||||||
{
|
{
|
||||||
$form = new BitlyAdminPanelForm($this);
|
$form = new BitlyAdminPanelForm($this);
|
||||||
$form->show();
|
$form->show();
|
||||||
@ -85,7 +79,7 @@ class BitlyadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function saveSettings()
|
public function saveSettings()
|
||||||
{
|
{
|
||||||
static $settings = array(
|
static $settings = array(
|
||||||
'bitly' => array('default_login', 'default_apikey')
|
'bitly' => array('default_login', 'default_apikey')
|
||||||
@ -108,7 +102,7 @@ class BitlyadminpanelAction extends AdminPanelAction
|
|||||||
|
|
||||||
$config = new Config();
|
$config = new Config();
|
||||||
|
|
||||||
$config->query('BEGIN');
|
$config->query('START TRANSACTION');
|
||||||
|
|
||||||
foreach ($settings as $section => $parts) {
|
foreach ($settings as $section => $parts) {
|
||||||
foreach ($parts as $setting) {
|
foreach ($parts as $setting) {
|
||||||
@ -121,7 +115,7 @@ class BitlyadminpanelAction extends AdminPanelAction
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function validate(&$values)
|
public function validate(&$values)
|
||||||
{
|
{
|
||||||
// Validate consumer key and secret (can't be too long)
|
// Validate consumer key and secret (can't be too long)
|
||||||
|
|
||||||
@ -148,7 +142,7 @@ class BitlyAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return int ID of the form
|
* @return int ID of the form
|
||||||
*/
|
*/
|
||||||
function id()
|
public function id()
|
||||||
{
|
{
|
||||||
return 'bitlyadminpanel';
|
return 'bitlyadminpanel';
|
||||||
}
|
}
|
||||||
@ -158,7 +152,7 @@ class BitlyAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return string class of the form
|
* @return string class of the form
|
||||||
*/
|
*/
|
||||||
function formClass()
|
public function formClass()
|
||||||
{
|
{
|
||||||
return 'form_settings';
|
return 'form_settings';
|
||||||
}
|
}
|
||||||
@ -168,7 +162,7 @@ class BitlyAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return string URL of the action
|
* @return string URL of the action
|
||||||
*/
|
*/
|
||||||
function action()
|
public function action()
|
||||||
{
|
{
|
||||||
return common_local_url('bitlyadminpanel');
|
return common_local_url('bitlyadminpanel');
|
||||||
}
|
}
|
||||||
@ -178,27 +172,33 @@ class BitlyAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function formData()
|
public function formData()
|
||||||
{
|
{
|
||||||
$this->out->elementStart(
|
$this->out->elementStart(
|
||||||
'fieldset',
|
'fieldset',
|
||||||
array('id' => 'settings_bitly')
|
array('id' => 'settings_bitly')
|
||||||
);
|
);
|
||||||
// TRANS: Fieldset legend in administration panel for bit.ly username and API key.
|
// TRANS: Fieldset legend in administration panel for bit.ly username and API key.
|
||||||
$this->out->element('legend', null, _m('LEGEND','Credentials'));
|
$this->out->element('legend', null, _m('LEGEND', 'Credentials'));
|
||||||
|
|
||||||
// Do we have global defaults to fall back on?
|
// Do we have global defaults to fall back on?
|
||||||
$login = $apiKey = false;
|
$login = $apiKey = false;
|
||||||
Event::handle('BitlyDefaultCredentials', array(&$login, &$apiKey));
|
Event::handle('BitlyDefaultCredentials', array(&$login, &$apiKey));
|
||||||
$haveGlobalDefaults = ($login && $apiKey);
|
$haveGlobalDefaults = ($login && $apiKey);
|
||||||
if ($login && $apiKey) {
|
if ($login && $apiKey) {
|
||||||
$this->out->element('p', 'form_guide',
|
$this->out->element(
|
||||||
|
'p',
|
||||||
|
'form_guide',
|
||||||
// TRANS: Form guide in administration panel for bit.ly URL shortening.
|
// TRANS: Form guide in administration panel for bit.ly URL shortening.
|
||||||
_m('Leave these empty to use global default credentials.'));
|
_m('Leave these empty to use global default credentials.')
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$this->out->element('p', 'form_guide',
|
$this->out->element(
|
||||||
|
'p',
|
||||||
|
'form_guide',
|
||||||
// TRANS: Form guide in administration panel for bit.ly URL shortening.
|
// TRANS: Form guide in administration panel for bit.ly URL shortening.
|
||||||
_m('If you leave these empty, bit.ly will be unavailable to users.'));
|
_m('If you leave these empty, bit.ly will be unavailable to users.')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$this->out->elementStart('ul', 'form_data');
|
$this->out->elementStart('ul', 'form_data');
|
||||||
|
|
||||||
@ -231,14 +231,16 @@ class BitlyAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function formActions()
|
public function formActions()
|
||||||
{
|
{
|
||||||
$this->out->submit('submit',
|
$this->out->submit(
|
||||||
// TRANS: Button text to save setting in administration panel for bit.ly URL shortening.
|
'submit',
|
||||||
_m('BUTTON','Save'),
|
// TRANS: Button text to save setting in administration panel for bit.ly URL shortening.
|
||||||
'submit',
|
_m('BUTTON', 'Save'),
|
||||||
null,
|
'submit',
|
||||||
// TRANS: Button title to save setting in administration panel for bit.ly URL shortening.
|
null,
|
||||||
_m('Save bit.ly settings'));
|
// TRANS: Button title to save setting in administration panel for bit.ly URL shortening.
|
||||||
|
_m('Save bit.ly settings')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||||
* 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
|
// GNU social is free software: you can redistribute it and/or modify
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
// it under the terms of the GNU Affero General Public License as published by
|
||||||
* (at your option) any later version.
|
// 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
|
// GNU social is distributed in the hope that it will be useful,
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* GNU Affero General Public License for more details.
|
// 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/>.
|
// 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/>.
|
||||||
|
|
||||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
defined('GNUSOCIAL') || die();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table Definition for mention_url_profile
|
* Table Definition for mention_url_profile
|
||||||
@ -40,54 +40,59 @@ class Mention_url_profile extends Managed_DataObject
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function fromUrl($url, $depth=0) {
|
public static function fromUrl($url, $depth = 0)
|
||||||
|
{
|
||||||
common_debug('MentionURL: trying to find a profile for ' . $url);
|
common_debug('MentionURL: trying to find a profile for ' . $url);
|
||||||
|
|
||||||
$url = preg_replace('#https?://#', 'https://', $url);
|
$url = preg_replace('#https?://#', 'https://', $url);
|
||||||
try {
|
try {
|
||||||
$profile = Profile::fromUri($url);
|
$profile = Profile::fromUri($url);
|
||||||
} catch(UnknownUriException $ex) {}
|
} catch (UnknownUriException $ex) {}
|
||||||
|
|
||||||
if(!($profile instanceof Profile)) {
|
if (!($profile instanceof Profile)) {
|
||||||
$profile = self::findProfileByProfileURL($url);
|
$profile = self::findProfileByProfileURL($url);
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = str_replace('https://', 'http://', $url);
|
$url = str_replace('https://', 'http://', $url);
|
||||||
if(!($profile instanceof Profile)) {
|
if (!($profile instanceof Profile)) {
|
||||||
try {
|
try {
|
||||||
$profile = Profile::fromUri($url);
|
$profile = Profile::fromUri($url);
|
||||||
} catch(UnknownUriException $ex) {}
|
} catch (UnknownUriException $ex) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!($profile instanceof Profile)) {
|
if (!($profile instanceof Profile)) {
|
||||||
$profile = self::findProfileByProfileURL($url);
|
$profile = self::findProfileByProfileURL($url);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!($profile instanceof Profile)) {
|
if (!($profile instanceof Profile)) {
|
||||||
$hcard = mention_url_representative_hcard($url);
|
$hcard = mention_url_representative_hcard($url);
|
||||||
if(!$hcard) return null;
|
if (!$hcard) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$mention_profile = new Mention_url_profile();
|
$mention_profile = new Mention_url_profile();
|
||||||
$mention_profile->query('BEGIN');
|
$mention_profile->query('START TRANSACTION');
|
||||||
|
|
||||||
$profile = new Profile();
|
$profile = new Profile();
|
||||||
$profile->profileurl = $hcard['url'][0];
|
$profile->profileurl = $hcard['url'][0];
|
||||||
$profile->fullname = $hcard['name'][0];
|
$profile->fullname = $hcard['name'][0];
|
||||||
preg_match('/\/([^\/]+)\/*$/', $profile->profileurl, $matches);
|
preg_match('/\/([^\/]+)\/*$/', $profile->profileurl, $matches);
|
||||||
if(!$hcard['nickname']) $hcard['nickname'] = array($matches[1]);
|
if (!$hcard['nickname']) {
|
||||||
|
$hcard['nickname'] = [$matches[1]];
|
||||||
|
}
|
||||||
$profile->nickname = $hcard['nickname'][0];
|
$profile->nickname = $hcard['nickname'][0];
|
||||||
$profile->created = common_sql_now();
|
$profile->created = common_sql_now();
|
||||||
|
|
||||||
$mention_profile->profile_id = $profile->insert();
|
$mention_profile->profile_id = $profile->insert();
|
||||||
if(!$mention_profile->profile_id) {
|
if (!$mention_profile->profile_id) {
|
||||||
$mention_profile->query('ROLLBACK');
|
$mention_profile->query('ROLLBACK');
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$mention_profile->profileurl = $profile->profileurl;
|
$mention_profile->profileurl = $profile->profileurl;
|
||||||
if(!$mention_profile->insert()) {
|
if (!$mention_profile->insert()) {
|
||||||
$mention_profile->query('ROLLBACK');
|
$mention_profile->query('ROLLBACK');
|
||||||
if($depth > 0) {
|
if ($depth > 0) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return self::fromUrl($url, $depth+1);
|
return self::fromUrl($url, $depth+1);
|
||||||
@ -100,9 +105,10 @@ class Mention_url_profile extends Managed_DataObject
|
|||||||
return $profile;
|
return $profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function findProfileByProfileURL($url) {
|
protected static function findProfileByProfileURL($url)
|
||||||
|
{
|
||||||
$profile = Profile::getKV('profileurl', $url);
|
$profile = Profile::getKV('profileurl', $url);
|
||||||
if($profile instanceof Profile) {
|
if ($profile instanceof Profile) {
|
||||||
$mention_profile = new Mention_url_profile();
|
$mention_profile = new Mention_url_profile();
|
||||||
$mention_profile->profile_id = $profile->id;
|
$mention_profile->profile_id = $profile->id;
|
||||||
$mention_profile->profileurl = $profile->profileurl;
|
$mention_profile->profileurl = $profile->profileurl;
|
||||||
@ -112,7 +118,8 @@ class Mention_url_profile extends Managed_DataObject
|
|||||||
return $profile;
|
return $profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getProfile() {
|
public function getProfile()
|
||||||
|
{
|
||||||
return Profile::getKV('id', $this->profile_id);
|
return Profile::getKV('id', $this->profile_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,28 +1,34 @@
|
|||||||
<?php
|
<?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
|
* @package GNUsocial
|
||||||
* Copyright (C) 2009-2010, StatusNet, Inc.
|
* @author Brion Vibber <brion@status.net>
|
||||||
*
|
* @author Mikael Nordfeldth <mmn@hethane.se>
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* @copyright 2009-2010 StatusNet, Inc.
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* 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/>.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
defined('GNUSOCIAL') || die();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package OStatusPlugin
|
* @package OStatusPlugin
|
||||||
* @author Brion Vibber <brion@status.net>
|
* @author Brion Vibber <brion@status.net>
|
||||||
* @maintainer Mikael Nordfeldth <mmn@hethane.se>
|
* @author Mikael Nordfeldth <mmn@hethane.se>
|
||||||
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
*/
|
*/
|
||||||
class Ostatus_profile extends Managed_DataObject
|
class Ostatus_profile extends Managed_DataObject
|
||||||
{
|
{
|
||||||
@ -46,7 +52,7 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
*
|
*
|
||||||
* @return array array of column definitions
|
* @return array array of column definitions
|
||||||
*/
|
*/
|
||||||
static function schemaDef()
|
public static function schemaDef()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'fields' => array(
|
'fields' => array(
|
||||||
@ -96,7 +102,7 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
return FeedSub::getByUri($this->feeduri);
|
return FeedSub::getByUri($this->feeduri);
|
||||||
}
|
}
|
||||||
|
|
||||||
static function fromProfile(Profile $profile)
|
public static function fromProfile(Profile $profile)
|
||||||
{
|
{
|
||||||
$oprofile = Ostatus_profile::getKV('profile_id', $profile->getID());
|
$oprofile = Ostatus_profile::getKV('profile_id', $profile->getID());
|
||||||
if (!$oprofile instanceof Ostatus_profile) {
|
if (!$oprofile instanceof Ostatus_profile) {
|
||||||
@ -156,11 +162,11 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
*
|
*
|
||||||
* @return ActivityObject
|
* @return ActivityObject
|
||||||
*/
|
*/
|
||||||
function asActivityObject()
|
public function asActivityObject()
|
||||||
{
|
{
|
||||||
if ($this->isGroup()) {
|
if ($this->isGroup()) {
|
||||||
return ActivityObject::fromGroup($this->localGroup());
|
return ActivityObject::fromGroup($this->localGroup());
|
||||||
} else if ($this->isPeopletag()) {
|
} elseif ($this->isPeopletag()) {
|
||||||
return ActivityObject::fromPeopletag($this->localPeopletag());
|
return ActivityObject::fromPeopletag($this->localPeopletag());
|
||||||
} else {
|
} else {
|
||||||
return $this->localProfile()->asActivityObject();
|
return $this->localProfile()->asActivityObject();
|
||||||
@ -178,12 +184,12 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
* @param string $element one of 'actor', 'subject', 'object', 'target'
|
* @param string $element one of 'actor', 'subject', 'object', 'target'
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function asActivityNoun($element)
|
public function asActivityNoun($element)
|
||||||
{
|
{
|
||||||
if ($this->isGroup()) {
|
if ($this->isGroup()) {
|
||||||
$noun = ActivityObject::fromGroup($this->localGroup());
|
$noun = ActivityObject::fromGroup($this->localGroup());
|
||||||
return $noun->asString('activity:' . $element);
|
return $noun->asString('activity:' . $element);
|
||||||
} else if ($this->isPeopletag()) {
|
} elseif ($this->isPeopletag()) {
|
||||||
$noun = ActivityObject::fromPeopletag($this->localPeopletag());
|
$noun = ActivityObject::fromPeopletag($this->localPeopletag());
|
||||||
return $noun->asString('activity:' . $element);
|
return $noun->asString('activity:' . $element);
|
||||||
} else {
|
} else {
|
||||||
@ -195,13 +201,13 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
/**
|
/**
|
||||||
* @return boolean true if this is a remote group
|
* @return boolean true if this is a remote group
|
||||||
*/
|
*/
|
||||||
function isGroup()
|
public function isGroup()
|
||||||
{
|
{
|
||||||
if ($this->profile_id || $this->peopletag_id && !$this->group_id) {
|
if ($this->profile_id || $this->peopletag_id && !$this->group_id) {
|
||||||
return false;
|
return false;
|
||||||
} else if ($this->group_id && !$this->profile_id && !$this->peopletag_id) {
|
} elseif ($this->group_id && !$this->profile_id && !$this->peopletag_id) {
|
||||||
return true;
|
return true;
|
||||||
} else if ($this->group_id && ($this->profile_id || $this->peopletag_id)) {
|
} elseif ($this->group_id && ($this->profile_id || $this->peopletag_id)) {
|
||||||
// TRANS: Server exception. %s is a URI
|
// TRANS: Server exception. %s is a URI
|
||||||
throw new ServerException(sprintf(_m('Invalid ostatus_profile state: Two or more IDs set for %s.'), $this->getUri()));
|
throw new ServerException(sprintf(_m('Invalid ostatus_profile state: Two or more IDs set for %s.'), $this->getUri()));
|
||||||
} else {
|
} else {
|
||||||
@ -218,13 +224,13 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
/**
|
/**
|
||||||
* @return boolean true if this is a remote peopletag
|
* @return boolean true if this is a remote peopletag
|
||||||
*/
|
*/
|
||||||
function isPeopletag()
|
public function isPeopletag()
|
||||||
{
|
{
|
||||||
if ($this->profile_id || $this->group_id && !$this->peopletag_id) {
|
if ($this->profile_id || $this->group_id && !$this->peopletag_id) {
|
||||||
return false;
|
return false;
|
||||||
} else if ($this->peopletag_id && !$this->profile_id && !$this->group_id) {
|
} elseif ($this->peopletag_id && !$this->profile_id && !$this->group_id) {
|
||||||
return true;
|
return true;
|
||||||
} else if ($this->peopletag_id && ($this->profile_id || $this->group_id)) {
|
} elseif ($this->peopletag_id && ($this->profile_id || $this->group_id)) {
|
||||||
// TRANS: Server exception. %s is a URI
|
// TRANS: Server exception. %s is a URI
|
||||||
throw new ServerException(sprintf(_m('Invalid ostatus_profile state: Two or more IDs set for %s.'), $this->getUri()));
|
throw new ServerException(sprintf(_m('Invalid ostatus_profile state: Two or more IDs set for %s.'), $this->getUri()));
|
||||||
} else {
|
} else {
|
||||||
@ -260,7 +266,8 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
* @return boolean true if subscription is removed, false if there are still subscribers to the feed
|
* @return boolean true if subscription is removed, false if there are still subscribers to the feed
|
||||||
* @throws Exception of various kinds on failure.
|
* @throws Exception of various kinds on failure.
|
||||||
*/
|
*/
|
||||||
public function unsubscribe() {
|
public function unsubscribe()
|
||||||
|
{
|
||||||
return $this->garbageCollect();
|
return $this->garbageCollect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,7 +303,7 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
if ($this->isGroup()) {
|
if ($this->isGroup()) {
|
||||||
$members = $this->localGroup()->getMembers(0, 1);
|
$members = $this->localGroup()->getMembers(0, 1);
|
||||||
$count = $members->N;
|
$count = $members->N;
|
||||||
} else if ($this->isPeopletag()) {
|
} elseif ($this->isPeopletag()) {
|
||||||
$subscribers = $this->localPeopletag()->getSubscribers(0, 1);
|
$subscribers = $this->localPeopletag()->getSubscribers(0, 1);
|
||||||
$count = $subscribers->N;
|
$count = $subscribers->N;
|
||||||
} else {
|
} else {
|
||||||
@ -334,10 +341,12 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$text = 'update';
|
$text = 'update';
|
||||||
$id = TagURI::mint('%s:%s:%s',
|
$id = TagURI::mint(
|
||||||
$verb,
|
'%s:%s:%s',
|
||||||
$actor->getURI(),
|
$verb,
|
||||||
common_date_iso8601(time()));
|
$actor->getURI(),
|
||||||
|
common_date_iso8601(time())
|
||||||
|
);
|
||||||
|
|
||||||
// @todo FIXME: Consolidate all these NS settings somewhere.
|
// @todo FIXME: Consolidate all these NS settings somewhere.
|
||||||
$attributes = array('xmlns' => Activity::ATOM,
|
$attributes = array('xmlns' => Activity::ATOM,
|
||||||
@ -421,9 +430,9 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
$preamble = '<?xml version="1.0" encoding="UTF-8" ?' . ">\n";
|
$preamble = '<?xml version="1.0" encoding="UTF-8" ?' . ">\n";
|
||||||
if (is_string($entry)) {
|
if (is_string($entry)) {
|
||||||
return $entry;
|
return $entry;
|
||||||
} else if ($entry instanceof Activity) {
|
} elseif ($entry instanceof Activity) {
|
||||||
return $preamble . $entry->asString(true);
|
return $preamble . $entry->asString(true);
|
||||||
} else if ($entry instanceof Notice) {
|
} elseif ($entry instanceof Notice) {
|
||||||
return $preamble . $entry->asAtomEntry(true, true);
|
return $preamble . $entry->asAtomEntry(true, true);
|
||||||
} else {
|
} else {
|
||||||
// TRANS: Server exception.
|
// TRANS: Server exception.
|
||||||
@ -431,11 +440,11 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBestName()
|
public function getBestName()
|
||||||
{
|
{
|
||||||
if ($this->isGroup()) {
|
if ($this->isGroup()) {
|
||||||
return $this->localGroup()->getBestName();
|
return $this->localGroup()->getBestName();
|
||||||
} else if ($this->isPeopletag()) {
|
} elseif ($this->isPeopletag()) {
|
||||||
return $this->localPeopletag()->getBestName();
|
return $this->localPeopletag()->getBestName();
|
||||||
} else {
|
} else {
|
||||||
return $this->localProfile()->getBestName();
|
return $this->localProfile()->getBestName();
|
||||||
@ -456,7 +465,8 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
|
|
||||||
if ($feed->localName == 'feed' && $feed->namespaceURI == Activity::ATOM) {
|
if ($feed->localName == 'feed' && $feed->namespaceURI == Activity::ATOM) {
|
||||||
$this->processAtomFeed($feed, $source);
|
$this->processAtomFeed($feed, $source);
|
||||||
} else if ($feed->localName == 'rss') { // @todo FIXME: Check namespace.
|
} elseif ($feed->localName == 'rss') {
|
||||||
|
// @todo FIXME: Check namespace.
|
||||||
$this->processRssFeed($feed, $source);
|
$this->processRssFeed($feed, $source);
|
||||||
} else {
|
} else {
|
||||||
// TRANS: Exception.
|
// TRANS: Exception.
|
||||||
@ -482,7 +492,7 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
if ($channels->length == 0) {
|
if ($channels->length == 0) {
|
||||||
// TRANS: Exception.
|
// TRANS: Exception.
|
||||||
throw new Exception(_m('RSS feed without a channel.'));
|
throw new Exception(_m('RSS feed without a channel.'));
|
||||||
} else if ($channels->length > 1) {
|
} elseif ($channels->length > 1) {
|
||||||
common_log(LOG_WARNING, __METHOD__ . ": more than one channel in an RSS feed");
|
common_log(LOG_WARNING, __METHOD__ . ": more than one channel in an RSS feed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -532,7 +542,6 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
|
|
||||||
if (Event::handle('StartHandleFeedEntryWithProfile', array($activity, $this->localProfile(), &$notice)) &&
|
if (Event::handle('StartHandleFeedEntryWithProfile', array($activity, $this->localProfile(), &$notice)) &&
|
||||||
Event::handle('StartHandleFeedEntry', array($activity))) {
|
Event::handle('StartHandleFeedEntry', array($activity))) {
|
||||||
|
|
||||||
common_log(LOG_INFO, "Ignoring activity with unrecognized verb $activity->verb");
|
common_log(LOG_INFO, "Ignoring activity with unrecognized verb $activity->verb");
|
||||||
|
|
||||||
Event::handle('EndHandleFeedEntry', array($activity));
|
Event::handle('EndHandleFeedEntry', array($activity));
|
||||||
@ -569,7 +578,7 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
* @param array in/out &$attention_uris set of URIs, will be pruned on output
|
* @param array in/out &$attention_uris set of URIs, will be pruned on output
|
||||||
* @return array of group IDs
|
* @return array of group IDs
|
||||||
*/
|
*/
|
||||||
static public function filterAttention(Profile $sender, array $attention)
|
public static function filterAttention(Profile $sender, array $attention)
|
||||||
{
|
{
|
||||||
common_log(LOG_DEBUG, "Original reply recipients: " . implode(', ', array_keys($attention)));
|
common_log(LOG_DEBUG, "Original reply recipients: " . implode(', ', array_keys($attention)));
|
||||||
$groups = array();
|
$groups = array();
|
||||||
@ -617,7 +626,6 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
// Neither a recognizable local nor remote user!
|
// Neither a recognizable local nor remote user!
|
||||||
common_log(LOG_DEBUG, "Skipping reply to unrecognized profile $recipient: " . $e->getMessage());
|
common_log(LOG_DEBUG, "Skipping reply to unrecognized profile $recipient: " . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
common_log(LOG_DEBUG, "Local reply recipients: " . implode(', ', $replies));
|
common_log(LOG_DEBUG, "Local reply recipients: " . implode(', ', $replies));
|
||||||
common_log(LOG_DEBUG, "Local group recipients: " . implode(', ', $groups));
|
common_log(LOG_DEBUG, "Local group recipients: " . implode(', ', $groups));
|
||||||
@ -653,7 +661,7 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
|
|
||||||
if (!$response->isOk()) {
|
if (!$response->isOk()) {
|
||||||
// TRANS: Exception. %s is a profile URL.
|
// TRANS: Exception. %s is a profile URL.
|
||||||
throw new Exception(sprintf(_m('Could not reach profile page %s.'),$profile_url));
|
throw new Exception(sprintf(_m('Could not reach profile page %s.'), $profile_url));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we have a non-canonical URL
|
// Check if we have a non-canonical URL
|
||||||
@ -661,7 +669,6 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
$finalUrl = $response->getEffectiveUrl();
|
$finalUrl = $response->getEffectiveUrl();
|
||||||
|
|
||||||
if ($finalUrl != $profile_url) {
|
if ($finalUrl != $profile_url) {
|
||||||
|
|
||||||
$hints['profileurl'] = $finalUrl;
|
$hints['profileurl'] = $finalUrl;
|
||||||
|
|
||||||
$oprofile = self::getFromProfileURL($finalUrl);
|
$oprofile = self::getFromProfileURL($finalUrl);
|
||||||
@ -673,8 +680,13 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
|
|
||||||
if (in_array(
|
if (in_array(
|
||||||
preg_replace('/\s*;.*$/', '', $response->getHeader('Content-Type')),
|
preg_replace('/\s*;.*$/', '', $response->getHeader('Content-Type')),
|
||||||
array('application/rss+xml', 'application/atom+xml', 'application/xml', 'text/xml'))
|
[
|
||||||
) {
|
'application/rss+xml',
|
||||||
|
'application/atom+xml',
|
||||||
|
'application/xml',
|
||||||
|
'text/xml',
|
||||||
|
]
|
||||||
|
)) {
|
||||||
$hints['feedurl'] = $response->getEffectiveUrl();
|
$hints['feedurl'] = $response->getEffectiveUrl();
|
||||||
} else {
|
} else {
|
||||||
// Try to get some hCard data
|
// Try to get some hCard data
|
||||||
@ -718,7 +730,7 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TRANS: Exception. %s is a URL.
|
// TRANS: Exception. %s is a URL.
|
||||||
throw new Exception(sprintf(_m('Could not find a feed URL for profile page %s.'),$finalUrl));
|
throw new Exception(sprintf(_m('Could not find a feed URL for profile page %s.'), $finalUrl));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -729,7 +741,7 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
* @return mixed Ostatus_profile or null
|
* @return mixed Ostatus_profile or null
|
||||||
* @throws OStatusShadowException for local profiles
|
* @throws OStatusShadowException for local profiles
|
||||||
*/
|
*/
|
||||||
static function getFromProfileURL($profile_url)
|
public static function getFromProfileURL($profile_url)
|
||||||
{
|
{
|
||||||
$profile = Profile::getKV('profileurl', $profile_url);
|
$profile = Profile::getKV('profileurl', $profile_url);
|
||||||
if (!$profile instanceof Profile) {
|
if (!$profile instanceof Profile) {
|
||||||
@ -756,7 +768,7 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function getFromProfile(Profile $profile)
|
public static function getFromProfile(Profile $profile)
|
||||||
{
|
{
|
||||||
$oprofile = new Ostatus_profile();
|
$oprofile = new Ostatus_profile();
|
||||||
$oprofile->profile_id = $profile->id;
|
$oprofile->profile_id = $profile->id;
|
||||||
@ -804,7 +816,7 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
|
|
||||||
if ($feedEl->tagName == 'feed') {
|
if ($feedEl->tagName == 'feed') {
|
||||||
return self::ensureAtomFeed($feedEl, $hints);
|
return self::ensureAtomFeed($feedEl, $hints);
|
||||||
} else if ($feedEl->tagName == 'channel') {
|
} elseif ($feedEl->tagName == 'channel') {
|
||||||
return self::ensureRssChannel($feedEl, $hints);
|
return self::ensureRssChannel($feedEl, $hints);
|
||||||
} else {
|
} else {
|
||||||
throw new FeedSubBadXmlException($feeduri);
|
throw new FeedSubBadXmlException($feeduri);
|
||||||
@ -877,7 +889,9 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
// with different <author> or <dc:creator> elements, and... I dunno.
|
// with different <author> or <dc:creator> elements, and... I dunno.
|
||||||
// Do something about that.
|
// Do something about that.
|
||||||
|
|
||||||
if(empty($obj)) { $obj = ActivityObject::fromRssChannel($feedEl); }
|
if (empty($obj)) {
|
||||||
|
$obj = ActivityObject::fromRssChannel($feedEl);
|
||||||
|
}
|
||||||
|
|
||||||
return self::ensureActivityObjectProfile($obj, $hints);
|
return self::ensureActivityObjectProfile($obj, $hints);
|
||||||
}
|
}
|
||||||
@ -927,10 +941,12 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
$id = $this->profile_id;
|
$id = $this->profile_id;
|
||||||
}
|
}
|
||||||
$imagefile = new ImageFile(null, $temp_filename);
|
$imagefile = new ImageFile(null, $temp_filename);
|
||||||
$filename = Avatar::filename($id,
|
$filename = Avatar::filename(
|
||||||
image_type_to_extension($imagefile->type),
|
$id,
|
||||||
null,
|
image_type_to_extension($imagefile->type),
|
||||||
common_timestamp());
|
null,
|
||||||
|
common_timestamp()
|
||||||
|
);
|
||||||
rename($temp_filename, Avatar::path($filename));
|
rename($temp_filename, Avatar::path($filename));
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
unlink($temp_filename);
|
unlink($temp_filename);
|
||||||
@ -960,7 +976,7 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
* @param array $hints
|
* @param array $hints
|
||||||
* @return mixed URL string or false
|
* @return mixed URL string or false
|
||||||
*/
|
*/
|
||||||
public static function getActivityObjectAvatar(ActivityObject $object, array $hints=array())
|
public static function getActivityObjectAvatar(ActivityObject $object, array $hints = [])
|
||||||
{
|
{
|
||||||
if ($object->avatarLinks) {
|
if ($object->avatarLinks) {
|
||||||
$best = false;
|
$best = false;
|
||||||
@ -976,7 +992,7 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $best->url;
|
return $best->url;
|
||||||
} else if (array_key_exists('avatar', $hints)) {
|
} elseif (array_key_exists('avatar', $hints)) {
|
||||||
return $hints['avatar'];
|
return $hints['avatar'];
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -1241,9 +1257,9 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
throw new ServerException(_m('Cannot save local profile.'));
|
throw new ServerException(_m('Cannot save local profile.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ($object->type == ActivityObject::GROUP) {
|
} elseif ($object->type == ActivityObject::GROUP) {
|
||||||
$profile = new Profile();
|
$profile = new Profile();
|
||||||
$profile->query('BEGIN');
|
$profile->query('START TRANSACTION');
|
||||||
|
|
||||||
$group = new User_group();
|
$group = new User_group();
|
||||||
$group->uri = $homeuri;
|
$group->uri = $homeuri;
|
||||||
@ -1282,7 +1298,7 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$profile->query('COMMIT');
|
$profile->query('COMMIT');
|
||||||
} else if ($object->type == ActivityObject::_LIST) {
|
} elseif ($object->type == ActivityObject::_LIST) {
|
||||||
$ptag = new Profile_list();
|
$ptag = new Profile_list();
|
||||||
$ptag->uri = $homeuri;
|
$ptag->uri = $homeuri;
|
||||||
$ptag->created = common_sql_now();
|
$ptag->created = common_sql_now();
|
||||||
@ -1337,7 +1353,7 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
if ($this->isGroup()) {
|
if ($this->isGroup()) {
|
||||||
$group = $this->localGroup();
|
$group = $this->localGroup();
|
||||||
self::updateGroup($group, $object, $hints);
|
self::updateGroup($group, $object, $hints);
|
||||||
} else if ($this->isPeopletag()) {
|
} elseif ($this->isPeopletag()) {
|
||||||
$ptag = $this->localPeopletag();
|
$ptag = $this->localPeopletag();
|
||||||
self::updatePeopletag($ptag, $object, $hints);
|
self::updatePeopletag($ptag, $object, $hints);
|
||||||
} else {
|
} else {
|
||||||
@ -1373,15 +1389,15 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
|
|
||||||
if (!empty($object->title)) {
|
if (!empty($object->title)) {
|
||||||
$profile->fullname = $object->title;
|
$profile->fullname = $object->title;
|
||||||
} else if (array_key_exists('fullname', $hints)) {
|
} elseif (array_key_exists('fullname', $hints)) {
|
||||||
$profile->fullname = $hints['fullname'];
|
$profile->fullname = $hints['fullname'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($object->link)) {
|
if (!empty($object->link)) {
|
||||||
$profile->profileurl = $object->link;
|
$profile->profileurl = $object->link;
|
||||||
} else if (array_key_exists('profileurl', $hints)) {
|
} elseif (array_key_exists('profileurl', $hints)) {
|
||||||
$profile->profileurl = $hints['profileurl'];
|
$profile->profileurl = $hints['profileurl'];
|
||||||
} else if (common_valid_http_url($object->id)) {
|
} elseif (common_valid_http_url($object->id)) {
|
||||||
$profile->profileurl = $object->id;
|
$profile->profileurl = $object->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1430,7 +1446,7 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
|
|
||||||
if (!empty($object->link)) {
|
if (!empty($object->link)) {
|
||||||
$group->mainpage = $object->link;
|
$group->mainpage = $object->link;
|
||||||
} else if (array_key_exists('profileurl', $hints)) {
|
} elseif (array_key_exists('profileurl', $hints)) {
|
||||||
$group->mainpage = $hints['profileurl'];
|
$group->mainpage = $hints['profileurl'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1446,14 +1462,15 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function updatePeopletag($tag, ActivityObject $object, array $hints=array()) {
|
protected static function updatePeopletag($tag, ActivityObject $object, array $hints=array())
|
||||||
|
{
|
||||||
$orig = clone($tag);
|
$orig = clone($tag);
|
||||||
|
|
||||||
$tag->tag = $object->title;
|
$tag->tag = $object->title;
|
||||||
|
|
||||||
if (!empty($object->link)) {
|
if (!empty($object->link)) {
|
||||||
$tag->mainpage = $object->link;
|
$tag->mainpage = $object->link;
|
||||||
} else if (array_key_exists('profileurl', $hints)) {
|
} elseif (array_key_exists('profileurl', $hints)) {
|
||||||
$tag->mainpage = $hints['profileurl'];
|
$tag->mainpage = $hints['profileurl'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1492,7 +1509,7 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
if (!empty($object->poco) &&
|
if (!empty($object->poco) &&
|
||||||
isset($object->poco->address->formatted)) {
|
isset($object->poco->address->formatted)) {
|
||||||
$location = $object->poco->address->formatted;
|
$location = $object->poco->address->formatted;
|
||||||
} else if (array_key_exists('location', $hints)) {
|
} elseif (array_key_exists('location', $hints)) {
|
||||||
$location = $hints['location'];
|
$location = $hints['location'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1513,7 +1530,7 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
|
|
||||||
if (!empty($object->poco)) {
|
if (!empty($object->poco)) {
|
||||||
$note = $object->poco->note;
|
$note = $object->poco->note;
|
||||||
} else if (array_key_exists('bio', $hints)) {
|
} elseif (array_key_exists('bio', $hints)) {
|
||||||
$note = $hints['bio'];
|
$note = $hints['bio'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1550,7 +1567,7 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
// Try the profile url (like foo.example.com or example.com/user/foo)
|
// Try the profile url (like foo.example.com or example.com/user/foo)
|
||||||
if (!empty($object->link)) {
|
if (!empty($object->link)) {
|
||||||
$profileUrl = $object->link;
|
$profileUrl = $object->link;
|
||||||
} else if (!empty($hints['profileurl'])) {
|
} elseif (!empty($hints['profileurl'])) {
|
||||||
$profileUrl = $hints['profileurl'];
|
$profileUrl = $hints['profileurl'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1659,8 +1676,10 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
throw new Exception(_m('Not a valid webfinger address.'));
|
throw new Exception(_m('Not a valid webfinger address.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$hints = array_merge(array('webfinger' => $addr),
|
$hints = array_merge(
|
||||||
DiscoveryHints::fromXRD($xrd));
|
['webfinger' => $addr],
|
||||||
|
DiscoveryHints::fromXRD($xrd)
|
||||||
|
);
|
||||||
|
|
||||||
// If there's an Hcard, let's grab its info
|
// If there's an Hcard, let's grab its info
|
||||||
if (array_key_exists('hcard', $hints)) {
|
if (array_key_exists('hcard', $hints)) {
|
||||||
@ -1735,7 +1754,7 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
if ($profile_id === false) {
|
if ($profile_id === false) {
|
||||||
common_log_db_error($profile, 'INSERT', __FILE__);
|
common_log_db_error($profile, 'INSERT', __FILE__);
|
||||||
// TRANS: Exception. %s is a webfinger address.
|
// TRANS: Exception. %s is a webfinger address.
|
||||||
throw new Exception(sprintf(_m('Could not save profile for "%s".'),$addr));
|
throw new Exception(sprintf(_m('Could not save profile for "%s".'), $addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
$oprofile = new Ostatus_profile();
|
$oprofile = new Ostatus_profile();
|
||||||
@ -1755,7 +1774,7 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
$profile->delete();
|
$profile->delete();
|
||||||
common_log_db_error($oprofile, 'INSERT', __FILE__);
|
common_log_db_error($oprofile, 'INSERT', __FILE__);
|
||||||
// TRANS: Exception. %s is a webfinger address.
|
// TRANS: Exception. %s is a webfinger address.
|
||||||
throw new Exception(sprintf(_m('Could not save OStatus profile for "%s".'),$addr));
|
throw new Exception(sprintf(_m('Could not save OStatus profile for "%s".'), $addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
self::cacheSet(sprintf('ostatus_profile:webfinger:%s', $addr), $oprofile->getUri());
|
self::cacheSet(sprintf('ostatus_profile:webfinger:%s', $addr), $oprofile->getUri());
|
||||||
@ -1763,7 +1782,7 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TRANS: Exception. %s is a webfinger address.
|
// TRANS: Exception. %s is a webfinger address.
|
||||||
throw new Exception(sprintf(_m('Could not find a valid profile for "%s".'),$addr));
|
throw new Exception(sprintf(_m('Could not find a valid profile for "%s".'), $addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1774,20 +1793,26 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
* @param string $rendered HTML fragment for HTML page's body
|
* @param string $rendered HTML fragment for HTML page's body
|
||||||
* @return File
|
* @return File
|
||||||
*/
|
*/
|
||||||
function saveHTMLFile($title, $rendered)
|
public function saveHTMLFile($title, $rendered)
|
||||||
{
|
{
|
||||||
$final = sprintf("<!DOCTYPE html>\n" .
|
$final = sprintf(
|
||||||
'<html><head>' .
|
<<<'END'
|
||||||
'<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">' .
|
<!DOCTYPE html>
|
||||||
'<title>%s</title>' .
|
<html><head>
|
||||||
'</head>' .
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
'<body>%s</body></html>',
|
<title>%s</title>
|
||||||
htmlspecialchars($title),
|
</head>
|
||||||
$rendered);
|
<body>%s</body></html>
|
||||||
|
END,
|
||||||
|
htmlspecialchars($title),
|
||||||
|
$rendered
|
||||||
|
);
|
||||||
|
|
||||||
$filename = File::filename($this->localProfile(),
|
$filename = File::filename(
|
||||||
'ostatus', // ignored?
|
$this->localProfile(),
|
||||||
'text/html');
|
'ostatus', // ignored?
|
||||||
|
'text/html'
|
||||||
|
);
|
||||||
|
|
||||||
$filepath = File::path($filename);
|
$filepath = File::path($filename);
|
||||||
$fileurl = File::url($filename);
|
$fileurl = File::url($filename);
|
||||||
@ -1814,7 +1839,7 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function ensureProfileURI($uri)
|
public static function ensureProfileURI($uri)
|
||||||
{
|
{
|
||||||
$oprofile = null;
|
$oprofile = null;
|
||||||
|
|
||||||
@ -1842,13 +1867,15 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
default:
|
default:
|
||||||
// TRANS: Server exception.
|
// TRANS: Server exception.
|
||||||
// TRANS: %1$s is a protocol, %2$s is a URI.
|
// TRANS: %1$s is a protocol, %2$s is a URI.
|
||||||
throw new ServerException(sprintf(_m('Unrecognized URI protocol for profile: %1$s (%2$s).'),
|
throw new ServerException(sprintf(
|
||||||
$protocol,
|
_m('Unrecognized URI protocol for profile: %1$s (%2$s).'),
|
||||||
$uri));
|
$protocol,
|
||||||
|
$uri
|
||||||
|
));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TRANS: Server exception. %s is a URI.
|
// TRANS: Server exception. %s is a URI.
|
||||||
throw new ServerException(sprintf(_m('No URI protocol for profile: %s.'),$uri));
|
throw new ServerException(sprintf(_m('No URI protocol for profile: %s.'), $uri));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $oprofile;
|
return $oprofile;
|
||||||
@ -1861,9 +1888,11 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
$oprofile = self::ensureActorProfile($activity);
|
$oprofile = self::ensureActorProfile($activity);
|
||||||
if ($oprofile->isGroup() || $oprofile->isPeopletag()) {
|
if ($oprofile->isGroup() || $oprofile->isPeopletag()) {
|
||||||
// Groups can't post notices in StatusNet.
|
// Groups can't post notices in StatusNet.
|
||||||
common_log(LOG_WARNING,
|
common_log(
|
||||||
"OStatus: skipping post with group listed ".
|
LOG_WARNING,
|
||||||
"as author: " . $oprofile->getUri() . " in feed from " . $this->getUri());
|
'OStatus: skipping post with group listed as author: '
|
||||||
|
. "{$oprofile->getUri()} in feed from {$this->getUri()}"
|
||||||
|
);
|
||||||
throw new ServerException('Activity author is a non-actor');
|
throw new ServerException('Activity author is a non-actor');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1871,9 +1900,10 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
|
|
||||||
if (empty($actor)) {
|
if (empty($actor)) {
|
||||||
// OK here! assume the default
|
// OK here! assume the default
|
||||||
} else if ($actor->id == $this->getUri() || $actor->link == $this->getUri()) {
|
} elseif ($actor->id == $this->getUri()
|
||||||
|
|| $actor->link == $this->getUri()) {
|
||||||
$this->updateFromActivityObject($actor);
|
$this->updateFromActivityObject($actor);
|
||||||
} else if ($actor->id) {
|
} elseif ($actor->id) {
|
||||||
// We have an ActivityStreams actor with an explicit ID that doesn't match the feed owner.
|
// We have an ActivityStreams actor with an explicit ID that doesn't match the feed owner.
|
||||||
// This isn't what we expect from mainline OStatus person feeds!
|
// This isn't what we expect from mainline OStatus person feeds!
|
||||||
// Group feeds go down another path, with different validation...
|
// Group feeds go down another path, with different validation...
|
||||||
|
@ -1,35 +1,30 @@
|
|||||||
<?php
|
<?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
|
|
||||||
*
|
|
||||||
* Complete adding an OpenID
|
* Complete adding an OpenID
|
||||||
*
|
*
|
||||||
* 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
|
* @category Settings
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @author Evan Prodromou <evan@status.net>
|
||||||
* @copyright 2008-2009 StatusNet, Inc.
|
* @copyright 2008-2009 StatusNet, Inc.
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET')) {
|
defined('GNUSOCIAL') || die();
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once INSTALLDIR.'/plugins/OpenID/openid.php';
|
require_once INSTALLDIR.'/plugins/OpenID/openid.php';
|
||||||
|
|
||||||
@ -38,11 +33,10 @@ require_once INSTALLDIR.'/plugins/OpenID/openid.php';
|
|||||||
*
|
*
|
||||||
* Handle the return from an OpenID verification
|
* Handle the return from an OpenID verification
|
||||||
*
|
*
|
||||||
* @category Settings
|
* @category Settings
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @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
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
class FinishaddopenidAction extends Action
|
class FinishaddopenidAction extends Action
|
||||||
{
|
{
|
||||||
@ -128,7 +122,7 @@ class FinishaddopenidAction extends Action
|
|||||||
|
|
||||||
// start a transaction
|
// start a transaction
|
||||||
|
|
||||||
$cur->query('BEGIN');
|
$cur->query('START TRANSACTION');
|
||||||
|
|
||||||
$result = oid_link_user($cur->id, $canonical, $display);
|
$result = oid_link_user($cur->id, $canonical, $display);
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ class FinishsynchopenidAction extends Action
|
|||||||
|
|
||||||
// start a transaction
|
// start a transaction
|
||||||
|
|
||||||
$cur->query('BEGIN');
|
$cur->query('START TRANSACTION');
|
||||||
|
|
||||||
if (Event::handle('StartOpenIDUpdateUser', [$cur, $canonical, &$sreg])) {
|
if (Event::handle('StartOpenIDUpdateUser', [$cur, $canonical, &$sreg])) {
|
||||||
if (!oid_update_user($cur, $sreg)) {
|
if (!oid_update_user($cur, $sreg)) {
|
||||||
|
@ -1,44 +1,38 @@
|
|||||||
<?php
|
<?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
|
|
||||||
*
|
|
||||||
* OpenID bridge administration panel
|
* OpenID bridge 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
|
* @category Settings
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Zach Copley <zach@status.net>
|
* @author Zach Copley <zach@status.net>
|
||||||
* @copyright 2010 StatusNet, Inc.
|
* @copyright 2010 StatusNet, Inc.
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET')) {
|
defined('GNUSOCIAL') || die();
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Administer global OpenID settings
|
* Administer global OpenID settings
|
||||||
*
|
*
|
||||||
* @category Admin
|
* @category Admin
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Zach Copley <zach@status.net>
|
* @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
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
class OpenidadminpanelAction extends AdminPanelAction
|
class OpenidadminpanelAction extends AdminPanelAction
|
||||||
{
|
{
|
||||||
@ -47,10 +41,10 @@ class OpenidadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return string page title
|
* @return string page title
|
||||||
*/
|
*/
|
||||||
function title()
|
public function title()
|
||||||
{
|
{
|
||||||
// TRANS: Title for OpenID bridge administration page.
|
// TRANS: Title for OpenID bridge administration page.
|
||||||
return _m('TITLE','OpenID Settings');
|
return _m('TITLE', 'OpenID Settings');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,7 +52,7 @@ class OpenidadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return string instructions
|
* @return string instructions
|
||||||
*/
|
*/
|
||||||
function getInstructions()
|
public function getInstructions()
|
||||||
{
|
{
|
||||||
// TRANS: Page instructions.
|
// TRANS: Page instructions.
|
||||||
return _m('OpenID settings');
|
return _m('OpenID settings');
|
||||||
@ -69,7 +63,7 @@ class OpenidadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showForm()
|
public function showForm()
|
||||||
{
|
{
|
||||||
$form = new OpenIDAdminPanelForm($this);
|
$form = new OpenIDAdminPanelForm($this);
|
||||||
$form->show();
|
$form->show();
|
||||||
@ -81,7 +75,7 @@ class OpenidadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function saveSettings()
|
public function saveSettings()
|
||||||
{
|
{
|
||||||
static $settings = array(
|
static $settings = array(
|
||||||
'openid' => array('trusted_provider', 'required_team')
|
'openid' => array('trusted_provider', 'required_team')
|
||||||
@ -116,7 +110,7 @@ class OpenidadminpanelAction extends AdminPanelAction
|
|||||||
|
|
||||||
$config = new Config();
|
$config = new Config();
|
||||||
|
|
||||||
$config->query('BEGIN');
|
$config->query('START TRANSACTION');
|
||||||
|
|
||||||
foreach ($settings as $section => $parts) {
|
foreach ($settings as $section => $parts) {
|
||||||
foreach ($parts as $setting) {
|
foreach ($parts as $setting) {
|
||||||
@ -135,7 +129,7 @@ class OpenidadminpanelAction extends AdminPanelAction
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function validate(&$values)
|
public function validate(&$values)
|
||||||
{
|
{
|
||||||
// Validate consumer key and secret (can't be too long)
|
// Validate consumer key and secret (can't be too long)
|
||||||
|
|
||||||
@ -162,7 +156,7 @@ class OpenIDAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return int ID of the form
|
* @return int ID of the form
|
||||||
*/
|
*/
|
||||||
function id()
|
public function id()
|
||||||
{
|
{
|
||||||
return 'openidadminpanel';
|
return 'openidadminpanel';
|
||||||
}
|
}
|
||||||
@ -172,7 +166,7 @@ class OpenIDAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return string class of the form
|
* @return string class of the form
|
||||||
*/
|
*/
|
||||||
function formClass()
|
public function formClass()
|
||||||
{
|
{
|
||||||
return 'form_settings';
|
return 'form_settings';
|
||||||
}
|
}
|
||||||
@ -182,7 +176,7 @@ class OpenIDAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return string URL of the action
|
* @return string URL of the action
|
||||||
*/
|
*/
|
||||||
function action()
|
public function action()
|
||||||
{
|
{
|
||||||
return common_local_url('openidadminpanel');
|
return common_local_url('openidadminpanel');
|
||||||
}
|
}
|
||||||
@ -196,19 +190,22 @@ class OpenIDAdminPanelForm extends AdminForm
|
|||||||
* Make sure that the acting administrator has a valid OpenID matching,
|
* Make sure that the acting administrator has a valid OpenID matching,
|
||||||
* or more carefully warn folks.
|
* or more carefully warn folks.
|
||||||
*/
|
*/
|
||||||
function formData()
|
public function formData()
|
||||||
{
|
{
|
||||||
$this->out->elementStart(
|
$this->out->elementStart(
|
||||||
'fieldset',
|
'fieldset',
|
||||||
array('id' => 'settings_openid')
|
array('id' => 'settings_openid')
|
||||||
);
|
);
|
||||||
// TRANS: Fieldset legend.
|
// TRANS: Fieldset legend.
|
||||||
$this->out->element('legend', null, _m('LEGEND','Trusted provider'));
|
$this->out->element('legend', null, _m('LEGEND', 'Trusted provider'));
|
||||||
$this->out->element('p', 'form_guide',
|
$this->out->element(
|
||||||
|
'p',
|
||||||
|
'form_guide',
|
||||||
// TRANS: Form guide.
|
// TRANS: Form guide.
|
||||||
_m('By default, users are allowed to authenticate with any OpenID provider. ' .
|
_m('By default, users are allowed to authenticate with any OpenID provider. ' .
|
||||||
'If you are using your own OpenID service for shared sign-in, ' .
|
'If you are using your own OpenID service for shared sign-in, ' .
|
||||||
'you can restrict access to only your own users here.'));
|
'you can restrict access to only your own users here.')
|
||||||
|
);
|
||||||
$this->out->elementStart('ul', 'form_data');
|
$this->out->elementStart('ul', 'form_data');
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
@ -225,7 +222,8 @@ class OpenIDAdminPanelForm extends AdminForm
|
|||||||
$this->li();
|
$this->li();
|
||||||
$this->out->checkbox(
|
$this->out->checkbox(
|
||||||
// TRANS: Checkbox label.
|
// TRANS: Checkbox label.
|
||||||
'append_username', _m('Append a username to base URL'),
|
'append_username',
|
||||||
|
_m('Append a username to base URL'),
|
||||||
(bool) $this->value('append_username', 'openid'),
|
(bool) $this->value('append_username', 'openid'),
|
||||||
// TRANS: Checkbox title.
|
// TRANS: Checkbox title.
|
||||||
_m('Login form will show the base URL and prompt for a username to add at the end. Use when OpenID provider URL should be the profile page for individual users.'),
|
_m('Login form will show the base URL and prompt for a username to add at the end. Use when OpenID provider URL should be the profile page for individual users.'),
|
||||||
@ -252,7 +250,7 @@ class OpenIDAdminPanelForm extends AdminForm
|
|||||||
array('id' => 'settings_openid-options')
|
array('id' => 'settings_openid-options')
|
||||||
);
|
);
|
||||||
// TRANS: Fieldset legend.
|
// TRANS: Fieldset legend.
|
||||||
$this->out->element('legend', null, _m('LEGEND','Options'));
|
$this->out->element('legend', null, _m('LEGEND', 'Options'));
|
||||||
|
|
||||||
$this->out->elementStart('ul', 'form_data');
|
$this->out->elementStart('ul', 'form_data');
|
||||||
|
|
||||||
@ -260,7 +258,8 @@ class OpenIDAdminPanelForm extends AdminForm
|
|||||||
|
|
||||||
$this->out->checkbox(
|
$this->out->checkbox(
|
||||||
// TRANS: Checkbox label.
|
// TRANS: Checkbox label.
|
||||||
'openidonly', _m('Enable OpenID-only mode'),
|
'openidonly',
|
||||||
|
_m('Enable OpenID-only mode'),
|
||||||
(bool) $this->value('openidonly', 'site'),
|
(bool) $this->value('openidonly', 'site'),
|
||||||
// TRANS: Checkbox title.
|
// TRANS: Checkbox title.
|
||||||
_m('Require all users to login via OpenID. Warning: disables password authentication for all users!'),
|
_m('Require all users to login via OpenID. Warning: disables password authentication for all users!'),
|
||||||
@ -278,11 +277,16 @@ class OpenIDAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function formActions()
|
public function formActions()
|
||||||
{
|
{
|
||||||
// TRANS: Button text to save OpenID settings.
|
// TRANS: Button text to save OpenID settings.
|
||||||
$this->out->submit('submit', _m('BUTTON','Save'), 'submit', null,
|
$this->out->submit(
|
||||||
// TRANS: Button title to save OpenID settings.
|
'submit',
|
||||||
_m('Save OpenID settings.'));
|
_m('BUTTON', 'Save'),
|
||||||
|
'submit',
|
||||||
|
null,
|
||||||
|
// TRANS: Button title to save OpenID settings.
|
||||||
|
_m('Save OpenID settings.')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ class OverwriteThemeBackgroundAdminPanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showForm()
|
public function showForm()
|
||||||
{
|
{
|
||||||
$form = new OverwriteThemeBackgroundAdminPanelForm($this);
|
$form = new OverwriteThemeBackgroundAdminPanelForm($this);
|
||||||
$form->show();
|
$form->show();
|
||||||
@ -71,7 +71,7 @@ class OverwriteThemeBackgroundAdminPanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function saveSettings()
|
public function saveSettings()
|
||||||
{
|
{
|
||||||
static $settings = [
|
static $settings = [
|
||||||
'overwritethemebackground' => [
|
'overwritethemebackground' => [
|
||||||
@ -100,7 +100,7 @@ class OverwriteThemeBackgroundAdminPanelAction extends AdminPanelAction
|
|||||||
|
|
||||||
$config = new Config();
|
$config = new Config();
|
||||||
|
|
||||||
$config->query('BEGIN');
|
$config->query('START TRANSACTION');
|
||||||
|
|
||||||
foreach ($settings as $section => $parts) {
|
foreach ($settings as $section => $parts) {
|
||||||
foreach ($parts as $setting) {
|
foreach ($parts as $setting) {
|
||||||
@ -119,7 +119,7 @@ class OverwriteThemeBackgroundAdminPanelAction extends AdminPanelAction
|
|||||||
* @param $values
|
* @param $values
|
||||||
* @throws ClientException
|
* @throws ClientException
|
||||||
*/
|
*/
|
||||||
function validate(&$values)
|
public function validate(&$values)
|
||||||
{
|
{
|
||||||
// Validate background
|
// Validate background
|
||||||
if (!empty($values['overwritethemebackground']['background-image']) &&
|
if (!empty($values['overwritethemebackground']['background-image']) &&
|
||||||
@ -149,7 +149,7 @@ class OverwriteThemeBackgroundAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return int ID of the form
|
* @return int ID of the form
|
||||||
*/
|
*/
|
||||||
function id()
|
public function id()
|
||||||
{
|
{
|
||||||
return 'form_site_admin_panel';
|
return 'form_site_admin_panel';
|
||||||
}
|
}
|
||||||
@ -159,7 +159,7 @@ class OverwriteThemeBackgroundAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return string class of the form
|
* @return string class of the form
|
||||||
*/
|
*/
|
||||||
function formClass()
|
public function formClass()
|
||||||
{
|
{
|
||||||
return 'form_settings';
|
return 'form_settings';
|
||||||
}
|
}
|
||||||
@ -169,7 +169,7 @@ class OverwriteThemeBackgroundAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return string URL of the action
|
* @return string URL of the action
|
||||||
*/
|
*/
|
||||||
function action()
|
public function action()
|
||||||
{
|
{
|
||||||
return common_local_url('overwritethemebackgroundAdminPanel');
|
return common_local_url('overwritethemebackgroundAdminPanel');
|
||||||
}
|
}
|
||||||
@ -179,7 +179,7 @@ class OverwriteThemeBackgroundAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function formData()
|
public function formData()
|
||||||
{
|
{
|
||||||
$this->out->elementStart('fieldset', ['id' => 'settings_site_background']);
|
$this->out->elementStart('fieldset', ['id' => 'settings_site_background']);
|
||||||
// TRANS: Fieldset legend for form to change background.
|
// TRANS: Fieldset legend for form to change background.
|
||||||
@ -189,52 +189,68 @@ class OverwriteThemeBackgroundAdminPanelForm extends AdminForm
|
|||||||
/* Background colour */
|
/* Background colour */
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input('background-color',
|
$this->input(
|
||||||
|
'background-color',
|
||||||
// TRANS: Field label for GNU social site background.
|
// TRANS: Field label for GNU social site background.
|
||||||
_m('Site background color'),
|
_m('Site background color'),
|
||||||
// TRANS: Title for field label for GNU social site background.
|
// TRANS: Title for field label for GNU social site background.
|
||||||
'Background color for the site (hexadecimal with #).',
|
'Background color for the site (hexadecimal with #).',
|
||||||
'overwritethemebackground');
|
'overwritethemebackground'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
/* Background image */
|
/* Background image */
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input('background-image',
|
$this->input(
|
||||||
|
'background-image',
|
||||||
// TRANS: Field label for GNU social site background.
|
// TRANS: Field label for GNU social site background.
|
||||||
_m('Site background'),
|
_m('Site background'),
|
||||||
// TRANS: Title for field label for GNU social site background.
|
// TRANS: Title for field label for GNU social site background.
|
||||||
'Background for the site (full URL).',
|
'Background for the site (full URL).',
|
||||||
'overwritethemebackground');
|
'overwritethemebackground'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input('sslbackground-image',
|
$this->input(
|
||||||
|
'sslbackground-image',
|
||||||
// TRANS: Field label for SSL GNU social site background.
|
// TRANS: Field label for SSL GNU social site background.
|
||||||
_m('SSL background'),
|
_m('SSL background'),
|
||||||
// TRANS: Title for field label for SSL GNU social site background.
|
// TRANS: Title for field label for SSL GNU social site background.
|
||||||
'Background to show on SSL pages (full URL).',
|
'Background to show on SSL pages (full URL).',
|
||||||
'overwritethemebackground');
|
'overwritethemebackground'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
/* Background repeat */
|
/* Background repeat */
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
// TRANS: Dropdown label on site settings panel.
|
// TRANS: Dropdown label on site settings panel.
|
||||||
$this->out->dropdown('background-repeat', _m('Background repeat'),
|
$this->out->dropdown(
|
||||||
|
'background-repeat',
|
||||||
|
_m('Background repeat'),
|
||||||
// TRANS: Dropdown title on site settings panel.
|
// TRANS: Dropdown title on site settings panel.
|
||||||
['Repeat horizontally and vertically', 'Repeat Horizontally', 'Repeat Vertically', 'Don\'t repeat'], _m('repeat horizontally and/or vertically'),
|
['Repeat horizontally and vertically', 'Repeat Horizontally', 'Repeat Vertically', 'Don\'t repeat'],
|
||||||
false, common_config('overwritethemebackground', 'background-repeat') ?? 'repeat');
|
_m('repeat horizontally and/or vertically'),
|
||||||
|
false,
|
||||||
|
common_config('overwritethemebackground', 'background-repeat') ?? 'repeat'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
/* Background attachment */
|
/* Background attachment */
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
// TRANS: Dropdown label on site settings panel.
|
// TRANS: Dropdown label on site settings panel.
|
||||||
$this->out->dropdown('background-attachment', _m('Background attachment'),
|
$this->out->dropdown(
|
||||||
|
'background-attachment',
|
||||||
|
_m('Background attachment'),
|
||||||
// TRANS: Dropdown title on site settings panel.
|
// TRANS: Dropdown title on site settings panel.
|
||||||
['Scroll with page', 'Stay fixed'], _m('Whether the background image should scroll or be fixed (will not scroll with the rest of the page)'),
|
['Scroll with page', 'Stay fixed'],
|
||||||
false, common_config('overwritethemebackground', 'background-attachment') ?? 'scroll');
|
_m('Whether the background image should scroll or be fixed (will not scroll with the rest of the page)'),
|
||||||
|
false,
|
||||||
|
common_config('overwritethemebackground', 'background-attachment') ?? 'scroll'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
/* Background position */
|
/* Background position */
|
||||||
@ -253,10 +269,15 @@ class OverwriteThemeBackgroundAdminPanelForm extends AdminForm
|
|||||||
];
|
];
|
||||||
$this->li();
|
$this->li();
|
||||||
// TRANS: Dropdown label on site settings panel.
|
// TRANS: Dropdown label on site settings panel.
|
||||||
$this->out->dropdown('background-position', _m('Background position'),
|
$this->out->dropdown(
|
||||||
|
'background-position',
|
||||||
|
_m('Background position'),
|
||||||
// TRANS: Dropdown title on site settings panel.
|
// TRANS: Dropdown title on site settings panel.
|
||||||
$background_position_options, _m('Sets the starting position of a background image'),
|
$background_position_options,
|
||||||
false, common_config('overwritethemebackground', 'background-attachment') ?? 'initial');
|
_m('Sets the starting position of a background image'),
|
||||||
|
false,
|
||||||
|
common_config('overwritethemebackground', 'background-attachment') ?? 'initial'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->out->elementEnd('ul');
|
$this->out->elementEnd('ul');
|
||||||
@ -268,14 +289,16 @@ class OverwriteThemeBackgroundAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function formActions()
|
public function formActions()
|
||||||
{
|
{
|
||||||
$this->out->submit('submit',
|
$this->out->submit(
|
||||||
|
'submit',
|
||||||
// TRANS: Button text for saving site settings.
|
// TRANS: Button text for saving site settings.
|
||||||
_m('BUTTON', 'Save'),
|
_m('BUTTON', 'Save'),
|
||||||
'submit',
|
'submit',
|
||||||
null,
|
null,
|
||||||
// TRANS: Button title for saving site settings.
|
// TRANS: Button title for saving site settings.
|
||||||
_m('Save the site settings.'));
|
_m('Save the site settings.')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,44 +1,38 @@
|
|||||||
<?php
|
<?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
|
|
||||||
*
|
|
||||||
* Sitemap administration panel
|
* Sitemap 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 Sitemap
|
* @category Sitemap
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @author Evan Prodromou <evan@status.net>
|
||||||
* @copyright 2010 StatusNet, Inc.
|
* @copyright 2010 StatusNet, Inc.
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET')) {
|
defined('GNUSOCIAL') || die();
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Administer sitemap settings
|
* Administer sitemap settings
|
||||||
*
|
*
|
||||||
* @category Sitemap
|
* @category Sitemap
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @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
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
class SitemapadminpanelAction extends AdminPanelAction
|
class SitemapadminpanelAction extends AdminPanelAction
|
||||||
{
|
{
|
||||||
@ -47,7 +41,7 @@ class SitemapadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return string page title
|
* @return string page title
|
||||||
*/
|
*/
|
||||||
function title()
|
public function title()
|
||||||
{
|
{
|
||||||
// TRANS: Title for sitemap.
|
// TRANS: Title for sitemap.
|
||||||
return _m('Sitemap');
|
return _m('Sitemap');
|
||||||
@ -58,7 +52,7 @@ class SitemapadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return string instructions
|
* @return string instructions
|
||||||
*/
|
*/
|
||||||
function getInstructions()
|
public function getInstructions()
|
||||||
{
|
{
|
||||||
// TRANS: Instructions for sitemap.
|
// TRANS: Instructions for sitemap.
|
||||||
return _m('Sitemap settings for this StatusNet site');
|
return _m('Sitemap settings for this StatusNet site');
|
||||||
@ -69,7 +63,7 @@ class SitemapadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showForm()
|
public function showForm()
|
||||||
{
|
{
|
||||||
$form = new SitemapAdminPanelForm($this);
|
$form = new SitemapAdminPanelForm($this);
|
||||||
$form->show();
|
$form->show();
|
||||||
@ -81,7 +75,7 @@ class SitemapadminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function saveSettings()
|
public function saveSettings()
|
||||||
{
|
{
|
||||||
static $settings = array('sitemap' => array('yahookey', 'bingkey'));
|
static $settings = array('sitemap' => array('yahookey', 'bingkey'));
|
||||||
|
|
||||||
@ -100,7 +94,7 @@ class SitemapadminpanelAction extends AdminPanelAction
|
|||||||
|
|
||||||
$config = new Config();
|
$config = new Config();
|
||||||
|
|
||||||
$config->query('BEGIN');
|
$config->query('START TRANSACTION');
|
||||||
|
|
||||||
foreach ($settings as $section => $parts) {
|
foreach ($settings as $section => $parts) {
|
||||||
foreach ($parts as $setting) {
|
foreach ($parts as $setting) {
|
||||||
@ -113,7 +107,7 @@ class SitemapadminpanelAction extends AdminPanelAction
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function validate(&$values)
|
public function validate(&$values)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -128,7 +122,7 @@ class SitemapAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return int ID of the form
|
* @return int ID of the form
|
||||||
*/
|
*/
|
||||||
function id()
|
public function id()
|
||||||
{
|
{
|
||||||
return 'form_sitemap_admin_panel';
|
return 'form_sitemap_admin_panel';
|
||||||
}
|
}
|
||||||
@ -138,7 +132,7 @@ class SitemapAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return string class of the form
|
* @return string class of the form
|
||||||
*/
|
*/
|
||||||
function formClass()
|
public function formClass()
|
||||||
{
|
{
|
||||||
return 'form_sitemap';
|
return 'form_sitemap';
|
||||||
}
|
}
|
||||||
@ -148,7 +142,7 @@ class SitemapAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return string URL of the action
|
* @return string URL of the action
|
||||||
*/
|
*/
|
||||||
function action()
|
public function action()
|
||||||
{
|
{
|
||||||
return common_local_url('sitemapadminpanel');
|
return common_local_url('sitemapadminpanel');
|
||||||
}
|
}
|
||||||
@ -158,24 +152,28 @@ class SitemapAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function formData()
|
public function formData()
|
||||||
{
|
{
|
||||||
$this->out->elementStart('ul', 'form_data');
|
$this->out->elementStart('ul', 'form_data');
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input('yahookey',
|
$this->input(
|
||||||
// TRANS: Field label.
|
'yahookey',
|
||||||
_m('Yahoo key'),
|
// TRANS: Field label.
|
||||||
// TRANS: Title for field label.
|
_m('Yahoo key'),
|
||||||
_m('Yahoo! Site Explorer verification key.'),
|
// TRANS: Title for field label.
|
||||||
'sitemap');
|
_m('Yahoo! Site Explorer verification key.'),
|
||||||
|
'sitemap'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->input('bingkey',
|
$this->input(
|
||||||
// TRANS: Field label.
|
'bingkey',
|
||||||
_m('Bing key'),
|
// TRANS: Field label.
|
||||||
// TRANS: Title for field label.
|
_m('Bing key'),
|
||||||
_m('Bing Webmaster Tools verification key.'),
|
// TRANS: Title for field label.
|
||||||
'sitemap');
|
_m('Bing Webmaster Tools verification key.'),
|
||||||
|
'sitemap'
|
||||||
|
);
|
||||||
$this->unli();
|
$this->unli();
|
||||||
$this->out->elementEnd('ul');
|
$this->out->elementEnd('ul');
|
||||||
}
|
}
|
||||||
@ -185,14 +183,16 @@ class SitemapAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function formActions()
|
public function formActions()
|
||||||
{
|
{
|
||||||
$this->out->submit('submit',
|
$this->out->submit(
|
||||||
// TRANS: Submit button text to save sitemap settings.
|
'submit',
|
||||||
_m('BUTTON','Save'),
|
// TRANS: Submit button text to save sitemap settings.
|
||||||
'submit',
|
_m('BUTTON', 'Save'),
|
||||||
null,
|
'submit',
|
||||||
// TRANS: Submit button title to save sitemap settings.
|
null,
|
||||||
_m('Save sitemap settings.'));
|
// TRANS: Submit button title to save sitemap settings.
|
||||||
|
_m('Save sitemap settings.')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,44 +1,41 @@
|
|||||||
<?php
|
<?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
|
|
||||||
*
|
|
||||||
* Twitter bridge administration panel
|
* Twitter bridge 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
|
* 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/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* @category Settings
|
* @category Settings
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Zach Copley <zach@status.net>
|
* @author Zach Copley <zach@status.net>
|
||||||
* @copyright 2010 StatusNet, Inc.
|
* @copyright 2010 StatusNet, Inc.
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET')) {
|
defined('GNUSOCIAL') || die();
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Administer global Twitter bridge settings
|
* Administer global Twitter bridge settings
|
||||||
*
|
*
|
||||||
* @category Admin
|
* @category Admin
|
||||||
* @package StatusNet
|
* @package GNUsocial
|
||||||
* @author Zach Copley <zach@status.net>
|
* @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
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||||
* @link http://status.net/
|
|
||||||
*/
|
*/
|
||||||
class TwitteradminpanelAction extends AdminPanelAction
|
class TwitteradminpanelAction extends AdminPanelAction
|
||||||
{
|
{
|
||||||
@ -47,10 +44,10 @@ class TwitteradminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return string page title
|
* @return string page title
|
||||||
*/
|
*/
|
||||||
function title()
|
public function title()
|
||||||
{
|
{
|
||||||
// TRANS: Page title for Twitter administration panel.
|
// TRANS: Page title for Twitter administration panel.
|
||||||
return _m('TITLE','Twitter');
|
return _m('TITLE', 'Twitter');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,7 +55,7 @@ class TwitteradminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return string instructions
|
* @return string instructions
|
||||||
*/
|
*/
|
||||||
function getInstructions()
|
public function getInstructions()
|
||||||
{
|
{
|
||||||
// TRANS: Instructions for Twitter bridge administration page.
|
// TRANS: Instructions for Twitter bridge administration page.
|
||||||
return _m('Twitter bridge settings');
|
return _m('Twitter bridge settings');
|
||||||
@ -69,7 +66,7 @@ class TwitteradminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showForm()
|
public function showForm()
|
||||||
{
|
{
|
||||||
$form = new TwitterAdminPanelForm($this);
|
$form = new TwitterAdminPanelForm($this);
|
||||||
$form->show();
|
$form->show();
|
||||||
@ -81,7 +78,7 @@ class TwitteradminpanelAction extends AdminPanelAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function saveSettings()
|
public function saveSettings()
|
||||||
{
|
{
|
||||||
static $settings = array(
|
static $settings = array(
|
||||||
'twitter' => array('consumer_key', 'consumer_secret'),
|
'twitter' => array('consumer_key', 'consumer_secret'),
|
||||||
@ -119,7 +116,7 @@ class TwitteradminpanelAction extends AdminPanelAction
|
|||||||
|
|
||||||
$config = new Config();
|
$config = new Config();
|
||||||
|
|
||||||
$config->query('BEGIN');
|
$config->query('START TRANSACTION');
|
||||||
|
|
||||||
foreach ($settings as $section => $parts) {
|
foreach ($settings as $section => $parts) {
|
||||||
foreach ($parts as $setting) {
|
foreach ($parts as $setting) {
|
||||||
@ -143,7 +140,7 @@ class TwitteradminpanelAction extends AdminPanelAction
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function validate(&$values)
|
public function validate(&$values)
|
||||||
{
|
{
|
||||||
// Validate consumer key and secret (can't be too long)
|
// Validate consumer key and secret (can't be too long)
|
||||||
|
|
||||||
@ -162,7 +159,7 @@ class TwitteradminpanelAction extends AdminPanelAction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isImportEnabled()
|
public function isImportEnabled()
|
||||||
{
|
{
|
||||||
// Since daemon setup isn't automated yet...
|
// Since daemon setup isn't automated yet...
|
||||||
// @todo: if merged into main queues, detect presence of daemon config
|
// @todo: if merged into main queues, detect presence of daemon config
|
||||||
@ -177,7 +174,7 @@ class TwitterAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return int ID of the form
|
* @return int ID of the form
|
||||||
*/
|
*/
|
||||||
function id()
|
public function id()
|
||||||
{
|
{
|
||||||
return 'twitteradminpanel';
|
return 'twitteradminpanel';
|
||||||
}
|
}
|
||||||
@ -187,7 +184,7 @@ class TwitterAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return string class of the form
|
* @return string class of the form
|
||||||
*/
|
*/
|
||||||
function formClass()
|
public function formClass()
|
||||||
{
|
{
|
||||||
return 'form_settings';
|
return 'form_settings';
|
||||||
}
|
}
|
||||||
@ -197,7 +194,7 @@ class TwitterAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return string URL of the action
|
* @return string URL of the action
|
||||||
*/
|
*/
|
||||||
function action()
|
public function action()
|
||||||
{
|
{
|
||||||
return common_local_url('twitteradminpanel');
|
return common_local_url('twitteradminpanel');
|
||||||
}
|
}
|
||||||
@ -207,7 +204,7 @@ class TwitterAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function formData()
|
public function formData()
|
||||||
{
|
{
|
||||||
$this->out->elementStart(
|
$this->out->elementStart(
|
||||||
'fieldset',
|
'fieldset',
|
||||||
@ -276,7 +273,8 @@ class TwitterAdminPanelForm extends AdminForm
|
|||||||
|
|
||||||
$this->out->checkbox(
|
$this->out->checkbox(
|
||||||
// TRANS: Checkbox label for global setting.
|
// TRANS: Checkbox label for global setting.
|
||||||
'signin', _m('Enable "Sign-in with Twitter"'),
|
'signin',
|
||||||
|
_m('Enable "Sign-in with Twitter"'),
|
||||||
(bool) $this->value('signin', 'twitter'),
|
(bool) $this->value('signin', 'twitter'),
|
||||||
// TRANS: Checkbox title.
|
// TRANS: Checkbox title.
|
||||||
_m('This allow users to login with their Twitter credentials.')
|
_m('This allow users to login with their Twitter credentials.')
|
||||||
@ -287,7 +285,8 @@ class TwitterAdminPanelForm extends AdminForm
|
|||||||
$this->li();
|
$this->li();
|
||||||
$this->out->checkbox(
|
$this->out->checkbox(
|
||||||
// TRANS: Checkbox label for global setting.
|
// TRANS: Checkbox label for global setting.
|
||||||
'enabled', _m('Enable Twitter import'),
|
'enabled',
|
||||||
|
_m('Enable Twitter import'),
|
||||||
(bool) $this->value('enabled', 'twitterimport'),
|
(bool) $this->value('enabled', 'twitterimport'),
|
||||||
// TRANS: Checkbox title for global setting.
|
// TRANS: Checkbox title for global setting.
|
||||||
_m('Allow users to import their Twitter friends\' timelines. Requires daemons to be manually configured.')
|
_m('Allow users to import their Twitter friends\' timelines. Requires daemons to be manually configured.')
|
||||||
@ -305,11 +304,16 @@ class TwitterAdminPanelForm extends AdminForm
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function formActions()
|
public function formActions()
|
||||||
{
|
{
|
||||||
// TRANS: Button text for saving the administrative Twitter bridge settings.
|
// TRANS: Button text for saving the administrative Twitter bridge settings.
|
||||||
$this->out->submit('submit', _m('BUTTON','Save'), 'submit', null,
|
$this->out->submit(
|
||||||
// TRANS: Button title for saving the administrative Twitter bridge settings.
|
'submit',
|
||||||
_m('Save the Twitter bridge settings.'));
|
_m('BUTTON', 'Save'),
|
||||||
|
'submit',
|
||||||
|
null,
|
||||||
|
// TRANS: Button title for saving the administrative Twitter bridge settings.
|
||||||
|
_m('Save the Twitter bridge settings.')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,7 @@ class TwitterImport
|
|||||||
}
|
}
|
||||||
|
|
||||||
$profile = new Profile();
|
$profile = new Profile();
|
||||||
$profile->query("BEGIN");
|
$profile->query('START TRANSACTION');
|
||||||
$profile->nickname = $twuser->screen_name;
|
$profile->nickname = $twuser->screen_name;
|
||||||
$profile->fullname = $twuser->name;
|
$profile->fullname = $twuser->name;
|
||||||
$profile->homepage = $twuser->url;
|
$profile->homepage = $twuser->url;
|
||||||
|
@ -65,7 +65,6 @@ function main()
|
|||||||
fixupUserBadNulls();
|
fixupUserBadNulls();
|
||||||
fixupGroupURI();
|
fixupGroupURI();
|
||||||
if ($iterate_files) {
|
if ($iterate_files) {
|
||||||
printfnq("Running file iterations:\n");
|
|
||||||
printfnq("* "); fixupFileGeometry();
|
printfnq("* "); fixupFileGeometry();
|
||||||
printfnq("* "); deleteLocalFileThumbnailsWithoutFilename();
|
printfnq("* "); deleteLocalFileThumbnailsWithoutFilename();
|
||||||
printfnq("* "); deleteMissingLocalFileThumbnails();
|
printfnq("* "); deleteMissingLocalFileThumbnails();
|
||||||
@ -305,7 +304,7 @@ function initGroupProfileId()
|
|||||||
$profile->created = $group->created;
|
$profile->created = $group->created;
|
||||||
$profile->modified = $group->modified;
|
$profile->modified = $group->modified;
|
||||||
|
|
||||||
$profile->query('BEGIN');
|
$profile->query('START TRANSACTION');
|
||||||
$id = $profile->insert();
|
$id = $profile->insert();
|
||||||
if (empty($id)) {
|
if (empty($id)) {
|
||||||
$profile->query('ROLLBACK');
|
$profile->query('ROLLBACK');
|
||||||
|
Loading…
Reference in New Issue
Block a user