summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-05-19 14:42:19 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-05-19 14:42:19 -0400
commit8cc8f9fd0c0ad8d1c38bd0c113f9f0a4d7918256 (patch)
tree9ff8e6cecfcd1539a2d6772133cd99e7706d94fc /actions
parent99f8501d321ae9d8087abbe6523e28ce5fd095d3 (diff)
parent09e95cc33fb2228066d524e399bcc549e85eb565 (diff)
Merge branch '0.8.x' of git@gitorious.org:laconica/dev into 0.8.x
Conflicts: config.php.sample
Diffstat (limited to 'actions')
-rw-r--r--actions/attachment.php209
-rw-r--r--actions/attachment_ajax.php141
-rw-r--r--actions/attachments.php292
-rw-r--r--actions/attachments_ajax.php115
-rw-r--r--actions/designsettings.php95
-rw-r--r--actions/logout.php16
-rw-r--r--actions/newnotice.php23
-rw-r--r--actions/showstream.php16
-rw-r--r--actions/tag.php3
-rw-r--r--actions/userrss.php24
10 files changed, 896 insertions, 38 deletions
diff --git a/actions/attachment.php b/actions/attachment.php
new file mode 100644
index 000000000..b9187ff08
--- /dev/null
+++ b/actions/attachment.php
@@ -0,0 +1,209 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Show notice attachments
+ *
+ * PHP version 5
+ *
+ * LICENCE: 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 <http://www.gnu.org/licenses/>.
+ *
+ * @category Personal
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2008-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);
+}
+
+//require_once INSTALLDIR.'/lib/personalgroupnav.php';
+//require_once INSTALLDIR.'/lib/feedlist.php';
+require_once INSTALLDIR.'/lib/attachmentlist.php';
+
+/**
+ * Show notice attachments
+ *
+ * @category Personal
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://laconi.ca/
+ */
+
+class AttachmentAction extends Action
+{
+ /**
+ * Attachment object to show
+ */
+
+ var $attachment = null;
+
+ /**
+ * Load attributes based on database arguments
+ *
+ * Loads all the DB stuff
+ *
+ * @param array $args $_REQUEST array
+ *
+ * @return success flag
+ */
+
+ function prepare($args)
+ {
+ parent::prepare($args);
+
+ $id = $this->arg('attachment');
+
+ $this->attachment = File::staticGet($id);
+
+ if (!$this->attachment) {
+ $this->clientError(_('No such attachment.'), 404);
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Is this action read-only?
+ *
+ * @return boolean true
+ */
+
+ function isReadOnly($args)
+ {
+ return true;
+ }
+
+ /**
+ * Title of the page
+ *
+ * @return string title of the page
+ */
+ function title()
+ {
+ $a = new Attachment($this->attachment);
+ return $a->title();
+ }
+
+ /**
+ * Last-modified date for page
+ *
+ * When was the content of this page last modified? Based on notice,
+ * profile, avatar.
+ *
+ * @return int last-modified date as unix timestamp
+ */
+/*
+ function lastModified()
+ {
+ return max(strtotime($this->notice->created),
+ strtotime($this->profile->modified),
+ ($this->avatar) ? strtotime($this->avatar->modified) : 0);
+ }
+*/
+
+ /**
+ * An entity tag for this page
+ *
+ * Shows the ETag for the page, based on the notice ID and timestamps
+ * for the notice, profile, and avatar. It's weak, since we change
+ * the date text "one hour ago", etc.
+ *
+ * @return string etag
+ */
+/*
+ function etag()
+ {
+ $avtime = ($this->avatar) ?
+ strtotime($this->avatar->modified) : 0;
+
+ return 'W/"' . implode(':', array($this->arg('action'),
+ common_language(),
+ $this->notice->id,
+ strtotime($this->notice->created),
+ strtotime($this->profile->modified),
+ $avtime)) . '"';
+ }
+*/
+
+
+ /**
+ * Handle input
+ *
+ * Only handles get, so just show the page.
+ *
+ * @param array $args $_REQUEST data (unused)
+ *
+ * @return void
+ */
+
+ function handle($args)
+ {
+ parent::handle($args);
+ $this->showPage();
+ }
+
+ /**
+ * Don't show local navigation
+ *
+ * @return void
+ */
+
+ function showLocalNavBlock()
+ {
+ }
+
+ /**
+ * Fill the content area of the page
+ *
+ * Shows a single notice list item.
+ *
+ * @return void
+ */
+
+ function showContent()
+ {
+ $this->elementStart('ul', array('class' => 'attachments'));
+ $ali = new Attachment($this->attachment, $this);
+ $cnt = $ali->show();
+ $this->elementEnd('ul');
+ }
+
+ /**
+ * Don't show page notice
+ *
+ * @return void
+ */
+
+ function showPageNoticeBlock()
+ {
+ }
+
+ /**
+ * Show aside: this attachments appears in what notices
+ *
+ * @return void
+ */
+ function showSections() {
+ $ns = new AttachmentNoticeSection($this);
+ $ns->show();
+ $atcs = new AttachmentTagCloudSection($this);
+ $atcs->show();
+ }
+}
+
diff --git a/actions/attachment_ajax.php b/actions/attachment_ajax.php
new file mode 100644
index 000000000..1620b27dd
--- /dev/null
+++ b/actions/attachment_ajax.php
@@ -0,0 +1,141 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Show notice attachments
+ *
+ * PHP version 5
+ *
+ * LICENCE: 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 <http://www.gnu.org/licenses/>.
+ *
+ * @category Personal
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2008-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);
+}
+
+require_once INSTALLDIR.'/actions/attachment.php';
+
+/**
+ * Show notice attachments
+ *
+ * @category Personal
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://laconi.ca/
+ */
+
+class Attachment_ajaxAction extends AttachmentAction
+{
+ /**
+ * Load attributes based on database arguments
+ *
+ * Loads all the DB stuff
+ *
+ * @param array $args $_REQUEST array
+ *
+ * @return success flag
+ */
+
+ function prepare($args)
+ {
+ parent::prepare($args);
+ if (!$this->attachment) {
+ $this->clientError(_('No such attachment.'), 404);
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Show page, a template method.
+ *
+ * @return nothing
+ */
+ function showPage()
+ {
+ if (Event::handle('StartShowBody', array($this))) {
+ $this->showCore();
+ Event::handle('EndShowBody', array($this));
+ }
+ }
+
+ /**
+ * Show core.
+ *
+ * Shows local navigation, content block and aside.
+ *
+ * @return nothing
+ */
+ function showCore()
+ {
+ $this->elementStart('div', array('id' => 'core'));
+ if (Event::handle('StartShowContentBlock', array($this))) {
+ $this->showContentBlock();
+ Event::handle('EndShowContentBlock', array($this));
+ }
+ $this->elementEnd('div');
+ }
+
+
+
+ /**
+ * Last-modified date for page
+ *
+ * When was the content of this page last modified? Based on notice,
+ * profile, avatar.
+ *
+ * @return int last-modified date as unix timestamp
+ */
+/*
+ function lastModified()
+ {
+ return max(strtotime($this->notice->created),
+ strtotime($this->profile->modified),
+ ($this->avatar) ? strtotime($this->avatar->modified) : 0);
+ }
+*/
+
+ /**
+ * An entity tag for this page
+ *
+ * Shows the ETag for the page, based on the notice ID and timestamps
+ * for the notice, profile, and avatar. It's weak, since we change
+ * the date text "one hour ago", etc.
+ *
+ * @return string etag
+ */
+/*
+ function etag()
+ {
+ $avtime = ($this->avatar) ?
+ strtotime($this->avatar->modified) : 0;
+
+ return 'W/"' . implode(':', array($this->arg('action'),
+ common_language(),
+ $this->notice->id,
+ strtotime($this->notice->created),
+ strtotime($this->profile->modified),
+ $avtime)) . '"';
+ }
+*/
+}
+
diff --git a/actions/attachments.php b/actions/attachments.php
new file mode 100644
index 000000000..6b31c839d
--- /dev/null
+++ b/actions/attachments.php
@@ -0,0 +1,292 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Show notice attachments
+ *
+ * PHP version 5
+ *
+ * LICENCE: 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 <http://www.gnu.org/licenses/>.
+ *
+ * @category Personal
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2008-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);
+}
+
+//require_once INSTALLDIR.'/lib/personalgroupnav.php';
+//require_once INSTALLDIR.'/lib/feedlist.php';
+require_once INSTALLDIR.'/lib/attachmentlist.php';
+
+/**
+ * Show notice attachments
+ *
+ * @category Personal
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://laconi.ca/
+ */
+
+class AttachmentsAction extends Action
+{
+ /**
+ * Notice object to show
+ */
+
+ var $notice = null;
+
+ /**
+ * Profile of the notice object
+ */
+
+ var $profile = null;
+
+ /**
+ * Avatar of the profile of the notice object
+ */
+
+ var $avatar = null;
+
+ /**
+ * Is this action read-only?
+ *
+ * @return boolean true
+ */
+
+ function isReadOnly($args)
+ {
+ return true;
+ }
+
+ /**
+ * Last-modified date for page
+ *
+ * When was the content of this page last modified? Based on notice,
+ * profile, avatar.
+ *
+ * @return int last-modified date as unix timestamp
+ */
+
+ function lastModified()
+ {
+ return max(strtotime($this->notice->created),
+ strtotime($this->profile->modified),
+ ($this->avatar) ? strtotime($this->avatar->modified) : 0);
+ }
+
+ /**
+ * An entity tag for this page
+ *
+ * Shows the ETag for the page, based on the notice ID and timestamps
+ * for the notice, profile, and avatar. It's weak, since we change
+ * the date text "one hour ago", etc.
+ *
+ * @return string etag
+ */
+
+ function etag()
+ {
+ $avtime = ($this->avatar) ?
+ strtotime($this->avatar->modified) : 0;
+
+ return 'W/"' . implode(':', array($this->arg('action'),
+ common_language(),
+ $this->notice->id,
+ strtotime($this->notice->created),
+ strtotime($this->profile->modified),
+ $avtime)) . '"';
+ }
+
+ /**
+ * Title of the page
+ *
+ * @return string title of the page
+ */
+
+ function title()
+ {
+ return sprintf(_('%1$s\'s status on %2$s'),
+ $this->profile->nickname,
+ common_exact_date($this->notice->created));
+ }
+
+
+ /**
+ * Load attributes based on database arguments
+ *
+ * Loads all the DB stuff
+ *
+ * @param array $args $_REQUEST array
+ *
+ * @return success flag
+ */
+
+ function prepare($args)
+ {
+ parent::prepare($args);
+
+ $id = $this->arg('notice');
+
+ $this->notice = Notice::staticGet($id);
+
+ if (!$this->notice) {
+ $this->clientError(_('No such notice.'), 404);
+ return false;
+ }
+
+
+/*
+// STOP if there are no attachments
+// maybe even redirect if there's a single one
+// RYM FIXME TODO
+ $this->clientError(_('No such attachment.'), 404);
+ return false;
+
+*/
+
+
+
+
+ $this->profile = $this->notice->getProfile();
+
+ if (!$this->profile) {
+ $this->serverError(_('Notice has no profile'), 500);
+ return false;
+ }
+
+ $this->avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
+ return true;
+ }
+
+
+
+ /**
+ * Handle input
+ *
+ * Only handles get, so just show the page.
+ *
+ * @param array $args $_REQUEST data (unused)
+ *
+ * @return void
+ */
+
+ function handle($args)
+ {
+ parent::handle($args);
+
+ if ($this->notice->is_local == 0) {
+ if (!empty($this->notice->url)) {
+ common_redirect($this->notice->url, 301);
+ } else if (!empty($this->notice->uri) && preg_match('/^https?:/', $this->notice->uri)) {
+ common_redirect($this->notice->uri, 301);
+ }
+ } else {
+ $f2p = new File_to_post;
+ $f2p->post_id = $this->notice->id;
+ $file = new File;
+ $file->joinAdd($f2p);
+ $file->selectAdd();
+ $file->selectAdd('file.id as id');
+ $count = $file->find(true);
+ if (!$count) return;
+ if (1 === $count) {
+ common_redirect(common_local_url('attachment', array('attachment' => $file->id)), 301);
+ } else {
+ $this->showPage();
+ }
+ }
+ }
+
+ /**
+ * Don't show local navigation
+ *
+ * @return void
+ */
+
+ function showLocalNavBlock()
+ {
+ }
+
+ /**
+ * Fill the content area of the page
+ *
+ * Shows a single notice list item.
+ *
+ * @return void
+ */
+
+ function showContent()
+ {
+ $al = new AttachmentList($this->notice, $this);
+ $cnt = $al->show();
+ }
+
+ /**
+ * Don't show page notice
+ *
+ * @return void
+ */
+
+ function showPageNoticeBlock()
+ {
+ }
+
+ /**
+ * Don't show aside
+ *
+ * @return void
+ */
+
+ function showAside() {
+ }
+
+ /**
+ * Extra <head> content
+ *
+ * We show the microid(s) for the author, if any.
+ *
+ * @return void
+ */
+
+ function extraHead()
+ {
+ $user = User::staticGet($this->profile->id);
+
+ if (!$user) {
+ return;
+ }
+
+ if ($user->emailmicroid && $user->email && $this->notice->uri) {
+ $id = new Microid('mailto:'. $user->email,
+ $this->notice->uri);
+ $this->element('meta', array('name' => 'microid',
+ 'content' => $id->toString()));
+ }
+
+ if ($user->jabbermicroid && $user->jabber && $this->notice->uri) {
+ $id = new Microid('xmpp:', $user->jabber,
+ $this->notice->uri);
+ $this->element('meta', array('name' => 'microid',
+ 'content' => $id->toString()));
+ }
+ }
+}
+
diff --git a/actions/attachments_ajax.php b/actions/attachments_ajax.php
new file mode 100644
index 000000000..402d8b5e7
--- /dev/null
+++ b/actions/attachments_ajax.php
@@ -0,0 +1,115 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * Show notice attachments
+ *
+ * PHP version 5
+ *
+ * LICENCE: 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 <http://www.gnu.org/licenses/>.
+ *
+ * @category Personal
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2008-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);
+}
+
+//require_once INSTALLDIR.'/lib/personalgroupnav.php';
+//require_once INSTALLDIR.'/lib/feedlist.php';
+require_once INSTALLDIR.'/actions/attachments.php';
+
+/**
+ * Show notice attachments
+ *
+ * @category Personal
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://laconi.ca/
+ */
+
+class Attachments_ajaxAction extends AttachmentsAction
+{
+ function showContent()
+ {
+ }
+
+ /**
+ * Fill the content area of the page
+ *
+ * Shows a single notice list item.
+ *
+ * @return void
+ */
+
+ function showContentBlock()
+ {
+ $al = new AttachmentList($this->notice, $this);
+ $cnt = $al->show();
+ }
+
+ /**
+ * Extra <head> content
+ *
+ * We show the microid(s) for the author, if any.
+ *
+ * @return void
+ */
+
+ function extraHead()
+ {
+ }
+
+
+ /**
+ * Show page, a template method.
+ *
+ * @return nothing
+ */
+ function showPage()
+ {
+ if (Event::handle('StartShowBody', array($this))) {
+ $this->showCore();
+ Event::handle('EndShowBody', array($this));
+ }
+ }
+
+ /**
+ * Show core.
+ *
+ * Shows local navigation, content block and aside.
+ *
+ * @return nothing
+ */
+ function showCore()
+ {
+ $this->elementStart('div', array('id' => 'core'));
+ if (Event::handle('StartShowContentBlock', array($this))) {
+ $this->showContentBlock();
+ Event::handle('EndShowContentBlock', array($this));
+ }
+ $this->elementEnd('div');
+ }
+
+
+
+
+}
+
diff --git a/actions/designsettings.php b/actions/designsettings.php
index cdd950e78..a85b36a25 100644
--- a/actions/designsettings.php
+++ b/actions/designsettings.php
@@ -76,14 +76,22 @@ class DesignsettingsAction extends AccountSettingsAction
'action' =>
common_local_url('designsettings')));
$this->elementStart('fieldset');
-// $this->element('legend', null, _('Design settings'));
$this->hidden('token', common_session_token());
$this->elementStart('fieldset', array('id' => 'settings_design_background-image'));
$this->element('legend', null, _('Change background image'));
$this->elementStart('ul', 'form_data');
$this->elementStart('li');
- $this->element('p', null, _('Upload background image'));
+ $this->element('label', array('for' => 'design_ background-image_file'),
+ _('Upload file'));
+ $this->element('input', array('name' => 'design_background-image_file',
+ 'type' => 'file',
+ 'id' => 'design_background-image_file'));
+ $this->element('p', 'form_guide', _('You can upload your personal background image. The maximum file size is 2Mb.'));
+ $this->element('input', array('name' => 'MAX_FILE_SIZE',
+ 'type' => 'hidden',
+ 'id' => 'MAX_FILE_SIZE',
+ 'value' => ImageFile::maxFileSizeInt()));
$this->elementEnd('li');
$this->elementEnd('ul');
$this->elementEnd('fieldset');
@@ -91,28 +99,57 @@ class DesignsettingsAction extends AccountSettingsAction
$this->elementStart('fieldset', array('id' => 'settings_design_color'));
$this->element('legend', null, _('Change colours'));
$this->elementStart('ul', 'form_data');
- $this->elementStart('li');
- $this->input('color-1', _('Background color'), '#F0F2F5', null);
- $this->elementEnd('li');
- $this->elementStart('li');
- $this->input('color-2', _('Content background color'), '#FFFFFF', null);
- $this->elementEnd('li');
- $this->elementStart('li');
- $this->input('color-3', _('Sidebar background color'), '#CEE1E9', null);
- $this->elementEnd('li');
- $this->elementStart('li');
- $this->input('color-4', _('Text color'), '#000000', null);
- $this->elementEnd('li');
- $this->elementStart('li');
- $this->input('color-5', _('Link color'), '#002E6E', null);
- $this->elementEnd('li');
+
+ //This is a JSON object in the DB field. Here for testing. Remove later.
+ $userSwatch = '{"body":{"background-color":"#F0F2F5"},
+ "#content":{"background-color":"#FFFFFF"},
+ "#aside_primary":{"background-color":"#CEE1E9"},
+ "html body":{"color":"#000000"},
+ "a":{"color":"#002E6E"}}';
+
+ //Default theme swatch -- Where should this be stored?
+ $defaultSwatch = array('body' => array('background-color' => '#F0F2F5'),
+ '#content' => array('background-color' => '#FFFFFF'),
+ '#aside_primary' => array('background-color' => '#CEE1E9'),
+ 'html body' => array('color' => '#000000'),
+ 'a' => array('color' => '#002E6E'));
+
+ $userSwatch = ($userSwatch) ? json_decode($userSwatch, true) : $defaultSwatch;
+
+ $s = 0;
+ $labelSwatch = array('Background',
+ 'Content',
+ 'Sidebar',
+ 'Text',
+ 'Links');
+ foreach($userSwatch as $propertyvalue => $value) {
+ $foo = array_values($value);
+ $this->elementStart('li');
+ $this->element('label', array('for' => 'swatch-'.$s), _($labelSwatch[$s]));
+ $this->element('input', array('name' => 'swatch-'.$s, //prefer swatch[$s] ?
+ 'type' => 'text',
+ 'id' => 'swatch-'.$s,
+ 'class' => 'swatch',
+ 'maxlength' => '7',
+ 'size' => '7',
+ 'value' => $foo[0]));
+ $this->elementEnd('li');
+ $s++;
+ }
+
$this->elementEnd('ul');
- $this->element('div', array('id' => 'color-picker'));
$this->elementEnd('fieldset');
-
$this->submit('save', _('Save'));
-
+ $this->element('input', array('type' => 'reset',
+ 'value' => 'Reset',
+ 'class' => 'form_action-secondary'));
+
+/*TODO: Check submitted form values:
+json_encode(form values)
+if submitted Swatch == DefaultSwatch, don't store in DB.
+else store in BD
+*/
$this->elementEnd('fieldset');
$this->elementEnd('form');
@@ -187,7 +224,7 @@ class DesignsettingsAction extends AccountSettingsAction
/**
- * Add the jCrop stylesheet
+ * Add the Farbtastic stylesheet
*
* @return void
*/
@@ -205,7 +242,7 @@ class DesignsettingsAction extends AccountSettingsAction
}
/**
- * Add the jCrop scripts
+ * Add the Farbtastic scripts
*
* @return void
*/
@@ -214,14 +251,12 @@ class DesignsettingsAction extends AccountSettingsAction
{
parent::showScripts();
-// if ($this->mode == 'crop') {
- $farbtasticPack = common_path('js/farbtastic/farbtastic.js');
- $farbtasticGo = common_path('js/farbtastic/farbtastic.go.js');
+ $farbtasticPack = common_path('js/farbtastic/farbtastic.js');
+ $farbtasticGo = common_path('js/farbtastic/farbtastic.go.js');
- $this->element('script', array('type' => 'text/javascript',
- 'src' => $farbtasticPack));
- $this->element('script', array('type' => 'text/javascript',
- 'src' => $farbtasticGo));
-// }
+ $this->element('script', array('type' => 'text/javascript',
+ 'src' => $farbtasticPack));
+ $this->element('script', array('type' => 'text/javascript',
+ 'src' => $farbtasticGo));
}
}
diff --git a/actions/logout.php b/actions/logout.php
index 9f3bfe247..c34b10987 100644
--- a/actions/logout.php
+++ b/actions/logout.php
@@ -70,10 +70,20 @@ class LogoutAction extends Action
if (!common_logged_in()) {
$this->clientError(_('Not logged in.'));
} else {
- common_set_user(null);
- common_real_login(false); // not logged in
- common_forgetme(); // don't log back in!
+ if (Event::handle('StartLogout', array($this))) {
+ $this->logout();
+ }
+ Event::handle('EndLogout', array($this));
+
common_redirect(common_local_url('public'), 303);
}
}
+
+ function logout()
+ {
+ common_set_user(null);
+ common_real_login(false); // not logged in
+ common_forgetme(); // don't log back in!
+ }
+
}
diff --git a/actions/newnotice.php b/actions/newnotice.php
index cbd04c58b..ae0ff9636 100644
--- a/actions/newnotice.php
+++ b/actions/newnotice.php
@@ -158,7 +158,8 @@ class NewnoticeAction extends Action
$replyto = 'false';
}
- $notice = Notice::saveNew($user->id, $content, 'web', 1,
+// $notice = Notice::saveNew($user->id, $content_shortened, 'web', 1,
+ $notice = Notice::saveNew($user->id, $content_shortened, 'web', 1,
($replyto == 'false') ? null : $replyto);
if (is_string($notice)) {
@@ -166,6 +167,8 @@ class NewnoticeAction extends Action
return;
}
+ $this->saveUrls($notice);
+
common_broadcast_notice($notice);
if ($this->boolean('ajax')) {
@@ -191,6 +194,24 @@ class NewnoticeAction extends Action
}
}
+ /** save all urls in the notice to the db
+ *
+ * follow redirects and save all available file information
+ * (mimetype, date, size, oembed, etc.)
+ *
+ * @param class $notice Notice to pull URLs from
+ *
+ * @return void
+ */
+ function saveUrls($notice) {
+ common_replace_urls_callback($notice->content, array($this, 'saveUrl'), $notice->id);
+ }
+
+ function saveUrl($data) {
+ list($url, $notice_id) = $data;
+ $zzz = File::processNew($url, $notice_id);
+ }
+
/**
* Show an Ajax-y error message
*
diff --git a/actions/showstream.php b/actions/showstream.php
index 82665e5b8..678a3174c 100644
--- a/actions/showstream.php
+++ b/actions/showstream.php
@@ -68,6 +68,9 @@ class ShowstreamAction extends ProfileAction
} else {
$base = $this->user->nickname;
}
+ if (!empty($this->tag)) {
+ $base .= sprintf(_(' tagged %s'), $this->tag);
+ }
if ($this->page == 1) {
return $base;
@@ -110,6 +113,15 @@ class ShowstreamAction extends ProfileAction
function getFeeds()
{
+ if (!empty($this->tag)) {
+ return array(new Feed(Feed::RSS1,
+ common_local_url('userrss',
+ array('nickname' => $this->user->nickname,
+ 'tag' => $this->tag)),
+ sprintf(_('Notice feed for %s tagged %s (RSS 1.0)'),
+ $this->user->nickname, $this->tag)));
+ }
+
return array(new Feed(Feed::RSS1,
common_local_url('userrss',
array('nickname' => $this->user->nickname)),
@@ -363,7 +375,9 @@ class ShowstreamAction extends ProfileAction
function showNotices()
{
- $notice = $this->user->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
+ $notice = empty($this->tag)
+ ? $this->user->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1)
+ : $this->user->getTaggedNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1, 0, 0, null, $this->tag);
$pnl = new ProfileNoticeList($notice, $this);
$cnt = $pnl->show();
diff --git a/actions/tag.php b/actions/tag.php
index 02f3e3522..47420e4c3 100644
--- a/actions/tag.php
+++ b/actions/tag.php
@@ -49,9 +49,10 @@ class TagAction extends Action
{
$pop = new PopularNoticeSection($this);
$pop->show();
+ $freqatt = new FrequentAttachmentSection($this);
+ $freqatt->show();
}
-
function title()
{
if ($this->page == 1) {
diff --git a/actions/userrss.php b/actions/userrss.php
index 5861d9ee3..2280509b2 100644
--- a/actions/userrss.php
+++ b/actions/userrss.php
@@ -25,14 +25,15 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
class UserrssAction extends Rss10Action
{
-
var $user = null;
+ var $tag = null;
function prepare($args)
{
parent::prepare($args);
- $nickname = $this->trimmed('nickname');
+ $nickname = $this->trimmed('nickname');
$this->user = User::staticGet('nickname', $nickname);
+ $this->tag = $this->trimmed('tag');
if (!$this->user) {
$this->clientError(_('No such user.'));
@@ -42,6 +43,25 @@ class UserrssAction extends Rss10Action
}
}
+ function getTaggedNotices($tag = null, $limit=0)
+ {
+ $user = $this->user;
+
+ if (is_null($user)) {
+ return null;
+ }
+
+ $notice = $user->getTaggedNotices(0, ($limit == 0) ? NOTICES_PER_PAGE : $limit, 0, 0, null, $tag);
+
+ $notices = array();
+ while ($notice->fetch()) {
+ $notices[] = clone($notice);
+ }
+
+ return $notices;
+ }
+
+
function getNotices($limit=0)
{