X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fsmssettings.php;h=672abcef8c15587e0eda8e089578e4bbea496c0a;hb=c899e4a84ee45b65950980ccb87e52129871d58e;hp=f89cbe1ab9dda11bec07ced6f3203ed27e28a2a3;hpb=a7c85bebd5be9ea019a8c80d74730d7eb28d4651;p=quix0rs-gnu-social.git diff --git a/actions/smssettings.php b/actions/smssettings.php index f89cbe1ab9..672abcef8c 100644 --- a/actions/smssettings.php +++ b/actions/smssettings.php @@ -1,6 +1,6 @@ . * * @category Settings - * @package Laconica - * @author Evan Prodromou - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -37,10 +37,10 @@ require_once INSTALLDIR.'/lib/connectsettingsaction.php'; * Settings for SMS * * @category Settings - * @package Laconica - * @author Evan Prodromou + * @package StatusNet + * @author Evan Prodromou * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ * * @see SettingsAction */ @@ -69,6 +69,12 @@ class SmssettingsAction extends ConnectSettingsAction return _('You can receive SMS messages through email from %%site.name%%.'); } + function showScripts() + { + parent::showScripts(); + $this->autofocus('sms'); + } + /** * Content area of the page * @@ -80,6 +86,12 @@ class SmssettingsAction extends ConnectSettingsAction function showContent() { + if (!common_config('sms', 'enabled')) { + $this->element('div', array('class' => 'error'), + _('SMS is not available.')); + return; + } + $user = common_current_user(); $this->elementStart('form', array('method' => 'post', @@ -488,6 +500,58 @@ class SmssettingsAction extends ConnectSettingsAction } common_redirect(common_local_url('confirmaddress', - array('code' => $code))); + array('code' => $code)), + 303); + } + + /** + * Handle a request to remove an incoming email address + * + * @return void + */ + + function removeIncoming() + { + $user = common_current_user(); + + if (!$user->incomingemail) { + $this->showForm(_('No incoming email address.')); + return; + } + + $orig = clone($user); + + $user->incomingemail = null; + + if (!$user->updateKeys($orig)) { + common_log_db_error($user, 'UPDATE', __FILE__); + $this->serverError(_("Couldn't update user record.")); + } + + $this->showForm(_('Incoming email address removed.'), true); + } + + /** + * Generate a new incoming email address + * + * @return void + * + * @see Emailsettings::newIncoming + */ + + function newIncoming() + { + $user = common_current_user(); + + $orig = clone($user); + + $user->incomingemail = mail_new_incoming_address(); + + if (!$user->updateKeys($orig)) { + common_log_db_error($user, 'UPDATE', __FILE__); + $this->serverError(_("Couldn't update user record.")); + } + + $this->showForm(_('New incoming email address added.'), true); } }