update commitaddress

This commit is contained in:
Evan Prodromou 2009-01-18 18:41:41 +00:00
parent c0f23a2703
commit f2b06b8bbd
1 changed files with 76 additions and 10 deletions

View File

@ -1,9 +1,12 @@
<?php
/*
* Laconica - a distributed open-source microblogging tool
* Copyright (C) 2008, Controlez-Vous, Inc.
/**
* Laconica, the distributed open-source microblogging tool
*
* This program is free software: you can redistribute it and/or modify
* 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.
@ -15,12 +18,49 @@
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Confirm
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @copyright 2008-2009 Control Yourself, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
*/
if (!defined('LACONICA')) { exit(1); }
if (!defined('LACONICA')) {
exit(1);
}
/**
* Confirm an address
*
* When users change their SMS, email, Jabber, or other addresses, we send out
* a confirmation code to make sure the owner of that address approves. This class
* accepts those codes.
*
* @category Confirm
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
*/
class ConfirmaddressAction extends Action
{
/** type of confirmation. */
var $type = null;
/**
* Accept a confirmation code
*
* Checks the code and confirms the address in the
* user record
*
* @param args $args $_REQUEST array
*
* @return void
*/
function handle($args)
{
@ -62,8 +102,8 @@ class ConfirmaddressAction extends Action
$cur->$type = $confirm->address;
if ($type == 'sms') {
$cur->carrier = ($confirm->address_extra)+0;
$carrier = Sms_carrier::staticGet($cur->carrier);
$cur->carrier = ($confirm->address_extra)+0;
$carrier = Sms_carrier::staticGet($cur->carrier);
$cur->smsemail = $carrier->toEmailAddress($cur->sms);
}
@ -89,9 +129,35 @@ class ConfirmaddressAction extends Action
$cur->query('COMMIT');
common_show_header(_('Confirm Address'));
$this->type = $type;
$this->showPage();
}
/**
* Title of the page
*
* @return string title
*/
function title()
{
return _('Confirm Address');
}
/**
* Show a confirmation message.
*
* @return void
*/
function showContent()
{
$cur = common_current_user();
$type = $this->type;
$this->element('p', null,
sprintf(_('The address "%s" has been confirmed for your account.'), $cur->$type));
common_show_footer();
sprintf(_('The address "%s" has been '.
'confirmed for your account.'),
$cur->$type));
}
}