From d6245dca6347a670445701e9c726b0719ea945c8 Mon Sep 17 00:00:00 2001 From: Sean Murphy Date: Fri, 6 Feb 2009 18:36:34 -0500 Subject: Fixed #1048: Edit avatar link on profile page. --- actions/showstream.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'actions') diff --git a/actions/showstream.php b/actions/showstream.php index eab1fc0a2..3b4c97865 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -245,6 +245,15 @@ class ShowstreamAction extends Action 'height' => AVATAR_PROFILE_SIZE, 'alt' => $this->profile->nickname)); $this->elementEnd('dd'); + + $user = User::staticGet('id', $this->profile->id); + $cur = common_current_user(); + if ($cur && $cur->id == $user->id) { + $this->elementStart('dd'); + $this->element('a', array('href' => common_local_url('avatarsettings')), _('Edit Avatar')); + $this->elementEnd('dd'); + } + $this->elementEnd('dl'); $this->elementStart('dl', 'entity_nickname'); @@ -317,7 +326,6 @@ class ShowstreamAction extends Action $this->element('h2', null, _('User actions')); $this->elementStart('ul'); $this->elementStart('li', array('class' => 'entity_subscribe')); - $cur = common_current_user(); if ($cur) { if ($cur->id != $this->profile->id) { if ($cur->isSubscribed($this->profile)) { @@ -335,7 +343,6 @@ class ShowstreamAction extends Action // common_profile_new_message_nudge($cur, $this->user, $this->profile); - $user = User::staticGet('id', $this->profile->id); if ($cur && $cur->id != $user->id && $cur->mutuallySubscribed($user)) { $this->elementStart('li', array('class' => 'entity_send-a-message')); $this->element('a', array('href' => common_local_url('newmessage', array('to' => $user->id)), -- cgit v1.2.3-54-g00ecf From 43888b523919f816e45a956a2e9f7d10416067df Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Mon, 9 Feb 2009 15:35:38 +0000 Subject: trac #1160 fix dropdown xmloutput function for the selected attribute and fix newmessage auto-selected dropdown. --- actions/newmessage.php | 2 +- lib/htmloutputter.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'actions') diff --git a/actions/newmessage.php b/actions/newmessage.php index f83015a37..82276ff34 100644 --- a/actions/newmessage.php +++ b/actions/newmessage.php @@ -201,7 +201,7 @@ class NewmessageAction extends Action function showNoticeForm() { - $message_form = new MessageForm($this, $this->to, $this->content); + $message_form = new MessageForm($this, $this->other, $this->content); $message_form->show(); } } diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index 7780b1c19..e2319b1fd 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -255,7 +255,7 @@ class HTMLOutputter extends XMLOutputter foreach ($content as $value => $option) { if ($value == $selected) { $this->element('option', array('value' => $value, - 'selected' => $value), + 'selected' => 'selected'), $option); } else { $this->element('option', array('value' => $value), $option); -- cgit v1.2.3-54-g00ecf From 9b7c57d094ef5fc52a8a2c4ac6b7a89b1c221c54 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 9 Feb 2009 12:07:21 -0500 Subject: whitespace and formatting in showstream.php --- actions/showstream.php | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'actions') diff --git a/actions/showstream.php b/actions/showstream.php index 6bed700c2..962f4b452 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -111,7 +111,7 @@ class ShowstreamAction extends Action $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; common_set_returnto($this->selfUrl()); - + return true; } @@ -178,21 +178,21 @@ class ShowstreamAction extends Action function showFeeds() { $this->element('link', array('rel' => 'alternate', - 'type' => 'application/rss+xml', - 'href' => common_local_url('userrss', - array('nickname' => $this->user->nickname)), - 'title' => sprintf(_('Notice feed for %s (RSS)'), - $this->user->nickname))); - - $this->element('link', - array('rel' => 'alternate', - 'href' => common_local_url('api', - array('apiaction' => 'statuses', - 'method' => 'user_timeline.atom', - 'argument' => $this->user->nickname)), - 'type' => 'application/atom+xml', - 'title' => sprintf(_('Notice feed for %s (Atom)'), - $this->user->nickname))); + 'type' => 'application/rss+xml', + 'href' => common_local_url('userrss', + array('nickname' => $this->user->nickname)), + 'title' => sprintf(_('Notice feed for %s (RSS)'), + $this->user->nickname))); + + $this->element('link', + array('rel' => 'alternate', + 'href' => common_local_url('api', + array('apiaction' => 'statuses', + 'method' => 'user_timeline.atom', + 'argument' => $this->user->nickname)), + 'type' => 'application/atom+xml', + 'title' => sprintf(_('Notice feed for %s (Atom)'), + $this->user->nickname))); } function extraHead() @@ -206,7 +206,7 @@ class ShowstreamAction extends Action // for remote subscriptions etc. $this->element('meta', array('http-equiv' => 'X-XRDS-Location', 'content' => common_local_url('xrds', array('nickname' => - $this->user->nickname)))); + $this->user->nickname)))); if ($this->profile->bio) { $this->element('meta', array('name' => 'description', @@ -248,7 +248,7 @@ class ShowstreamAction extends Action 'height' => AVATAR_PROFILE_SIZE, 'alt' => $this->profile->nickname)); $this->elementEnd('dd'); - + $user = User::staticGet('id', $this->profile->id); $cur = common_current_user(); if ($cur && $cur->id == $user->id) { @@ -256,7 +256,7 @@ class ShowstreamAction extends Action $this->element('a', array('href' => common_local_url('avatarsettings')), _('Edit Avatar')); $this->elementEnd('dd'); } - + $this->elementEnd('dl'); $this->elementStart('dl', 'entity_nickname'); @@ -265,7 +265,7 @@ class ShowstreamAction extends Action $hasFN = ($this->profile->fullname) ? 'nickname url uid' : 'fn nickname url uid'; $this->element('a', array('href' => $this->profile->profileurl, 'rel' => 'me', 'class' => $hasFN), - $this->profile->nickname); + $this->profile->nickname); $this->elementEnd('dd'); $this->elementEnd('dl'); @@ -333,7 +333,7 @@ class ShowstreamAction extends Action $this->elementStart('li', 'entity_edit'); $this->element('a', array('href' => common_local_url('profilesettings'), 'title' => _('Edit profile settings')), - _('Edit')); + _('Edit')); $this->elementEnd('li'); } @@ -356,7 +356,7 @@ class ShowstreamAction extends Action } if ($cur && $cur->id != $user->id && $cur->mutuallySubscribed($user)) { - $this->elementStart('li', 'entity_send-a-message'); + $this->elementStart('li', 'entity_send-a-message'); $this->element('a', array('href' => common_local_url('newmessage', array('to' => $user->id)), 'title' => _('Send a direct message to this user')), _('Message')); @@ -498,7 +498,7 @@ class ShowstreamAction extends Action $this->elementStart('dl', 'entity_member-since'); $this->element('dt', null, _('Member since')); $this->element('dd', null, date('j M Y', - strtotime($this->profile->created))); + strtotime($this->profile->created))); $this->elementEnd('dl'); $this->elementStart('dl', 'entity_subscriptions'); -- cgit v1.2.3-54-g00ecf From 47a5d2b7f06cd1612734c47ad21fc397bbff5276 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 9 Feb 2009 23:13:11 +0000 Subject: Fixed remote subscribe avatar problems Had some Avatar file-copying issues; seem to be fixed. --- actions/finishremotesubscribe.php | 8 +++++++- actions/userauthorization.php | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'actions') diff --git a/actions/finishremotesubscribe.php b/actions/finishremotesubscribe.php index f9094a50c..76db887de 100644 --- a/actions/finishremotesubscribe.php +++ b/actions/finishremotesubscribe.php @@ -237,7 +237,13 @@ class FinishremotesubscribeAction extends Action { $temp_filename = tempnam(sys_get_temp_dir(), 'listener_avatar'); copy($url, $temp_filename); - return $profile->setOriginal($temp_filename); + $imagefile = new ImageFile($profile->id, $temp_filename); + $filename = Avatar::filename($profile->id, + image_type_to_extension($imagefile->type), + null, + common_timestamp()); + rename($temp_filename, Avatar::path($filename)); + return $profile->setOriginal($filename); } function access_token($omb) diff --git a/actions/userauthorization.php b/actions/userauthorization.php index 7455a41a6..ed17ceec9 100644 --- a/actions/userauthorization.php +++ b/actions/userauthorization.php @@ -330,7 +330,13 @@ class UserauthorizationAction extends Action { $temp_filename = tempnam(sys_get_temp_dir(), 'listenee_avatar'); copy($url, $temp_filename); - return $profile->setOriginal($temp_filename); + $imagefile = new ImageFile($profile->id, $temp_filename); + $filename = Avatar::filename($profile->id, + image_type_to_extension($imagefile->type), + null, + common_timestamp()); + rename($temp_filename, Avatar::path($filename)); + return $profile->setOriginal($filename); } function showAcceptMessage($tok) -- cgit v1.2.3-54-g00ecf From 55fcc150fe90156ad33f8627128c7ae555662528 Mon Sep 17 00:00:00 2001 From: Sean Murphy Date: Mon, 9 Feb 2009 20:17:56 -0500 Subject: Fixed #1025: Delete avatar option. --- actions/avatarsettings.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'actions') diff --git a/actions/avatarsettings.php b/actions/avatarsettings.php index 7dd53f6eb..f38a44a24 100644 --- a/actions/avatarsettings.php +++ b/actions/avatarsettings.php @@ -145,6 +145,7 @@ class AvatarsettingsAction extends AccountSettingsAction 'height' => AVATAR_PROFILE_SIZE, 'alt' => $user->nickname)); $this->elementEnd('div'); + $this->submit('delete', _('Delete')); $this->elementEnd('li'); } @@ -256,6 +257,8 @@ class AvatarsettingsAction extends AccountSettingsAction $this->uploadAvatar(); } else if ($this->arg('crop')) { $this->cropAvatar(); + } else if ($this->arg('delete')) { + $this->deleteAvatar(); } else { $this->showForm(_('Unexpected form submission.')); } @@ -344,6 +347,29 @@ class AvatarsettingsAction extends AccountSettingsAction $this->showForm(_('Failed updating avatar.')); } } + + /** + * Get rid of the current avatar. + * + * @return void + */ + + function deleteAvatar() + { + $user = common_current_user(); + $profile = $user->getProfile(); + + $avatar = $profile->getOriginalAvatar(); + $avatar->delete(); + $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE); + $avatar->delete(); + $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE); + $avatar->delete(); + $avatar = $profile->getAvatar(AVATAR_MINI_SIZE); + $avatar->delete(); + + $this->showForm(_('Avatar deleted.'), true); + } /** * Add the jCrop stylesheet -- cgit v1.2.3-54-g00ecf From 7763f804cafa6f41316e30512c4ceab9b78f2c08 Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Tue, 10 Feb 2009 22:04:47 +0000 Subject: trac #233 Explicitely show we have an rss feed for notice searches. --- actions/noticesearch.php | 76 +++++++++++++++++++++++++++++++++++------------- lib/feedlist.php | 7 +++++ 2 files changed, 63 insertions(+), 20 deletions(-) (limited to 'actions') diff --git a/actions/noticesearch.php b/actions/noticesearch.php index a5f01350c..2d94a7906 100644 --- a/actions/noticesearch.php +++ b/actions/noticesearch.php @@ -78,6 +78,62 @@ class NoticesearchAction extends SearchAction return _('Text search'); } + + function showExportData() + { + $q = $this->trimmed('q'); + if (!$q) { + return; + } + $fl = new FeedList($this); + $fl->show(array(0 => array('href' => common_local_url('noticesearchrss', array('q' => $q)), + 'type' => 'rss', + 'version' => 'RSS 1.0', + 'item' => 'noticesearchrss'))); + } + + + + function showFeeds() + { + $q = $this->trimmed('q'); + if (!$q) { + return; + } + + $this->element('link', array('rel' => 'alternate', + 'href' => common_local_url('noticesearchrss', + array('q' => $q)), + 'type' => 'application/rss+xml', + 'title' => _('Search Stream Feed'))); + } + + + /** + * Show header + * + * @param array $arr array containing the query + * + * @return void + */ + + function extraHead2() + { + $q = $this->trimmed('q'); + if ($q) { + $this->element('link', array('rel' => 'alternate', + 'href' => common_local_url('noticesearchrss', + array('q' => $q)), + 'type' => 'application/rss+xml', + 'title' => _('Search Stream Feed'))); + } + } + + + + + + /** * Show results * @@ -119,26 +175,6 @@ class NoticesearchAction extends SearchAction $page, 'noticesearch', array('q' => $q)); } - /** - * Show header - * - * @param array $arr array containing the query - * - * @return void - */ - - function extraHead() - { - $q = $this->trimmed('q'); - if ($q) { - $this->element('link', array('rel' => 'alternate', - 'href' => common_local_url('noticesearchrss', - array('q' => $q)), - 'type' => 'application/rss+xml', - 'title' => _('Search Stream Feed'))); - } - } - /** * Show notice * diff --git a/lib/feedlist.php b/lib/feedlist.php index 47d909e96..8bfcb9c5a 100644 --- a/lib/feedlist.php +++ b/lib/feedlist.php @@ -112,6 +112,13 @@ class FeedList extends Widget $feed['textContent'] = "Atom"; break; + case 'noticesearchrss': + $feed_classname = $feed['type']; + $feed_mimetype = "application/".$feed['type']."+xml"; + $feed_title = $feed['version']." feed for this notice search"; + $feed['textContent'] = "RSS"; + break; + case 'tagrss': $feed_classname = $feed['type']; $feed_mimetype = "application/".$feed['type']."+xml"; -- cgit v1.2.3-54-g00ecf From 1a7337f2fdc106b80a48692628d0b749ee090c03 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 10 Feb 2009 22:33:57 -0500 Subject: Moved /doc/ to /doc-src/ Moved the doc/ dir to /doc-src/ so that the actual markdown files aren't substituted for the docs. --- actions/doc.php | 12 +++++----- doc-src/about | 10 ++++++++ doc-src/contact | 24 +++++++++++++++++++ doc-src/faq | 42 +++++++++++++++++++++++++++++++++ doc-src/groups | 42 +++++++++++++++++++++++++++++++++ doc-src/help | 32 +++++++++++++++++++++++++ doc-src/im | 35 ++++++++++++++++++++++++++++ doc-src/openid | 11 +++++++++ doc-src/openmublog | 25 ++++++++++++++++++++ doc-src/privacy | 45 ++++++++++++++++++++++++++++++++++++ doc-src/sms | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ doc-src/source | 12 ++++++++++ doc-src/tags | 40 ++++++++++++++++++++++++++++++++ doc/about | 10 -------- doc/contact | 24 ------------------- doc/faq | 42 --------------------------------- doc/groups | 42 --------------------------------- doc/help | 32 ------------------------- doc/im | 35 ---------------------------- doc/openid | 11 --------- doc/openmublog | 25 -------------------- doc/privacy | 45 ------------------------------------ doc/sms | 68 ------------------------------------------------------ doc/source | 12 ---------- doc/tags | 40 -------------------------------- 25 files changed, 392 insertions(+), 392 deletions(-) create mode 100644 doc-src/about create mode 100644 doc-src/contact create mode 100644 doc-src/faq create mode 100644 doc-src/groups create mode 100644 doc-src/help create mode 100644 doc-src/im create mode 100644 doc-src/openid create mode 100644 doc-src/openmublog create mode 100644 doc-src/privacy create mode 100644 doc-src/sms create mode 100644 doc-src/source create mode 100644 doc-src/tags delete mode 100644 doc/about delete mode 100644 doc/contact delete mode 100644 doc/faq delete mode 100644 doc/groups delete mode 100644 doc/help delete mode 100644 doc/im delete mode 100644 doc/openid delete mode 100644 doc/openmublog delete mode 100644 doc/privacy delete mode 100644 doc/sms delete mode 100644 doc/source delete mode 100644 doc/tags (limited to 'actions') diff --git a/actions/doc.php b/actions/doc.php index 6957659ad..ebffb7c15 100644 --- a/actions/doc.php +++ b/actions/doc.php @@ -50,7 +50,7 @@ class DocAction extends Action /** * Class handler. - * + * * @param array $args array of arguments * * @return nothing @@ -59,7 +59,7 @@ class DocAction extends Action { parent::handle($args); $this->title = $this->trimmed('title'); - $this->filename = INSTALLDIR.'/doc/'.$this->title; + $this->filename = INSTALLDIR.'/doc-src/'.$this->title; if (!file_exists($this->filename)) { $this->clientError(_('No such document.')); return; @@ -71,14 +71,14 @@ class DocAction extends Action function showPageTitle() { $this->element('h1', array('class' => 'entry-title'), $this->title()); } - + // overrided to add hentry, and content-inner classes function showContentBlock() { $this->elementStart('div', array('id' => 'content', 'class' => 'hentry')); $this->showPageTitle(); $this->showPageNoticeBlock(); - $this->elementStart('div', array('id' => 'content_inner', + $this->elementStart('div', array('id' => 'content_inner', 'class' => 'entry-content')); // show the actual content (forms, lists, whatever) $this->showContent(); @@ -88,7 +88,7 @@ class DocAction extends Action /** * Display content. - * + * * @return nothing */ function showContent() @@ -100,7 +100,7 @@ class DocAction extends Action /** * Page title. - * + * * @return page title */ function title() diff --git a/doc-src/about b/doc-src/about new file mode 100644 index 000000000..3036a51b9 --- /dev/null +++ b/doc-src/about @@ -0,0 +1,10 @@ +%%site.name%% is a +[micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service +based on the Free Software [Laconica](http://laconi.ca/) tool. + +If you [register](%%action.register%%) for an account, +you can post small (140 chars or less) text notices +about yourself, where you are, what you're doing, or practically +anything you want. You can also subscribe to the notices of your +friends, or other people you're interested in, and follow them on the +Web or in an [RSS](http://en.wikipedia.org/wiki/RSS) feed. diff --git a/doc-src/contact b/doc-src/contact new file mode 100644 index 000000000..a8efc456a --- /dev/null +++ b/doc-src/contact @@ -0,0 +1,24 @@ +There are a number of options for getting in contact with responsible +people for %%site.name%%. + +Post a notice +------------- + +If you have a question about how to do something, just post a notice +with your question. People here like to answer messages. Watch the +[public timeline](%%action.public%%) for answers; they'll usually start +with "@" plus your user name. + +Bugs +---- + +If you think you've found a bug in the [Laconica](http://laconi.ca/) software, +or if there's a new feature you'd like to see, add it into the [Laconica bug database](http://laconi.ca/PITS/HomePage). Don't forget to check the list of +existing bugs to make sure it hasn't already been reported! + +Email +----- + +You can reach the responsible party for this server at [%%site.email%%](mailto:%%site.email%%). + + diff --git a/doc-src/faq b/doc-src/faq new file mode 100644 index 000000000..31582b9f0 --- /dev/null +++ b/doc-src/faq @@ -0,0 +1,42 @@ +These are some *Frequently Asked Questions* about this service, with +some answers. + +What is %%site.name%%? +---------------------- + +%%site.name%% is a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service. +You can use it to write short notices about yourself, where you are, +and what you're doing, and those notices will be sent to all your friends +and fans. + +How is %%site.name%% different from Twitter, Jaiku, Pownce, Plurk, others? +-------------------------------------------------------------------------- + +%%site.name%% is an [Open Network Service](http://opendefinition.org/ossd). Our main +goal is to provide a fair and transparent service that preserves users' autonomy. In +particular, all the software used for %%site.name%% is [Free Software](http://en.wikipedia.org/wiki/Free_Software), and all the data is available +under the [%%license.title%%](%%license.url%%) license, making it Open Data. + +The software also implements the [OpenMicroBlogging](http://openmicroblogging.org/) protocol, meaning that you can have friends on other microblogging services +that can receive your notices. + +The goal here is *autonomy* -- you deserve the right to manage your own on-line +presence. If you don't like how %%site.name%% works, you can take your data and the source code and set up your own server (or move your account to another one). + +Where is feature X? +------------------- + +The software we run, [Laconica](http://laconi.ca/), is still in its early stages, +and many features people expect from microblogging sites are not yet implemented. Some important ones that are expected "soon": + +* More [AJAX](http://en.wikipedia.org/wiki/AJAX)-y interface +* Maps +* Cross-post to Pownce, Jaiku, etc. +* Pull messages from Twitter, Pownce, Jaiku, etc. +* [Facebook](http://www.facebook.com/) integration +* Image, video, audio notices + +There is [a list of bugs and features](http://laconi.ca/trac/) that you may find +interesting. New ideas or complaints are very welcome. + + diff --git a/doc-src/groups b/doc-src/groups new file mode 100644 index 000000000..645390e0c --- /dev/null +++ b/doc-src/groups @@ -0,0 +1,42 @@ +Users on %%site.name%% can create *groups* that other users can join. +Groups can be a great way to share information and entertainment with +a group of people who have a common interest or background. + +You can find out about groups on the server on the +[Groups](%%action.groups%%) page. You can join a group by clicking on +the "Join" button either in the group list or on the group's home page. + +Starting a new group +-------------------- + +If you want, you can start a new group for friends and people with +common interests. Note that all groups are free for anyone to join. + +To start a new group, use the [new group](%%action.newgroup%%) tool +and fill out the form. Describe your group as best you can if you want +people to be able to find it. + +When choosing the nickname for your group, try to keep it short. The +nickname is included in every message to and from the group, so the +less chars the better. Try using acronyms for organizations, or +airport codes for places (like 'pdx' instead of 'portland'). + +Sending messages to a group +--------------------------- + +You can send a message to a group using the syntax "!groupname" +anywhere in the message. If you have more than one group named, the +notice will go to each group. Only members can send notices to a +group, and groups do not respond to direct messages (DMs). + +Receiving messages +------------------ + +New group messages will appear in your inbox, and will also come to +your phone or IM client if you've set them up to receive notices. + +Remote groups +------------- + +While it's technically possible, this version of Laconica does not +support remote group membership. diff --git a/doc-src/help b/doc-src/help new file mode 100644 index 000000000..a8cfccd2b --- /dev/null +++ b/doc-src/help @@ -0,0 +1,32 @@ +%%site.name%% is a **microblogging service**. Users post short (140 +character) notices which are broadcast to their friends and fans using +the Web, RSS, or instant messages. + +If you'd like to try it out, first [register](%%action.register%%) a new account. +Then, on the [public timeline](%%action.public%%), enter your message into +the textbox at the top of the page, and click "Send". It will go out on the +public timeline and to anyone who is subscribed to your notices (probably nobody, +at first). + +To subscribe to other people's notifications, go to their profile page +and click the "subscribe" button. They'll get a notice that you're now +subscribed to their notifications, and, who knows?, they might subscribe +back. + +More help +--------- + +Here are some documents that you might find helpful in understanding +%%site.name%% and how to use it. + +* [About](%%doc.about%%) - an overview of the service +* [FAQ](%%doc.faq%%) - frequently-asked questions about %%site.name%% +* [Contact](%%doc.contact%%) - who to contact with questions about the service +* [IM](%%doc.im%%) - using the instant-message (IM) features of %%site.name%% +* [SMS](%%doc.sms%%) - tying your cellphone to %%site.name%% +* [tags](%%doc.tags%%) - different ways to use tagging +* [Groups](%%doc.groups%%) - joining together in groups +* [OpenID](%%doc.openid%%) - what OpenID is and how to use it with this service +* [OpenMicroBlogging](%%doc.openmublog%%) - subscribing to remote users +* [Privacy](%%doc.privacy%%) - %%site.name%%'s privacy policy +* [Source](%%doc.source%%) - How to get the Laconica source code diff --git a/doc-src/im b/doc-src/im new file mode 100644 index 000000000..da07f9fe7 --- /dev/null +++ b/doc-src/im @@ -0,0 +1,35 @@ +You can post messages to %%site.name%% using a [Jabber](http://jabber.org/) client +on your computer, mobile phone, or other platform. ([GTalk](http://talk.google.com/), +Google's Jabber program, will also work.) This can be a convenient way to keep +up with your friends on %%site.name%%. + +If you don't already have a Jabber account, you can use GTalk or one of the other +[public Jabber services](http://www.jabber.org/im-services). You'll probably also +need an IM client like [Pidgin](http://www.pidgin.im/). + +Managing your IM settings +------------------------- + +Use the [IM settings](%%action.imsettings%%) page to set your IM preferences. You can add or change your Jabber address and set the flags for Jabber update. + +When you add or change your address, you'll receive a message from **%%xmpp.user%%@%%xmpp.server%%** asking you to confirm the change. (You may need to +add %%xmpp.user%%@%%xmpp.server%% to your buddy list *before* changing your IM +settings; this is definitely true for GTalk.) + +Sending updates +--------------- + +You send updates by sending messages to %%xmpp.user%%@%%xmpp.server%%. Messages +should be less than 140 characters; longer messages will be truncated. + +Commands +-------- + +You can do some minor management of your account through Jabber. These are the +currently-implemented commands: + +* **on**: Turn on notifications. You'll receive copies of messages by people + you subscribe to. +* **off**: Turn off notifications. You'll no longer receive Jabber + notifications. + diff --git a/doc-src/openid b/doc-src/openid new file mode 100644 index 000000000..c741e3674 --- /dev/null +++ b/doc-src/openid @@ -0,0 +1,11 @@ +%%site.name%% supports the [OpenID](http://openid.net/) standard for single signon between Web sites. OpenID lets you log into many different Web sites without using a different password for each. (See [Wikipedia's OpenID article](http://en.wikipedia.org/wiki/OpenID) for more information.) + +If you already have an account on %%site.name%%, you can [login](%%action.login%%) with your username and password as usual. +To use OpenID in the future, you can [add an OpenID to your account](%%action.openidsettings%%) after you have logged in normally. + +There are many [Public OpenID providers](http://wiki.openid.net/Public_OpenID_providers), and you may already have an OpenID-enabled account on another service. + +* On wikis: If you have an account on an OpenID-enabled wiki, like [Wikitravel](http://wikitravel.org/), [wikiHow](http://www.wikihow.com/), [Vinismo](http://vinismo.com/), [AboutUs](http://aboutus.org/) or [Keiki](http://kei.ki/), you can log in to %%site.name%% by entering the **full URL** of your user page on that other wiki in the box above. For example, *http://kei.ki/en/User:Evan*. +* [Yahoo!](http://openid.yahoo.com/) : If you have an account with Yahoo!, you can log in to this site by entering your Yahoo!-provided OpenID in the box above. Yahoo! OpenID URLs have the form *https://me.yahoo.com/yourusername*. +* [AOL](http://dev.aol.com/aol-and-63-million-openids) : If you have an account with [AOL](http://www.aol.com/), like an [AIM](http://www.aim.com/) account, you can log in to %%site.name%% by entering your AOL-provided OpenID in the box above. AOL OpenID URLs have the form *http://openid.aol.com/yourusername*. Your username should be all lowercase, no spaces. +* [Blogger](http://bloggerindraft.blogspot.com/2008/01/new-feature-blogger-as-openid-provider.html), [Wordpress.com](http://faq.wordpress.com/2007/03/06/what-is-openid/), [LiveJournal](http://www.livejournal.com/openid/about.bml), [Vox](http://bradfitz.vox.com/library/post/openid-for-vox.html) : If you have a blog on any of these services, enter your blog URL in the box above. For example, *http://yourusername.blogspot.com/*, *http://yourusername.wordpress.com/*, *http://yourusername.livejournal.com/*, or *http://yourusername.vox.com/*. diff --git a/doc-src/openmublog b/doc-src/openmublog new file mode 100644 index 000000000..6e3abee42 --- /dev/null +++ b/doc-src/openmublog @@ -0,0 +1,25 @@ +[OpenMicroBlogging](http://openmicroblogging.org/) is a protocol that +lets users of one [microblogging](http://en.wikipedia.org/wiki/microblogging) service +subscribe to notices by users of another service. The protocol, based on +[OAuth](http://oauth.net/), is open and free, and doesn't depend on any +central authority to maintain the federated microblogs. + +The [Laconica](http://laconi.ca/) software that runs %%site.name%% supports +OpenMicroBlogging 0.1. Anyone can make a new installation of Laconica on their +own servers, and users of that new installation can subscribe to notices from +%%site.name%%. + +Remote subscription +------------------- + +If you have an account on a remote site that supports OpenMicroBlogging, and you +want to subscribe to the notices of a user on this site, click on the "Subscribe" +link under their avatar on their profile page. This should take you to the +[remote subscription](%%action.remotesubscribe%%) page. Make sure that you've got the +right nickname registered, and enter your profile URL on the other microblogging +service. + +You'll be taken to your microblogging service, where you'll be asked to confirm the +subscription. When you confirm, your service will receive new notifications from +the user on %%site.name%%, and your service will forward them to you (using IM, SMS, +the Web, or whatever else). diff --git a/doc-src/privacy b/doc-src/privacy new file mode 100644 index 000000000..90c7b3c7f --- /dev/null +++ b/doc-src/privacy @@ -0,0 +1,45 @@ +This document outlines this service's respect for your personal +privacy as a user of the service. + +- Almost all the text and files that users upload to this site is + available under the site license (see the license block at the bottom + of this page). Users agree to the license when they register to use + the site for the first time. Typically that means that the data can + be copied far and wide, for commercial and non-commercial purposes, + and in modified or unmodified form. If you're not OK with that, + don't use the service. +- The following data items are considered *private data* that won't be + shared with other users, business partners, or the public at large: + * your password + * your email address + * your IM address (AIM, Jabber, or other instant messaging address) + * your phone number + * your "private messages" + * your login credentials (username and password) for other services (Twitter, Facebook, etc.) +- Some private data may be published in aggregate, e.g. "30% of our + users are registered with Hotmail addresses." +- Your notices (including files) can be downloaded and re-used by + other services, either one-by-one or in bulk as + [RSS](http://en.wikipedia.org/wiki/RSS) files. +- Your profile information (including subscriptions and avatars) can be + downloaded and re-used by other services, either scraped from the HTML + interface or in bulk as [FOAF](http://en.wikipedia.org/wiki/FOAF) files. +- Your notices will be forwarded to users who subscribe to them, + including users on another microblogging service. +- Your profile information will be sent to microblogging services for + users who subscribe to you or to whom you subscribe. +- Based on your email preferences, you may receive automated email + messages for important system events, such as when others subscribe + to your notices. +- Based on your email preferences, you may receive an email + newsletter. You can opt out of the newsletter if you don't want to + receive it. +- In urgent situations, administrators may send you email directly to + your registered email address, even if you've requested no notices + or newsletter. *Administrators will use digitally-signed email.* +- This service will comply with court orders to turn over your private + information. + + + + diff --git a/doc-src/sms b/doc-src/sms new file mode 100644 index 000000000..1beb49786 --- /dev/null +++ b/doc-src/sms @@ -0,0 +1,68 @@ +You can post messages to %%site.name%% using a many kinds of cell +phones that support SMS messaging. This site does not support SMS +directly; rather, it uses your carrier's email gateway to send and +receive messages. + +Managing your SMS settings +-------------------------- + +Use the [SMS settings](%%action.smssettings%%) page to set your SMS +preferences. You can add or change your SMS number and set the +flags for SMS updates. + +When you add or change your phone number, you'll receive a message on your +phone with a verification code. Enter it into the SMS settings page to +confirm that the owner of the phone authorizes sending it messages. + +Note that only the carriers listed in the drop down list on the form +are supported by %%site.name%%. They're the only ones we know how to +make email addresses for. + +Receiving messages +------------------ + +Once you've verified your phone number, you can enable sending +messages to your phone. If you have a lot of friends and a typical +phone, it can be hard to keep up. + +Sending messages +---------------- + +To send a message, you must send an email to the incoming email +address visible on your SMS settings page. The method for sending +email from your phone varies from carrier to carrier and from handset +to handet; if in doubt, ask your carrier. + +Keep your incoming email address a secret -- it's the only way we know +you're really you! + +Commands +-------- + +You can use the following commands with %%site.name%%. + +* on - turn on notifications +* off - turn off notifications +* help - show this help +* follow - subscribe to user +* leave - unsubscribe from user +* d - direct message to user +* get - get last notice from user +* whois - get profile info on user +* fav - add user's last notice as a 'fave' +* stats - get your stats +* stop - same as 'off' +* quit - same as 'off' +* sub - same as 'follow' +* unsub - same as 'leave' +* last - same as 'get' +* on - not yet implemented. +* off - not yet implemented. +* nudge - not yet implemented. +* invite - not yet implemented. +* track - not yet implemented. +* untrack - not yet implemented. +* track off - not yet implemented. +* untrack all - not yet implemented. +* tracks - not yet implemented. +* tracking - not yet implemented. diff --git a/doc-src/source b/doc-src/source new file mode 100644 index 000000000..83debbe53 --- /dev/null +++ b/doc-src/source @@ -0,0 +1,12 @@ +This service uses a Free microblogging tool called **Laconica**. +Laconica is available under the [GNU Affero General Public License +Version 3.0](http://www.fsf.org/licensing/licenses/agpl-3.0.html), a +Free Software license for network services. + +You can get a copy of the software from the +[Laconica](http://laconi.ca/) main site. The version of the software +that runs on *this* site is unmodified from that version. The site +also depends on certain libraries and other software; you can get +those at the Laconica site, too. + + diff --git a/doc-src/tags b/doc-src/tags new file mode 100644 index 000000000..2ed352e70 --- /dev/null +++ b/doc-src/tags @@ -0,0 +1,40 @@ +%%site.name%% supports +[tags](http://en.wikipedia.org/wiki/Tag_(metadata)) to help you +organize your activities here. You can use tags for people and for +notices. + +Tagging a notice +---------------- + +You can tag a notice using a *hashtag*; a # character followed by +letters and numbers as well as '.', '-', and '_'. Note that accented +latin characters are not supported, and non-roman scripts are right out. + +The HTML for the notice will link to a stream of all the other notices +with that tag. This can be a great way to keep track of a conversation. + +The most popular current tags on the site can be found in the [public +tag cloud](%%action.publictagcloud%%). Their size shows their +popularity and recency. + +Tagging yourself +---------------- + +You can also add tags for yourself on your [profile +settings](%%action.profilesettings%%) page. Use single words to +describe yourself, your experiences and your interest. The tags will +become links on your profile page to a list of all the users on the +site who use that same tag. It can be a nice way to find people who +are related to you geographically or who have a common interest. + +Tagging your subscriptions +-------------------------- + +You can also tag your subscriptions, on the subscriptions page. This +makes it easy to organize your subscriptions into groups and sort +through them separately. + +You can also send a notice "to the attention of" everyone you've +marked with a particular tag (note: *not* people who've marked +themselves with that tag). "@#family hello" will send a notice to +everyone you've marked with the tag 'family'. \ No newline at end of file diff --git a/doc/about b/doc/about deleted file mode 100644 index 3036a51b9..000000000 --- a/doc/about +++ /dev/null @@ -1,10 +0,0 @@ -%%site.name%% is a -[micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service -based on the Free Software [Laconica](http://laconi.ca/) tool. - -If you [register](%%action.register%%) for an account, -you can post small (140 chars or less) text notices -about yourself, where you are, what you're doing, or practically -anything you want. You can also subscribe to the notices of your -friends, or other people you're interested in, and follow them on the -Web or in an [RSS](http://en.wikipedia.org/wiki/RSS) feed. diff --git a/doc/contact b/doc/contact deleted file mode 100644 index a8efc456a..000000000 --- a/doc/contact +++ /dev/null @@ -1,24 +0,0 @@ -There are a number of options for getting in contact with responsible -people for %%site.name%%. - -Post a notice -------------- - -If you have a question about how to do something, just post a notice -with your question. People here like to answer messages. Watch the -[public timeline](%%action.public%%) for answers; they'll usually start -with "@" plus your user name. - -Bugs ----- - -If you think you've found a bug in the [Laconica](http://laconi.ca/) software, -or if there's a new feature you'd like to see, add it into the [Laconica bug database](http://laconi.ca/PITS/HomePage). Don't forget to check the list of -existing bugs to make sure it hasn't already been reported! - -Email ------ - -You can reach the responsible party for this server at [%%site.email%%](mailto:%%site.email%%). - - diff --git a/doc/faq b/doc/faq deleted file mode 100644 index 31582b9f0..000000000 --- a/doc/faq +++ /dev/null @@ -1,42 +0,0 @@ -These are some *Frequently Asked Questions* about this service, with -some answers. - -What is %%site.name%%? ----------------------- - -%%site.name%% is a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service. -You can use it to write short notices about yourself, where you are, -and what you're doing, and those notices will be sent to all your friends -and fans. - -How is %%site.name%% different from Twitter, Jaiku, Pownce, Plurk, others? --------------------------------------------------------------------------- - -%%site.name%% is an [Open Network Service](http://opendefinition.org/ossd). Our main -goal is to provide a fair and transparent service that preserves users' autonomy. In -particular, all the software used for %%site.name%% is [Free Software](http://en.wikipedia.org/wiki/Free_Software), and all the data is available -under the [%%license.title%%](%%license.url%%) license, making it Open Data. - -The software also implements the [OpenMicroBlogging](http://openmicroblogging.org/) protocol, meaning that you can have friends on other microblogging services -that can receive your notices. - -The goal here is *autonomy* -- you deserve the right to manage your own on-line -presence. If you don't like how %%site.name%% works, you can take your data and the source code and set up your own server (or move your account to another one). - -Where is feature X? -------------------- - -The software we run, [Laconica](http://laconi.ca/), is still in its early stages, -and many features people expect from microblogging sites are not yet implemented. Some important ones that are expected "soon": - -* More [AJAX](http://en.wikipedia.org/wiki/AJAX)-y interface -* Maps -* Cross-post to Pownce, Jaiku, etc. -* Pull messages from Twitter, Pownce, Jaiku, etc. -* [Facebook](http://www.facebook.com/) integration -* Image, video, audio notices - -There is [a list of bugs and features](http://laconi.ca/trac/) that you may find -interesting. New ideas or complaints are very welcome. - - diff --git a/doc/groups b/doc/groups deleted file mode 100644 index 645390e0c..000000000 --- a/doc/groups +++ /dev/null @@ -1,42 +0,0 @@ -Users on %%site.name%% can create *groups* that other users can join. -Groups can be a great way to share information and entertainment with -a group of people who have a common interest or background. - -You can find out about groups on the server on the -[Groups](%%action.groups%%) page. You can join a group by clicking on -the "Join" button either in the group list or on the group's home page. - -Starting a new group --------------------- - -If you want, you can start a new group for friends and people with -common interests. Note that all groups are free for anyone to join. - -To start a new group, use the [new group](%%action.newgroup%%) tool -and fill out the form. Describe your group as best you can if you want -people to be able to find it. - -When choosing the nickname for your group, try to keep it short. The -nickname is included in every message to and from the group, so the -less chars the better. Try using acronyms for organizations, or -airport codes for places (like 'pdx' instead of 'portland'). - -Sending messages to a group ---------------------------- - -You can send a message to a group using the syntax "!groupname" -anywhere in the message. If you have more than one group named, the -notice will go to each group. Only members can send notices to a -group, and groups do not respond to direct messages (DMs). - -Receiving messages ------------------- - -New group messages will appear in your inbox, and will also come to -your phone or IM client if you've set them up to receive notices. - -Remote groups -------------- - -While it's technically possible, this version of Laconica does not -support remote group membership. diff --git a/doc/help b/doc/help deleted file mode 100644 index a8cfccd2b..000000000 --- a/doc/help +++ /dev/null @@ -1,32 +0,0 @@ -%%site.name%% is a **microblogging service**. Users post short (140 -character) notices which are broadcast to their friends and fans using -the Web, RSS, or instant messages. - -If you'd like to try it out, first [register](%%action.register%%) a new account. -Then, on the [public timeline](%%action.public%%), enter your message into -the textbox at the top of the page, and click "Send". It will go out on the -public timeline and to anyone who is subscribed to your notices (probably nobody, -at first). - -To subscribe to other people's notifications, go to their profile page -and click the "subscribe" button. They'll get a notice that you're now -subscribed to their notifications, and, who knows?, they might subscribe -back. - -More help ---------- - -Here are some documents that you might find helpful in understanding -%%site.name%% and how to use it. - -* [About](%%doc.about%%) - an overview of the service -* [FAQ](%%doc.faq%%) - frequently-asked questions about %%site.name%% -* [Contact](%%doc.contact%%) - who to contact with questions about the service -* [IM](%%doc.im%%) - using the instant-message (IM) features of %%site.name%% -* [SMS](%%doc.sms%%) - tying your cellphone to %%site.name%% -* [tags](%%doc.tags%%) - different ways to use tagging -* [Groups](%%doc.groups%%) - joining together in groups -* [OpenID](%%doc.openid%%) - what OpenID is and how to use it with this service -* [OpenMicroBlogging](%%doc.openmublog%%) - subscribing to remote users -* [Privacy](%%doc.privacy%%) - %%site.name%%'s privacy policy -* [Source](%%doc.source%%) - How to get the Laconica source code diff --git a/doc/im b/doc/im deleted file mode 100644 index da07f9fe7..000000000 --- a/doc/im +++ /dev/null @@ -1,35 +0,0 @@ -You can post messages to %%site.name%% using a [Jabber](http://jabber.org/) client -on your computer, mobile phone, or other platform. ([GTalk](http://talk.google.com/), -Google's Jabber program, will also work.) This can be a convenient way to keep -up with your friends on %%site.name%%. - -If you don't already have a Jabber account, you can use GTalk or one of the other -[public Jabber services](http://www.jabber.org/im-services). You'll probably also -need an IM client like [Pidgin](http://www.pidgin.im/). - -Managing your IM settings -------------------------- - -Use the [IM settings](%%action.imsettings%%) page to set your IM preferences. You can add or change your Jabber address and set the flags for Jabber update. - -When you add or change your address, you'll receive a message from **%%xmpp.user%%@%%xmpp.server%%** asking you to confirm the change. (You may need to -add %%xmpp.user%%@%%xmpp.server%% to your buddy list *before* changing your IM -settings; this is definitely true for GTalk.) - -Sending updates ---------------- - -You send updates by sending messages to %%xmpp.user%%@%%xmpp.server%%. Messages -should be less than 140 characters; longer messages will be truncated. - -Commands --------- - -You can do some minor management of your account through Jabber. These are the -currently-implemented commands: - -* **on**: Turn on notifications. You'll receive copies of messages by people - you subscribe to. -* **off**: Turn off notifications. You'll no longer receive Jabber - notifications. - diff --git a/doc/openid b/doc/openid deleted file mode 100644 index c741e3674..000000000 --- a/doc/openid +++ /dev/null @@ -1,11 +0,0 @@ -%%site.name%% supports the [OpenID](http://openid.net/) standard for single signon between Web sites. OpenID lets you log into many different Web sites without using a different password for each. (See [Wikipedia's OpenID article](http://en.wikipedia.org/wiki/OpenID) for more information.) - -If you already have an account on %%site.name%%, you can [login](%%action.login%%) with your username and password as usual. -To use OpenID in the future, you can [add an OpenID to your account](%%action.openidsettings%%) after you have logged in normally. - -There are many [Public OpenID providers](http://wiki.openid.net/Public_OpenID_providers), and you may already have an OpenID-enabled account on another service. - -* On wikis: If you have an account on an OpenID-enabled wiki, like [Wikitravel](http://wikitravel.org/), [wikiHow](http://www.wikihow.com/), [Vinismo](http://vinismo.com/), [AboutUs](http://aboutus.org/) or [Keiki](http://kei.ki/), you can log in to %%site.name%% by entering the **full URL** of your user page on that other wiki in the box above. For example, *http://kei.ki/en/User:Evan*. -* [Yahoo!](http://openid.yahoo.com/) : If you have an account with Yahoo!, you can log in to this site by entering your Yahoo!-provided OpenID in the box above. Yahoo! OpenID URLs have the form *https://me.yahoo.com/yourusername*. -* [AOL](http://dev.aol.com/aol-and-63-million-openids) : If you have an account with [AOL](http://www.aol.com/), like an [AIM](http://www.aim.com/) account, you can log in to %%site.name%% by entering your AOL-provided OpenID in the box above. AOL OpenID URLs have the form *http://openid.aol.com/yourusername*. Your username should be all lowercase, no spaces. -* [Blogger](http://bloggerindraft.blogspot.com/2008/01/new-feature-blogger-as-openid-provider.html), [Wordpress.com](http://faq.wordpress.com/2007/03/06/what-is-openid/), [LiveJournal](http://www.livejournal.com/openid/about.bml), [Vox](http://bradfitz.vox.com/library/post/openid-for-vox.html) : If you have a blog on any of these services, enter your blog URL in the box above. For example, *http://yourusername.blogspot.com/*, *http://yourusername.wordpress.com/*, *http://yourusername.livejournal.com/*, or *http://yourusername.vox.com/*. diff --git a/doc/openmublog b/doc/openmublog deleted file mode 100644 index 6e3abee42..000000000 --- a/doc/openmublog +++ /dev/null @@ -1,25 +0,0 @@ -[OpenMicroBlogging](http://openmicroblogging.org/) is a protocol that -lets users of one [microblogging](http://en.wikipedia.org/wiki/microblogging) service -subscribe to notices by users of another service. The protocol, based on -[OAuth](http://oauth.net/), is open and free, and doesn't depend on any -central authority to maintain the federated microblogs. - -The [Laconica](http://laconi.ca/) software that runs %%site.name%% supports -OpenMicroBlogging 0.1. Anyone can make a new installation of Laconica on their -own servers, and users of that new installation can subscribe to notices from -%%site.name%%. - -Remote subscription -------------------- - -If you have an account on a remote site that supports OpenMicroBlogging, and you -want to subscribe to the notices of a user on this site, click on the "Subscribe" -link under their avatar on their profile page. This should take you to the -[remote subscription](%%action.remotesubscribe%%) page. Make sure that you've got the -right nickname registered, and enter your profile URL on the other microblogging -service. - -You'll be taken to your microblogging service, where you'll be asked to confirm the -subscription. When you confirm, your service will receive new notifications from -the user on %%site.name%%, and your service will forward them to you (using IM, SMS, -the Web, or whatever else). diff --git a/doc/privacy b/doc/privacy deleted file mode 100644 index 90c7b3c7f..000000000 --- a/doc/privacy +++ /dev/null @@ -1,45 +0,0 @@ -This document outlines this service's respect for your personal -privacy as a user of the service. - -- Almost all the text and files that users upload to this site is - available under the site license (see the license block at the bottom - of this page). Users agree to the license when they register to use - the site for the first time. Typically that means that the data can - be copied far and wide, for commercial and non-commercial purposes, - and in modified or unmodified form. If you're not OK with that, - don't use the service. -- The following data items are considered *private data* that won't be - shared with other users, business partners, or the public at large: - * your password - * your email address - * your IM address (AIM, Jabber, or other instant messaging address) - * your phone number - * your "private messages" - * your login credentials (username and password) for other services (Twitter, Facebook, etc.) -- Some private data may be published in aggregate, e.g. "30% of our - users are registered with Hotmail addresses." -- Your notices (including files) can be downloaded and re-used by - other services, either one-by-one or in bulk as - [RSS](http://en.wikipedia.org/wiki/RSS) files. -- Your profile information (including subscriptions and avatars) can be - downloaded and re-used by other services, either scraped from the HTML - interface or in bulk as [FOAF](http://en.wikipedia.org/wiki/FOAF) files. -- Your notices will be forwarded to users who subscribe to them, - including users on another microblogging service. -- Your profile information will be sent to microblogging services for - users who subscribe to you or to whom you subscribe. -- Based on your email preferences, you may receive automated email - messages for important system events, such as when others subscribe - to your notices. -- Based on your email preferences, you may receive an email - newsletter. You can opt out of the newsletter if you don't want to - receive it. -- In urgent situations, administrators may send you email directly to - your registered email address, even if you've requested no notices - or newsletter. *Administrators will use digitally-signed email.* -- This service will comply with court orders to turn over your private - information. - - - - diff --git a/doc/sms b/doc/sms deleted file mode 100644 index 1beb49786..000000000 --- a/doc/sms +++ /dev/null @@ -1,68 +0,0 @@ -You can post messages to %%site.name%% using a many kinds of cell -phones that support SMS messaging. This site does not support SMS -directly; rather, it uses your carrier's email gateway to send and -receive messages. - -Managing your SMS settings --------------------------- - -Use the [SMS settings](%%action.smssettings%%) page to set your SMS -preferences. You can add or change your SMS number and set the -flags for SMS updates. - -When you add or change your phone number, you'll receive a message on your -phone with a verification code. Enter it into the SMS settings page to -confirm that the owner of the phone authorizes sending it messages. - -Note that only the carriers listed in the drop down list on the form -are supported by %%site.name%%. They're the only ones we know how to -make email addresses for. - -Receiving messages ------------------- - -Once you've verified your phone number, you can enable sending -messages to your phone. If you have a lot of friends and a typical -phone, it can be hard to keep up. - -Sending messages ----------------- - -To send a message, you must send an email to the incoming email -address visible on your SMS settings page. The method for sending -email from your phone varies from carrier to carrier and from handset -to handet; if in doubt, ask your carrier. - -Keep your incoming email address a secret -- it's the only way we know -you're really you! - -Commands --------- - -You can use the following commands with %%site.name%%. - -* on - turn on notifications -* off - turn off notifications -* help - show this help -* follow - subscribe to user -* leave - unsubscribe from user -* d - direct message to user -* get - get last notice from user -* whois - get profile info on user -* fav - add user's last notice as a 'fave' -* stats - get your stats -* stop - same as 'off' -* quit - same as 'off' -* sub - same as 'follow' -* unsub - same as 'leave' -* last - same as 'get' -* on - not yet implemented. -* off - not yet implemented. -* nudge - not yet implemented. -* invite - not yet implemented. -* track - not yet implemented. -* untrack - not yet implemented. -* track off - not yet implemented. -* untrack all - not yet implemented. -* tracks - not yet implemented. -* tracking - not yet implemented. diff --git a/doc/source b/doc/source deleted file mode 100644 index 83debbe53..000000000 --- a/doc/source +++ /dev/null @@ -1,12 +0,0 @@ -This service uses a Free microblogging tool called **Laconica**. -Laconica is available under the [GNU Affero General Public License -Version 3.0](http://www.fsf.org/licensing/licenses/agpl-3.0.html), a -Free Software license for network services. - -You can get a copy of the software from the -[Laconica](http://laconi.ca/) main site. The version of the software -that runs on *this* site is unmodified from that version. The site -also depends on certain libraries and other software; you can get -those at the Laconica site, too. - - diff --git a/doc/tags b/doc/tags deleted file mode 100644 index 2ed352e70..000000000 --- a/doc/tags +++ /dev/null @@ -1,40 +0,0 @@ -%%site.name%% supports -[tags](http://en.wikipedia.org/wiki/Tag_(metadata)) to help you -organize your activities here. You can use tags for people and for -notices. - -Tagging a notice ----------------- - -You can tag a notice using a *hashtag*; a # character followed by -letters and numbers as well as '.', '-', and '_'. Note that accented -latin characters are not supported, and non-roman scripts are right out. - -The HTML for the notice will link to a stream of all the other notices -with that tag. This can be a great way to keep track of a conversation. - -The most popular current tags on the site can be found in the [public -tag cloud](%%action.publictagcloud%%). Their size shows their -popularity and recency. - -Tagging yourself ----------------- - -You can also add tags for yourself on your [profile -settings](%%action.profilesettings%%) page. Use single words to -describe yourself, your experiences and your interest. The tags will -become links on your profile page to a list of all the users on the -site who use that same tag. It can be a nice way to find people who -are related to you geographically or who have a common interest. - -Tagging your subscriptions --------------------------- - -You can also tag your subscriptions, on the subscriptions page. This -makes it easy to organize your subscriptions into groups and sort -through them separately. - -You can also send a notice "to the attention of" everyone you've -marked with a particular tag (note: *not* people who've marked -themselves with that tag). "@#family hello" will send a notice to -everyone you've marked with the tag 'family'. \ No newline at end of file -- cgit v1.2.3-54-g00ecf From ad65c447d5e32b8ef5681789eca12a3717231311 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 11 Feb 2009 10:35:15 -0500 Subject: fix Atom link, add Atom and RSS 2.0 to --- actions/public.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'actions') diff --git a/actions/public.php b/actions/public.php index cc6537f74..1137bd876 100644 --- a/actions/public.php +++ b/actions/public.php @@ -73,9 +73,9 @@ class PublicAction extends Action { parent::prepare($args); $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; - + common_set_returnto($this->selfUrl()); - + return true; } @@ -123,8 +123,20 @@ class PublicAction extends Action { $this->element('link', array('rel' => 'alternate', 'href' => common_local_url('publicrss'), + 'type' => 'application/rdf+xml', + 'title' => _('Public Stream Feed (RSS 1.0)'))); + $this->element('link', array('rel' => 'alternate', + 'href' => common_local_url('api', + array('apiaction' => 'statuses', + 'method' => 'public_timeline.rss')), 'type' => 'application/rss+xml', - 'title' => _('Public Stream Feed'))); + 'title' => _('Public Stream Feed (RSS 2.0)'))); + $this->element('link', array('rel' => 'alternate', + 'href' => common_local_url('api', + array('apiaction' => 'statuses', + 'method' => 'public_timeline.atom')), + 'type' => 'application/atom+xml', + 'title' => _('Public Stream Feed (Atom)'))); } /** @@ -200,7 +212,9 @@ class PublicAction extends Action 'type' => 'rss', 'version' => 'RSS 1.0', 'item' => 'publicrss'), - 1 => array('href' => common_local_url('publicatom'), + 1 => array('href' => common_local_url('api', + array('apiaction' => 'statuses', + 'method' => 'public_timeline.atom')), 'type' => 'atom', 'version' => 'Atom 1.0', 'item' => 'publicatom'))); -- cgit v1.2.3-54-g00ecf From 22b10399aaa97061ed940f92f5b15f6aacfb1093 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 11 Feb 2009 11:37:50 -0500 Subject: Unify feeds definition in actions I got a little sick of trying to keep the export data and links synched in actions, so I made a common method, getFeeds(), which gets the feeds for both. It returns an array of Feed objects, which know about what their mime type is, title, location, all that jazz. I changed the FeedList class so it handles the new Feed objects instead of the old array of data. I changed all the actions that show feeds (I think...) so that they now use getFeeds() for all their feed needs. --- actions/all.php | 36 +++++++-------- actions/noticesearch.php | 62 +++++--------------------- actions/public.php | 53 ++++++---------------- actions/replies.php | 28 ++---------- actions/showfavorites.php | 33 ++------------ actions/showgroup.php | 25 ++--------- actions/showstream.php | 67 ++++++++++------------------ actions/tag.php | 22 +++------- lib/action.php | 38 +++++++++++++--- lib/feed.php | 110 ++++++++++++++++++++++++++++++++++++++++++++++ lib/feedlist.php | 101 ++++++++---------------------------------- 11 files changed, 240 insertions(+), 335 deletions(-) create mode 100644 lib/feed.php (limited to 'actions') diff --git a/actions/all.php b/actions/all.php index d75d1b946..08dcccbdd 100644 --- a/actions/all.php +++ b/actions/all.php @@ -42,9 +42,9 @@ class AllAction extends Action if (!$this->page) { $this->page = 1; } - + common_set_returnto($this->selfUrl()); - + return true; } @@ -69,13 +69,22 @@ class AllAction extends Action } } - function showFeeds() + function getFeeds() { - $this->element('link', array('rel' => 'alternate', - 'href' => common_local_url('allrss', array('nickname' => - $this->user->nickname)), - 'type' => 'application/rss+xml', - 'title' => sprintf(_('Feed for friends of %s'), $this->user->nickname))); + return array(new Feed(Feed::RSS1, + common_local_url('allrss', array('nickname' => + $this->user->nickname)), + sprintf(_('Feed for friends of %s (RSS 1.0)'), $this->user->nickname)), + new Feed(Feed::RSS2, + common_local_url('api', array('apiaction' => 'statuses', + 'method' => 'friends', + 'argument' => $this->user->nickname.'.rss')), + sprintf(_('Feed for friends of %s (RSS 2.0)'), $this->user->nickname)), + new Feed(Feed::ATOM, + common_local_url('api', array('apiaction' => 'statuses', + 'method' => 'friends', + 'argument' => $this->user->nickname.'.atom')), + sprintf(_('Feed for friends of %s (Atom)'), $this->user->nickname))); } function showLocalNav() @@ -84,15 +93,6 @@ class AllAction extends Action $nav->show(); } - function showExportData() - { - $fl = new FeedList($this); - $fl->show(array(0=>array('href'=>common_local_url('allrss', array('nickname' => $this->user->nickname)), - 'type' => 'rss', - 'version' => 'RSS 1.0', - 'item' => 'allrss'))); - } - function showContent() { $notice = $this->user->noticesWithFriends(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1); @@ -110,7 +110,7 @@ class AllAction extends Action $user =& common_current_user(); if ($user && ($user->id == $this->user->id)) { $this->element('h1', NULL, _("You and friends")); - } else { + } else { $this->element('h1', NULL, sprintf(_('%s and friends'), $this->user->nickname)); } } diff --git a/actions/noticesearch.php b/actions/noticesearch.php index 2d94a7906..dc58d7528 100644 --- a/actions/noticesearch.php +++ b/actions/noticesearch.php @@ -57,11 +57,11 @@ class NoticesearchAction extends SearchAction return true; } - + /** * Get instructions - * - * @return string instruction text + * + * @return string instruction text */ function getInstructions() { @@ -70,7 +70,7 @@ class NoticesearchAction extends SearchAction /** * Get title - * + * * @return string title */ function title() @@ -78,62 +78,20 @@ class NoticesearchAction extends SearchAction return _('Text search'); } - - function showExportData() + function getFeeds() { $q = $this->trimmed('q'); - if (!$q) { - return; - } - $fl = new FeedList($this); - $fl->show(array(0 => array('href' => common_local_url('noticesearchrss', array('q' => $q)), - 'type' => 'rss', - 'version' => 'RSS 1.0', - 'item' => 'noticesearchrss'))); - } - - - function showFeeds() - { - $q = $this->trimmed('q'); if (!$q) { - return; + return null; } - $this->element('link', array('rel' => 'alternate', - 'href' => common_local_url('noticesearchrss', - array('q' => $q)), - 'type' => 'application/rss+xml', - 'title' => _('Search Stream Feed'))); + return array(new Feed(Feed::RSS1, common_local_url('noticesearchrss', + array('q' => $q)), + sprintf(_('Search results for "%s" on %s'), + $q, common_config('site', 'name')))); } - - /** - * Show header - * - * @param array $arr array containing the query - * - * @return void - */ - - function extraHead2() - { - $q = $this->trimmed('q'); - if ($q) { - $this->element('link', array('rel' => 'alternate', - 'href' => common_local_url('noticesearchrss', - array('q' => $q)), - 'type' => 'application/rss+xml', - 'title' => _('Search Stream Feed'))); - } - } - - - - - - /** * Show results * diff --git a/actions/public.php b/actions/public.php index 1137bd876..a20ae4032 100644 --- a/actions/public.php +++ b/actions/public.php @@ -119,24 +119,20 @@ class PublicAction extends Action * @return void */ - function showFeeds() + function getFeeds() { - $this->element('link', array('rel' => 'alternate', - 'href' => common_local_url('publicrss'), - 'type' => 'application/rdf+xml', - 'title' => _('Public Stream Feed (RSS 1.0)'))); - $this->element('link', array('rel' => 'alternate', - 'href' => common_local_url('api', - array('apiaction' => 'statuses', - 'method' => 'public_timeline.rss')), - 'type' => 'application/rss+xml', - 'title' => _('Public Stream Feed (RSS 2.0)'))); - $this->element('link', array('rel' => 'alternate', - 'href' => common_local_url('api', - array('apiaction' => 'statuses', - 'method' => 'public_timeline.atom')), - 'type' => 'application/atom+xml', - 'title' => _('Public Stream Feed (Atom)'))); + return array(new Feed(Feed::RSS1, common_local_url('publicrss'), + _('Public Stream Feed (RSS 1.0)')), + new Feed(Feed::RSS2, + common_local_url('api', + array('apiaction' => 'statuses', + 'method' => 'public_timeline.rss')), + _('Public Stream Feed (RSS 2.0)')), + new Feed(Feed::ATOM, + common_local_url('api', + array('apiaction' => 'statuses', + 'method' => 'public_timeline.atom')), + _('Public Stream Feed (Atom)'))); } /** @@ -197,29 +193,6 @@ class PublicAction extends Action $this->page, 'public'); } - /** - * Makes a list of exported feeds for this page - * - * @return void - * - * @todo I18N - */ - - function showExportData() - { - $fl = new FeedList($this); - $fl->show(array(0 => array('href' => common_local_url('publicrss'), - 'type' => 'rss', - 'version' => 'RSS 1.0', - 'item' => 'publicrss'), - 1 => array('href' => common_local_url('api', - array('apiaction' => 'statuses', - 'method' => 'public_timeline.atom')), - 'type' => 'atom', - 'version' => 'Atom 1.0', - 'item' => 'publicatom'))); - } - function showSections() { // $top = new TopPostersSection($this); diff --git a/actions/replies.php b/actions/replies.php index 7eff74a66..4ab9b14ed 100644 --- a/actions/replies.php +++ b/actions/replies.php @@ -84,7 +84,7 @@ class RepliesAction extends Action $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; common_set_returnto($this->selfUrl()); - + return true; } @@ -129,16 +129,13 @@ class RepliesAction extends Action * @return void */ - function showFeeds() + function getFeeds() { $rssurl = common_local_url('repliesrss', array('nickname' => $this->user->nickname)); $rsstitle = sprintf(_('Feed for replies to %s'), $this->user->nickname); - $this->element('link', array('rel' => 'alternate', - 'href' => $rssurl, - 'type' => 'application/rss+xml', - 'title' => $rsstitle)); + return array(new Feed(Feed::RSS1, $rssurl, $rsstitle)); } /** @@ -153,25 +150,6 @@ class RepliesAction extends Action $nav->show(); } - /** - * Show the replies feed links - * - * @return void - */ - - function showExportData() - { - $fl = new FeedList($this); - - $rssurl = common_local_url('repliesrss', - array('nickname' => $this->user->nickname)); - - $fl->show(array(0=>array('href'=> $rssurl, - 'type' => 'rss', - 'version' => 'RSS 1.0', - 'item' => 'repliesrss'))); - } - /** * Show the content * diff --git a/actions/showfavorites.php b/actions/showfavorites.php index 31479e1a7..d1c9283f0 100644 --- a/actions/showfavorites.php +++ b/actions/showfavorites.php @@ -113,7 +113,7 @@ class ShowfavoritesAction extends Action } common_set_returnto($this->selfUrl()); - + return true; } @@ -136,10 +136,10 @@ class ShowfavoritesAction extends Action /** * Feeds for the section * - * @return void + * @return array Feed objects to show */ - function showFeeds() + function getFeeds() { $feedurl = common_local_url('favoritesrss', array('nickname' => @@ -147,10 +147,7 @@ class ShowfavoritesAction extends Action $feedtitle = sprintf(_('Feed for favorites of %s'), $this->user->nickname); - $this->element('link', array('rel' => 'alternate', - 'href' => $feedurl, - 'type' => 'application/rss+xml', - 'title' => $feedtitle)); + return array(new Feed(Feed::RSS1, $feedurl, $feedtitle)); } /** @@ -165,28 +162,6 @@ class ShowfavoritesAction extends Action $nav->show(); } - /** - * Show the replies feed links - * - * @return void - */ - - function showExportData() - { - $feedurl = common_local_url('favoritesrss', - array('nickname' => - $this->user->nickname)); - - $fl = new FeedList($this); - - // XXX: I18N - - $fl->show(array(0=>array('href'=> $feedurl, - 'type' => 'rss', - 'version' => 'RSS 1.0', - 'item' => 'Favorites'))); - } - /** * Show the content * diff --git a/actions/showgroup.php b/actions/showgroup.php index 7bc68fbc6..340e18333 100644 --- a/actions/showgroup.php +++ b/actions/showgroup.php @@ -292,37 +292,18 @@ class ShowgroupAction extends Action } /** - * Show a list of links to feeds this page produces + * Get a list of the feeds for this page * * @return void */ - function showExportData() - { - $fl = new FeedList($this); - $fl->show(array(0=>array('href'=>common_local_url('grouprss', - array('nickname' => $this->group->nickname)), - 'type' => 'rss', - 'version' => 'RSS 1.0', - 'item' => 'notices'))); - } - - /** - * Show a list of links to feeds this page produces - * - * @return void - */ - - function showFeeds() + function getFeeds() { $url = common_local_url('grouprss', array('nickname' => $this->group->nickname)); - $this->element('link', array('rel' => 'alternate', - 'href' => $url, - 'type' => 'application/rss+xml', - 'title' => sprintf(_('Notice feed for %s group'), + return array(new Feed(Feed::RSS1, $url, sprintf(_('Notice feed for %s group'), $this->group->nickname))); } diff --git a/actions/showstream.php b/actions/showstream.php index 962f4b452..0ee5d769e 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -155,54 +155,35 @@ class ShowstreamAction extends Action return; } - function showExportData() + function getFeeds() { - $fl = new FeedList($this); - $fl->show(array(0=>array('href'=>common_local_url('userrss', - array('nickname' => $this->user->nickname)), - 'type' => 'rss', - 'version' => 'RSS 1.0', - 'item' => 'notices'), - 1=>array('href'=>common_local_url('usertimeline', - array('nickname' => $this->user->nickname)), - 'type' => 'atom', - 'version' => 'Atom 1.0', - 'item' => 'usertimeline'), - 2=>array('href'=>common_local_url('foaf', - array('nickname' => $this->user->nickname)), - 'type' => 'rdf', - 'version' => 'FOAF', - 'item' => 'foaf'))); - } - - function showFeeds() - { - $this->element('link', array('rel' => 'alternate', - 'type' => 'application/rss+xml', - 'href' => common_local_url('userrss', - array('nickname' => $this->user->nickname)), - 'title' => sprintf(_('Notice feed for %s (RSS)'), - $this->user->nickname))); - - $this->element('link', - array('rel' => 'alternate', - 'href' => common_local_url('api', - array('apiaction' => 'statuses', - 'method' => 'user_timeline.atom', - 'argument' => $this->user->nickname)), - 'type' => 'application/atom+xml', - 'title' => sprintf(_('Notice feed for %s (Atom)'), - $this->user->nickname))); + return array(new Feed(Feed::RSS1, + common_local_url('userrss', + array('nickname' => $this->user->nickname)), + sprintf(_('Notice feed for %s (RSS 1.0)'), + $this->user->nickname)), + new Feed(Feed::RSS2, + common_local_url('api', + array('apiaction' => 'statuses', + 'method' => 'user_timeline', + 'argument' => $this->user->nickname.'.rss')), + sprintf(_('Notice feed for %s (RSS 2.0)'), + $this->user->nickname)), + new Feed(Feed::ATOM, + common_local_url('api', + array('apiaction' => 'statuses', + 'method' => 'user_timeline', + 'argument' => $this->user->nickname.'.atom')), + sprintf(_('Notice feed for %s (Atom)'), + $this->user->nickname)), + new Feed(Feed::FOAF, + common_local_url('foaf', array('nickname' => + $this->user->nickname)), + sprintf(_('FOAF for %s'), $this->user->nickname))); } function extraHead() { - // FOAF - $this->element('link', array('rel' => 'meta', - 'href' => common_local_url('foaf', array('nickname' => - $this->user->nickname)), - 'type' => 'application/rdf+xml', - 'title' => 'FOAF')); // for remote subscriptions etc. $this->element('meta', array('http-equiv' => 'X-XRDS-Location', 'content' => common_local_url('xrds', array('nickname' => diff --git a/actions/tag.php b/actions/tag.php index 4401f892a..231f2c299 100644 --- a/actions/tag.php +++ b/actions/tag.php @@ -37,9 +37,9 @@ class TagAction extends Action } $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; - + common_set_returnto($this->selfUrl()); - + return true; } @@ -61,12 +61,11 @@ class TagAction extends Action $this->showPage(); } - function showFeeds() + function getFeeds() { - $this->element('link', array('rel' => 'alternate', - 'href' => common_local_url('tagrss', array('tag' => $this->tag)), - 'type' => 'application/rss+xml', - 'title' => sprintf(_('Feed for tag %s'), $this->tag))); + return array(new Feed(Feed::RSS1, + common_local_url('tagrss', array('tag' => $this->tag)), + sprintf(_('Feed for tag %s'), $this->tag))); } function showPageNotice() @@ -74,15 +73,6 @@ class TagAction extends Action return sprintf(_('Messages tagged "%s", most recent first'), $this->tag); } - function showExportData() - { - $fl = new FeedList($this); - $fl->show(array(0=>array('href'=>common_local_url('tagrss', array('tag' => $this->tag)), - 'type' => 'rss', - 'version' => 'RSS 1.0', - 'item' => 'tagrss'))); - } - function showContent() { $notice = Notice_tag::getStream($this->tag, (($this->page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1); diff --git a/lib/action.php b/lib/action.php index ce92addf5..bd38bf79c 100644 --- a/lib/action.php +++ b/lib/action.php @@ -225,9 +225,19 @@ class Action extends HTMLOutputter // lawsuit * * @return nothing */ + function showFeeds() { - // does nothing by default + $feeds = $this->getFeeds(); + + if ($feeds) { + foreach ($feeds as $feed) { + $this->element('link', array('rel' => $feed->rel(), + 'href' => $feed->url, + 'type' => $feed->mimeType(), + 'title' => $feed->title)); + } + } } /** @@ -540,15 +550,16 @@ class Action extends HTMLOutputter // lawsuit /** * Show export data feeds. * - * MAY overload if there are feeds - * - * @return nothing + * @return void */ + function showExportData() { - // is there structure to this? - // list of (visible!) feed links - // can we reuse list of feeds from showFeeds() ? + $feeds = $this->getFeeds(); + if ($feeds) { + $fl = new FeedList($this); + $fl->show($feeds); + } } /** @@ -924,4 +935,17 @@ class Action extends HTMLOutputter // lawsuit $this->elementEnd('div'); } } + + /** + * An array of feeds for this action. + * + * Returns an array of potential feeds for this action. + * + * @return array Feed object to show in head and links + */ + + function getFeeds() + { + return null; + } } diff --git a/lib/feed.php b/lib/feed.php new file mode 100644 index 000000000..466926844 --- /dev/null +++ b/lib/feed.php @@ -0,0 +1,110 @@ +. + * + * @category Feed + * @package Laconica + * @author Evan Prodromou + * @copyright 2009 Control Yourself, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://laconi.ca/ + */ + +if (!defined('LACONICA')) { + exit(1); +} + +/** + * Data structure for feeds + * + * This structure is a helpful container for shipping around information about syndication feeds. + * + * @category Feed + * @package Laconica + * @author Evan Prodromou + * @author Sarven Capadisli + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://laconi.ca/ + */ + +class Feed +{ + const RSS1 = 1; + const RSS2 = 2; + const ATOM = 3; + const FOAF = 4; + + var $type = null; + var $url = null; + var $title = null; + + function __construct($type, $url, $title) + { + $this->type = $type; + $this->url = $url; + $this->title = $title; + } + + function mimeType() + { + switch ($this->type) { + case Feed::RSS1: + return 'application/rdf+xml'; + case Feed::RSS2: + return 'application/rss+xml'; + case Feed::ATOM: + return 'application/atom+xml'; + case Feed::FOAF: + return 'application/rdf+xml'; + default: + return null; + } + } + + function typeName() + { + switch ($this->type) { + case Feed::RSS1: + return _('RSS 1.0'); + case Feed::RSS2: + return _('RSS 2.0'); + case Feed::ATOM: + return _('Atom'); + case Feed::FOAF: + return _('FOAF'); + default: + return null; + } + } + + function rel() + { + switch ($this->type) { + case Feed::RSS1: + case Feed::RSS2: + case Feed::ATOM: + return 'alternate'; + case Feed::FOAF: + return 'meta'; + default: + return null; + } + } +} diff --git a/lib/feedlist.php b/lib/feedlist.php index 8bfcb9c5a..927e43c33 100644 --- a/lib/feedlist.php +++ b/lib/feedlist.php @@ -50,7 +50,7 @@ if (!defined('LACONICA')) { class FeedList extends Widget { var $action = null; - + function __construct($action=null) { parent::__construct($action); @@ -64,8 +64,8 @@ class FeedList extends Widget $this->out->element('h2', null, _('Export data')); $this->out->elementStart('ul', array('class' => 'xoxo')); - foreach ($feeds as $key => $value) { - $this->feedItem($feeds[$key]); + foreach ($feeds as $feed) { + $this->feedItem($feed); } $this->out->elementEnd('ul'); @@ -74,92 +74,27 @@ class FeedList extends Widget function feedItem($feed) { - $nickname = $this->action->trimmed('nickname'); - - switch($feed['item']) { - case 'notices': default: - $feed_classname = $feed['type']; - $feed_mimetype = "application/".$feed['type']."+xml"; - $feed_title = "$nickname's ".$feed['version']." notice feed"; - $feed['textContent'] = "RSS"; - break; - - case 'allrss': - $feed_classname = $feed['type']; - $feed_mimetype = "application/".$feed['type']."+xml"; - $feed_title = $feed['version']." feed for $nickname and friends"; - $feed['textContent'] = "RSS"; - break; - - case 'repliesrss': - $feed_classname = $feed['type']; - $feed_mimetype = "application/".$feed['type']."+xml"; - $feed_title = $feed['version']." feed for replies to $nickname"; - $feed['textContent'] = "RSS"; - break; - - case 'publicrss': - $feed_classname = $feed['type']; - $feed_mimetype = "application/".$feed['type']."+xml"; - $feed_title = "Public timeline ".$feed['version']." feed"; - $feed['textContent'] = "RSS"; - break; - - case 'publicatom': - $feed_classname = "atom"; - $feed_mimetype = "application/".$feed['type']."+xml"; - $feed_title = "Public timeline ".$feed['version']." feed"; - $feed['textContent'] = "Atom"; - break; - - case 'noticesearchrss': - $feed_classname = $feed['type']; - $feed_mimetype = "application/".$feed['type']."+xml"; - $feed_title = $feed['version']." feed for this notice search"; - $feed['textContent'] = "RSS"; - break; - - case 'tagrss': - $feed_classname = $feed['type']; - $feed_mimetype = "application/".$feed['type']."+xml"; - $feed_title = $feed['version']." feed for this tag"; - $feed['textContent'] = "RSS"; - break; + $classname = null; - case 'favoritedrss': - $feed_classname = $feed['type']; - $feed_mimetype = "application/".$feed['type']."+xml"; - $feed_title = "Favorited ".$feed['version']." feed"; - $feed['textContent'] = "RSS"; + switch ($feed->type) { + case Feed::RSS1: + case Feed::RSS2: + $classname = 'rss'; break; - - case 'foaf': - $feed_classname = "foaf"; - $feed_mimetype = "application/".$feed['type']."+xml"; - $feed_title = "$nickname's FOAF file"; - $feed['textContent'] = "FOAF"; + case Feed::ATOM: + $classname = 'atom'; break; - - case 'favoritesrss': - $feed_classname = "favorites"; - $feed_mimetype = "application/".$feed['type']."+xml"; - $feed_title = "Feed for favorites of $nickname"; - $feed['textContent'] = "RSS"; - break; - - case 'usertimeline': - $feed_classname = "atom"; - $feed_mimetype = "application/".$feed['type']."+xml"; - $feed_title = "$nickname's ".$feed['version']." notice feed"; - $feed['textContent'] = "Atom"; + case Feed::FOAF: + $classname = 'foaf'; break; } + $this->out->elementStart('li'); - $this->out->element('a', array('href' => $feed['href'], - 'class' => $feed_classname, - 'type' => $feed_mimetype, - 'title' => $feed_title), - $feed['textContent']); + $this->out->element('a', array('href' => $feed->url, + 'class' => $classname, + 'type' => $feed->mimeType(), + 'title' => $feed->title), + $feed->typeName()); $this->out->elementEnd('li'); } } -- cgit v1.2.3-54-g00ecf From fc293545be13473d992b512141be233c2963f6da Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 11 Feb 2009 16:50:07 +0000 Subject: Minor. Changed from @class location to label --- actions/showgroup.php | 2 +- actions/showstream.php | 2 +- actions/tagother.php | 2 +- lib/grouplist.php | 2 +- lib/profilelist.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'actions') diff --git a/actions/showgroup.php b/actions/showgroup.php index 7bc68fbc6..6df8dd306 100644 --- a/actions/showgroup.php +++ b/actions/showgroup.php @@ -244,7 +244,7 @@ class ShowgroupAction extends Action if ($this->group->location) { $this->elementStart('dl', 'entity_location'); $this->element('dt', null, _('Location')); - $this->element('dd', 'location', $this->group->location); + $this->element('dd', 'label', $this->group->location); $this->elementEnd('dl'); } diff --git a/actions/showstream.php b/actions/showstream.php index 962f4b452..bd6f4153b 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -281,7 +281,7 @@ class ShowstreamAction extends Action if ($this->profile->location) { $this->elementStart('dl', 'entity_location'); $this->element('dt', null, _('Location')); - $this->element('dd', 'location', $this->profile->location); + $this->element('dd', 'label', $this->profile->location); $this->elementEnd('dl'); } diff --git a/actions/tagother.php b/actions/tagother.php index 3e8a12fd6..79151c911 100644 --- a/actions/tagother.php +++ b/actions/tagother.php @@ -110,7 +110,7 @@ class TagotherAction extends Action if ($this->profile->location) { $this->elementStart('dl', 'entity_location'); $this->element('dt', null, _('Location')); - $this->element('dd', 'location', $this->profile->location); + $this->element('dd', 'label', $this->profile->location); $this->elementEnd('dl'); } if ($this->profile->homepage) { diff --git a/lib/grouplist.php b/lib/grouplist.php index 4c448e250..6801ab426 100644 --- a/lib/grouplist.php +++ b/lib/grouplist.php @@ -124,7 +124,7 @@ class GroupList extends Widget if ($this->group->location) { $this->out->elementStart('dl', 'entity_location'); $this->out->element('dt', null, _('Location')); - $this->out->elementStart('dd', 'location'); + $this->out->elementStart('dd', 'label'); $this->out->raw($this->highlight($this->group->location)); $this->out->elementEnd('dd'); $this->out->elementEnd('dl'); diff --git a/lib/profilelist.php b/lib/profilelist.php index 4d924b039..8bef49dce 100644 --- a/lib/profilelist.php +++ b/lib/profilelist.php @@ -123,7 +123,7 @@ class ProfileList extends Widget if ($this->profile->location) { $this->out->elementStart('dl', 'entity_location'); $this->out->element('dt', null, _('Location')); - $this->out->elementStart('dd', 'location'); + $this->out->elementStart('dd', 'label'); $this->out->raw($this->highlight($this->profile->location)); $this->out->elementEnd('dd'); $this->out->elementEnd('dl'); -- cgit v1.2.3-54-g00ecf From 7155cf813de1502e796c0eac1e680289f3552c29 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 11 Feb 2009 17:46:53 -0800 Subject: Move/reorg Twitter broadcast code to lib/twitter.php in prep for making a twitterqueuehandler. --- actions/twittersettings.php | 5 ++- lib/twitter.php | 97 +++++++++++++++++++++++++++++++++++++++++++-- lib/util.php | 87 ++++------------------------------------ 3 files changed, 104 insertions(+), 85 deletions(-) (limited to 'actions') diff --git a/actions/twittersettings.php b/actions/twittersettings.php index 2d41469bb..a79859bbf 100644 --- a/actions/twittersettings.php +++ b/actions/twittersettings.php @@ -32,6 +32,7 @@ if (!defined('LACONICA')) { } require_once INSTALLDIR.'/lib/connectsettingsaction.php'; +require_once INSTALLDIR.'/lib/twitter.php'; define('SUBSCRIPTIONS', 80); @@ -90,7 +91,7 @@ class TwittersettingsAction extends ConnectSettingsAction $fuser = null; - $flink = Foreign_link::getByUserID($user->id, 1); // 1 == Twitter + $flink = Foreign_link::getByUserID($user->id, TWITTER_SERVICE); if ($flink) { $fuser = $flink->getForeignUser(); @@ -358,7 +359,7 @@ class TwittersettingsAction extends ConnectSettingsAction $flink->user_id = $user->id; $flink->foreign_id = $twit_user->id; - $flink->service = 1; // Twitter + $flink->service = TWITTER_SERVICE; $flink->credentials = $password; $flink->created = common_sql_now(); diff --git a/lib/twitter.php b/lib/twitter.php index 197298549..72212c185 100644 --- a/lib/twitter.php +++ b/lib/twitter.php @@ -19,6 +19,8 @@ if (!defined('LACONICA')) { exit(1); } +define("TWITTER_SERVICE", 1); // Twitter is foreign_service ID 1 + function get_twitter_data($uri, $screen_name, $password) { @@ -28,14 +30,13 @@ function get_twitter_data($uri, $screen_name, $password) CURLOPT_FAILONERROR => true, CURLOPT_HEADER => false, CURLOPT_FOLLOWLOCATION => true, - # CURLOPT_USERAGENT => "identi.ca", + CURLOPT_USERAGENT => "Laconica", CURLOPT_CONNECTTIMEOUT => 120, CURLOPT_TIMEOUT => 120, # Twitter is strict about accepting invalid "Expect" headers CURLOPT_HTTPHEADER => array('Expect:') ); - $ch = curl_init($uri); curl_setopt_array($ch, $options); $data = curl_exec($ch); @@ -95,7 +96,7 @@ function add_twitter_user($twitter_id, $screen_name) $fuser->nickname = $screen_name; $fuser->uri = 'http://twitter.com/' . $screen_name; $fuser->id = $twitter_id; - $fuser->service = 1; // Twitter + $fuser->service = TWITTER_SERVICE; // Twitter $fuser->created = common_sql_now(); $result = $fuser->insert(); @@ -206,3 +207,93 @@ function save_twitter_friends($user, $twitter_id, $screen_name, $password) return true; } +function is_twitter_bound($notice, $flink) { + + // Check to see if notice should go to Twitter + if (($flink->noticesync & FOREIGN_NOTICE_SEND)) { + + // If it's not a Twitter-style reply, or if the user WANTS to send replies. + if (!preg_match('/^@[a-zA-Z0-9_]{1,15}\b/u', $notice->content) || + ($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY)) { + return true; + } + } + + return false; +} + +function broadcast_twitter($notice) +{ + global $config; + $success = true; + + $flink = Foreign_link::getByUserID($notice->profile_id, + TWITTER_SERVICE); + + // XXX: Not sure WHERE to check whether a notice should go to + // Twitter. Should we even put in the queue if it's not? --Zach + if (is_twitter_bound($notice, $flink)) { + + $fuser = $flink->getForeignUser(); + $twitter_user = $fuser->nickname; + $twitter_password = $flink->credentials; + $uri = 'http://www.twitter.com/statuses/update.json'; + + // XXX: Hack to get around PHP cURL's use of @ being a a meta character + $statustxt = preg_replace('/^@/', ' @', $notice->content); + + $options = array( + CURLOPT_USERPWD => "$twitter_user:$twitter_password", + CURLOPT_POST => true, + CURLOPT_POSTFIELDS => + array( + 'status' => $statustxt, + 'source' => $config['integration']['source'] + ), + CURLOPT_RETURNTRANSFER => true, + CURLOPT_FAILONERROR => true, + CURLOPT_HEADER => false, + CURLOPT_FOLLOWLOCATION => true, + CURLOPT_USERAGENT => "Laconica", + CURLOPT_CONNECTTIMEOUT => 120, // XXX: How long should this be? + CURLOPT_TIMEOUT => 120, + + # Twitter is strict about accepting invalid "Expect" headers + CURLOPT_HTTPHEADER => array('Expect:') + ); + + $ch = curl_init($uri); + curl_setopt_array($ch, $options); + $data = curl_exec($ch); + $errmsg = curl_error($ch); + + if ($errmsg) { + common_debug("cURL error: $errmsg - " . + "trying to send notice for $twitter_user.", + __FILE__); + $success = false; + } + + curl_close($ch); + + if (!$data) { + common_debug("No data returned by Twitter's " . + "API trying to send update for $twitter_user", + __FILE__); + $success = false; + } + + // Twitter should return a status + $status = json_decode($data); + + if (!$status->id) { + common_debug("Unexpected data returned by Twitter " . + " API trying to send update for $twitter_user", + __FILE__); + $success = false; + } + } + + return $success; +} + diff --git a/lib/util.php b/lib/util.php index c0c980111..3f4fae3a5 100644 --- a/lib/util.php +++ b/lib/util.php @@ -796,24 +796,6 @@ function common_redirect($url, $code=307) function common_broadcast_notice($notice, $remote=false) { - - // Check to see if notice should go to Twitter - $flink = Foreign_link::getByUserID($notice->profile_id, 1); // 1 == Twitter - if (($flink->noticesync & FOREIGN_NOTICE_SEND) == FOREIGN_NOTICE_SEND) { - - // If it's not a Twitter-style reply, or if the user WANTS to send replies... - - if (!preg_match('/^@[a-zA-Z0-9_]{1,15}\b/u', $notice->content) || - (($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) == FOREIGN_NOTICE_SEND_REPLY)) { - - $result = common_twitter_broadcast($notice, $flink); - - if (!$result) { - common_debug('Unable to send notice: ' . $notice->id . ' to Twitter.', __FILE__); - } - } - } - if (common_config('queue', 'enabled')) { // Do it later! return common_enqueue_notice($notice); @@ -822,68 +804,6 @@ function common_broadcast_notice($notice, $remote=false) } } -function common_twitter_broadcast($notice, $flink) -{ - global $config; - $success = true; - $fuser = $flink->getForeignUser(); - $twitter_user = $fuser->nickname; - $twitter_password = $flink->credentials; - $uri = 'http://www.twitter.com/statuses/update.json'; - - // XXX: Hack to get around PHP cURL's use of @ being a a meta character - $statustxt = preg_replace('/^@/', ' @', $notice->content); - - $options = array( - CURLOPT_USERPWD => "$twitter_user:$twitter_password", - CURLOPT_POST => true, - CURLOPT_POSTFIELDS => array( - 'status' => $statustxt, - 'source' => $config['integration']['source'] - ), - CURLOPT_RETURNTRANSFER => true, - CURLOPT_FAILONERROR => true, - CURLOPT_HEADER => false, - CURLOPT_FOLLOWLOCATION => true, - CURLOPT_USERAGENT => "Laconica", - CURLOPT_CONNECTTIMEOUT => 120, // XXX: Scary!!!! How long should this be? - CURLOPT_TIMEOUT => 120, - - # Twitter is strict about accepting invalid "Expect" headers - CURLOPT_HTTPHEADER => array('Expect:') - ); - - $ch = curl_init($uri); - curl_setopt_array($ch, $options); - $data = curl_exec($ch); - $errmsg = curl_error($ch); - - if ($errmsg) { - common_debug("cURL error: $errmsg - trying to send notice for $twitter_user.", - __FILE__); - $success = false; - } - - curl_close($ch); - - if (!$data) { - common_debug("No data returned by Twitter's API trying to send update for $twitter_user", - __FILE__); - $success = false; - } - - // Twitter should return a status - $status = json_decode($data); - - if (!$status->id) { - common_debug("Unexpected data returned by Twitter API trying to send update for $twitter_user", - __FILE__); - $success = false; - } - - return $success; -} - // Stick the notice on the queue function common_enqueue_notice($notice) @@ -935,6 +855,13 @@ function common_real_broadcast($notice, $remote=false) common_log(LOG_ERR, 'Error in public broadcast for notice ' . $notice->id); } } + if ($success) { + $success = broadcast_twitter($notice); + if (!$success) { + common_log(LOG_ERR, 'Error in Twitter broadcast for notice ' . $notice->id); + } + } + // XXX: broadcast notices to other IM return $success; } -- cgit v1.2.3-54-g00ecf From 9f035e2847e0d119ca3d70e02df6f4fa73ca64c3 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 11 Feb 2009 21:41:56 -0800 Subject: Code to handle PEAR_Errors raised by DB_DataObject that are bubbling up, but are actually expected and can safely be ignored. --- actions/emailsettings.php | 22 ++++++++++++++++++++++ actions/register.php | 23 ++++++++++++++++++++++- lib/action.php | 26 ++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 1 deletion(-) (limited to 'actions') diff --git a/actions/emailsettings.php b/actions/emailsettings.php index b84acb214..c6c983453 100644 --- a/actions/emailsettings.php +++ b/actions/emailsettings.php @@ -487,4 +487,26 @@ class EmailsettingsAction extends AccountSettingsAction return $other->id != $user->id; } } + + /** + * Check old fashioned PEAR_Error msgs coming from DB_DataObject + * + * In this case email don't exist in the DB yet, so DB_DataObject + * throws an error. Overrided from Action. + * + * @param PEAR_Error + * + * @return nothing + */ + + function checkDB_DataObjectError($error) { + if ($error->getCode() == DB_DATAOBJECT_ERROR_NODATA) { + + // Do nothing. + + } else { + parent::checkDB_DataObjectError($error); + } + } + } diff --git a/actions/register.php b/actions/register.php index 5d7a8ce69..853bd0cf6 100644 --- a/actions/register.php +++ b/actions/register.php @@ -223,10 +223,31 @@ class RegisterAction extends Action */ function nicknameExists($nickname) - { + { $user = User::staticGet('nickname', $nickname); return ($user !== false); } + + /** + * Check old fashioned PEAR_Error msgs coming from DB_DataObject + * + * In this case nickname and email don't exist in the DB yet, + * so DB_DataObject throws an error. Overrided from Action. + * + * @param PEAR_Error + * + * @return nothing + */ + + function checkDB_DataObjectError($error) { + if ($error->getCode() == DB_DATAOBJECT_ERROR_NODATA) { + + // Do nothing. + + } else { + parent::checkDB_DataObjectError($error); + } + } /** * Does the given email address already exist? diff --git a/lib/action.php b/lib/action.php index bd38bf79c..e3a8ef62c 100644 --- a/lib/action.php +++ b/lib/action.php @@ -82,6 +82,17 @@ class Action extends HTMLOutputter // lawsuit */ function prepare($argarray) { + // This is for checking PEAR_Errors raised by DB_DataObject. + // Setting this to PEAR_ERROR_CALLBACK because setting + // to PEAR_ERROR_EXCEPTION does't work to allow PEAR_Errors + // to be handled as PHP5 exceptions, and PEAR_ERROR_RETURN + // does not cause DB_DataObject to actually return PEAR_Errors + // that can be checked with PEAR::isError() -- instead + // they just disappear into the ether, and can only be checked for + // after the fact. -- Zach + PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, + array($this, "checkDB_DataObjectError")); + $this->args =& common_copy_args($argarray); return true; } @@ -844,6 +855,21 @@ class Action extends HTMLOutputter // lawsuit throw new ClientException($msg, $code); } + /** + * Check old fashioned PEAR_Error msgs coming from DB_DataObject + * + * Logs the DB_DataObject error. Override to do something else. + * + * @param PEAR_Error + * + * @return nothing + */ + + function checkDB_DataObjectError($error) { + common_log(LOG_ERR, $error->getMessage()); + // XXX: throw an exception here? --Zach + } + /** * Returns the current URL * -- cgit v1.2.3-54-g00ecf From 616bdd43a921b2554d21b80af28ddb0fb6cb3c16 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 11 Feb 2009 22:08:20 -0800 Subject: Just discovered the PEAR_Error handling function in index.php. Duh. Renamed the Action functions to throw an exception like it. I still think it probably makes sense to have the callback defined in both places for finer control. --- actions/emailsettings.php | 6 +++--- actions/register.php | 6 +++--- lib/action.php | 31 ++++++++++++++++++------------- 3 files changed, 24 insertions(+), 19 deletions(-) (limited to 'actions') diff --git a/actions/emailsettings.php b/actions/emailsettings.php index c6c983453..0a86aa66d 100644 --- a/actions/emailsettings.php +++ b/actions/emailsettings.php @@ -489,7 +489,7 @@ class EmailsettingsAction extends AccountSettingsAction } /** - * Check old fashioned PEAR_Error msgs coming from DB_DataObject + * Handle old fashioned PEAR_Error msgs coming from DB_DataObject * * In this case email don't exist in the DB yet, so DB_DataObject * throws an error. Overrided from Action. @@ -499,13 +499,13 @@ class EmailsettingsAction extends AccountSettingsAction * @return nothing */ - function checkDB_DataObjectError($error) { + function handleError($error) { if ($error->getCode() == DB_DATAOBJECT_ERROR_NODATA) { // Do nothing. } else { - parent::checkDB_DataObjectError($error); + parent::handleError($error); } } diff --git a/actions/register.php b/actions/register.php index 853bd0cf6..aafb54ebb 100644 --- a/actions/register.php +++ b/actions/register.php @@ -229,7 +229,7 @@ class RegisterAction extends Action } /** - * Check old fashioned PEAR_Error msgs coming from DB_DataObject + * Handle old fashioned PEAR_Error msgs coming from DB_DataObject * * In this case nickname and email don't exist in the DB yet, * so DB_DataObject throws an error. Overrided from Action. @@ -239,13 +239,13 @@ class RegisterAction extends Action * @return nothing */ - function checkDB_DataObjectError($error) { + function handleError($error) { if ($error->getCode() == DB_DATAOBJECT_ERROR_NODATA) { // Do nothing. } else { - parent::checkDB_DataObjectError($error); + parent::handleError($error); } } diff --git a/lib/action.php b/lib/action.php index e3a8ef62c..926fe93fb 100644 --- a/lib/action.php +++ b/lib/action.php @@ -82,16 +82,10 @@ class Action extends HTMLOutputter // lawsuit */ function prepare($argarray) { - // This is for checking PEAR_Errors raised by DB_DataObject. - // Setting this to PEAR_ERROR_CALLBACK because setting - // to PEAR_ERROR_EXCEPTION does't work to allow PEAR_Errors - // to be handled as PHP5 exceptions, and PEAR_ERROR_RETURN - // does not cause DB_DataObject to actually return PEAR_Errors - // that can be checked with PEAR::isError() -- instead - // they just disappear into the ether, and can only be checked for - // after the fact. -- Zach + + // For PEAR_Errors comming from DB_DataObject PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, - array($this, "checkDB_DataObjectError")); + array($this, "handleError")); $this->args =& common_copy_args($argarray); return true; @@ -856,7 +850,7 @@ class Action extends HTMLOutputter // lawsuit } /** - * Check old fashioned PEAR_Error msgs coming from DB_DataObject + * Handle old fashioned PEAR_Error msgs coming from DB_DataObject * * Logs the DB_DataObject error. Override to do something else. * @@ -865,9 +859,20 @@ class Action extends HTMLOutputter // lawsuit * @return nothing */ - function checkDB_DataObjectError($error) { - common_log(LOG_ERR, $error->getMessage()); - // XXX: throw an exception here? --Zach + function handleError($error) { + + common_log(LOG_ERR, "PEAR error: " . $error->getMessage()); + $msg = sprintf(_('The database for %s isn\'t responding correctly, '. + 'so the site won\'t work properly. '. + 'The site admins probably know about the problem, '. + 'but you can contact them at %s to make sure. '. + 'Otherwise, wait a few minutes and try again.'), + common_config('site', 'name'), + common_config('site', 'email')); + + $dac = new DBErrorAction($msg, 500); + $dac->showPage(); + exit(-1); } /** -- cgit v1.2.3-54-g00ecf From b09eb06dae77be27e56d1573de0de7d393950ce5 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 12 Feb 2009 16:04:43 -0500 Subject: Revert "Just discovered the PEAR_Error handling function in index.php. Duh." This reverts commit 616bdd43a921b2554d21b80af28ddb0fb6cb3c16. Kind of a long hard way to deal with a simple situation, so I'd prefer to just use the global handler. --- actions/emailsettings.php | 6 +++--- actions/register.php | 6 +++--- lib/action.php | 31 +++++++++++++------------------ 3 files changed, 19 insertions(+), 24 deletions(-) (limited to 'actions') diff --git a/actions/emailsettings.php b/actions/emailsettings.php index 0a86aa66d..c6c983453 100644 --- a/actions/emailsettings.php +++ b/actions/emailsettings.php @@ -489,7 +489,7 @@ class EmailsettingsAction extends AccountSettingsAction } /** - * Handle old fashioned PEAR_Error msgs coming from DB_DataObject + * Check old fashioned PEAR_Error msgs coming from DB_DataObject * * In this case email don't exist in the DB yet, so DB_DataObject * throws an error. Overrided from Action. @@ -499,13 +499,13 @@ class EmailsettingsAction extends AccountSettingsAction * @return nothing */ - function handleError($error) { + function checkDB_DataObjectError($error) { if ($error->getCode() == DB_DATAOBJECT_ERROR_NODATA) { // Do nothing. } else { - parent::handleError($error); + parent::checkDB_DataObjectError($error); } } diff --git a/actions/register.php b/actions/register.php index aafb54ebb..853bd0cf6 100644 --- a/actions/register.php +++ b/actions/register.php @@ -229,7 +229,7 @@ class RegisterAction extends Action } /** - * Handle old fashioned PEAR_Error msgs coming from DB_DataObject + * Check old fashioned PEAR_Error msgs coming from DB_DataObject * * In this case nickname and email don't exist in the DB yet, * so DB_DataObject throws an error. Overrided from Action. @@ -239,13 +239,13 @@ class RegisterAction extends Action * @return nothing */ - function handleError($error) { + function checkDB_DataObjectError($error) { if ($error->getCode() == DB_DATAOBJECT_ERROR_NODATA) { // Do nothing. } else { - parent::handleError($error); + parent::checkDB_DataObjectError($error); } } diff --git a/lib/action.php b/lib/action.php index 926fe93fb..e3a8ef62c 100644 --- a/lib/action.php +++ b/lib/action.php @@ -82,10 +82,16 @@ class Action extends HTMLOutputter // lawsuit */ function prepare($argarray) { - - // For PEAR_Errors comming from DB_DataObject + // This is for checking PEAR_Errors raised by DB_DataObject. + // Setting this to PEAR_ERROR_CALLBACK because setting + // to PEAR_ERROR_EXCEPTION does't work to allow PEAR_Errors + // to be handled as PHP5 exceptions, and PEAR_ERROR_RETURN + // does not cause DB_DataObject to actually return PEAR_Errors + // that can be checked with PEAR::isError() -- instead + // they just disappear into the ether, and can only be checked for + // after the fact. -- Zach PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, - array($this, "handleError")); + array($this, "checkDB_DataObjectError")); $this->args =& common_copy_args($argarray); return true; @@ -850,7 +856,7 @@ class Action extends HTMLOutputter // lawsuit } /** - * Handle old fashioned PEAR_Error msgs coming from DB_DataObject + * Check old fashioned PEAR_Error msgs coming from DB_DataObject * * Logs the DB_DataObject error. Override to do something else. * @@ -859,20 +865,9 @@ class Action extends HTMLOutputter // lawsuit * @return nothing */ - function handleError($error) { - - common_log(LOG_ERR, "PEAR error: " . $error->getMessage()); - $msg = sprintf(_('The database for %s isn\'t responding correctly, '. - 'so the site won\'t work properly. '. - 'The site admins probably know about the problem, '. - 'but you can contact them at %s to make sure. '. - 'Otherwise, wait a few minutes and try again.'), - common_config('site', 'name'), - common_config('site', 'email')); - - $dac = new DBErrorAction($msg, 500); - $dac->showPage(); - exit(-1); + function checkDB_DataObjectError($error) { + common_log(LOG_ERR, $error->getMessage()); + // XXX: throw an exception here? --Zach } /** -- cgit v1.2.3-54-g00ecf From 3b5fd8fb6bbfa95efe3294ea77ae809dab071f99 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 12 Feb 2009 16:05:37 -0500 Subject: Revert "Code to handle PEAR_Errors raised by DB_DataObject that are bubbling" This reverts commit 9f035e2847e0d119ca3d70e02df6f4fa73ca64c3. It's a lot of complicated stuff, and the global handler probably does fine. --- actions/emailsettings.php | 22 ---------------------- actions/register.php | 23 +---------------------- lib/action.php | 26 -------------------------- 3 files changed, 1 insertion(+), 70 deletions(-) (limited to 'actions') diff --git a/actions/emailsettings.php b/actions/emailsettings.php index c6c983453..b84acb214 100644 --- a/actions/emailsettings.php +++ b/actions/emailsettings.php @@ -487,26 +487,4 @@ class EmailsettingsAction extends AccountSettingsAction return $other->id != $user->id; } } - - /** - * Check old fashioned PEAR_Error msgs coming from DB_DataObject - * - * In this case email don't exist in the DB yet, so DB_DataObject - * throws an error. Overrided from Action. - * - * @param PEAR_Error - * - * @return nothing - */ - - function checkDB_DataObjectError($error) { - if ($error->getCode() == DB_DATAOBJECT_ERROR_NODATA) { - - // Do nothing. - - } else { - parent::checkDB_DataObjectError($error); - } - } - } diff --git a/actions/register.php b/actions/register.php index 853bd0cf6..5d7a8ce69 100644 --- a/actions/register.php +++ b/actions/register.php @@ -223,31 +223,10 @@ class RegisterAction extends Action */ function nicknameExists($nickname) - { + { $user = User::staticGet('nickname', $nickname); return ($user !== false); } - - /** - * Check old fashioned PEAR_Error msgs coming from DB_DataObject - * - * In this case nickname and email don't exist in the DB yet, - * so DB_DataObject throws an error. Overrided from Action. - * - * @param PEAR_Error - * - * @return nothing - */ - - function checkDB_DataObjectError($error) { - if ($error->getCode() == DB_DATAOBJECT_ERROR_NODATA) { - - // Do nothing. - - } else { - parent::checkDB_DataObjectError($error); - } - } /** * Does the given email address already exist? diff --git a/lib/action.php b/lib/action.php index e3a8ef62c..bd38bf79c 100644 --- a/lib/action.php +++ b/lib/action.php @@ -82,17 +82,6 @@ class Action extends HTMLOutputter // lawsuit */ function prepare($argarray) { - // This is for checking PEAR_Errors raised by DB_DataObject. - // Setting this to PEAR_ERROR_CALLBACK because setting - // to PEAR_ERROR_EXCEPTION does't work to allow PEAR_Errors - // to be handled as PHP5 exceptions, and PEAR_ERROR_RETURN - // does not cause DB_DataObject to actually return PEAR_Errors - // that can be checked with PEAR::isError() -- instead - // they just disappear into the ether, and can only be checked for - // after the fact. -- Zach - PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, - array($this, "checkDB_DataObjectError")); - $this->args =& common_copy_args($argarray); return true; } @@ -855,21 +844,6 @@ class Action extends HTMLOutputter // lawsuit throw new ClientException($msg, $code); } - /** - * Check old fashioned PEAR_Error msgs coming from DB_DataObject - * - * Logs the DB_DataObject error. Override to do something else. - * - * @param PEAR_Error - * - * @return nothing - */ - - function checkDB_DataObjectError($error) { - common_log(LOG_ERR, $error->getMessage()); - // XXX: throw an exception here? --Zach - } - /** * Returns the current URL * -- cgit v1.2.3-54-g00ecf From 4ad5d55ecf65fb1c9f58211b37f8f111e9ca0c7b Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 13 Feb 2009 10:52:26 -0500 Subject: Add events for filtering and logging new notices --- EVENTS.txt | 8 +++++++- actions/newnotice.php | 17 ++++++++++------- classes/Notice.php | 43 ++++++++++++++++++++++++------------------- 3 files changed, 41 insertions(+), 27 deletions(-) (limited to 'actions') diff --git a/EVENTS.txt b/EVENTS.txt index 16ca9ea06..af0bee587 100644 --- a/EVENTS.txt +++ b/EVENTS.txt @@ -30,7 +30,7 @@ EndShowLaconicaStyles: End showing Laconica Style links; good place to add hand StartShowUAStyles: Showing custom UA Style links - $action: the current action -EndShowUAStyles: End showing custom UA Style links; good place to add user-agent (e.g., filter, -webkit, -moz) specific styles +EndShowUAStyles: End showing custom UA Style links; good place to add user-agent (e.g., filter, -webkit, -moz) specific styles - $action: the current action StartShowScripts: Showing JavaScript links @@ -76,3 +76,9 @@ StartShowContentBlock: Showing before the content container EndShowContentBlock: Showing after the content container - $action: the current action +StartNoticeSave: before inserting a notice (good place for content filters) +- $notice: notice being saved (no ID or URI) + +EndNoticeSave: after inserting a notice and related code +- $notice: notice that was saved (with ID and URI) + diff --git a/actions/newnotice.php b/actions/newnotice.php index 5e7691f33..9face9644 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -98,7 +98,12 @@ class NewnoticeAction extends Action return; } - $this->saveNewNotice(); + try { + $this->saveNewNotice(); + } catch (Exception $e) { + $this->showForm($e->getMessage()); + return; + } } else { $this->showForm(); } @@ -123,15 +128,13 @@ class NewnoticeAction extends Action $content = $this->trimmed('status_textarea'); if (!$content) { - $this->showForm(_('No content!')); - return; + $this->clientError(_('No content!')); } else { $content_shortened = common_shorten_links($content); if (mb_strlen($content_shortened) > 140) { - $this->showForm(_('That\'s too long. '. - 'Max notice size is 140 chars.')); - return; + $this->clientError(_('That\'s too long. '. + 'Max notice size is 140 chars.')); } } @@ -154,7 +157,7 @@ class NewnoticeAction extends Action ($replyto == 'false') ? null : $replyto); if (is_string($notice)) { - $this->showForm($notice); + $this->clientError($notice); return; } diff --git a/classes/Notice.php b/classes/Notice.php index 329988368..6db59c96e 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -154,32 +154,37 @@ class Notice extends Memcached_DataObject $notice->source = $source; $notice->uri = $uri; - $id = $notice->insert(); + if (Event::handle('StartNoticeSave', array(&$notice))) { - if (!$id) { - common_log_db_error($notice, 'INSERT', __FILE__); - return _('Problem saving notice.'); - } - - # Update the URI after the notice is in the database - if (!$uri) { - $orig = clone($notice); - $notice->uri = common_notice_uri($notice); + $id = $notice->insert(); - if (!$notice->update($orig)) { - common_log_db_error($notice, 'UPDATE', __FILE__); + if (!$id) { + common_log_db_error($notice, 'INSERT', __FILE__); return _('Problem saving notice.'); } - } - # XXX: do we need to change this for remote users? + # Update the URI after the notice is in the database + if (!$uri) { + $orig = clone($notice); + $notice->uri = common_notice_uri($notice); + + if (!$notice->update($orig)) { + common_log_db_error($notice, 'UPDATE', __FILE__); + return _('Problem saving notice.'); + } + } + + # XXX: do we need to change this for remote users? - $notice->saveReplies(); - $notice->saveTags(); - $notice->saveGroups(); + $notice->saveReplies(); + $notice->saveTags(); + $notice->saveGroups(); - $notice->addToInboxes(); - $notice->query('COMMIT'); + $notice->addToInboxes(); + $notice->query('COMMIT'); + + Event::handle('EndNoticeSave', array($notice)); + } # Clear the cache for subscribed users, so they'll update at next request # XXX: someone clever could prepend instead of clearing the cache -- cgit v1.2.3-54-g00ecf From b727e8be33f5f5aaf0d319cdd11d422556e6167a Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 16 Feb 2009 18:45:05 -0500 Subject: Set @-message notification options in email settings Set the @-message notification options in email settings. --- actions/emailsettings.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'actions') diff --git a/actions/emailsettings.php b/actions/emailsettings.php index b84acb214..634388fdd 100644 --- a/actions/emailsettings.php +++ b/actions/emailsettings.php @@ -164,6 +164,11 @@ class EmailsettingsAction extends AccountSettingsAction $user->emailnotifymsg); $this->elementEnd('li'); $this->elementStart('li'); + $this->checkbox('emailnotifyattn', + _('Send me email when someone sends me an "@-reply".'), + $user->emailnotifyattn); + $this->elementEnd('li'); + $this->elementStart('li'); $this->checkbox('emailnotifynudge', _('Allow friends to nudge me and send me an email.'), $user->emailnotifynudge); @@ -255,6 +260,7 @@ class EmailsettingsAction extends AccountSettingsAction $emailnotifyfav = $this->boolean('emailnotifyfav'); $emailnotifymsg = $this->boolean('emailnotifymsg'); $emailnotifynudge = $this->boolean('emailnotifynudge'); + $emailnotifyattn = $this->boolean('emailnotifyattn'); $emailmicroid = $this->boolean('emailmicroid'); $emailpost = $this->boolean('emailpost'); @@ -270,6 +276,7 @@ class EmailsettingsAction extends AccountSettingsAction $user->emailnotifyfav = $emailnotifyfav; $user->emailnotifymsg = $emailnotifymsg; $user->emailnotifynudge = $emailnotifynudge; + $user->emailnotifyattn = $emailnotifyattn; $user->emailmicroid = $emailmicroid; $user->emailpost = $emailpost; -- cgit v1.2.3-54-g00ecf From 4327ae19d49384ca2f4b65b04926fb2fbea7d28d Mon Sep 17 00:00:00 2001 From: Meitar Moscovitz Date: Tue, 17 Feb 2009 18:37:02 +1100 Subject: Fixes ticket:1053; removes spacing between hash and tag on profile page. --- actions/showstream.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'actions') diff --git a/actions/showstream.php b/actions/showstream.php index c736c99b5..65482167e 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -292,11 +292,11 @@ class ShowstreamAction extends Action $this->elementStart('ul', 'tags xoxo'); foreach ($tags as $tag) { $this->elementStart('li'); - $this->element('span', 'mark_hash', '#'); - $this->element('a', array('rel' => 'tag', - 'href' => common_local_url('peopletag', - array('tag' => $tag))), - $tag); + // Avoid space by using raw output. + $pt = '#'; + $this->raw($pt); $this->elementEnd('li'); } $this->elementEnd('ul'); -- cgit v1.2.3-54-g00ecf From d8b6762e6dcb776571797f51d7c7d4cb99c9ef31 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 18 Feb 2009 09:35:59 -0500 Subject: move peoplesearchresults to its own module --- actions/peoplesearch.php | 26 +--------------- lib/peoplesearchresults.php | 75 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 25 deletions(-) create mode 100644 lib/peoplesearchresults.php (limited to 'actions') diff --git a/actions/peoplesearch.php b/actions/peoplesearch.php index 615201c46..14177fcf0 100644 --- a/actions/peoplesearch.php +++ b/actions/peoplesearch.php @@ -86,33 +86,9 @@ class PeoplesearchAction extends SearchAction } $profile->free(); - + $this->pagination($page > 1, $cnt > PROFILES_PER_PAGE, $page, 'peoplesearch', array('q' => $q)); } } -class PeopleSearchResults extends ProfileList -{ - var $terms = null; - var $pattern = null; - - function __construct($profile, $terms, $action) - { - parent::__construct($profile, $terms, $action); - $this->terms = array_map('preg_quote', - array_map('htmlspecialchars', $terms)); - $this->pattern = '/('.implode('|',$terms).')/i'; - } - - function highlight($text) - { - return preg_replace($this->pattern, '\\1', htmlspecialchars($text)); - } - - function isReadOnly() - { - return true; - } -} - diff --git a/lib/peoplesearchresults.php b/lib/peoplesearchresults.php new file mode 100644 index 000000000..f8ab7cf3b --- /dev/null +++ b/lib/peoplesearchresults.php @@ -0,0 +1,75 @@ + + * @author Robin Millette + * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 + * @link http://laconi.ca/ + * + * Laconica - a distributed open-source microblogging tool + * Copyright (C) 2008, Controlez-Vous, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +if (!defined('LACONICA')) { + exit(1); +} + +require_once INSTALLDIR.'/lib/profilelist.php'; + +/** + * People search results class + * + * Derivative of ProfileList with specialization for highlighting search terms. + * + * @category Widget + * @package Laconica + * @author Evan Prodromou + * @author Robin Millette + * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 + * @link http://laconi.ca/ + * + * @see PeoplesearchAction + */ + +class PeopleSearchResults extends ProfileList +{ + var $terms = null; + var $pattern = null; + + function __construct($profile, $terms, $action) + { + parent::__construct($profile, $terms, $action); + $this->terms = array_map('preg_quote', + array_map('htmlspecialchars', $terms)); + $this->pattern = '/('.implode('|',$terms).')/i'; + } + + function highlight($text) + { + return preg_replace($this->pattern, '\\1', htmlspecialchars($text)); + } + + function isReadOnly() + { + return true; + } +} + -- cgit v1.2.3-54-g00ecf From 28e1c163e3e14b646851d7641c1c8a6a00de8fdc Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 18 Feb 2009 15:33:52 -0800 Subject: Open the /api/laconica/config.format API method so clients can determine whether a site is "private". --- actions/api.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'actions') diff --git a/actions/api.php b/actions/api.php index 21fe4eea3..a27d24492 100644 --- a/actions/api.php +++ b/actions/api.php @@ -131,14 +131,14 @@ class ApiAction extends Action 'statuses/followers', 'favorites/favorites'); - # If the site is "private", all API methods need authentication - + $fullname = "$this->api_action/$this->api_method"; + + // If the site is "private", all API methods except laconica/config + // need authentication if (common_config('site', 'private')) { - return true; + return $fullname != 'laconica/config' || false; } - $fullname = "$this->api_action/$this->api_method"; - if (in_array($fullname, $bareauth)) { # bareauth: only needs auth if without an argument if ($this->api_arg) { -- cgit v1.2.3-54-g00ecf From 5ec5a22dc75cb8f4d896b41ca24067c68d3e1de6 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 20 Feb 2009 10:04:28 -0500 Subject: make tagother work with router --- actions/tagother.php | 3 ++- lib/router.php | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'actions') diff --git a/actions/tagother.php b/actions/tagother.php index 79151c911..0d18945a0 100644 --- a/actions/tagother.php +++ b/actions/tagother.php @@ -135,7 +135,8 @@ class TagotherAction extends Action 'id' => 'form_tag_user', 'class' => 'form_settings', 'name' => 'tagother', - 'action' => $this->selfUrl())); + 'action' => common_local_url('tagother', array('id' => $this->profile->id)))); + $this->elementStart('fieldset'); $this->element('legend', null, _('Tag user')); $this->hidden('token', common_session_token()); diff --git a/lib/router.php b/lib/router.php index d47ad7118..e55b597f2 100644 --- a/lib/router.php +++ b/lib/router.php @@ -98,12 +98,14 @@ class Router $main = array('login', 'logout', 'register', 'subscribe', 'unsubscribe', 'confirmaddress', 'recoverpassword', 'invite', 'favor', 'disfavor', 'sup', - 'tagother', 'block'); + 'block'); foreach ($main as $a) { $m->connect('main/'.$a, array('action' => $a)); } + $m->connect('main/tagother/:id', array('action' => 'tagother')); + // these take a code foreach (array('register', 'confirmaddress', 'recoverpassword') as $c) { -- cgit v1.2.3-54-g00ecf From 9a0e71f9bf3329004949a0cef61abb5a354c7688 Mon Sep 17 00:00:00 2001 From: Leslie Michael Orchard Date: Tue, 17 Feb 2009 23:22:56 -0500 Subject: Fixing a bunch of undefined variable warnings in OpenID signup process --- actions/finishopenidlogin.php | 17 +++++++++++------ classes/User.php | 18 +++++++++--------- 2 files changed, 20 insertions(+), 15 deletions(-) (limited to 'actions') diff --git a/actions/finishopenidlogin.php b/actions/finishopenidlogin.php index 1e7b73a7f..6d92cb9aa 100644 --- a/actions/finishopenidlogin.php +++ b/actions/finishopenidlogin.php @@ -83,7 +83,7 @@ class FinishopenidloginAction extends Action function showContent() { - if ($this->message_text) { + if (!empty($this->message_text)) { $this->element('p', null, $this->message); return; } @@ -232,7 +232,8 @@ class FinishopenidloginAction extends Action return; } - if ($sreg['country']) { + $location = ''; + if (!empty($sreg['country'])) { if ($sreg['postcode']) { # XXX: use postcode to get city and region # XXX: also, store postcode somewhere -- it's valuable! @@ -242,12 +243,16 @@ class FinishopenidloginAction extends Action } } - if ($sreg['fullname'] && mb_strlen($sreg['fullname']) <= 255) { + if (!empty($sreg['fullname']) && mb_strlen($sreg['fullname']) <= 255) { $fullname = $sreg['fullname']; + } else { + $fullname = ''; } - if ($sreg['email'] && Validate::email($sreg['email'], true)) { + if (!empty($sreg['email']) && Validate::email($sreg['email'], true)) { $email = $sreg['email']; + } else { + $email = ''; } # XXX: add language @@ -328,7 +333,7 @@ class FinishopenidloginAction extends Action # Try the passed-in nickname - if ($sreg['nickname']) { + if (!empty($sreg['nickname'])) { $nickname = $this->nicknamize($sreg['nickname']); if ($this->isNewNickname($nickname)) { return $nickname; @@ -337,7 +342,7 @@ class FinishopenidloginAction extends Action # Try the full name - if ($sreg['fullname']) { + if (!empty($sreg['fullname'])) { $fullname = $this->nicknamize($sreg['fullname']); if ($this->isNewNickname($fullname)) { return $fullname; diff --git a/classes/User.php b/classes/User.php index 495a98236..40cf18df6 100644 --- a/classes/User.php +++ b/classes/User.php @@ -183,16 +183,16 @@ class User extends Memcached_DataObject $profile->nickname = $nickname; $profile->profileurl = common_profile_url($nickname); - if ($fullname) { + if (!empty($fullname)) { $profile->fullname = $fullname; } - if ($homepage) { + if (!empty($homepage)) { $profile->homepage = $homepage; } - if ($bio) { + if (!empty($bio)) { $profile->bio = $bio; } - if ($location) { + if (!empty($location)) { $profile->location = $location; } @@ -200,7 +200,7 @@ class User extends Memcached_DataObject $id = $profile->insert(); - if (!$id) { + if (empty($id)) { common_log_db_error($profile, 'INSERT', __FILE__); return false; } @@ -210,13 +210,13 @@ class User extends Memcached_DataObject $user->id = $id; $user->nickname = $nickname; - if ($password) { # may not have a password for OpenID users + if (!empty($password)) { # may not have a password for OpenID users $user->password = common_munge_password($password, $id); } # Users who respond to invite email have proven their ownership of that address - if ($code) { + if (!empty($code)) { $invite = Invitation::staticGet($code); if ($invite && $invite->address && $invite->address_type == 'email' && $invite->address == $email) { $user->email = $invite->address; @@ -253,7 +253,7 @@ class User extends Memcached_DataObject return false; } - if ($email && !$user->email) { + if (!empty($email) && !$user->email) { $confirm = new Confirm_address(); $confirm->code = common_confirmation_code(128); @@ -268,7 +268,7 @@ class User extends Memcached_DataObject } } - if ($code && $user->email) { + if (!empty($code) && $user->email) { $user->emailChanged(); } -- cgit v1.2.3-54-g00ecf From 4aa9b95f51216edaffcd229d9c31a5f905a76b13 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 20 Feb 2009 16:58:19 -0500 Subject: use return value of common_check_user() in login.php --- actions/login.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'actions') diff --git a/actions/login.php b/actions/login.php index 71e467929..b049791fb 100644 --- a/actions/login.php +++ b/actions/login.php @@ -108,13 +108,15 @@ class LoginAction extends Action $nickname = common_canonical_nickname($this->trimmed('nickname')); $password = $this->arg('password'); - if (!common_check_user($nickname, $password)) { + $user = common_check_user($nickname, $password); + + if (!$user) { $this->showForm(_('Incorrect username or password.')); return; } // success! - if (!common_set_user($nickname)) { + if (!common_set_user($user)) { $this->serverError(_('Error setting user.')); return; } -- cgit v1.2.3-54-g00ecf From 12636d9fb1c8d6bdcf27e068f3be2ad9c9636ee1 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 20 Feb 2009 17:14:13 -0500 Subject: don't use SUP in group rss --- actions/grouprss.php | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'actions') diff --git a/actions/grouprss.php b/actions/grouprss.php index 1a7b858b1..de76a5960 100644 --- a/actions/grouprss.php +++ b/actions/grouprss.php @@ -111,13 +111,13 @@ class groupRssAction extends Rss10Action { $group = $this->group; - + if (is_null($group)) { return null; } - + $notice = $group->getNotices(0, ($limit == 0) ? NOTICES_PER_PAGE : $limit); - + while ($notice->fetch()) { $notices[] = clone($notice); } @@ -141,13 +141,4 @@ class groupRssAction extends Rss10Action { return $this->group->homepage_logo; } - - # override parent to add X-SUP-ID URL - - function initRss($limit=0) - { - $url = common_local_url('sup', null, $this->group->id); - header('X-SUP-ID: '.$url); - parent::initRss($limit); - } } -- cgit v1.2.3-54-g00ecf From 3a999af4d905d3cd23ea9163f47b6ed5c35f606c Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 20 Feb 2009 17:30:09 -0500 Subject: Change common_local_url() to take 4 arguments I changed common_local_url() to take an additional optional argument -- for query parameters. Being persnickety, I made it the third of four, and moved the last one ($fragment) down a slot. That required changing a couple of calls. --- actions/twitapistatuses.php | 2 +- actions/userrss.php | 11 +++++------ lib/router.php | 4 ++-- lib/util.php | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) (limited to 'actions') diff --git a/actions/twitapistatuses.php b/actions/twitapistatuses.php index 18e24c0f5..51c256589 100644 --- a/actions/twitapistatuses.php +++ b/actions/twitapistatuses.php @@ -204,7 +204,7 @@ class TwitapistatusesAction extends TwitterapiAction # FriendFeed's SUP protocol # Also added RSS and Atom feeds - $suplink = common_local_url('sup', null, $user->id); + $suplink = common_local_url('sup', null, null, $user->id); header('X-SUP-ID: '.$suplink); # XXX: since diff --git a/actions/userrss.php b/actions/userrss.php index 04855ccca..a3e5a3aab 100644 --- a/actions/userrss.php +++ b/actions/userrss.php @@ -46,13 +46,13 @@ class UserrssAction extends Rss10Action { $user = $this->user; - + if (is_null($user)) { return null; } - + $notice = $user->getNotices(0, ($limit == 0) ? NOTICES_PER_PAGE : $limit); - + while ($notice->fetch()) { $notices[] = clone($notice); } @@ -87,10 +87,10 @@ class UserrssAction extends Rss10Action } # override parent to add X-SUP-ID URL - + function initRss($limit=0) { - $url = common_local_url('sup', null, $this->user->id); + $url = common_local_url('sup', null, null, $this->user->id); header('X-SUP-ID: '.$url); parent::initRss($limit); } @@ -100,4 +100,3 @@ class UserrssAction extends Rss10Action return true; } } - diff --git a/lib/router.php b/lib/router.php index 0640a5911..85425bed2 100644 --- a/lib/router.php +++ b/lib/router.php @@ -350,7 +350,7 @@ class Router return $this->m->match($path); } - function build($action, $args=null, $fragment=null) + function build($action, $args=null, $params=null, $fragment=null) { $action_arg = array('action' => $action); @@ -360,6 +360,6 @@ class Router $args = $action_arg; } - return $this->m->generate($args, null, $fragment); + return $this->m->generate($args, $params, $fragment); } } \ No newline at end of file diff --git a/lib/util.php b/lib/util.php index 46aa7b9df..5345a08bb 100644 --- a/lib/util.php +++ b/lib/util.php @@ -705,10 +705,10 @@ function common_relative_profile($sender, $nickname, $dt=null) return null; } -function common_local_url($action, $args=null, $fragment=null) +function common_local_url($action, $args=null, $params=null, $fragment=null) { $r = Router::get(); - $path = $r->build($action, $args, $fragment); + $path = $r->build($action, $args, $params, $fragment); if ($path) { } if (common_config('site','fancy')) { -- cgit v1.2.3-54-g00ecf From cdab8d55a96b61ce6cfbec697d95e3223751fd3f Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sun, 22 Feb 2009 17:01:41 -0800 Subject: Ticket #925 - make verify_credentials return 'Authorized' if no return type specified --- actions/twitapiaccount.php | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'actions') diff --git a/actions/twitapiaccount.php b/actions/twitapiaccount.php index b7c09cc9d..c19cd370d 100644 --- a/actions/twitapiaccount.php +++ b/actions/twitapiaccount.php @@ -24,20 +24,19 @@ require_once(INSTALLDIR.'/lib/twitterapi.php'); class TwitapiaccountAction extends TwitterapiAction { - function verify_credentials($args, $apidata) + function verify_credentials($args, $apidata) { - - if ($apidata['content-type'] == 'xml') { - header('Content-Type: application/xml; charset=utf-8'); - print 'true'; - } elseif ($apidata['content-type'] == 'json') { - header('Content-Type: application/json; charset=utf-8'); - print '{"authorized":true}'; - } else { - common_user_error(_('API method not found!'), $code=404); - } - - } + if ($apidata['content-type'] == 'xml') { + header('Content-Type: application/xml; charset=utf-8'); + print 'true'; + } elseif ($apidata['content-type'] == 'json') { + header('Content-Type: application/json; charset=utf-8'); + print '{"authorized":true}'; + } else { + header('Content-Type: text/html; charset=utf-8'); + print 'Authorized'; + } + } function end_session($args, $apidata) { -- cgit v1.2.3-54-g00ecf From cab322d21b8c8077192a1396bf13050d734c2aba Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sun, 22 Feb 2009 20:04:47 -0800 Subject: Ticket #1108 - Added 'social graph' methods to the API --- actions/twitapistatuses.php | 52 +++++++++++++++++++++++++++++++++++++++------ lib/router.php | 27 +++++++++++++++++++++++ 2 files changed, 73 insertions(+), 6 deletions(-) (limited to 'actions') diff --git a/actions/twitapistatuses.php b/actions/twitapistatuses.php index 51c256589..216835026 100644 --- a/actions/twitapistatuses.php +++ b/actions/twitapistatuses.php @@ -470,19 +470,28 @@ class TwitapistatusesAction extends TwitterapiAction return $this->subscriptions($apidata, 'subscribed', 'subscriber'); } - function followers($args, $apidata) + function friendsIDs($args, $apidata) { parent::handle($args); + return $this->subscriptions($apidata, 'subscribed', 'subscriber', true); + } + function followers($args, $apidata) + { + parent::handle($args); return $this->subscriptions($apidata, 'subscriber', 'subscribed'); } - function subscriptions($apidata, $other_attr, $user_attr) + function followersIDs($args, $apidata) { + parent::handle($args); + return $this->subscriptions($apidata, 'subscriber', 'subscribed', true); + } - # XXX: lite + function subscriptions($apidata, $other_attr, $user_attr, $onlyIDs=false) + { - $this->auth_user = $apidate['user']; + $this->auth_user = $apidata['user']; $user = $this->get_user($apidata['api_arg'], $apidata); if (!$user) { @@ -514,7 +523,10 @@ class TwitapistatusesAction extends TwitterapiAction } $sub->orderBy('created DESC'); - $sub->limit(($page-1)*100, 100); + + if (!$onlyIDs) { + $sub->limit(($page-1)*100, 100); + } $others = array(); @@ -529,7 +541,13 @@ class TwitapistatusesAction extends TwitterapiAction $type = $apidata['content-type']; $this->init_document($type); - $this->show_profiles($others, $type); + + if ($onlyIDs) { + $this->showIDs($others, $type); + } else { + $this->show_profiles($others, $type); + } + $this->end_document($type); } @@ -555,6 +573,28 @@ class TwitapistatusesAction extends TwitterapiAction } } + function showIDs($profiles, $type) + { + switch ($type) { + case 'xml': + $this->elementStart('ids'); + foreach ($profiles as $profile) { + $this->element('id', null, $profile->id); + } + $this->elementEnd('ids'); + break; + case 'json': + $ids = array(); + foreach ($profiles as $profile) { + $ids[] = (int)$profile->id; + } + print json_encode($ids); + break; + default: + $this->clientError(_('unsupported file type')); + } + } + function featured($args, $apidata) { parent::handle($args); diff --git a/lib/router.php b/lib/router.php index a41d35f22..b18a5523e 100644 --- a/lib/router.php +++ b/lib/router.php @@ -265,6 +265,33 @@ class Router 'apiaction' => 'friendships'), array('method' => 'exists(\.(xml|json|rss|atom))')); + + // Social graph + + $m->connect('api/friends/ids/:argument', + array('action' => 'api', + 'apiaction' => 'statuses', + 'method' => 'friendsIDs')); + + foreach (array('xml', 'json') as $e) { + $m->connect('api/friends/ids.'.$e, + array('action' => 'api', + 'apiaction' => 'statuses', + 'method' => 'friendsIDs.'.$e)); + } + + $m->connect('api/followers/ids/:argument', + array('action' => 'api', + 'apiaction' => 'statuses', + 'method' => 'followersIDs')); + + foreach (array('xml', 'json') as $e) { + $m->connect('api/followers/ids.'.$e, + array('action' => 'api', + 'apiaction' => 'statuses', + 'method' => 'followersIDs.'.$e)); + } + // account $m->connect('api/account/:method', -- cgit v1.2.3-54-g00ecf From 8c3fe83c645265a11a3fca80cac2ac48ea72cdab Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 23 Feb 2009 13:27:22 -0800 Subject: Make allrss.php work with phpcs --- actions/allrss.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'actions') diff --git a/actions/allrss.php b/actions/allrss.php index 05787f3f7..0114c4396 100644 --- a/actions/allrss.php +++ b/actions/allrss.php @@ -53,7 +53,9 @@ class AllrssAction extends Rss10Action /** * Initialization. - * + * + * @param array $args Web and URL arguments + * * @return boolean false if user doesn't exist */ function prepare($args) @@ -81,7 +83,7 @@ class AllrssAction extends Rss10Action { $user = $this->user; $notice = $user->noticesWithFriends(0, $limit); - + while ($notice->fetch()) { $notices[] = clone($notice); } @@ -104,7 +106,8 @@ class AllrssAction extends Rss10Action 'link' => common_local_url('all', array('nickname' => $user->nickname)), - 'description' => sprintf(_('Feed for friends of %s'), $user->nickname)); + 'description' => sprintf(_('Feed for friends of %s'), + $user->nickname)); return $c; } @@ -123,10 +126,5 @@ class AllrssAction extends Rss10Action $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE); return $avatar ? $avatar->url : null; } - - function isReadOnly() - { - return true; - } } -- cgit v1.2.3-54-g00ecf