diff --git a/actions/favorited.php b/actions/favorited.php index 231b978973..20a354674f 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/public.php b/actions/public.php index fca90488fe..5a2720a9ad 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 5322372b2a..5bc7e0cbff 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 d28a09383f..5d48e66b62 100644 --- a/db/notice_source.sql +++ b/db/notice_source.sql @@ -45,4 +45,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/lib/util.php b/lib/util.php index ad1044fa23..78b5a36f87 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)