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
|
StartRegisterSuccess: After showing the registration success message
|
||||||
- $action: the registration action
|
- $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()
|
function title()
|
||||||
{
|
{
|
||||||
if ($this->page > 1) {
|
$user = common_current_user();
|
||||||
// TRANS: Page title. %1$s is user nickname, %2$d is page number
|
if ($user->id == $this->user->id) {
|
||||||
return sprintf(_('%1$s and friends, page %2$d'), $this->user->nickname, $this->page);
|
return _('Home timeline');
|
||||||
} else {
|
} else {
|
||||||
// TRANS: Page title. %s is user nickname
|
$profile = $this->user->getProfile();
|
||||||
return sprintf(_("%s and friends"), $this->user->nickname);
|
return sprintf(_("%s's home timeline"), $profile->getBestName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,18 +190,6 @@ class AllAction extends ProfileAction
|
|||||||
// $pop = new InboxTagCloudSection($this, $this->user);
|
// $pop = new InboxTagCloudSection($this, $this->user);
|
||||||
// $pop->show();
|
// $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
|
class ThreadingInboxNoticeStream extends ThreadingNoticeStream
|
||||||
|
@ -63,24 +63,29 @@ class DocFile
|
|||||||
|
|
||||||
$filename = null;
|
$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 = $path.'/'.$title;
|
||||||
$def = null;
|
|
||||||
|
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.'.*');
|
Event::handle('EndDocFileForTitle', array($title, $paths, &$filename));
|
||||||
|
|
||||||
if ($lang === false) {
|
|
||||||
$lang = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($lang) || !empty($def)) {
|
|
||||||
$filename = self::negotiateLanguage($lang, $def);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($filename)) {
|
if (empty($filename)) {
|
||||||
|
@ -62,20 +62,6 @@ class SearchAction extends Action
|
|||||||
$this->showPage();
|
$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)
|
function showTop($arr=null)
|
||||||
{
|
{
|
||||||
$error = null;
|
$error = null;
|
||||||
|
@ -22,8 +22,16 @@
|
|||||||
|
|
||||||
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
|
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
|
||||||
|
|
||||||
|
$shortoptions = 'wt::';
|
||||||
|
$longoptions = array('welcome', 'template=');
|
||||||
|
|
||||||
$helptext = <<<END_OF_INSTALLFOREMAIL_HELP
|
$helptext = <<<END_OF_INSTALLFOREMAIL_HELP
|
||||||
|
|
||||||
installforemail.php [options] <email address>
|
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;
|
END_OF_INSTALLFOREMAIL_HELP;
|
||||||
|
|
||||||
@ -54,6 +62,16 @@ StatusNet::switchSite($sn->nickname);
|
|||||||
|
|
||||||
$confirm = EmailRegistrationPlugin::registerEmail($email);
|
$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));
|
$confirmUrl = common_local_url('register', array('code' => $confirm->code));
|
||||||
|
|
||||||
print $confirmUrl."\n";
|
print $confirmUrl."\n";
|
||||||
|
@ -155,7 +155,7 @@ class EmailRegistrationPlugin extends Plugin
|
|||||||
return $nickname;
|
return $nickname;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function sendConfirmEmail($confirm)
|
static function sendConfirmEmail($confirm, $title=null)
|
||||||
{
|
{
|
||||||
$sitename = common_config('site', 'name');
|
$sitename = common_config('site', 'name');
|
||||||
|
|
||||||
@ -165,25 +165,31 @@ class EmailRegistrationPlugin extends Plugin
|
|||||||
$headers['To'] = trim($confirm->address);
|
$headers['To'] = trim($confirm->address);
|
||||||
// TRANS: Subject for confirmation e-mail.
|
// TRANS: Subject for confirmation e-mail.
|
||||||
// TRANS: %s is the StatusNet sitename.
|
// 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));
|
$confirmUrl = common_local_url('register', array('code' => $confirm->code));
|
||||||
|
|
||||||
// TRANS: Body for confirmation e-mail.
|
if (empty($title)) {
|
||||||
// TRANS: %1$s is the StatusNet sitename, %2$s is the confirmation URL.
|
$title = 'confirmemailreg';
|
||||||
$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.'.
|
$confirmTemplate = DocFile::forTitle($title, DocFile::mailPaths());
|
||||||
"\n".
|
|
||||||
'%2$s'.
|
$body = $confirmTemplate->toHTML(array('confirmurl' => $confirmUrl));
|
||||||
"\n".
|
|
||||||
'If it was not you, you can safely ignore this message.'),
|
|
||||||
$sitename,
|
|
||||||
$confirmUrl);
|
|
||||||
|
|
||||||
mail_send($recipients, $headers, $body);
|
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)
|
function onPluginVersion(&$versions)
|
||||||
{
|
{
|
||||||
$versions[] = array('name' => 'EmailRegistration',
|
$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__) . '/../../..'));
|
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
|
||||||
|
|
||||||
|
$shortoptions = 'wt::';
|
||||||
|
$longoptions = array('welcome', 'template=');
|
||||||
|
|
||||||
$helptext = <<<END_OF_REGISTEREMAILUSER_HELP
|
$helptext = <<<END_OF_REGISTEREMAILUSER_HELP
|
||||||
registeremailuser.php [options] <email address>
|
registeremailuser.php [options] <email address>
|
||||||
|
|
||||||
Options:
|
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.
|
register a new user by email address.
|
||||||
|
|
||||||
@ -40,8 +44,14 @@ $email = $args[0];
|
|||||||
|
|
||||||
$confirm = EmailRegistrationPlugin::registerEmail($email);
|
$confirm = EmailRegistrationPlugin::registerEmail($email);
|
||||||
|
|
||||||
if (have_option('e', 'email')) {
|
if (have_option('w', 'welcome')) {
|
||||||
EmailRegistrationPlugin::sendConfirmEmail($confirm);
|
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));
|
$confirmUrl = common_local_url('register', array('code' => $confirm->code));
|
||||||
|
Loading…
Reference in New Issue
Block a user