summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-04-07 11:40:38 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-04-07 11:40:38 -0400
commit770788d98eb9dfca51e6299e023edab26765c0bf (patch)
tree17817163962b9c8aaea7dfdbc3cc2ed3cdd7b774
parent4cc6d0ea2c7bec551c7726d7a336afea17d27df8 (diff)
parent17fb51f747c023392cd6127abe9b019e693f0544 (diff)
Merge branch '0.7.x' of git@gitorious.org:laconica/dev into 0.7.x
-rw-r--r--actions/favorited.php19
-rw-r--r--actions/groupsearch.php24
-rw-r--r--actions/noticesearch.php21
-rw-r--r--actions/peoplesearch.php19
-rw-r--r--actions/public.php3
-rw-r--r--actions/publictagcloud.php2
-rw-r--r--db/notice_source.sql3
-rw-r--r--doc-src/bookmarklet8
-rw-r--r--lib/searchaction.php23
-rw-r--r--lib/util.php6
-rw-r--r--scripts/laconica.spec15
11 files changed, 104 insertions, 39 deletions
diff --git a/actions/favorited.php b/actions/favorited.php
index 231b97897..20a354674 100644
--- a/actions/favorited.php
+++ b/actions/favorited.php
@@ -143,6 +143,25 @@ class FavoritedAction extends Action
$this->elementStart('div', 'instructions');
$this->raw($output);
$this->elementEnd('div');
+
+ $favorite = new Fave;
+
+ if ($favorite->count()) {
+ return;
+ }
+
+ $message = _('Favorite notices appear on this page but noone has favorited one yet.') . ' ';
+
+ if (common_logged_in()) {
+ $message .= _('Be the first to add a notice to your favorites by clicking the fave button next to any notice you like.');
+ }
+ else {
+ $message .= _('Why not [register an account](%%action.register%%) and be the first to add a notice to your favorites!');
+ }
+
+ $this->elementStart('div', 'blankfiller');
+ $this->raw(common_markup_to_html($message));
+ $this->elementEnd('div');
}
/**
diff --git a/actions/groupsearch.php b/actions/groupsearch.php
index 109a53ce1..31c4ffd94 100644
--- a/actions/groupsearch.php
+++ b/actions/groupsearch.php
@@ -72,12 +72,23 @@ class GroupsearchAction extends SearchAction
$terms = preg_split('/[\s,]+/', $q);
$results = new GroupSearchResults($user_group, $terms, $this);
$results->show();
+ $user_group->free();
+ $this->pagination($page > 1, $cnt > GROUPS_PER_PAGE,
+ $page, 'groupsearch', array('q' => $q));
} else {
- $this->element('p', 'error', _('No results'));
+ $this->element('p', 'error', _('No results.'));
+ $this->searchSuggestions($q);
+ if (common_logged_in()) {
+ $message = _('If you can\'t find the group you\'re looking for, you can [create it](%%action.newgroup%%) yourself.');
+ }
+ else {
+ $message = _('Why not [register an account](%%action.register%%) and [create the group](%%action.newgroup%%) yourself!');
+ }
+ $this->elementStart('div', 'blankfiller');
+ $this->raw(common_markup_to_html($message));
+ $this->elementEnd('div');
+ $user_group->free();
}
- $user_group->free();
- $this->pagination($page > 1, $cnt > GROUPS_PER_PAGE,
- $page, 'groupsearch', array('q' => $q));
}
}
@@ -98,10 +109,5 @@ class GroupSearchResults extends GroupList
{
return preg_replace($this->pattern, '<strong>\\1</strong>', htmlspecialchars($text));
}
-
- function isReadOnly()
- {
- return true;
- }
}
diff --git a/actions/noticesearch.php b/actions/noticesearch.php
index 9058cf53c..a4308450b 100644
--- a/actions/noticesearch.php
+++ b/actions/noticesearch.php
@@ -114,22 +114,27 @@ class NoticesearchAction extends SearchAction
$cnt = $notice->find();
}
if ($cnt === 0) {
- $this->element('p', 'error', _('No results'));
+ $this->element('p', 'error', _('No results.'));
+
+ $this->searchSuggestions($q);
+ if (common_logged_in()) {
+ $message = sprintf(_('Be the first to [post on this topic](%%%%action.newnotice%%%%?status_textarea=%s)!'), urlencode($q));
+ }
+ else {
+ $message = sprintf(_('Why not [register an account](%%%%action.register%%%%) and be the first to [post on this topic](%%%%action.newnotice%%%%?status_textarea=%s)!'), urlencode($q));
+ }
+
+ $this->elementStart('div', 'blankfiller');
+ $this->raw(common_markup_to_html($message));
+ $this->elementEnd('div');
return;
}
$terms = preg_split('/[\s,]+/', $q);
$nl = new SearchNoticeList($notice, $this, $terms);
-
$cnt = $nl->show();
-
$this->pagination($page > 1, $cnt > NOTICES_PER_PAGE,
$page, 'noticesearch', array('q' => $q));
}
-
- function isReadOnly()
- {
- return true;
- }
}
class SearchNoticeList extends NoticeList {
diff --git a/actions/peoplesearch.php b/actions/peoplesearch.php
index 9e515ade1..65d970dd1 100644
--- a/actions/peoplesearch.php
+++ b/actions/peoplesearch.php
@@ -60,14 +60,8 @@ class PeoplesearchAction extends SearchAction
function showResults($q, $page)
{
-
$profile = new Profile();
-
- // 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.
$search_engine->limit((($page-1)*PROFILES_PER_PAGE), PROFILES_PER_PAGE + 1);
@@ -81,14 +75,15 @@ class PeoplesearchAction extends SearchAction
$terms = preg_split('/[\s,]+/', $q);
$results = new PeopleSearchResults($profile, $terms, $this);
$results->show();
+ $profile->free();
+ $this->pagination($page > 1, $cnt > PROFILES_PER_PAGE,
+ $page, 'peoplesearch', array('q' => $q));
+
} else {
- $this->element('p', 'error', _('No results'));
+ $this->element('p', 'error', _('No results.'));
+ $this->searchSuggestions($q);
+ $profile->free();
}
-
- $profile->free();
-
- $this->pagination($page > 1, $cnt > PROFILES_PER_PAGE,
- $page, 'peoplesearch', array('q' => $q));
}
}
diff --git a/actions/public.php b/actions/public.php
index fca90488f..5a2720a9a 100644
--- a/actions/public.php
+++ b/actions/public.php
@@ -168,14 +168,13 @@ class PublicAction extends Action
function showPageNotice()
{
- $notice = Notice::publicStream(0, 1);
+ $notice = new Notice;
if (!$notice) {
$this->serverError(_('Could not retrieve public stream.'));
return;
}
- // no notices in the public stream, let's get out of here
if ($notice->count()) {
return;
}
diff --git a/actions/publictagcloud.php b/actions/publictagcloud.php
index 5322372b2..5bc7e0cbf 100644
--- a/actions/publictagcloud.php
+++ b/actions/publictagcloud.php
@@ -63,7 +63,7 @@ class PublictagcloudAction extends Action
sprintf(_('These are most popular recent tags on %s '),
common_config('site', 'name')));
- $tags = new Notice_tag();
+ $tags = new Notice_tag;
if ($tags->count()) {
return;
}
diff --git a/db/notice_source.sql b/db/notice_source.sql
index 18ce1ecbe..52d555dbf 100644
--- a/db/notice_source.sql
+++ b/db/notice_source.sql
@@ -46,4 +46,5 @@ VALUES
('twitux','Twitux','http://live.gnome.org/DanielMorales/Twitux', now()),
('twitvim','TwitVim','http://vim.sourceforge.net/scripts/script.php?script_id=2204', now()),
('urfastr','urfastr','http://urfastr.net/', now()),
- ('adium', 'Adium', 'http://www.adiumx.com/', now());
+ ('adium', 'Adium', 'http://www.adiumx.com/', now()),
+ ('yatca','Yatca','http://www.yatca.com/', now());
diff --git a/doc-src/bookmarklet b/doc-src/bookmarklet
new file mode 100644
index 000000000..03c0e97c9
--- /dev/null
+++ b/doc-src/bookmarklet
@@ -0,0 +1,8 @@
+A bookmarklet is a small piece of javascript code used as a bookmark. This one will let you post to %%site.name%% simply by selecting some text on a page and pressing the bookmarklet.
+
+Drag-and-drop the following link to your bookmarks bar or right-click it and add it to your browser favorites to keep it handy.
+
+<MTMarkdownOptions output='raw'>
+<a href="javascript:var%20d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='http://%%site.server%%/%%site.path%%/notice/new',l=d.location,e=encodeURIComponent,g=f+'?status_textarea=%22'+e(s)+'%22 from '+l.href;function%20a(){if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=720,height=570')){l.href=g;}}a();void(0);">Post to %%site.name%%</a>
+</MTMarkdownOptions>
+
diff --git a/lib/searchaction.php b/lib/searchaction.php
index c762db16f..918f8dd9a 100644
--- a/lib/searchaction.php
+++ b/lib/searchaction.php
@@ -133,5 +133,28 @@ class SearchAction extends Action
$this->showResults($q, $page);
}
}
+
+ function searchSuggestions($q) {
+ $qe = urlencode($q);
+ $message = sprintf(_(<<<E_O_T
+* Make sure all words are spelled correctly.
+* Try different keywords.
+* Try more general keywords.
+* Try fewer keywords.
+
+You can also try your search on other engines:
+
+* [Twingly](http://www.twingly.com/search?q=%s&content=microblog&site=identi.ca)
+* [Tweet scan](http://www.tweetscan.com/indexi.php?s=%s)
+* [Google](http://www.google.com/search?q=site%%3A%%%%site.server%%%%+%s)
+* [Yahoo](http://search.yahoo.com/search?p=site%%3A%%%%site.server%%%%+%s)
+
+
+E_O_T
+), $qe, $qe, $qe, $qe);
+ $this->elementStart('div', 'blankfiller');
+ $this->raw(common_markup_to_html($message));
+ $this->elementEnd('div');
+ }
}
diff --git a/lib/util.php b/lib/util.php
index 73410e289..b17a44bd8 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -581,10 +581,8 @@ function common_shorten_link($url, $reverse = false)
function common_xml_safe_str($str)
{
- $xmlStr = htmlentities(iconv('UTF-8', 'UTF-8//IGNORE', $str), ENT_NOQUOTES, 'UTF-8');
-
- // Replace control, formatting, and surrogate characters with '*', ala Twitter
- return preg_replace('/[\p{Cc}\p{Cf}\p{Cs}]/u', '*', $str);
+ // Neutralize control codes and surrogates
+ return preg_replace('/[\p{Cc}\p{Cs}]/u', '*', $str);
}
function common_tag_link($tag)
diff --git a/scripts/laconica.spec b/scripts/laconica.spec
index 5f0ed5fa9..331e10671 100644
--- a/scripts/laconica.spec
+++ b/scripts/laconica.spec
@@ -1,11 +1,14 @@
+# This version needs to match the tarball and unpacked directory name.
+%define LACVER 0.7.3
+
BuildRequires: php-pear
BuildRequires: httpd-devel
Name: laconica
-Version: 0.7.2
+Version: %{LACVER}
Release: 1%{?dist}
License: GAGPL v3 or later
-Source: laconica-0.7.2.tar.gz
+Source: laconica-%{version}.tar.gz
Group: Applications/Internet
Summary: Laconica, the Open Source microblogging platform
BuildArch: noarch
@@ -49,6 +52,8 @@ cp -a * %{buildroot}%{wwwpath}
mkdir -p %{buildroot}%{_datadir}/laconica
cp -a db %{buildroot}%{_datadir}/laconica/db
+mkdir -p %{buildroot}%{_datadir}/laconica/avatar
+
mkdir -p %{buildroot}%{_sysconfdir}/httpd/conf.d
cat > %{buildroot}%{_sysconfdir}/httpd/conf.d/laconica.conf <<"EOF"
Alias /laconica/ "/var/www/laconica/"
@@ -74,6 +79,12 @@ rm -rf %buildroot
%config(noreplace) %{_sysconfdir}/httpd/conf.d/laconica.conf
%changelog
+* Wed Apr 03 2009 Zach Copley <zach@controlyourself.ca> - 0.7.3
+- Changed version number to 0.7.3.
+
+* Fri Mar 13 2009 Ken Sedgwick <ksedgwic@bonsai.com> - 0.7.2.1-1
+- Factored laconica version to the first line of the file.
+
* Wed Mar 03 2009 Zach Copley <zach@controlyourself.ca> - 0.7.2
- Changed version number to 0.7.2.