exit(1);
}
-require_once INSTALLDIR.'/lib/connectsettingsaction.php';
-
/**
* Settings for SMS
*
* @see SettingsAction
*/
-class SmssettingsAction extends ConnectSettingsAction
+class SmssettingsAction extends SettingsAction
{
/**
* Title of the page
*
* @return string Title of the page
*/
-
function title()
{
// TRANS: Title for SMS settings.
*
* @return instructions for use
*/
-
function getInstructions()
{
// XXX: For consistency of parameters in messages, this should be a
*
* @return void
*/
-
function showContent()
{
if (!common_config('sms', 'enabled')) {
} else {
$confirm = $this->getConfirmation();
if ($confirm) {
- $carrier = Sms_carrier::staticGet($confirm->address_extra);
+ $carrier = Sms_carrier::getKV($confirm->address_extra);
$this->element('p', 'form_unconfirmed',
$confirm->address . ' (' . $carrier->name . ')');
$this->element('p', 'form_guide',
($this->arg('sms')) ? $this->arg('sms') : null,
// TRANS: SMS phone number input field instructions in SMS settings form.
_('Phone number, no punctuation or spaces, '.
- 'with area code'));
+ 'with area code.'));
$this->elementEnd('li');
$this->elementEnd('ul');
$this->carrierSelect();
*
* @todo very similar to EmailsettingsAction::getConfirmation(); refactor?
*/
-
function getConfirmation()
{
$user = common_current_user();
*
* @return void
*/
-
function handlePost()
{
// CSRF protection
$token = $this->trimmed('token');
if (!$token || $token != common_session_token()) {
+ // TRANS: Client error displayed when the session token does not match or is not given.
$this->showForm(_('There was a problem with your session token. '.
'Try again, please.'));
return;
*
* @return void
*/
-
function savePreferences()
{
$smsnotify = $this->boolean('smsnotify');
if ($result === false) {
common_log_db_error($user, 'UPDATE', __FILE__);
// TRANS: Server error thrown on database error updating SMS preferences.
- $this->serverError(_('Couldn\'t update user.'));
- return;
+ $this->serverError(_('Could not update user.'));
}
$user->query('COMMIT');
*
* @return void
*/
-
function addAddress()
{
$user = common_current_user();
if ($result === false) {
common_log_db_error($confirm, 'INSERT', __FILE__);
// TRANS: Server error thrown on database error adding SMS confirmation code.
- $this->serverError(_('Couldn\'t insert confirmation code.'));
- return;
+ $this->serverError(_('Could not insert confirmation code.'));
}
- $carrier = Sms_carrier::staticGet($carrier_id);
+ $carrier = Sms_carrier::getKV($carrier_id);
mail_confirm_sms($confirm->code,
$user->nickname,
*
* @return void
*/
-
function cancelConfirmation()
{
$sms = $this->trimmed('sms');
if (!$result) {
common_log_db_error($confirm, 'DELETE', __FILE__);
// TRANS: Server error thrown on database error canceling SMS phone number confirmation.
- $this->serverError(_('Couldn\'t delete email confirmation.'));
- return;
+ $this->serverError(_('Could not delete SMS confirmation.'));
}
// TRANS: Message given after successfully canceling SMS phone number confirmation.
*
* @return void
*/
-
function removeAddress()
{
$user = common_current_user();
if (!$result) {
common_log_db_error($user, 'UPDATE', __FILE__);
// TRANS: Server error thrown on database error removing a registered SMS phone number.
- $this->serverError(_('Couldn\'t update user.'));
- return;
+ $this->serverError(_('Could not update user.'));
}
$user->query('COMMIT');
*
* @return boolean does the number exist
*/
-
function smsExists($sms)
{
$user = common_current_user();
- $other = User::staticGet('sms', $sms);
+ $other = User::getKV('sms', $sms);
if (!$other) {
return false;
*
* @return void
*/
-
function carrierSelect()
{
$carrier = new Sms_carrier();
*
* @return void
*/
-
function confirmCode()
{
$code = $this->trimmed('code');
if (!$code) {
// TRANS: Message given saving SMS phone number confirmation code without having provided one.
- $this->showForm(_('No code entered'));
+ $this->showForm(_('No code entered.'));
return;
}
*
* @return void
*/
-
function removeIncoming()
{
$user = common_current_user();
if (!$user->incomingemail) {
+ // TRANS: Form validation error displayed when trying to remove an incoming e-mail address while no address has been set.
$this->showForm(_('No incoming email address.'));
return;
}
if (!$user->updateKeys($orig)) {
common_log_db_error($user, 'UPDATE', __FILE__);
- $this->serverError(_("Couldn't update user record."));
+ // TRANS: Server error displayed when the user could not be updated in SMS settings.
+ $this->serverError(_('Could not update user record.'));
}
+ // TRANS: Confirmation text after updating SMS settings.
$this->showForm(_('Incoming email address removed.'), true);
}
*
* @see Emailsettings::newIncoming
*/
-
function newIncoming()
{
$user = common_current_user();
if (!$user->updateKeys($orig)) {
common_log_db_error($user, 'UPDATE', __FILE__);
- $this->serverError(_("Couldn't update user record."));
+ // TRANS: Server error displayed when the user could not be updated in SMS settings.
+ $this->serverError(_('Could not update user record.'));
}
+ // TRANS: Confirmation text after updating SMS settings.
$this->showForm(_('New incoming email address added.'), true);
}
}