summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-03-23 15:55:07 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-03-23 15:55:07 -0400
commit8c073a34ce472fc8d0385659a222339a5ba4254a (patch)
tree57c83c48333b52a93b84d0910f9450c210e1815c /actions
parentb3a0eea3b66e95becb6c4595ed71c7fe71ed6437 (diff)
parent14afe2d26874ed30a0ccef5e0acda2c5171afcde (diff)
Merge branch '0.7.x' into 0.8.x
Diffstat (limited to 'actions')
-rw-r--r--actions/groupsearch.php11
-rw-r--r--actions/noticesearch.php6
-rw-r--r--actions/noticesearchrss.php3
-rw-r--r--actions/peoplesearch.php6
-rw-r--r--actions/public.php11
-rw-r--r--actions/recoverpassword.php22
-rw-r--r--actions/showgroup.php15
-rw-r--r--actions/shownotice.php16
-rw-r--r--actions/showstream.php14
9 files changed, 67 insertions, 37 deletions
diff --git a/actions/groupsearch.php b/actions/groupsearch.php
index 9b0026db9..109a53ce1 100644
--- a/actions/groupsearch.php
+++ b/actions/groupsearch.php
@@ -1,9 +1,4 @@
<?php
-
-
-// define('GROUPS_PER_PAGE', 20);
-
-
/**
* Group search action class.
*
@@ -90,15 +85,15 @@ class GroupSearchResults extends GroupList
{
var $terms = null;
var $pattern = null;
-
+
function __construct($user_group, $terms, $action)
{
parent::__construct($user_group, $terms, $action);
- $this->terms = array_map('preg_quote',
+ $this->terms = array_map('preg_quote',
array_map('htmlspecialchars', $terms));
$this->pattern = '/('.implode('|',$terms).')/i';
}
-
+
function highlight($text)
{
return preg_replace($this->pattern, '<strong>\\1</strong>', htmlspecialchars($text));
diff --git a/actions/noticesearch.php b/actions/noticesearch.php
index 83e59dd9a..4aec41621 100644
--- a/actions/noticesearch.php
+++ b/actions/noticesearch.php
@@ -103,7 +103,7 @@ class NoticesearchAction extends SearchAction
function showResults($q, $page)
{
$notice = new Notice();
- $q = strtolower($q);
+
$search_engine = $notice->getSearchEngine('identica_notices');
$search_engine->set_sort_mode('chron');
// Ask for an extra to see if there's more.
@@ -122,8 +122,8 @@ class NoticesearchAction extends SearchAction
$cnt = $nl->show();
- $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
- $this->page, 'noticesearch', array('q' => $q));
+ $this->pagination($page > 1, $cnt > NOTICES_PER_PAGE,
+ $page, 'noticesearch', array('q' => $q));
}
function isReadOnly()
{
diff --git a/actions/noticesearchrss.php b/actions/noticesearchrss.php
index 0f98ed04b..ba5276d06 100644
--- a/actions/noticesearchrss.php
+++ b/actions/noticesearchrss.php
@@ -62,9 +62,6 @@ class NoticesearchrssAction extends Rss10Action
$notice = new Notice();
- # lcase it for comparison
- $q = strtolower($q);
-
$search_engine = $notice->getSearchEngine('identica_notices');
$search_engine->set_sort_mode('chron');
diff --git a/actions/peoplesearch.php b/actions/peoplesearch.php
index 14177fcf0..9e515ade1 100644
--- a/actions/peoplesearch.php
+++ b/actions/peoplesearch.php
@@ -63,13 +63,13 @@ class PeoplesearchAction extends SearchAction
$profile = new Profile();
- # lcase it for comparison
- $q = strtolower($q);
+ // lcase it for comparison
+ // $q = strtolower($q);
$search_engine = $profile->getSearchEngine('identica_people');
$search_engine->set_sort_mode('chron');
- # Ask for an extra to see if there's more.
+ // Ask for an extra to see if there's more.
$search_engine->limit((($page-1)*PROFILES_PER_PAGE), PROFILES_PER_PAGE + 1);
if (false === $search_engine->query($q)) {
$cnt = 0;
diff --git a/actions/public.php b/actions/public.php
index a20ae4032..9b22e0a2c 100644
--- a/actions/public.php
+++ b/actions/public.php
@@ -207,9 +207,14 @@ class PublicAction extends Action
function showAnonymousMessage()
{
- $m = _('This is %%site.name%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
- 'based on the Free Software [Laconica](http://laconi.ca/) tool. ' .
- '[Join now](%%action.register%%) to share notices about yourself with friends, family, and colleagues! ([Read more](%%doc.help%%))');
+ if (! (common_config('site','closed') || common_config('site','inviteonly'))) {
+ $m = _('This is %%site.name%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
+ 'based on the Free Software [Laconica](http://laconi.ca/) tool. ' .
+ '[Join now](%%action.register%%) to share notices about yourself with friends, family, and colleagues! ([Read more](%%doc.help%%))');
+ } else {
+ $m = _('This is %%site.name%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
+ 'based on the Free Software [Laconica](http://laconi.ca/) tool.');
+ }
$this->elementStart('div', array('id' => 'anon_notice'));
$this->raw(common_markup_to_html($m));
$this->elementEnd('div');
diff --git a/actions/recoverpassword.php b/actions/recoverpassword.php
index eeb6b2516..620fe7eb8 100644
--- a/actions/recoverpassword.php
+++ b/actions/recoverpassword.php
@@ -181,13 +181,21 @@ class RecoverpasswordAction extends Action
function showRecoverForm()
{
$this->elementStart('form', array('method' => 'post',
- 'id' => 'recoverpassword',
+ 'id' => 'form_password_recover',
+ 'class' => 'form_settings',
'action' => common_local_url('recoverpassword')));
+ $this->elementStart('fieldset');
+ $this->element('legend', null, _('Password recover'));
+ $this->elementStart('ul', 'form_data');
+ $this->elementStart('li');
$this->input('nicknameoremail', _('Nickname or email'),
$this->trimmed('nicknameoremail'),
_('Your nickname on this server, ' .
'or your registered email address.'));
+ $this->elementEnd('li');
+ $this->elementEnd('ul');
$this->submit('recover', _('Recover'));
+ $this->elementEnd('fieldset');
$this->elementEnd('form');
}
@@ -213,14 +221,24 @@ class RecoverpasswordAction extends Action
function showResetForm()
{
$this->elementStart('form', array('method' => 'post',
- 'id' => 'recoverpassword',
+ 'id' => 'form_password_change',
+ 'class' => 'form_settings',
'action' => common_local_url('recoverpassword')));
+ $this->elementStart('fieldset');
+ $this->element('legend', null, _('Password change'));
$this->hidden('token', common_session_token());
+ $this->elementStart('ul', 'form_data');
+ $this->elementStart('li');
$this->password('newpassword', _('New password'),
_('6 or more characters, and don\'t forget it!'));
+ $this->elementEnd('li');
+ $this->elementStart('li');
$this->password('confirm', _('Confirm'),
_('Same as password above'));
+ $this->elementEnd('li');
+ $this->elementEnd('ul');
$this->submit('reset', _('Reset'));
+ $this->elementEnd('fieldset');
$this->elementEnd('form');
}
diff --git a/actions/showgroup.php b/actions/showgroup.php
index b6022840b..58cc7a97c 100644
--- a/actions/showgroup.php
+++ b/actions/showgroup.php
@@ -390,11 +390,18 @@ class ShowgroupAction extends Action
function showAnonymousMessage()
{
- $m = sprintf(_('**%s** is a user group on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
- 'based on the Free Software [Laconica](http://laconi.ca/) tool. Its members share ' .
- 'short messages about their life and interests. '.
- '[Join now](%%%%action.register%%%%) to become part of this group and many more! ([Read more](%%%%doc.help%%%%))'),
+ if (!(common_config('site','closed') || common_config('site','inviteonly'))) {
+ $m = sprintf(_('**%s** is a user group on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
+ 'based on the Free Software [Laconica](http://laconi.ca/) tool. Its members share ' .
+ 'short messages about their life and interests. '.
+ '[Join now](%%%%action.register%%%%) to become part of this group and many more! ([Read more](%%%%doc.help%%%%))'),
$this->group->nickname);
+ } else {
+ $m = sprintf(_('**%s** is a user group on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
+ 'based on the Free Software [Laconica](http://laconi.ca/) tool. Its members share ' .
+ 'short messages about their life and interests. '),
+ $this->group->nickname);
+ }
$this->elementStart('div', array('id' => 'anon_notice'));
$this->raw(common_markup_to_html($m));
$this->elementEnd('div');
diff --git a/actions/shownotice.php b/actions/shownotice.php
index d5f35cd84..ccae49bb3 100644
--- a/actions/shownotice.php
+++ b/actions/shownotice.php
@@ -177,10 +177,17 @@ class ShownoticeAction extends Action
{
parent::handle($args);
- $this->showPage();
+ if ($this->notice->is_local == 0) {
+ if (!empty($this->notice->url)) {
+ common_redirect($this->notice->url, 301);
+ } else if (!empty($this->notice->uri) && preg_match('/^https?:/', $this->notice->uri)) {
+ common_redirect($this->notice->uri, 301);
+ }
+ } else {
+ $this->showPage();
+ }
}
-
/**
* Don't show local navigation
*
@@ -191,7 +198,6 @@ class ShownoticeAction extends Action
{
}
-
/**
* Fill the content area of the page
*
@@ -208,8 +214,6 @@ class ShownoticeAction extends Action
$this->elementEnd('ul');
}
-
-
/**
* Don't show page notice
*
@@ -220,7 +224,6 @@ class ShownoticeAction extends Action
{
}
-
/**
* Don't show aside
*
@@ -230,7 +233,6 @@ class ShownoticeAction extends Action
function showAside() {
}
-
/**
* Extra <head> content
*
diff --git a/actions/showstream.php b/actions/showstream.php
index 65482167e..b83f45d53 100644
--- a/actions/showstream.php
+++ b/actions/showstream.php
@@ -539,10 +539,16 @@ class ShowstreamAction extends Action
function showAnonymousMessage()
{
- $m = sprintf(_('**%s** has an account on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
- 'based on the Free Software [Laconica](http://laconi.ca/) tool. ' .
- '[Join now](%%%%action.register%%%%) to follow **%s**\'s notices and many more! ([Read more](%%%%doc.help%%%%))'),
- $this->user->nickname, $this->user->nickname);
+ if (!(common_config('site','closed') || common_config('site','inviteonly'))) {
+ $m = sprintf(_('**%s** has an account on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
+ 'based on the Free Software [Laconica](http://laconi.ca/) tool. ' .
+ '[Join now](%%%%action.register%%%%) to follow **%s**\'s notices and many more! ([Read more](%%%%doc.help%%%%))'),
+ $this->user->nickname, $this->user->nickname);
+ } else {
+ $m = sprintf(_('**%s** has an account on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
+ 'based on the Free Software [Laconica](http://laconi.ca/) tool. '),
+ $this->user->nickname, $this->user->nickname);
+ }
$this->elementStart('div', array('id' => 'anon_notice'));
$this->raw(common_markup_to_html($m));
$this->elementEnd('div');