diff --git a/EVENTS.txt b/EVENTS.txt index 5bf6078a1c..e1620a7e2a 100644 --- a/EVENTS.txt +++ b/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) diff --git a/actions/all.php b/actions/all.php index f558c3925f..8ee3ec3fa6 100644 --- a/actions/all.php +++ b/actions/all.php @@ -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 diff --git a/lib/docfile.php b/lib/docfile.php index 982177315a..e396870695 100644 --- a/lib/docfile.php +++ b/lib/docfile.php @@ -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)) { diff --git a/lib/searchaction.php b/lib/searchaction.php index 030d2bb724..fd5f0b3ff5 100644 --- a/lib/searchaction.php +++ b/lib/searchaction.php @@ -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; diff --git a/plugins/DomainStatusNetwork/scripts/installforemail.php b/plugins/DomainStatusNetwork/scripts/installforemail.php index a1f7a65cd3..98ce620c28 100644 --- a/plugins/DomainStatusNetwork/scripts/installforemail.php +++ b/plugins/DomainStatusNetwork/scripts/installforemail.php @@ -22,8 +22,16 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); +$shortoptions = 'wt::'; +$longoptions = array('welcome', 'template='); + $helptext = << +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"; diff --git a/plugins/EmailRegistration/EmailRegistrationPlugin.php b/plugins/EmailRegistration/EmailRegistrationPlugin.php index 548702514a..8759614129 100644 --- a/plugins/EmailRegistration/EmailRegistrationPlugin.php +++ b/plugins/EmailRegistration/EmailRegistrationPlugin.php @@ -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', diff --git a/plugins/EmailRegistration/mail-src/confirmemailreg b/plugins/EmailRegistration/mail-src/confirmemailreg new file mode 100644 index 0000000000..954a2c0dfc --- /dev/null +++ b/plugins/EmailRegistration/mail-src/confirmemailreg @@ -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. diff --git a/plugins/EmailRegistration/scripts/registeremailuser.php b/plugins/EmailRegistration/scripts/registeremailuser.php index a8c942d3dd..02915240d3 100644 --- a/plugins/EmailRegistration/scripts/registeremailuser.php +++ b/plugins/EmailRegistration/scripts/registeremailuser.php @@ -20,11 +20,15 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); +$shortoptions = 'wt::'; +$longoptions = array('welcome', 'template='); + $helptext = << 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));