Merge branch '1.0.x' into testing
This commit is contained in:
commit
900b9ab498
10
EVENTS.txt
10
EVENTS.txt
@ -1381,3 +1381,13 @@ StartRegisterSuccess: Before showing the registration success message
|
||||
|
||||
StartRegisterSuccess: After showing the registration success message
|
||||
- $action: the registration action
|
||||
|
||||
StartDocFileForTitle: Before searching for a doc or mail template
|
||||
- $title: Title we're looking for
|
||||
- &$paths: Paths we're searching
|
||||
- &$filename: Filename so far (set this if you want)
|
||||
|
||||
EndDocFileForTitle: After searching for a doc or mail template
|
||||
- $title: Title we looked for
|
||||
- $paths: Paths we searched
|
||||
- &$filename: Filename so far (set this if you want)
|
||||
|
@ -84,12 +84,12 @@ class AllAction extends ProfileAction
|
||||
|
||||
function title()
|
||||
{
|
||||
if ($this->page > 1) {
|
||||
// TRANS: Page title. %1$s is user nickname, %2$d is page number
|
||||
return sprintf(_('%1$s and friends, page %2$d'), $this->user->nickname, $this->page);
|
||||
$user = common_current_user();
|
||||
if ($user->id == $this->user->id) {
|
||||
return _('Home timeline');
|
||||
} else {
|
||||
// TRANS: Page title. %s is user nickname
|
||||
return sprintf(_("%s and friends"), $this->user->nickname);
|
||||
$profile = $this->user->getProfile();
|
||||
return sprintf(_("%s's home timeline"), $profile->getBestName());
|
||||
}
|
||||
}
|
||||
|
||||
@ -190,18 +190,6 @@ class AllAction extends ProfileAction
|
||||
// $pop = new InboxTagCloudSection($this, $this->user);
|
||||
// $pop->show();
|
||||
}
|
||||
|
||||
function showPageTitle()
|
||||
{
|
||||
$user = common_current_user();
|
||||
if ($user && ($user->id == $this->user->id)) {
|
||||
// TRANS: H1 text for page when viewing a list for self.
|
||||
$this->element('h1', null, _("You and friends"));
|
||||
} else {
|
||||
// TRANS: H1 text for page. %s is a user nickname.
|
||||
$this->element('h1', null, sprintf(_('%s and friends'), $this->user->nickname));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ThreadingInboxNoticeStream extends ThreadingNoticeStream
|
||||
|
@ -63,24 +63,29 @@ class DocFile
|
||||
|
||||
$filename = null;
|
||||
|
||||
foreach ($paths as $path) {
|
||||
if (Event::handle('StartDocFileForTitle', array($title, &$paths, &$filename))) {
|
||||
|
||||
$def = $path.'/'.$title;
|
||||
foreach ($paths as $path) {
|
||||
|
||||
if (!file_exists($def)) {
|
||||
$def = null;
|
||||
$def = $path.'/'.$title;
|
||||
|
||||
if (!file_exists($def)) {
|
||||
$def = null;
|
||||
}
|
||||
|
||||
$lang = glob($path.'/'.$title.'.*');
|
||||
|
||||
if ($lang === false) {
|
||||
$lang = array();
|
||||
}
|
||||
|
||||
if (!empty($lang) || !empty($def)) {
|
||||
$filename = self::negotiateLanguage($lang, $def);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$lang = glob($path.'/'.$title.'.*');
|
||||
|
||||
if ($lang === false) {
|
||||
$lang = array();
|
||||
}
|
||||
|
||||
if (!empty($lang) || !empty($def)) {
|
||||
$filename = self::negotiateLanguage($lang, $def);
|
||||
break;
|
||||
}
|
||||
Event::handle('EndDocFileForTitle', array($title, $paths, &$filename));
|
||||
}
|
||||
|
||||
if (empty($filename)) {
|
||||
|
@ -62,20 +62,6 @@ class SearchAction extends Action
|
||||
$this->showPage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show tabset for this page
|
||||
*
|
||||
* Uses the SearchGroupNav widget
|
||||
*
|
||||
* @return void
|
||||
* @see SearchGroupNav
|
||||
*/
|
||||
function showObjectNav()
|
||||
{
|
||||
$nav = new SearchGroupNav($this, $this->trimmed('q'));
|
||||
$nav->show();
|
||||
}
|
||||
|
||||
function showTop($arr=null)
|
||||
{
|
||||
$error = null;
|
||||
|
@ -22,8 +22,16 @@
|
||||
|
||||
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
|
||||
|
||||
$shortoptions = 'wt::';
|
||||
$longoptions = array('welcome', 'template=');
|
||||
|
||||
$helptext = <<<END_OF_INSTALLFOREMAIL_HELP
|
||||
|
||||
installforemail.php [options] <email address>
|
||||
Create a new account and, if necessary, a new network for the given email address
|
||||
|
||||
-w --welcome Send a welcome email
|
||||
-t --template= Use this email template
|
||||
|
||||
END_OF_INSTALLFOREMAIL_HELP;
|
||||
|
||||
@ -54,6 +62,16 @@ StatusNet::switchSite($sn->nickname);
|
||||
|
||||
$confirm = EmailRegistrationPlugin::registerEmail($email);
|
||||
|
||||
if (have_option('w', 'welcome')) {
|
||||
if (have_option('t', 'template')) {
|
||||
// use the provided template
|
||||
EmailRegistrationPlugin::sendConfirmEmail($confirm, get_option_value('t', 'template'));
|
||||
} else {
|
||||
// use the default template
|
||||
EmailRegistrationPlugin::sendConfirmEmail($confirm);
|
||||
}
|
||||
}
|
||||
|
||||
$confirmUrl = common_local_url('register', array('code' => $confirm->code));
|
||||
|
||||
print $confirmUrl."\n";
|
||||
|
@ -155,7 +155,7 @@ class EmailRegistrationPlugin extends Plugin
|
||||
return $nickname;
|
||||
}
|
||||
|
||||
static function sendConfirmEmail($confirm)
|
||||
static function sendConfirmEmail($confirm, $title=null)
|
||||
{
|
||||
$sitename = common_config('site', 'name');
|
||||
|
||||
@ -165,25 +165,31 @@ class EmailRegistrationPlugin extends Plugin
|
||||
$headers['To'] = trim($confirm->address);
|
||||
// TRANS: Subject for confirmation e-mail.
|
||||
// TRANS: %s is the StatusNet sitename.
|
||||
$headers['Subject'] = sprintf(_m('Confirm your registration on %s'), $sitename);
|
||||
$headers['Subject'] = sprintf(_m('Welcome to %s'), $sitename);
|
||||
$headers['Content-Type'] = 'text/html; charset=UTF-8';
|
||||
|
||||
$confirmUrl = common_local_url('register', array('code' => $confirm->code));
|
||||
|
||||
// TRANS: Body for confirmation e-mail.
|
||||
// TRANS: %1$s is the StatusNet sitename, %2$s is the confirmation URL.
|
||||
$body = sprintf(_m('Someone (probably you) has requested an account on %1$s using this email address.'.
|
||||
"\n".
|
||||
'To confirm the address, click the following URL or copy it into the address bar of your browser.'.
|
||||
"\n".
|
||||
'%2$s'.
|
||||
"\n".
|
||||
'If it was not you, you can safely ignore this message.'),
|
||||
$sitename,
|
||||
$confirmUrl);
|
||||
if (empty($title)) {
|
||||
$title = 'confirmemailreg';
|
||||
}
|
||||
|
||||
$confirmTemplate = DocFile::forTitle($title, DocFile::mailPaths());
|
||||
|
||||
$body = $confirmTemplate->toHTML(array('confirmurl' => $confirmUrl));
|
||||
|
||||
mail_send($recipients, $headers, $body);
|
||||
}
|
||||
|
||||
function onEndDocFileForTitle($title, $paths, &$filename)
|
||||
{
|
||||
if ($title == 'confirmemailreg' && empty($filename)) {
|
||||
$filename = dirname(__FILE__).'/mail-src/'.$title;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function onPluginVersion(&$versions)
|
||||
{
|
||||
$versions[] = array('name' => 'EmailRegistration',
|
||||
|
7
plugins/EmailRegistration/mail-src/confirmemailreg
Normal file
7
plugins/EmailRegistration/mail-src/confirmemailreg
Normal file
@ -0,0 +1,7 @@
|
||||
Someone (probably you) has requested an account on %%site.name%% using this email address.
|
||||
|
||||
To confirm the address, click the following URL or copy it into the address bar of your browser.
|
||||
|
||||
> [%%arg.confirmurl%%](%%arg.confirmurl%%)
|
||||
|
||||
If it was not you, you can safely ignore this message.
|
@ -20,11 +20,15 @@
|
||||
|
||||
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
|
||||
|
||||
$shortoptions = 'wt::';
|
||||
$longoptions = array('welcome', 'template=');
|
||||
|
||||
$helptext = <<<END_OF_REGISTEREMAILUSER_HELP
|
||||
registeremailuser.php [options] <email address>
|
||||
|
||||
Options:
|
||||
-e --email Send a confirmation message to the email address
|
||||
-w --welcome Send a welcome email
|
||||
-t --template= Use this email template
|
||||
|
||||
register a new user by email address.
|
||||
|
||||
@ -40,8 +44,14 @@ $email = $args[0];
|
||||
|
||||
$confirm = EmailRegistrationPlugin::registerEmail($email);
|
||||
|
||||
if (have_option('e', 'email')) {
|
||||
EmailRegistrationPlugin::sendConfirmEmail($confirm);
|
||||
if (have_option('w', 'welcome')) {
|
||||
if (have_option('t', 'template')) {
|
||||
// use the provided template
|
||||
EmailRegistrationPlugin::sendConfirmEmail($confirm, get_option_value('t', 'template'));
|
||||
} else {
|
||||
// use the default template
|
||||
EmailRegistrationPlugin::sendConfirmEmail($confirm);
|
||||
}
|
||||
}
|
||||
|
||||
$confirmUrl = common_local_url('register', array('code' => $confirm->code));
|
||||
|
Loading…
Reference in New Issue
Block a user