From 55c99d0018c5fafe7f47f14e07ec28c883f55183 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 1 Feb 2009 23:43:07 +0000 Subject: Using startXML() instead of deprecated common_start_xml() --- actions/opensearch.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actions') diff --git a/actions/opensearch.php b/actions/opensearch.php index 7709249bb..2eb818306 100644 --- a/actions/opensearch.php +++ b/actions/opensearch.php @@ -67,7 +67,7 @@ class OpensearchAction extends Action $short_name = _('Notice Search'); } header('Content-Type: text/html'); - common_start_xml(); + $this->startXML(); $this->elementStart('OpenSearchDescription', array('xmlns' => 'http://a9.com/-/spec/opensearch/1.1/')); $short_name = common_config('site', 'name').' '.$short_name; $this->element('ShortName', null, $short_name); @@ -81,7 +81,7 @@ class OpensearchAction extends Action $this->element('OutputEncoding', null, 'UTF-8'); $this->element('InputEncoding', null, 'UTF-8'); $this->elementEnd('OpenSearchDescription'); - common_end_xml(); + $this->endXML(); } function isReadOnly() -- cgit v1.2.3-54-g00ecf From 5f004c0158f228531230bb6f2f668e368b69a9f3 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 2 Feb 2009 16:33:47 +0000 Subject: Added "Edit" entity_action. Updated theme files. --- actions/showstream.php | 24 +++++++++++++++-------- theme/base/css/display.css | 2 ++ theme/default/css/display.css | 43 +++++++----------------------------------- theme/default/css/ie.css | 9 +++++++++ theme/identica/css/display.css | 38 ++++--------------------------------- 5 files changed, 38 insertions(+), 78 deletions(-) create mode 100644 theme/default/css/ie.css (limited to 'actions') diff --git a/actions/showstream.php b/actions/showstream.php index eab1fc0a2..ecd952635 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -312,14 +312,22 @@ class ShowstreamAction extends Action } $this->elementEnd('div'); - //XXX: entity_actions doesn't need to be outputted if entity is looking at their own profile $this->elementStart('div', 'entity_actions'); $this->element('h2', null, _('User actions')); $this->elementStart('ul'); - $this->elementStart('li', array('class' => 'entity_subscribe')); $cur = common_current_user(); + + if ($cur && $cur->id == $this->profile->id) { + $this->elementStart('li', 'entity_edit'); + $this->element('a', array('href' => common_local_url('profilesettings'), + 'title' => _('Edit profile settings')), + _('Edit')); + $this->elementEnd('li'); + } + if ($cur) { if ($cur->id != $this->profile->id) { + $this->elementStart('li', 'entity_subscribe'); if ($cur->isSubscribed($this->profile)) { $usf = new UnsubscribeForm($this, $this->profile); $usf->show(); @@ -327,24 +335,24 @@ class ShowstreamAction extends Action $sf = new SubscribeForm($this, $this->profile); $sf->show(); } + $this->elementEnd('li'); } } else { + $this->elementStart('li', 'entity_subscribe'); $this->showRemoteSubscribeLink(); + $this->elementEnd('li'); } - $this->elementEnd('li'); - -// 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->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')); $this->elementEnd('li'); if ($user->email && $user->emailnotifynudge) { - $this->elementStart('li', array('class' => 'entity_nudge')); + $this->elementStart('li', 'entity_nudge'); $nf = new NudgeForm($this, $user); $nf->show(); $this->elementEnd('li'); @@ -353,7 +361,7 @@ class ShowstreamAction extends Action if ($cur && $cur->id != $this->profile->id) { $blocked = $cur->hasBlocked($this->profile); - $this->elementStart('li', array('class' => 'entity_block')); + $this->elementStart('li', 'entity_block'); if ($blocked) { $ubf = new UnblockForm($this, $this->profile); $ubf->show(); diff --git a/theme/base/css/display.css b/theme/base/css/display.css index db669c088..207be17f3 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -605,12 +605,14 @@ display:block; .form_user_block input.submit, .form_user_unblock input.submit, .entity_send-a-message a, +.entity_edit a, .form_user_nudge input.submit, .entity_nudge p { border:0; padding-left:20px; } +.entity_edit a, .entity_send-a-message a, .entity_nudge p { padding:4px 4px 4px 23px; diff --git a/theme/default/css/display.css b/theme/default/css/display.css index 97a6a12a8..faff64967 100644 --- a/theme/default/css/display.css +++ b/theme/default/css/display.css @@ -92,12 +92,6 @@ color:#333; color:#000; } -#form_notice #notice_data-attach_view { -background-image:url(../images/icons/twotone/green/paper-clip.gif); -background-repeat:no-repeat; -background-position:0 45%; -background-color:transparent; -} #nav_register a { text-decoration:none; @@ -123,8 +117,6 @@ background-color:rgba(255, 255, 255, 0.7); } - - #page_notice .error { background-color:#F7E8E8; } @@ -144,8 +136,6 @@ background-color:#A9BF4F; } - - #export_data li a { background-repeat:no-repeat; background-position:0 45%; @@ -164,6 +154,7 @@ background-image:url(../../base/images/icons/icon_vcard.gif); } +.entity_edit a, .entity_send-a-message a, .form_user_nudge input.submit, .form_user_block input.submit, @@ -185,6 +176,9 @@ color:#fff; background-color:#97BFD1; } +.entity_edit a { +background-image:url(../images/icons/twotone/green/edit.gif); +} .entity_send-a-message a { background-image:url(../images/icons/twotone/green/quote.gif); } @@ -204,30 +198,6 @@ background-image:url(../images/icons/twotone/green/shield.gif); background-color:#fcfcfc; } -.notice-data a span { -background-color:transparent; -background-repeat:no-repeat; -background-position:0 45%; -} -.notice_video .notice-data a span { -background-image:url(../images/icons/twotone/green/camera.gif); -} -.notice_audio .notice-data a span { -background-image:url(../images/icons/twotone/green/music.gif); -} -.notice_image .notice-data a span { -background-image:url(../images/icons/twotone/green/search.gif); -} -.notice_event .notice-data a span { -background-image:url(../images/icons/twotone/green/calendar.gif); -} -.notice_location .notice-data a span { -background-image:url(../images/icons/twotone/green/flag.gif); -} -.notice_document .notice-data a span { -background-image:url(../images/icons/twotone/green/document.gif); -} - .notice-options .notice_reply a, .notice-options form input.submit { background-color:transparent; @@ -274,12 +244,13 @@ background:transparent url(../images/icons/twotone/green/news.gif) no-repeat 0 4 .pagination .nav_prev a, .pagination .nav_next a { background-repeat:no-repeat; +border-color:#D1D9E4; } .pagination .nav_prev a { background-image:url(../images/icons/twotone/green/arrow-left.gif); -background-position:0 45%; +background-position:10% 45%; } .pagination .nav_next a { background-image:url(../images/icons/twotone/green/arrow-right.gif); -background-position:100% 45%; +background-position:90% 45%; } diff --git a/theme/default/css/ie.css b/theme/default/css/ie.css new file mode 100644 index 000000000..2b06768ea --- /dev/null +++ b/theme/default/css/ie.css @@ -0,0 +1,9 @@ +/* IE specific styles */ + +.notice-options input.submit { +color:#fff; +} + +#site_nav_local_views a { +background-color:#ACCCDA; +} diff --git a/theme/identica/css/display.css b/theme/identica/css/display.css index beb5a2c13..39b839d26 100644 --- a/theme/identica/css/display.css +++ b/theme/identica/css/display.css @@ -92,12 +92,6 @@ color:#333; color:#000; } -#form_notice #notice_data-attach_view { -background-image:url(../images/icons/twotone/green/paper-clip.gif); -background-repeat:no-repeat; -background-position:0 45%; -background-color:transparent; -} #nav_register a { text-decoration:none; @@ -123,8 +117,6 @@ background-color:rgba(255, 255, 255, 0.7); } - - #page_notice .error { background-color:#F7E8E8; } @@ -144,8 +136,6 @@ background-color:#9BB43E; } - - #export_data li a { background-repeat:no-repeat; background-position:0 45%; @@ -164,6 +154,7 @@ background-image:url(../../base/images/icons/icon_vcard.gif); } +.entity_edit a, .entity_send-a-message a, .form_user_nudge input.submit, .form_user_block input.submit, @@ -185,6 +176,9 @@ color:#fff; background-color:#87B4C8; } +.entity_edit a { +background-image:url(../images/icons/twotone/green/edit.gif); +} .entity_send-a-message a { background-image:url(../images/icons/twotone/green/quote.gif); } @@ -204,30 +198,6 @@ background-image:url(../images/icons/twotone/green/shield.gif); background-color:#fcfcfc; } -.notice-data a span { -background-color:transparent; -background-repeat:no-repeat; -background-position:0 45%; -} -.notice_video .notice-data a span { -background-image:url(../images/icons/twotone/green/camera.gif); -} -.notice_audio .notice-data a span { -background-image:url(../images/icons/twotone/green/music.gif); -} -.notice_image .notice-data a span { -background-image:url(../images/icons/twotone/green/search.gif); -} -.notice_event .notice-data a span { -background-image:url(../images/icons/twotone/green/calendar.gif); -} -.notice_location .notice-data a span { -background-image:url(../images/icons/twotone/green/flag.gif); -} -.notice_document .notice-data a span { -background-image:url(../images/icons/twotone/green/document.gif); -} - .notice-options .notice_reply a, .notice-options form input.submit { background-color:transparent; -- cgit v1.2.3-54-g00ecf From 01b6aca078f9665eb01c1b1fbbbe2f4c6340cf9b Mon Sep 17 00:00:00 2001 From: Meitar Moscovitz Date: Wed, 4 Feb 2009 03:34:17 +1100 Subject: Fix PHP warnings when user avatar crop controls aren'tn touched. --- actions/avatarsettings.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'actions') diff --git a/actions/avatarsettings.php b/actions/avatarsettings.php index 19f53b882..3029b0621 100644 --- a/actions/avatarsettings.php +++ b/actions/avatarsettings.php @@ -316,11 +316,6 @@ class AvatarsettingsAction extends AccountSettingsAction $profile = $user->getProfile(); - $x = $this->arg('avatar_crop_x'); - $y = $this->arg('avatar_crop_y'); - $w = $this->arg('avatar_crop_w'); - $h = $this->arg('avatar_crop_h'); - $filedata = $_SESSION['FILEDATA']; if (!$filedata) { @@ -328,6 +323,11 @@ class AvatarsettingsAction extends AccountSettingsAction return; } + $x = $this->arg('avatar_crop_x'); + $y = $this->arg('avatar_crop_y'); + $w = ($this->arg('avatar_crop_w')) ? $this->arg('avatar_crop_w') : $filedata['width']; + $h = ($this->arg('avatar_crop_h')) ? $this->arg('avatar_crop_h') : $filedata['height']; + $filepath = common_avatar_path($filedata['filename']); if (!file_exists($filepath)) { -- cgit v1.2.3-54-g00ecf From dcf18e96949483631319f23de51f71340c1f276e Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Tue, 3 Feb 2009 11:23:30 -0800 Subject: trac1104 Destroy method was dying because it was still calling deprecated common_dequeue_notice() func --- actions/twitapistatuses.php | 1 - 1 file changed, 1 deletion(-) (limited to 'actions') diff --git a/actions/twitapistatuses.php b/actions/twitapistatuses.php index a35f4b12e..18e24c0f5 100644 --- a/actions/twitapistatuses.php +++ b/actions/twitapistatuses.php @@ -450,7 +450,6 @@ class TwitapistatusesAction extends TwitterapiAction if ($user->id == $notice->profile_id) { $replies = new Reply; $replies->get('notice_id', $notice_id); - common_dequeue_notice($notice); $replies->delete(); $notice->delete(); -- cgit v1.2.3-54-g00ecf From 32b1bb381acd14ec6a0d98afc5c39247b1d5a027 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Tue, 3 Feb 2009 21:46:09 +0000 Subject: Fixed ajaxErrorMsg(). Using startHTML() instead of common_start_html() --- actions/newnotice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actions') diff --git a/actions/newnotice.php b/actions/newnotice.php index 5142cb5ff..e3974cd07 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -195,7 +195,7 @@ class NewnoticeAction extends Action function ajaxErrorMsg($msg) { - common_start_html('text/xml;charset=utf-8', true); + $this->startHTML('text/xml;charset=utf-8', true); $this->elementStart('head'); $this->element('title', null, _('Ajax Error')); $this->elementEnd('head'); -- cgit v1.2.3-54-g00ecf From c16ddd677588424f51d63d37ea9b3eb34c73c233 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Tue, 3 Feb 2009 16:31:41 -0800 Subject: trac1095 Profile page had bad alternate links for RSS and Atom feeds --- actions/showstream.php | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) (limited to 'actions') diff --git a/actions/showstream.php b/actions/showstream.php index ecd952635..90ffcacf9 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -170,26 +170,22 @@ class ShowstreamAction extends Action function showFeeds() { - // Feeds $this->element('link', array('rel' => 'alternate', - 'href' => common_local_url('api', - array('apiaction' => 'statuses', - 'method' => 'entity_timeline.rss', - 'argument' => $this->user->nickname)), - 'type' => 'application/rss+xml', - 'title' => sprintf(_('Notice feed for %s'), $this->user->nickname))); - $this->element('link', array('rel' => 'alternate feed', - 'href' => common_local_url('api', - array('apiaction' => 'statuses', - 'method' => 'entity_timeline.atom', - 'argument' => $this->user->nickname)), - 'type' => 'application/atom+xml', - 'title' => sprintf(_('Notice feed for %s'), $this->user->nickname))); - $this->element('link', array('rel' => 'alternate', - 'href' => common_local_url('userrss', array('nickname' => - $this->user->nickname)), - 'type' => 'application/rdf+xml', - 'title' => sprintf(_('Notice feed for %s'), $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() -- cgit v1.2.3-54-g00ecf From 2d063650effb22c90936a4588f44946c69e1d9a1 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 4 Feb 2009 07:59:30 -0500 Subject: Make WebChannel and AjaxWebChannel work These command-output channels were using the old common_element_* functions. They now take an $out constructor parameter, and use that for output. The WebChannel has pretty remedial output; it would be nice if it output a real formatted page. --- actions/newnotice.php | 4 +-- classes/Channel.php | 93 +++++++++++++++++++++++++++------------------------ 2 files changed, 52 insertions(+), 45 deletions(-) (limited to 'actions') diff --git a/actions/newnotice.php b/actions/newnotice.php index e3974cd07..61f0f8365 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -141,9 +141,9 @@ class NewnoticeAction extends Action if ($cmd) { if ($this->boolean('ajax')) { - $cmd->execute(new AjaxWebChannel()); + $cmd->execute(new AjaxWebChannel($this)); } else { - $cmd->execute(new WebChannel()); + $cmd->execute(new WebChannel($this)); } return; } diff --git a/classes/Channel.php b/classes/Channel.php index 2e3e4e8d4..fdeff21fc 100644 --- a/classes/Channel.php +++ b/classes/Channel.php @@ -21,7 +21,7 @@ if (!defined('LACONICA')) { exit(1); } class Channel { - + function on($user) { return false; @@ -36,12 +36,12 @@ class Channel { return false; } - + function error($user, $text) { return false; } - + function source() { return null; @@ -52,22 +52,22 @@ class XMPPChannel extends Channel { var $conn = null; - + function source() { return 'xmpp'; } - + function __construct($conn) { $this->conn = $conn; } - + function on($user) { return $this->set_notify($user, 1); } - + function off($user) { return $this->set_notify($user, 0); @@ -78,13 +78,13 @@ class XMPPChannel extends Channel $text = '['.common_config('site', 'name') . '] ' . $text; jabber_send_message($user->jabber, $text); } - + function error($user, $text) { $text = '['.common_config('site', 'name') . '] ' . $text; jabber_send_message($user->jabber, $text); } - + function set_notify(&$user, $notify) { $orig = clone($user); @@ -105,20 +105,25 @@ class XMPPChannel extends Channel } } - class WebChannel extends Channel { + var $out = null; + + function __construct($out=null) + { + $this->out = $out; + } function source() { return 'web'; } - + function on($user) { return false; } - + function off($user) { return false; @@ -129,47 +134,49 @@ class WebChannel extends Channel # XXX: buffer all output and send it at the end # XXX: even better, redirect to appropriate page # depending on what command was run - common_show_header(_('Command results')); - common_element('p', null, $text); - common_show_footer(); + $this->out->startHTML(); + $this->out->elementStart('head'); + $this->out->element('title', null, _('Command results')); + $this->out->elementEnd('head'); + $this->out->elementStart('body'); + $this->out->element('p', array('id' => 'command_result'), $text); + $this->out->elementEnd('body'); + $this->out->endHTML(); } - + function error($user, $text) { common_user_error($text); } } - class AjaxWebChannel extends WebChannel { - function output($user, $text) { - common_start_html('text/xml;charset=utf-8', true); - common_element_start('head'); - common_element('title', null, _('Command results')); - common_element_end('head'); - common_element_start('body'); - common_element('p', array('id' => 'command_result'), $text); - common_element_end('body'); - common_element_end('html'); + $this->out->startHTML('text/xml;charset=utf-8'); + $this->out->elementStart('head'); + $this->out->element('title', null, _('Command results')); + $this->out->elementEnd('head'); + $this->out->elementStart('body'); + $this->out->element('p', array('id' => 'command_result'), $text); + $this->out->elementEnd('body'); + $this->out->endHTML(); } function error($user, $text) { - common_start_html('text/xml;charset=utf-8', true); - common_element_start('head'); - common_element('title', null, _('Ajax Error')); - common_element_end('head'); - common_element_start('body'); - common_element('p', array('id' => 'error'), $text); - common_element_end('body'); - common_element_end('html'); + $this->out->startHTML('text/xml;charset=utf-8'); + $this->out->elementStart('head'); + $this->out->element('title', null, _('Ajax Error')); + $this->out->elementEnd('head'); + $this->out->elementStart('body'); + $this->out->element('p', array('id' => 'error'), $text); + $this->out->elementEnd('body'); + $this->out->endHTML(); } } - class MailChannel extends Channel { @@ -179,17 +186,17 @@ class MailChannel extends Channel { return 'mail'; } - + function __construct($addr=null) { $this->addr = $addr; } - + function on($user) { return $this->set_notify($user, 1); } - + function off($user) { return $this->set_notify($user, 0); @@ -200,23 +207,23 @@ class MailChannel extends Channel $headers['From'] = $user->incomingemail; $headers['To'] = $this->addr; - + $headers['Subject'] = _('Command complete'); return mail_send(array($this->addr), $headers, $text); } - + function error($user, $text) { - + $headers['From'] = $user->incomingemail; $headers['To'] = $this->addr; - + $headers['Subject'] = _('Command failed'); return mail_send(array($this->addr), $headers, $text); } - + function set_notify($user, $value) { $orig = clone($user); -- cgit v1.2.3-54-g00ecf From df41b1307f9a2690115e246e584d6a398d4f9730 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 4 Feb 2009 11:55:22 -0800 Subject: Removed erroneous comments referring to old common_notice_form() func --- actions/login.php | 1 - actions/newnotice.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'actions') diff --git a/actions/login.php b/actions/login.php index 11cf1f02a..6c6567b7b 100644 --- a/actions/login.php +++ b/actions/login.php @@ -96,7 +96,6 @@ class LoginAction extends Action { // XXX: login throttle - // CSRF protection - token set in common_notice_form() $token = $this->trimmed('token'); if (!$token || $token != common_session_token()) { $this->clientError(_('There was a problem with your session token. '. diff --git a/actions/newnotice.php b/actions/newnotice.php index 61f0f8365..5e7691f33 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -90,7 +90,7 @@ class NewnoticeAction extends Action $this->clientError(_('Not logged in.')); } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { - // CSRF protection - token set in common_notice_form() + // CSRF protection $token = $this->trimmed('token'); if (!$token || $token != common_session_token()) { $this->clientError(_('There was a problem with your session token. '. -- cgit v1.2.3-54-g00ecf From 2bd52059dbcc2ece561daba73963c66d410ad89e Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 4 Feb 2009 15:38:26 -0500 Subject: take out redundant code from login --- actions/login.php | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) (limited to 'actions') diff --git a/actions/login.php b/actions/login.php index 11cf1f02a..98cc8a855 100644 --- a/actions/login.php +++ b/actions/login.php @@ -96,7 +96,7 @@ class LoginAction extends Action { // XXX: login throttle - // CSRF protection - token set in common_notice_form() + // CSRF protection - token set in NoticeForm $token = $this->trimmed('token'); if (!$token || $token != common_session_token()) { $this->clientError(_('There was a problem with your session token. '. @@ -106,35 +106,14 @@ class LoginAction extends Action $nickname = common_canonical_nickname($this->trimmed('nickname')); $password = $this->arg('password'); - if (common_check_user($nickname, $password)) { - // success! - if (!common_set_user($nickname)) { - $this->serverError(_('Error setting user.')); - return; - } - common_real_login(true); - if ($this->boolean('rememberme')) { - common_debug('Adding rememberme cookie for ' . $nickname); - common_rememberme(); - } - // success! - $url = common_get_returnto(); - if ($url) { - // We don't have to return to it again - common_set_returnto(null); - } else { - $url = common_local_url('all', - array('nickname' => - $nickname)); - } - common_redirect($url); - } else { + + if (!common_check_user($nickname, $password)) { $this->showForm(_('Incorrect username or password.')); return; } // success! - if (!common_set_user($user)) { + if (!common_set_user($nickname)) { $this->serverError(_('Error setting user.')); return; } @@ -142,11 +121,11 @@ class LoginAction extends Action common_real_login(true); if ($this->boolean('rememberme')) { - common_debug('Adding rememberme cookie for ' . $nickname); common_rememberme($user); } - // success! + $url = common_get_returnto(); + if ($url) { // We don't have to return to it again common_set_returnto(null); @@ -155,6 +134,7 @@ class LoginAction extends Action array('nickname' => $nickname)); } + common_redirect($url); } -- cgit v1.2.3-54-g00ecf From 68152dcf3acca51b85fc80e5549718c8123f943c Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 4 Feb 2009 22:33:50 +0000 Subject: Facebook app - reorganized some stuff; better HTML output --- actions/facebookhome.php | 5 ----- lib/facebookaction.php | 20 ++++---------------- 2 files changed, 4 insertions(+), 21 deletions(-) (limited to 'actions') diff --git a/actions/facebookhome.php b/actions/facebookhome.php index d943104c2..5946e6c98 100644 --- a/actions/facebookhome.php +++ b/actions/facebookhome.php @@ -148,14 +148,11 @@ class FacebookhomeAction extends FacebookAction function showNoticeForm() { - $post_action = "$this->app_uri/index.php"; $notice_form = new FacebookNoticeForm($this, $post_action, null, $post_action, $this->user); $notice_form->show(); - - } function title() @@ -169,7 +166,6 @@ class FacebookhomeAction extends FacebookAction function showContent() { - $notice = $this->user->noticesWithFriends(($this->page-1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1); @@ -179,7 +175,6 @@ class FacebookhomeAction extends FacebookAction $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE, $this->page, 'index.php', array('nickname' => $this->user->nickname)); - } function showNoticeList($notice) diff --git a/lib/facebookaction.php b/lib/facebookaction.php index f42427540..b6481011f 100644 --- a/lib/facebookaction.php +++ b/lib/facebookaction.php @@ -129,7 +129,7 @@ class FacebookAction extends Action * Start an Facebook ready HTML document * * For Facebook we don't want to actually output any headers, - * DTD info, etc. + * DTD info, etc. Just Stylesheet and JavaScript links. * * If $type isn't specified, will attempt to do content negotiation. * @@ -140,6 +140,9 @@ class FacebookAction extends Action function startHTML($type=null) { + $this->showStylesheets(); + $this->showScripts(); + $this->elementStart('div', array('class' => 'facebook-page')); } @@ -181,8 +184,6 @@ class FacebookAction extends Action function showHead($error, $success) { - $this->showStylesheets(); - $this->showScripts(); if ($error) { $this->element("h1", null, $error); @@ -204,7 +205,6 @@ class FacebookAction extends Action // Make this into a widget later function showLocalNav() { - $this->elementStart('ul', array('class' => 'nav')); $this->elementStart('li', array('class' => @@ -229,18 +229,7 @@ class FacebookAction extends Action $this->elementEnd('li'); $this->elementEnd('ul'); - } - - /** - * Show primary navigation. - * - * @return nothing - */ - function showPrimaryNav() - { - // we don't want to show anything for this - } /** * Show header of the page. @@ -254,7 +243,6 @@ class FacebookAction extends Action $this->elementStart('div', array('id' => 'header')); $this->showLogo(); $this->showNoticeForm(); - $this->showPrimaryNav(); $this->elementEnd('div'); } -- cgit v1.2.3-54-g00ecf From e5b075b912e1fb416e73988547e2ece8f89e6453 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 5 Feb 2009 04:54:42 +0000 Subject: Matching Facebook app UI to identi.ca. Fixed tabs, add to profile, widths, font-size, and some HTML markup. --- actions/facebookinvite.php | 8 ++-- lib/facebookaction.php | 9 +++-- theme/base/css/facebookapp.css | 84 ++++++++++++++++++++++++++++++++++++++---- 3 files changed, 86 insertions(+), 15 deletions(-) (limited to 'actions') diff --git a/actions/facebookinvite.php b/actions/facebookinvite.php index b7224783a..3c872f94b 100644 --- a/actions/facebookinvite.php +++ b/actions/facebookinvite.php @@ -73,7 +73,7 @@ class FacebookinviteAction extends FacebookAction $friend_ids = $_POST['ids']; // XXX: Hmm... is this the best way to acces the list? - $this->elementStart("ul"); + $this->elementStart('ul', array('id' => 'facebook-friends')); foreach ($friend_ids as $friend) { $this->elementStart('li'); @@ -112,11 +112,11 @@ class FacebookinviteAction extends FacebookAction $this->element('h2', null, sprintf(_('Friends already using %s:'), common_config('site', 'name'))); - $this->elementStart("ul"); - + $this->elementStart('ul', array('id' => 'facebook-friends')); + foreach ($exclude_ids as $friend) { $this->elementStart('li'); - $this->element('fb:profile-pic', array('uid' => $friend)); + $this->element('fb:profile-pic', array('uid' => $friend, 'size' => 'square')); $this->element('fb:name', array('uid' => $friend, 'capitalize' => 'true')); $this->elementEnd('li'); diff --git a/lib/facebookaction.php b/lib/facebookaction.php index b6481011f..d369cc385 100644 --- a/lib/facebookaction.php +++ b/lib/facebookaction.php @@ -270,7 +270,6 @@ class FacebookAction extends Action $loginmsg_part1 = _('To use the %s Facebook Application you need to login ' . 'with your username and password. Don\'t have a username yet? '); - $loginmsg_part2 = _(' a new account.'); $this->elementStart('dd'); @@ -279,18 +278,18 @@ class FacebookAction extends Action $this->element('a', array('href' => common_local_url('register')), _('Register')); $this->text($loginmsg_part2); + $this->elementEnd('p'); $this->elementEnd('dd'); + $this->elementEnd('dl'); - $this->elementEnd('div'); - } function showLoginForm($msg = null) { - $this->elementStart('div', array('class' => 'content')); + $this->elementStart('div', array('id' => 'content')); $this->element('h1', null, _('Login')); if ($msg) { @@ -318,6 +317,7 @@ class FacebookAction extends Action $this->elementEnd('ul'); $this->submit('submit', _('Login')); + $this->elementEnd('fieldset'); $this->elementEnd('form'); $this->elementStart('p'); @@ -326,6 +326,7 @@ class FacebookAction extends Action $this->elementEnd('p'); $this->elementEnd('div'); + $this->elementEnd('div'); } diff --git a/theme/base/css/facebookapp.css b/theme/base/css/facebookapp.css index af188ad7a..163b41fb4 100644 --- a/theme/base/css/facebookapp.css +++ b/theme/base/css/facebookapp.css @@ -1,10 +1,86 @@ @import url("display.css"); @import url("../../identica/css/display.css"); -span.facebook-button { border: 2px solid #777; padding: 5px; display: block; float: left; margin-right: 20px; -moz-border-radius: 4px; border-radius:4px; -webkit-border-radius:4px; font-weight: bold; background-color:#A9BF4F; color:#fff; font-size:1.2em } +* { +font-size:14px; +font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif; +} + +#wrap { +background-color:#F0F2F5; +padding-left:18px; +padding-right:18px; +width:auto; +} + +p,label, +h1,h2,h3,h4,h5,h6 { +color:#000; +} + +#content { +width:95%; +} + +#site_nav_local_views a { +background-color:#D0DFE7; +} +#site_nav_local_views a:hover { +background-color:#FAFBFC; +} + +span.facebook-button { +border: 2px solid #aaa; +padding: 3px; +display: block; +float: left; +margin-right: 20px; +-moz-border-radius: 4px; +border-radius:4px; +-webkit-border-radius:4px; +font-weight: bold; +background-color:#A9BF4F; +color:#fff; +font-size:1.2em +} span.facebook-button a { color:#fff } +.facebook_guide { +margin-bottom:18px; +} +.facebook_guide p { +font-weight:bold; +} + + +input { +height:auto !important; +} + +#facebook-friends { +float:left; +width:100%; +} + +#facebook-friends li { +float:left; +margin-right:2%; +margin-bottom:11px; +width:18%; +height:115px; +} +#facebook-friends li a { +float:left; +} + +#add_to_profile { +position:absolute; +right:18px; +top:10px; +z-index:2; +} + .notice div.entry-content dl, .notice div.entry-content dt, .notice div.entry-content dd { @@ -19,12 +95,6 @@ margin-bottom:18px; list-style-type:none; } -.facebook_guide p { -margin-bottom:18px; -font-size:1.3em; -font-weight:bold; -} - .form_settings label { margin-right:18px; } -- cgit v1.2.3-54-g00ecf From 7ad3ff4a2cd494ef8c1cc293e15c0a70b8786fee Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 5 Feb 2009 11:46:17 -0500 Subject: Allow re-authentication with OpenID "Rememberme" logins aren't allowed to make changes to an account (since cookie-stealing is too easy). Users have to re-authenticate. Previously, it was impossible to do so without having a username and password; this change lets you do it with OpenID, too. --- actions/finishopenidlogin.php | 2 +- actions/openidlogin.php | 13 +++++++++++-- classes/User.php | 11 +++++++++++ lib/settingsaction.php | 7 ++++++- 4 files changed, 29 insertions(+), 4 deletions(-) (limited to 'actions') diff --git a/actions/finishopenidlogin.php b/actions/finishopenidlogin.php index 880a9505b..bc9151120 100644 --- a/actions/finishopenidlogin.php +++ b/actions/finishopenidlogin.php @@ -30,7 +30,7 @@ class FinishopenidloginAction extends Action function handle($args) { parent::handle($args); - if (common_logged_in()) { + if (common_is_real_login()) { $this->clientError(_('Already logged in.')); } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { $token = $this->trimmed('token'); diff --git a/actions/openidlogin.php b/actions/openidlogin.php index 7a267a2bd..1a4372d73 100644 --- a/actions/openidlogin.php +++ b/actions/openidlogin.php @@ -26,7 +26,7 @@ class OpenidloginAction extends Action function handle($args) { parent::handle($args); - if (common_logged_in()) { + if (common_is_real_login()) { $this->clientError(_('Already logged in.')); } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { $openid_url = $this->trimmed('openid_url'); @@ -59,7 +59,16 @@ class OpenidloginAction extends Action function getInstructions() { - return _('Login with an [OpenID](%%doc.openid%%) account.'); + if (common_logged_in() && !common_is_real_login() && + common_get_returnto()) { + // rememberme logins have to reauthenticate before + // changing any profile settings (cookie-stealing protection) + return _('For security reasons, please re-login with your ' . + '[OpenID](%%doc.openid%%) ' . + 'before changing your settings.'); + } else { + return _('Login with an [OpenID](%%doc.openid%%) account.'); + } } function showPageNotice() diff --git a/classes/User.php b/classes/User.php index b1c061c18..a6a1b11b9 100644 --- a/classes/User.php +++ b/classes/User.php @@ -630,4 +630,15 @@ class User extends Memcached_DataObject return $profile; } + + function hasOpenID() + { + $oid = new User_openid(); + + $oid->user_id = $this->id; + + $cnt = $oid->find(); + + return ($cnt > 0); + } } diff --git a/lib/settingsaction.php b/lib/settingsaction.php index dfe1f114b..53c807c6f 100644 --- a/lib/settingsaction.php +++ b/lib/settingsaction.php @@ -76,7 +76,12 @@ class SettingsAction extends Action // change important settings or see private info, and // _all_ our settings are important common_set_returnto($this->selfUrl()); - common_redirect(common_local_url('login')); + $user = common_current_user(); + if ($user->hasOpenID()) { + common_redirect(common_local_url('openidlogin')); + } else { + common_redirect(common_local_url('login')); + } } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { $this->handlePost(); } else { -- cgit v1.2.3-54-g00ecf From 68a3139d0b86a2a716b24a481e677aa5d4699396 Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Mon, 2 Feb 2009 01:43:41 +0100 Subject: Fix #81: Profile and personal shows „you“ instead of username when looking at own profile / personal. While doing so I fixed a wrong gettext usage were the result was not sprintf'd, but concat'd. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- actions/all.php | 11 +++++++++++ actions/showstream.php | 7 ++++++- 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'actions') diff --git a/actions/all.php b/actions/all.php index 428466f24..b03ad7ec3 100644 --- a/actions/all.php +++ b/actions/all.php @@ -101,4 +101,15 @@ class AllAction extends Action $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE, $this->page, 'all', array('nickname' => $this->user->nickname)); } + + function showPageTitle() + { + $user =& common_current_user(); + if ($user && ($user->id == $this->user->id)) { + $this->element('h1', NULL, _("You and friends")); + } else { + $this->element('h1', NULL, sprintf(_('%s and friends'), $this->user->nickname)); + } + } + } diff --git a/actions/showstream.php b/actions/showstream.php index 90ffcacf9..4b1679969 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -140,7 +140,12 @@ class ShowstreamAction extends Action function showPageTitle() { - $this->element('h1', NULL, $this->profile->nickname._("'s profile")); + $user =& common_current_user(); + if ($user && ($user->id == $this->profile->id)) { + $this->element('h1', NULL, _("Your profile")); + } else { + $this->element('h1', NULL, sprintf(_('%s\'s profile'), $this->profile->nickname)); + } } function showPageNoticeBlock() -- cgit v1.2.3-54-g00ecf From 9febe8ce394d8428355ac73f1c0f6a9555252bd2 Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Thu, 5 Feb 2009 18:10:47 +0000 Subject: trac #1142 fix tag rss --- actions/tagrss.php | 16 +++++++--------- lib/util.php | 2 ++ 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'actions') diff --git a/actions/tagrss.php b/actions/tagrss.php index b4c2dcdff..a77fa12c9 100644 --- a/actions/tagrss.php +++ b/actions/tagrss.php @@ -25,12 +25,12 @@ require_once(INSTALLDIR.'/lib/rssaction.php'); class TagrssAction extends Rss10Action { + var $tag; - function init() - { - $tag = $this->trimmed('tag'); + function prepare($args) { + parent::prepare($args); + $tag = common_canonical_tag($this->trimmed('tag')); $this->tag = Notice_tag::staticGet('tag', $tag); - if (!$this->tag) { $this->clientError(_('No such tag.')); return false; @@ -39,7 +39,7 @@ class TagrssAction extends Rss10Action } } - function get_notices($limit=0) + function getNotices($limit=0) { $tag = $this->tag; @@ -48,7 +48,6 @@ class TagrssAction extends Rss10Action } $notice = Notice_tag::getStream($tag->tag, 0, ($limit == 0) ? NOTICES_PER_PAGE : $limit); - while ($notice->fetch()) { $notices[] = clone($notice); } @@ -56,10 +55,9 @@ class TagrssAction extends Rss10Action return $notices; } - function get_channel() + function getChannel() { - $tag = $this->tag->tag; - + $tagname = $this->tag->tag; $c = array('url' => common_local_url('tagrss', array('tag' => $tagname)), 'title' => $tagname, 'link' => common_local_url('tagrss', array('tag' => $tagname)), diff --git a/lib/util.php b/lib/util.php index 579f964ac..cbff35a9d 100644 --- a/lib/util.php +++ b/lib/util.php @@ -736,6 +736,8 @@ function common_fancy_url($action, $args=null) return common_path("api/statuses/public_timeline.atom"); case 'publicxrds': return common_path('xrds'); + case 'tagrss': + return common_path('tag/' . $args['tag'] . '/rss'); case 'featuredrss': return common_path('featuredrss'); case 'favoritedrss': -- cgit v1.2.3-54-g00ecf From 02eecb4f07fd4bede01bf81b441e04e68b6091ec Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 5 Feb 2009 21:26:06 +0000 Subject: Minor markup consistency --- actions/noticesearch.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'actions') diff --git a/actions/noticesearch.php b/actions/noticesearch.php index a0d723b12..630fb8857 100644 --- a/actions/noticesearch.php +++ b/actions/noticesearch.php @@ -154,7 +154,8 @@ class NoticesearchAction extends SearchAction $this->elementStart('div', 'entry-title'); $this->elementStart('span', 'vcard author'); $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE); - $this->elementStart('a', array('href' => $profile->profileurl)); + $this->elementStart('a', array('href' => $profile->profileurl, + 'class' => 'url')); $this->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE), 'class' => 'avatar photo', 'width' => AVATAR_STREAM_SIZE, @@ -223,15 +224,6 @@ class NoticesearchAction extends SearchAction $this->elementEnd('a'); $this->elementEnd('dd'); $this->elementEnd('dl'); - - $this->elementStart('a', - array('href' => common_local_url('newnotice', - array('replyto' => $profile->nickname)), - 'onclick' => 'doreply("'.$profile->nickname.'"); return false', - 'title' => _('reply'), - 'class' => 'replybutton')); - $this->hidden('posttoken', common_session_token()); - $this->elementEnd('a'); $this->elementEnd('div'); $this->elementEnd('li'); } -- cgit v1.2.3-54-g00ecf From 99d520b351cdcfd93901732228d3be3d9e0a442b Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 5 Feb 2009 16:32:58 -0500 Subject: Two different functions for file size Made two different functions for file size in ImageFile; one uses the other. Also, use sprintf() for gettext msgs. --- actions/avatarsettings.php | 4 ++-- actions/grouplogo.php | 8 +++---- lib/imagefile.php | 57 +++++++++++++++++++++++++++------------------- 3 files changed, 39 insertions(+), 30 deletions(-) (limited to 'actions') diff --git a/actions/avatarsettings.php b/actions/avatarsettings.php index 0f8122c07..5c702ecc0 100644 --- a/actions/avatarsettings.php +++ b/actions/avatarsettings.php @@ -75,7 +75,7 @@ class AvatarsettingsAction extends AccountSettingsAction function getInstructions() { - return _('You can upload your personal avatar. The maximum file size is '.ImageFile::maxFileSize().'.'); + return sprintf(_('You can upload your personal avatar. The maximum file size is %s.'), ImageFile::maxFileSize()); } /** @@ -155,7 +155,7 @@ class AvatarsettingsAction extends AccountSettingsAction $this->element('input', array('name' => 'MAX_FILE_SIZE', 'type' => 'hidden', 'id' => 'MAX_FILE_SIZE', - 'value' => ImageFile::maxFileSize(true))); + 'value' => ImageFile::maxFileSizeInt())); $this->elementEnd('li'); $this->elementEnd('ul'); diff --git a/actions/grouplogo.php b/actions/grouplogo.php index 473303373..7cf198dc7 100644 --- a/actions/grouplogo.php +++ b/actions/grouplogo.php @@ -152,7 +152,7 @@ class GrouplogoAction extends Action function getInstructions() { - return _('You can upload a logo image for your group. The maximum file size is '.ImageFile::maxFileSize().'.'); + return sprintf(_('You can upload a logo image for your group. The maximum file size is %s.'), ImageFile::maxFileSize()); } /** @@ -229,7 +229,7 @@ class GrouplogoAction extends Action $this->element('input', array('name' => 'MAX_FILE_SIZE', 'type' => 'hidden', 'id' => 'MAX_FILE_SIZE', - 'value' => ImageFile::maxFileSize(true))); + 'value' => ImageFile::maxFileSizeInt())); $this->elementEnd('li'); $this->elementEnd('ul'); @@ -382,7 +382,7 @@ class GrouplogoAction extends Action $this->serverError(_('Lost our file data.')); return; } - + // If image is not being cropped assume pos & dimentions of original $dest_x = $this->arg('avatar_crop_x') ? $this->arg('avatar_crop_x'):0; $dest_y = $this->arg('avatar_crop_y') ? $this->arg('avatar_crop_y'):0; @@ -390,7 +390,7 @@ class GrouplogoAction extends Action $dest_h = $this->arg('avatar_crop_h') ? $this->arg('avatar_crop_h'):$filedata['height']; $size = min($dest_w, $dest_h); $size = ($size > MAX_ORIGINAL) ? MAX_ORIGINAL:$size; - + $imagefile = new ImageFile($this->group->id, $filedata['filepath']); $filename = $imagefile->resize($size, $dest_x, $dest_y, $dest_w, $dest_h); diff --git a/lib/imagefile.php b/lib/imagefile.php index 74c3d14f0..fa0581dd0 100644 --- a/lib/imagefile.php +++ b/lib/imagefile.php @@ -58,7 +58,7 @@ class ImageFile { $this->id = $id; $this->filepath = $filepath; - + $info = @getimagesize($this->filepath); $this->type = ($info) ? $info[2]:$type; $this->width = ($info) ? $info[0]:$width; @@ -72,7 +72,7 @@ class ImageFile break; case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: - throw new Exception(_('That file is too big. The maximum file size is '.$this->maxFileSize().'.')); + throw new Exception(sprintf(_('That file is too big. The maximum file size is %d.'), $this->maxFileSize())); return; case UPLOAD_ERR_PARTIAL: @unlink($_FILES[$param]['tmp_name']); @@ -82,19 +82,19 @@ class ImageFile throw new Exception(_('System error uploading file.')); return; } - + $info = @getimagesize($_FILES[$param]['tmp_name']); - + if (!$info) { @unlink($_FILES[$param]['tmp_name']); throw new Exception(_('Not an image or corrupt file.')); return; } - + if ($info[2] !== IMAGETYPE_GIF && $info[2] !== IMAGETYPE_JPEG && $info[2] !== IMAGETYPE_PNG) { - + @unlink($_FILES[$param]['tmp_name']); throw new Exception(_('Unsupported image file format.')); return; @@ -102,7 +102,7 @@ class ImageFile return new ImageFile(null, $_FILES[$param]['tmp_name']); } - + function resize($size, $x = 0, $y = 0, $w = null, $h = null) { $w = ($w === null) ? $this->width:$w; @@ -129,25 +129,25 @@ class ImageFile } $image_dest = imagecreatetruecolor($size, $size); - + if ($this->type == IMAGETYPE_GIF || $this->type == IMAGETYPE_PNG) { $transparent_idx = imagecolortransparent($image_src); - + if ($transparent_idx >= 0) { - + $transparent_color = imagecolorsforindex($image_src, $transparent_idx); $transparent_idx = imagecolorallocate($image_dest, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']); imagefill($image_dest, 0, 0, $transparent_idx); imagecolortransparent($image_dest, $transparent_idx); - + } elseif ($this->type == IMAGETYPE_PNG) { - + imagealphablending($image_dest, false); $transparent = imagecolorallocatealpha($image_dest, 0, 0, 0, 127); imagefill($image_dest, 0, 0, $transparent); imagesavealpha($image_dest, true); - + } } @@ -182,23 +182,32 @@ class ImageFile { @unlink($this->filename); } - - static function maxFileSize($return_bytes = false) + + static function maxFileSize() { - $limit = min(ImageFile::strToInt(ini_get('post_max_size')), ImageFile::strToInt(ini_get('upload_max_filesize')), ImageFile::strToInt(ini_get('memory_limit'))); - - if ($return_bytes) { - return $limit; + $value = ImageFile::maxFileSizeInt(); + + if ($value > 1024 * 1024) { + return ($value/(1024*1024)).'Mb'; + } else if ($value > 1024) { + return ($value/(1024)).'kB'; + } else { + return $value; } - - return ($limit/(1024*1024)).'MB'; } - + + static function maxFileSizeInt() + { + return min(ImageFile::strToInt(ini_get('post_max_size')), + ImageFile::strToInt(ini_get('upload_max_filesize')), + ImageFile::strToInt(ini_get('memory_limit'))); + } + static function strToInt($str) { $unit = substr($str, -1); $num = substr($str, 0, -1); - + switch(strtoupper($unit)){ case 'G': $num *= 1024; @@ -207,7 +216,7 @@ class ImageFile case 'K': $num *= 1024; } - + return $num; } } \ No newline at end of file -- cgit v1.2.3-54-g00ecf From 444c7944809544928e05bd71479f6551acc98fc4 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 5 Feb 2009 16:34:38 -0500 Subject: Don't show stretchy-box on avatar if not cropping --- actions/avatarsettings.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'actions') diff --git a/actions/avatarsettings.php b/actions/avatarsettings.php index 5c702ecc0..3f50ca24c 100644 --- a/actions/avatarsettings.php +++ b/actions/avatarsettings.php @@ -373,12 +373,14 @@ class AvatarsettingsAction extends AccountSettingsAction { parent::showScripts(); - $jcropPack = common_path('js/jcrop/jquery.Jcrop.pack.js'); - $jcropGo = common_path('js/jcrop/jquery.Jcrop.go.js'); + if ($this->mode == 'crop') { + $jcropPack = common_path('js/jcrop/jquery.Jcrop.pack.js'); + $jcropGo = common_path('js/jcrop/jquery.Jcrop.go.js'); - $this->element('script', array('type' => 'text/javascript', - 'src' => $jcropPack)); - $this->element('script', array('type' => 'text/javascript', - 'src' => $jcropGo)); + $this->element('script', array('type' => 'text/javascript', + 'src' => $jcropPack)); + $this->element('script', array('type' => 'text/javascript', + 'src' => $jcropGo)); + } } } -- cgit v1.2.3-54-g00ecf From ab82978b2d67545a9cd7bfc80837798212cff31b Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 5 Feb 2009 16:16:10 -0800 Subject: Trac #894 and #1013 - fixed bad redirects after delete notice --- actions/all.php | 3 +++ actions/deletenotice.php | 4 ++++ actions/favorited.php | 3 +++ actions/noticesearch.php | 10 ++++++++++ actions/public.php | 3 +++ actions/replies.php | 2 ++ actions/showfavorites.php | 2 ++ actions/showgroup.php | 2 ++ actions/showstream.php | 2 ++ actions/tag.php | 3 +++ lib/mailbox.php | 2 ++ lib/personal.php | 1 - 12 files changed, 36 insertions(+), 1 deletion(-) (limited to 'actions') diff --git a/actions/all.php b/actions/all.php index b03ad7ec3..d75d1b946 100644 --- a/actions/all.php +++ b/actions/all.php @@ -42,6 +42,9 @@ class AllAction extends Action if (!$this->page) { $this->page = 1; } + + common_set_returnto($this->selfUrl()); + return true; } diff --git a/actions/deletenotice.php b/actions/deletenotice.php index d4b8e50e5..fc4a74eac 100644 --- a/actions/deletenotice.php +++ b/actions/deletenotice.php @@ -134,6 +134,10 @@ class DeletenoticeAction extends DeleteAction $url = common_get_returnto(); + + $urlval = ($url) ? $url : 'null'; + common_debug("deleteNotice() - returnto url = $urlval"); + if ($url) { common_set_returnto(null); } else { diff --git a/actions/favorited.php b/actions/favorited.php index 4155b3a23..fd5ff413c 100644 --- a/actions/favorited.php +++ b/actions/favorited.php @@ -104,6 +104,9 @@ class FavoritedAction extends Action { parent::prepare($args); $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; + + common_set_returnto($this->selfUrl()); + return true; } diff --git a/actions/noticesearch.php b/actions/noticesearch.php index 630fb8857..c0c238120 100644 --- a/actions/noticesearch.php +++ b/actions/noticesearch.php @@ -48,6 +48,16 @@ require_once INSTALLDIR.'/lib/searchaction.php'; */ class NoticesearchAction extends SearchAction { + + function prepare($args) + { + parent::prepare($args); + + common_set_returnto($this->selfUrl()); + + return true; + } + /** * Get instructions * diff --git a/actions/public.php b/actions/public.php index cfdc99bb3..cc6537f74 100644 --- a/actions/public.php +++ b/actions/public.php @@ -73,6 +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; } diff --git a/actions/replies.php b/actions/replies.php index 9ec373a96..7eff74a66 100644 --- a/actions/replies.php +++ b/actions/replies.php @@ -83,6 +83,8 @@ class RepliesAction extends Action $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; + common_set_returnto($this->selfUrl()); + return true; } diff --git a/actions/showfavorites.php b/actions/showfavorites.php index bb68f8d94..31479e1a7 100644 --- a/actions/showfavorites.php +++ b/actions/showfavorites.php @@ -112,6 +112,8 @@ class ShowfavoritesAction extends Action $this->page = 1; } + common_set_returnto($this->selfUrl()); + return true; } diff --git a/actions/showgroup.php b/actions/showgroup.php index 468990e7b..7bc68fbc6 100644 --- a/actions/showgroup.php +++ b/actions/showgroup.php @@ -129,6 +129,8 @@ class ShowgroupAction extends Action return false; } + common_set_returnto($this->selfUrl()); + return true; } diff --git a/actions/showstream.php b/actions/showstream.php index 4b1679969..224bbce9f 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -110,6 +110,8 @@ class ShowstreamAction extends Action $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; + common_set_returnto($this->selfUrl()); + return true; } diff --git a/actions/tag.php b/actions/tag.php index 803026e62..4401f892a 100644 --- a/actions/tag.php +++ b/actions/tag.php @@ -37,6 +37,9 @@ class TagAction extends Action } $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; + + common_set_returnto($this->selfUrl()); + return true; } diff --git a/lib/mailbox.php b/lib/mailbox.php index 8d5d44e49..e8323dc28 100644 --- a/lib/mailbox.php +++ b/lib/mailbox.php @@ -63,6 +63,8 @@ class MailboxAction extends PersonalAction $this->page = 1; } + common_set_returnto($this->selfUrl()); + return true; } diff --git a/lib/personal.php b/lib/personal.php index 900df0257..e46350c63 100644 --- a/lib/personal.php +++ b/lib/personal.php @@ -55,7 +55,6 @@ class PersonalAction extends Action function handle($args) { parent::handle($args); - common_set_returnto($this->selfUrl()); } } -- cgit v1.2.3-54-g00ecf From d51be320caf9371d3b45b231e7c6de61c67d9068 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 5 Feb 2009 16:21:23 -0800 Subject: Removed debugging statements I accidentally left in deletenotice.php --- actions/deletenotice.php | 4 ---- 1 file changed, 4 deletions(-) (limited to 'actions') diff --git a/actions/deletenotice.php b/actions/deletenotice.php index fc4a74eac..d4b8e50e5 100644 --- a/actions/deletenotice.php +++ b/actions/deletenotice.php @@ -134,10 +134,6 @@ class DeletenoticeAction extends DeleteAction $url = common_get_returnto(); - - $urlval = ($url) ? $url : 'null'; - common_debug("deleteNotice() - returnto url = $urlval"); - if ($url) { common_set_returnto(null); } else { -- cgit v1.2.3-54-g00ecf From ac23321a4039eeffe2d7fedf2a45504b97b49b70 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Fri, 6 Feb 2009 06:27:04 +0000 Subject: Added primary and secondary form actions. Fixed markup for form_notice_delete --- actions/deletenotice.php | 15 ++++++++------- theme/base/css/display.css | 13 ++++++++++--- theme/default/css/display.css | 6 +++++- theme/identica/css/display.css | 6 +++++- 4 files changed, 28 insertions(+), 12 deletions(-) (limited to 'actions') diff --git a/actions/deletenotice.php b/actions/deletenotice.php index d4b8e50e5..16e2df889 100644 --- a/actions/deletenotice.php +++ b/actions/deletenotice.php @@ -103,17 +103,18 @@ class DeletenoticeAction extends DeleteAction function showContent() { - $this->elementStart('form', array('id' => 'notice_delete_form', + $this->elementStart('form', array('id' => 'form_notice_delete', + 'class' => 'form_settings', 'method' => 'post', 'action' => common_local_url('deletenotice'))); + $this->elementStart('fieldset'); + $this->element('legend', null, _('Delete notice')); $this->hidden('token', common_session_token()); $this->hidden('notice', $this->trimmed('notice')); - $this->elementStart('p'); - $this->element('span', array('id' => 'confirmation_text'), - _('Are you sure you want to delete this notice?')); - $this->submit('yes', _('Yes')); - $this->submit('no', _('No')); - $this->elementEnd('p'); + $this->element('p', null, _('Are you sure you want to delete this notice?')); + $this->submit('form_action-yes', _('Yes'), 'submit form_action-primary', 'yes'); + $this->submit('form_action-no', _('No'), 'submit form_action-secondary', 'no'); + $this->elementEnd('fieldset'); $this->elementEnd('form'); } diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 60eaa8f22..f6e3c0fc7 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -152,7 +152,8 @@ font-weight:bold; #form_remote_subscribe legend, #form_openid_login legend, #form_search legend, -#form_invite legend { +#form_invite legend, +#form_notice_delete legend { display:none; } @@ -179,6 +180,7 @@ float:left; width:90%; } + #form_login p.form_guide, #form_register #settings_rememberme p.form_guide, #form_openid_login #settings_rememberme p.form_guide, @@ -194,12 +196,16 @@ border-radius:4px; padding:0 7px; } + +.form_settings input.form_action-secondary { +margin-left:29px; +padding:0; +} + #form_search .submit { margin-left:11px; } - - address { float:left; margin-bottom:18px; @@ -1169,3 +1175,4 @@ clear:both; margin-bottom:0; } + diff --git a/theme/default/css/display.css b/theme/default/css/display.css index da1ba6717..854202956 100644 --- a/theme/default/css/display.css +++ b/theme/default/css/display.css @@ -34,6 +34,9 @@ border-color:#aaa; border-color:#97BFD1; } +.form_settings input.form_action-secondary { +background:none; +} input.submit, #form_notice.warning #notice_text-count, @@ -59,7 +62,8 @@ div.notice-options input, .form_user_unblock input.submit, .entity_send-a-message a, .form_user_nudge input.submit, -.entity_nudge p { +.entity_nudge p, +.form_settings input.form_action-secondary { color:#002E6E; } diff --git a/theme/identica/css/display.css b/theme/identica/css/display.css index 6fcd730a9..9f6499013 100644 --- a/theme/identica/css/display.css +++ b/theme/identica/css/display.css @@ -34,6 +34,9 @@ border-color:#aaa; border-color:#ddd; } +.form_settings input.form_action-secondary { +background:none; +} input.submit, #form_notice.warning #notice_text-count, @@ -59,7 +62,8 @@ div.notice-options input, .form_user_unblock input.submit, .entity_send-a-message a, .form_user_nudge input.submit, -.entity_nudge p { +.entity_nudge p, +.form_settings input.form_action-secondary { color:#002E6E; } -- cgit v1.2.3-54-g00ecf From 343cd6f20577c44487eae4e90ec10bfd954980e3 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 6 Feb 2009 03:13:08 -0500 Subject: Move common_avatar_* functions to Avatar Moved the common_avatar_* functions to the Avatar class. Typically either as methods on the object or as static methods. Replaced all the uses of the functions in other modules. --- actions/avatarbynickname.php | 4 +-- actions/avatarsettings.php | 8 ++--- actions/grouplogo.php | 8 ++--- actions/noticesearch.php | 2 +- actions/showstream.php | 2 +- actions/tagother.php | 2 +- actions/twittersettings.php | 4 +-- classes/Avatar.php | 50 +++++++++++++++++++++++---- classes/Profile.php | 21 ++++++++---- classes/User_group.php | 10 +++--- lib/imagefile.php | 4 +-- lib/jabber.php | 2 +- lib/mailbox.php | 4 +-- lib/noticelist.php | 4 +-- lib/noticesection.php | 2 +- lib/profilelist.php | 2 +- lib/profileminilist.php | 2 +- lib/profilesection.php | 2 +- lib/rssaction.php | 4 +-- lib/twitterapi.php | 2 +- lib/util.php | 78 ++++++++----------------------------------- scripts/enjitqueuehandler.php | 2 +- 22 files changed, 107 insertions(+), 112 deletions(-) (limited to 'actions') diff --git a/actions/avatarbynickname.php b/actions/avatarbynickname.php index 9bbdecefa..ca58c9653 100644 --- a/actions/avatarbynickname.php +++ b/actions/avatarbynickname.php @@ -90,9 +90,9 @@ class AvatarbynicknameAction extends Action $url = $avatar->url; } else { if ($size == 'original') { - $url = common_default_avatar(AVATAR_PROFILE_SIZE); + $url = Avatar::defaultImage(AVATAR_PROFILE_SIZE); } else { - $url = common_default_avatar($size+0); + $url = Avatar::defaultImage($size+0); } } common_redirect($url, 302); diff --git a/actions/avatarsettings.php b/actions/avatarsettings.php index 3f50ca24c..a0be5d8f8 100644 --- a/actions/avatarsettings.php +++ b/actions/avatarsettings.php @@ -200,7 +200,7 @@ class AvatarsettingsAction extends AccountSettingsAction 'class' => 'avatar_view')); $this->element('h2', null, _("Original")); $this->elementStart('div', array('id'=>'avatar_original_view')); - $this->element('img', array('src' => common_avatar_url($this->filedata['filename']), + $this->element('img', array('src' => Avatar::url($this->filedata['filename']), 'width' => $this->filedata['width'], 'height' => $this->filedata['height'], 'alt' => $user->nickname)); @@ -212,7 +212,7 @@ class AvatarsettingsAction extends AccountSettingsAction 'class' => 'avatar_view')); $this->element('h2', null, _("Preview")); $this->elementStart('div', array('id'=>'avatar_preview_view')); - $this->element('img', array('src' => common_avatar_url($this->filedata['filename']), + $this->element('img', array('src' => Avatar::url($this->filedata['filename']), 'width' => AVATAR_PROFILE_SIZE, 'height' => AVATAR_PROFILE_SIZE, 'alt' => $user->nickname)); @@ -281,12 +281,12 @@ class AvatarsettingsAction extends AccountSettingsAction $cur = common_current_user(); - $filename = common_avatar_filename($cur->id, + $filename = Avatar::filename($cur->id, image_type_to_extension($imagefile->type), null, 'tmp'.common_timestamp()); - $filepath = common_avatar_path($filename); + $filepath = Avatar::path($filename); move_uploaded_file($imagefile->filepath, $filepath); diff --git a/actions/grouplogo.php b/actions/grouplogo.php index 7cf198dc7..650c95255 100644 --- a/actions/grouplogo.php +++ b/actions/grouplogo.php @@ -263,7 +263,7 @@ class GrouplogoAction extends Action 'class' => 'avatar_view')); $this->element('h2', null, _("Original")); $this->elementStart('div', array('id'=>'avatar_original_view')); - $this->element('img', array('src' => common_avatar_url($this->filedata['filename']), + $this->element('img', array('src' => Avatar::url($this->filedata['filename']), 'width' => $this->filedata['width'], 'height' => $this->filedata['height'], 'alt' => $this->group->nickname)); @@ -275,7 +275,7 @@ class GrouplogoAction extends Action 'class' => 'avatar_view')); $this->element('h2', null, _("Preview")); $this->elementStart('div', array('id'=>'avatar_preview_view')); - $this->element('img', array('src' => common_avatar_url($this->filedata['filename']), + $this->element('img', array('src' => Avatar::url($this->filedata['filename']), 'width' => AVATAR_PROFILE_SIZE, 'height' => AVATAR_PROFILE_SIZE, 'alt' => $this->group->nickname)); @@ -343,12 +343,12 @@ class GrouplogoAction extends Action return; } - $filename = common_avatar_filename($this->group->id, + $filename = Avatar::filename($this->group->id, image_type_to_extension($imagefile->type), null, 'group-temp-'.common_timestamp()); - $filepath = common_avatar_path($filename); + $filepath = Avatar::path($filename); move_uploaded_file($imagefile->filepath, $filepath); diff --git a/actions/noticesearch.php b/actions/noticesearch.php index c0c238120..a5f01350c 100644 --- a/actions/noticesearch.php +++ b/actions/noticesearch.php @@ -166,7 +166,7 @@ class NoticesearchAction extends SearchAction $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE); $this->elementStart('a', array('href' => $profile->profileurl, 'class' => 'url')); - $this->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE), + $this->element('img', array('src' => ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE), 'class' => 'avatar photo', 'width' => AVATAR_STREAM_SIZE, 'height' => AVATAR_STREAM_SIZE, diff --git a/actions/showstream.php b/actions/showstream.php index 224bbce9f..28bb8453f 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -242,7 +242,7 @@ class ShowstreamAction extends Action $this->elementStart('dl', 'entity_depiction'); $this->element('dt', null, _('Photo')); $this->elementStart('dd'); - $this->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE), + $this->element('img', array('src' => ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE), 'class' => 'photo avatar', 'width' => AVATAR_PROFILE_SIZE, 'height' => AVATAR_PROFILE_SIZE, diff --git a/actions/tagother.php b/actions/tagother.php index cbace5b6b..3e8a12fd6 100644 --- a/actions/tagother.php +++ b/actions/tagother.php @@ -80,7 +80,7 @@ class TagotherAction extends Action $this->elementStart('dl', 'entity_depiction'); $this->element('dt', null, _('Photo')); $this->elementStart('dd'); - $this->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE), + $this->element('img', array('src' => ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE), 'class' => 'photo avatar', 'width' => AVATAR_PROFILE_SIZE, 'height' => AVATAR_PROFILE_SIZE, diff --git a/actions/twittersettings.php b/actions/twittersettings.php index b3bf67dc3..2d41469bb 100644 --- a/actions/twittersettings.php +++ b/actions/twittersettings.php @@ -250,8 +250,8 @@ class TwittersettingsAction extends ConnectSettingsAction $avatar = $other->getAvatar(AVATAR_MINI_SIZE); $avatar_url = ($avatar) ? - common_avatar_display_url($avatar) : - common_default_avatar(AVATAR_MINI_SIZE); + $avatar->displayUrl() : + Avatar::defaultImage(AVATAR_MINI_SIZE); $this->element('img', array('src' => $avatar_url, 'width' => AVATAR_MINI_SIZE, diff --git a/classes/Avatar.php b/classes/Avatar.php index 6a9ea7686..6248a84d3 100644 --- a/classes/Avatar.php +++ b/classes/Avatar.php @@ -4,18 +4,18 @@ */ require_once INSTALLDIR.'/classes/Memcached_DataObject.php'; -class Avatar extends Memcached_DataObject +class Avatar extends Memcached_DataObject { ###START_AUTOCODE /* the code below is auto generated do not remove the above tag */ public $__table = 'avatar'; // table name public $profile_id; // int(4) primary_key not_null - public $original; // tinyint(1) + public $original; // tinyint(1) public $width; // int(4) primary_key not_null public $height; // int(4) primary_key not_null public $mediatype; // varchar(32) not_null - public $filename; // varchar(255) + public $filename; // varchar(255) public $url; // varchar(255) unique_key public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP @@ -33,13 +33,51 @@ class Avatar extends Memcached_DataObject { $filename = $this->filename; if (parent::delete()) { - @unlink(common_avatar_path($filename)); + @unlink(Avatar::path($filename)); } } - - function &pkeyGet($kv) + + function &pkeyGet($kv) { return Memcached_DataObject::pkeyGet('Avatar', $kv); } + // where should the avatar go for this user? + + static function filename($id, $extension, $size=null, $extra=null) + { + if ($size) { + return $id . '-' . $size . (($extra) ? ('-' . $extra) : '') . $extension; + } else { + return $id . '-original' . (($extra) ? ('-' . $extra) : '') . $extension; + } + } + + static function path($filename) + { + return INSTALLDIR . '/avatar/' . $filename; + } + + static function url($filename) + { + return common_path('avatar/'.$filename); + } + + function displayUrl() + { + $server = common_config('avatar', 'server'); + if ($server) { + return 'http://'.$server.'/'.$this->filename; + } else { + return $this->url; + } + } + + static function defaultAvatar($size) + { + static $sizenames = array(AVATAR_PROFILE_SIZE => 'profile', + AVATAR_STREAM_SIZE => 'stream', + AVATAR_MINI_SIZE => 'mini'); + return theme_path('default-avatar-'.$sizenames[$size].'.png'); + } } diff --git a/classes/Profile.php b/classes/Profile.php index 5be632f87..f3bfe299c 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -71,7 +71,7 @@ class Profile extends Memcached_DataObject function setOriginal($filename) { - $imagefile = new ImageFile($this->id, common_avatar_path($filename)); + $imagefile = new ImageFile($this->id, Avatar::path($filename)); $avatar = new Avatar(); $avatar->profile_id = $this->id; @@ -80,22 +80,22 @@ class Profile extends Memcached_DataObject $avatar->mediatype = image_type_to_mime_type($imagefile->type); $avatar->filename = $filename; $avatar->original = true; - $avatar->url = common_avatar_url($filename); + $avatar->url = Avatar::url($filename); $avatar->created = DB_DataObject_Cast::dateTime(); # current time # XXX: start a transaction here if (!$this->delete_avatars() || !$avatar->insert()) { - @unlink(common_avatar_path($filename)); + @unlink(Avatar::path($filename)); return null; } foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) { # We don't do a scaled one if original is our scaled size if (!($avatar->width == $size && $avatar->height == $size)) { - + $scaled_filename = $imagefile->resize($size); - + //$scaled = DB_DataObject::factory('avatar'); $scaled = new Avatar(); $scaled->profile_id = $this->id; @@ -104,7 +104,7 @@ class Profile extends Memcached_DataObject $scaled->original = false; $scaled->mediatype = image_type_to_mime_type($imagefile->type); $scaled->filename = $scaled_filename; - $scaled->url = common_avatar_url($scaled_filename); + $scaled->url = Avatar::url($scaled_filename); $scaled->created = DB_DataObject_Cast::dateTime(); # current time if (!$scaled->insert()) { @@ -194,4 +194,13 @@ class Profile extends Memcached_DataObject } } + function avatarUrl($size=AVATAR_PROFILE_SIZE) + { + $avatar = $this->getAvatar($size); + if ($avatar) { + return $avatar->displayUrl(); + } else { + return Avatar::defaultImage($size); + } + } } diff --git a/classes/User_group.php b/classes/User_group.php index 340d7f67a..d152f9d56 100755 --- a/classes/User_group.php +++ b/classes/User_group.php @@ -90,13 +90,13 @@ class User_group extends Memcached_DataObject function setOriginal($filename) { - $imagefile = new ImageFile($this->id, common_avatar_path($filename)); + $imagefile = new ImageFile($this->id, Avatar::path($filename)); $orig = clone($this); - $this->original_logo = common_avatar_url($filename); - $this->homepage_logo = common_avatar_url($imagefile->resize(AVATAR_PROFILE_SIZE)); - $this->stream_logo = common_avatar_url($imagefile->resize(AVATAR_STREAM_SIZE)); - $this->mini_logo = common_avatar_url($imagefile->resize(AVATAR_MINI_SIZE)); + $this->original_logo = Avatar::url($filename); + $this->homepage_logo = Avatar::url($imagefile->resize(AVATAR_PROFILE_SIZE)); + $this->stream_logo = Avatar::url($imagefile->resize(AVATAR_STREAM_SIZE)); + $this->mini_logo = Avatar::url($imagefile->resize(AVATAR_MINI_SIZE)); common_debug(common_log_objstring($this)); return $this->update($orig); } diff --git a/lib/imagefile.php b/lib/imagefile.php index fa0581dd0..db344db8f 100644 --- a/lib/imagefile.php +++ b/lib/imagefile.php @@ -153,12 +153,12 @@ class ImageFile imagecopyresampled($image_dest, $image_src, 0, 0, $x, $y, $size, $size, $w, $h); - $outname = common_avatar_filename($this->id, + $outname = Avatar::filename($this->id, image_type_to_extension($this->type), $size, common_timestamp()); - $outpath = common_avatar_path($outname); + $outpath = Avatar::path($outname); switch ($this->type) { case IMAGETYPE_GIF: diff --git a/lib/jabber.php b/lib/jabber.php index f1be57768..f41d984d6 100644 --- a/lib/jabber.php +++ b/lib/jabber.php @@ -178,7 +178,7 @@ function jabber_format_entry($profile, $notice) $entry .= "\n"; $entry .= "\n"; $entry .= "" . $profile->nickname . "\n"; - $entry .= "" . common_profile_avatar_url($profile, AVATAR_PROFILE_SIZE) . "\n"; + $entry .= "" . $profile->avatarUrl(AVATAR_PROFILE_SIZE) . "\n"; $entry .= "\n"; $entry .= "" . htmlspecialchars($msg) . "\n"; $entry .= "" . htmlspecialchars($msg) . "\n"; diff --git a/lib/mailbox.php b/lib/mailbox.php index e8323dc28..d77234549 100644 --- a/lib/mailbox.php +++ b/lib/mailbox.php @@ -183,8 +183,8 @@ class MailboxAction extends PersonalAction 'class' => 'url')); $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE); $this->element('img', array('src' => ($avatar) ? - common_avatar_display_url($avatar) : - common_default_avatar(AVATAR_STREAM_SIZE), + $avatar->displayUrl() : + Avatar::defaultImage(AVATAR_STREAM_SIZE), 'class' => 'photo avatar', 'width' => AVATAR_STREAM_SIZE, 'height' => AVATAR_STREAM_SIZE, diff --git a/lib/noticelist.php b/lib/noticelist.php index 3ef6691af..9fc0126b3 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -285,8 +285,8 @@ class NoticeListItem extends Widget $avatar = $this->profile->getAvatar($avatar_size); $this->out->element('img', array('src' => ($avatar) ? - common_avatar_display_url($avatar) : - common_default_avatar($avatar_size), + $avatar->displayUrl() : + Avatar::defaultImage($avatar_size), 'class' => 'avatar photo', 'width' => $avatar_size, 'height' => $avatar_size, diff --git a/lib/noticesection.php b/lib/noticesection.php index aa8e03229..97b517529 100644 --- a/lib/noticesection.php +++ b/lib/noticesection.php @@ -82,7 +82,7 @@ class NoticeSection extends Section $profile->nickname, 'href' => $profile->profileurl, 'class' => 'url')); - $this->out->element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_MINI_SIZE)), + $this->out->element('img', array('src' => (($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_MINI_SIZE)), 'width' => AVATAR_MINI_SIZE, 'height' => AVATAR_MINI_SIZE, 'class' => 'avatar photo', diff --git a/lib/profilelist.php b/lib/profilelist.php index 6e14c0b69..4d924b039 100644 --- a/lib/profilelist.php +++ b/lib/profilelist.php @@ -97,7 +97,7 @@ class ProfileList extends Widget $avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE); $this->out->elementStart('a', array('href' => $this->profile->profileurl, 'class' => 'url')); - $this->out->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE), + $this->out->element('img', array('src' => ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE), 'class' => 'photo avatar', 'width' => AVATAR_STREAM_SIZE, 'height' => AVATAR_STREAM_SIZE, diff --git a/lib/profileminilist.php b/lib/profileminilist.php index 81cd7aed5..0d466bba8 100644 --- a/lib/profileminilist.php +++ b/lib/profileminilist.php @@ -74,7 +74,7 @@ class ProfileMiniList extends ProfileList 'rel' => 'contact member', 'class' => 'url')); $avatar = $this->profile->getAvatar(AVATAR_MINI_SIZE); - $this->out->element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_MINI_SIZE)), + $this->out->element('img', array('src' => (($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_MINI_SIZE)), 'width' => AVATAR_MINI_SIZE, 'height' => AVATAR_MINI_SIZE, 'class' => 'avatar photo', diff --git a/lib/profilesection.php b/lib/profilesection.php index 3642ae164..8ed290e03 100644 --- a/lib/profilesection.php +++ b/lib/profilesection.php @@ -86,7 +86,7 @@ class ProfileSection extends Section 'rel' => 'contact member', 'class' => 'url')); $avatar = $profile->getAvatar(AVATAR_MINI_SIZE); - $this->out->element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_MINI_SIZE)), + $this->out->element('img', array('src' => (($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_MINI_SIZE)), 'width' => AVATAR_MINI_SIZE, 'height' => AVATAR_MINI_SIZE, 'class' => 'avatar photo', diff --git a/lib/rssaction.php b/lib/rssaction.php index 2bd7f1f19..131e8ac65 100644 --- a/lib/rssaction.php +++ b/lib/rssaction.php @@ -199,7 +199,7 @@ class Rss10Action extends Action $this->element('dc:date', null, common_date_w3dtf($notice->created)); $this->element('dc:creator', null, ($profile->fullname) ? $profile->fullname : $profile->nickname); $this->element('sioc:has_creator', array('rdf:resource' => $creator_uri)); - $this->element('laconica:postIcon', array('rdf:resource' => common_profile_avatar_url($profile))); + $this->element('laconica:postIcon', array('rdf:resource' => $profile->avatarUrl())); $this->element('cc:licence', array('rdf:resource' => common_config('license', 'url'))); $this->elementEnd('item'); $this->creators[$creator_uri] = $profile; @@ -216,7 +216,7 @@ class Rss10Action extends Action $this->element('foaf:name', null, $profile->fullname); } $this->element('sioc:id', null, $id); - $avatar = common_profile_avatar_url($profile); + $avatar = $profile->avatarUrl(); $this->element('sioc:avatar', array('rdf:resource' => $avatar)); $this->elementEnd('sioc:User'); } diff --git a/lib/twitterapi.php b/lib/twitterapi.php index da8b8b1e5..a4d183fcd 100644 --- a/lib/twitterapi.php +++ b/lib/twitterapi.php @@ -43,7 +43,7 @@ class TwitterapiAction extends Action $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE); - $twitter_user['profile_image_url'] = ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE); + $twitter_user['profile_image_url'] = ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE); $twitter_user['protected'] = 'false'; # not supported by Laconica yet $twitter_user['url'] = ($profile->homepage) ? $profile->homepage : null; diff --git a/lib/util.php b/lib/util.php index 5275ad6b6..0655ebf27 100644 --- a/lib/util.php +++ b/lib/util.php @@ -395,15 +395,15 @@ function common_render_text($text) function common_replace_urls_callback($text, $callback) { // Start off with a regex preg_match_all('#(?:(?:(?:https?|ftps?|mms|rtsp|gopher|news|nntp|telnet|wais|file|prospero|webcal|xmpp|irc)://|(?:mailto|aim|tel):)[^.\s]+\.[^\s]+|(?:[^.\s/]+\.)+(?:museum|travel|[a-z]{2,4})(?:[:/][^\s]*)?)#i', $text, $matches); - + // Then clean up what the regex left behind $offset = 0; foreach($matches[0] as $url) { $url = htmlspecialchars_decode($url); - + // Make sure we didn't pick up an email address if (preg_match('#^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$#i', $url)) continue; - + // Remove trailing punctuation $url = rtrim($url, '.?!,;:\'"`'); @@ -422,48 +422,48 @@ function common_replace_urls_callback($text, $callback) { // Remove trailing punctuation again (in case there were some inside parens) $url = rtrim($url, '.?!,;:\'"`'); - + // Make sure we didn't capture part of the next sentence preg_match('#((?:[^.\s/]+\.)+)(museum|travel|[a-z]{2,4})#i', $url, $url_parts); - + // Were the parts capitalized any? $last_part = (mb_strtolower($url_parts[2]) !== $url_parts[2]) ? true:false; $prev_part = (mb_strtolower($url_parts[1]) !== $url_parts[1]) ? true:false; - + // If the first part wasn't cap'd but the last part was, we captured too much if ((!$prev_part && $last_part)) { $url = substr_replace($url, '', mb_strpos($url, '.'.$url_parts[2], 0)); } - + // Capture the new TLD preg_match('#((?:[^.\s/]+\.)+)(museum|travel|[a-z]{2,4})#i', $url, $url_parts); - + $tlds = array('ac', 'ad', 'ae', 'aero', 'af', 'ag', 'ai', 'al', 'am', 'an', 'ao', 'aq', 'ar', 'arpa', 'as', 'asia', 'at', 'au', 'aw', 'ax', 'az', 'ba', 'bb', 'bd', 'be', 'bf', 'bg', 'bh', 'bi', 'biz', 'bj', 'bm', 'bn', 'bo', 'br', 'bs', 'bt', 'bv', 'bw', 'by', 'bz', 'ca', 'cat', 'cc', 'cd', 'cf', 'cg', 'ch', 'ci', 'ck', 'cl', 'cm', 'cn', 'co', 'com', 'coop', 'cr', 'cu', 'cv', 'cx', 'cy', 'cz', 'de', 'dj', 'dk', 'dm', 'do', 'dz', 'ec', 'edu', 'ee', 'eg', 'er', 'es', 'et', 'eu', 'fi', 'fj', 'fk', 'fm', 'fo', 'fr', 'ga', 'gb', 'gd', 'ge', 'gf', 'gg', 'gh', 'gi', 'gl', 'gm', 'gn', 'gov', 'gp', 'gq', 'gr', 'gs', 'gt', 'gu', 'gw', 'gy', 'hk', 'hm', 'hn', 'hr', 'ht', 'hu', 'id', 'ie', 'il', 'im', 'in', 'info', 'int', 'io', 'iq', 'ir', 'is', 'it', 'je', 'jm', 'jo', 'jobs', 'jp', 'ke', 'kg', 'kh', 'ki', 'km', 'kn', 'kp', 'kr', 'kw', 'ky', 'kz', 'la', 'lb', 'lc', 'li', 'lk', 'lr', 'ls', 'lt', 'lu', 'lv', 'ly', 'ma', 'mc', 'md', 'me', 'mg', 'mh', 'mil', 'mk', 'ml', 'mm', 'mn', 'mo', 'mobi', 'mp', 'mq', 'mr', 'ms', 'mt', 'mu', 'museum', 'mv', 'mw', 'mx', 'my', 'mz', 'na', 'name', 'nc', 'ne', 'net', 'nf', 'ng', 'ni', 'nl', 'no', 'np', 'nr', 'nu', 'nz', 'om', 'org', 'pa', 'pe', 'pf', 'pg', 'ph', 'pk', 'pl', 'pm', 'pn', 'pr', 'pro', 'ps', 'pt', 'pw', 'py', 'qa', 're', 'ro', 'rs', 'ru', 'rw', 'sa', 'sb', 'sc', 'sd', 'se', 'sg', 'sh', 'si', 'sj', 'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'st', 'su', 'sv', 'sy', 'sz', 'tc', 'td', 'tel', 'tf', 'tg', 'th', 'tj', 'tk', 'tl', 'tm', 'tn', 'to', 'tp', 'tr', 'travel', 'tt', 'tv', 'tw', 'tz', 'ua', 'ug', 'uk', 'us', 'uy', 'uz', 'va', 'vc', 've', 'vg', 'vi', 'vn', 'vu', 'wf', 'ws', 'ye', 'yt', 'yu', 'za', 'zm', 'zw'); if (!in_array($url_parts[2], $tlds)) continue; - + // Call user specified func $modified_url = $callback($url); - + // Replace it! $start = mb_strpos($text, $url, $offset); $text = mb_substr($text, 0, $start).$modified_url.mb_substr($text, $start + mb_strlen($url), mb_strlen($text)); $offset = $start + mb_strlen($modified_url); } - + return $text; } function common_linkify($url) { $display = $url; $url = (!preg_match('#^([a-z]+://|(mailto|aim|tel):)#i', $url)) ? 'http://'.$url:$url; - + if ($longurl = common_longurl($url)) { $longurl = htmlentities($longurl, ENT_QUOTES, 'UTF-8'); $title = "title=\"$longurl\""; } else $title = ''; - + return "$display"; } @@ -653,48 +653,6 @@ function common_relative_profile($sender, $nickname, $dt=null) return null; } -// where should the avatar go for this user? - -function common_avatar_filename($id, $extension, $size=null, $extra=null) -{ - global $config; - - if ($size) { - return $id . '-' . $size . (($extra) ? ('-' . $extra) : '') . $extension; - } else { - return $id . '-original' . (($extra) ? ('-' . $extra) : '') . $extension; - } -} - -function common_avatar_path($filename) -{ - global $config; - return INSTALLDIR . '/avatar/' . $filename; -} - -function common_avatar_url($filename) -{ - return common_path('avatar/'.$filename); -} - -function common_avatar_display_url($avatar) -{ - $server = common_config('avatar', 'server'); - if ($server) { - return 'http://'.$server.'/'.$avatar->filename; - } else { - return $avatar->url; - } -} - -function common_default_avatar($size) -{ - static $sizenames = array(AVATAR_PROFILE_SIZE => 'profile', - AVATAR_STREAM_SIZE => 'stream', - AVATAR_MINI_SIZE => 'mini'); - return theme_path('default-avatar-'.$sizenames[$size].'.png'); -} - function common_local_url($action, $args=null, $fragment=null) { $url = null; @@ -1511,16 +1469,6 @@ function common_markup_to_html($c) return Markdown($c); } -function common_profile_avatar_url($profile, $size=AVATAR_PROFILE_SIZE) -{ - $avatar = $profile->getAvatar($size); - if ($avatar) { - return common_avatar_display_url($avatar); - } else { - return common_default_avatar($size); - } -} - function common_profile_uri($profile) { if (!$profile) { diff --git a/scripts/enjitqueuehandler.php b/scripts/enjitqueuehandler.php index 3a4f8315d..40f60da5d 100755 --- a/scripts/enjitqueuehandler.php +++ b/scripts/enjitqueuehandler.php @@ -74,7 +74,7 @@ class EnjitQueueHandler extends QueueHandler $atom .= "\n"; $atom .= " $profile->nickname)) . "'/>\n"; $atom .= "" . $profile->nickname . "\n"; - $atom .= "" . common_profile_avatar_url($profile, AVATAR_PROFILE_SIZE) . "\n"; + $atom .= "" . $profile->avatarUrl(AVATAR_PROFILE_SIZE) . "\n"; $atom .= "\n"; $atom .= "" . htmlspecialchars($msg) . "\n"; $atom .= "" . htmlspecialchars($msg) . "\n"; -- cgit v1.2.3-54-g00ecf From fc094e0cf432c223676755f14f54d3a2f559c25e Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 6 Feb 2009 03:54:51 -0500 Subject: fix formatting of new Avatar:: calls --- actions/avatarsettings.php | 6 +++--- actions/grouplogo.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'actions') diff --git a/actions/avatarsettings.php b/actions/avatarsettings.php index a0be5d8f8..7dd53f6eb 100644 --- a/actions/avatarsettings.php +++ b/actions/avatarsettings.php @@ -282,9 +282,9 @@ class AvatarsettingsAction extends AccountSettingsAction $cur = common_current_user(); $filename = Avatar::filename($cur->id, - image_type_to_extension($imagefile->type), - null, - 'tmp'.common_timestamp()); + image_type_to_extension($imagefile->type), + null, + 'tmp'.common_timestamp()); $filepath = Avatar::path($filename); diff --git a/actions/grouplogo.php b/actions/grouplogo.php index 650c95255..499db4ae8 100644 --- a/actions/grouplogo.php +++ b/actions/grouplogo.php @@ -344,9 +344,9 @@ class GrouplogoAction extends Action } $filename = Avatar::filename($this->group->id, - image_type_to_extension($imagefile->type), - null, - 'group-temp-'.common_timestamp()); + image_type_to_extension($imagefile->type), + null, + 'group-temp-'.common_timestamp()); $filepath = Avatar::path($filename); -- cgit v1.2.3-54-g00ecf From 8ec312043f8f4026d560e2cd0805200cb6c0f31a Mon Sep 17 00:00:00 2001 From: Meitar Moscovitz Date: Sat, 7 Feb 2009 04:03:25 +1100 Subject: Add a link to the group search page from a user's own group list. I've seen a request or two pop up for this on the Laconica group on Identica, and I'd personally like there to be a link to the search page from my own groups listing, as I often find myself looking for one and end up at my browser's address bar. --- actions/usergroups.php | 6 ++++++ theme/base/css/display.css | 2 +- theme/default/css/display.css | 5 ++++- theme/identica/css/display.css | 5 ++++- 4 files changed, 15 insertions(+), 3 deletions(-) (limited to 'actions') diff --git a/actions/usergroups.php b/actions/usergroups.php index 58cf7eeb6..ded4ba76b 100644 --- a/actions/usergroups.php +++ b/actions/usergroups.php @@ -125,6 +125,12 @@ class UsergroupsAction extends Action _('Create a new group')); $this->elementEnd('p'); + $this->elementStart('p', array('id' => 'group_search')); + $this->element('a', array('href' => common_local_url('groupsearch'), + 'class' => 'more'), + _('Search for more groups')); + $this->elementEnd('p'); + $offset = ($this->page-1) * GROUPS_PER_PAGE; $limit = GROUPS_PER_PAGE + 1; diff --git a/theme/base/css/display.css b/theme/base/css/display.css index f6e3c0fc7..3b72d00ce 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -947,7 +947,7 @@ padding:0; -#new_group { +#new_group, #group_search { margin-bottom:18px; } #new_group a { diff --git a/theme/default/css/display.css b/theme/default/css/display.css index 854202956..85b5aa13e 100644 --- a/theme/default/css/display.css +++ b/theme/default/css/display.css @@ -238,7 +238,10 @@ background-color:#fcfcfc; #new_group a { background:transparent url(../images/icons/twotone/green/news.gif) no-repeat 0 45%; } - +#usergroups #new_group { +float: left; +margin-right: 2em; +} .pagination .nav_prev a, .pagination .nav_next a { diff --git a/theme/identica/css/display.css b/theme/identica/css/display.css index 9f6499013..576a2e14b 100644 --- a/theme/identica/css/display.css +++ b/theme/identica/css/display.css @@ -238,7 +238,10 @@ background-color:#fcfcfc; #new_group a { background:transparent url(../images/icons/twotone/green/news.gif) no-repeat 0 45%; } - +#usergroups #new_group { +float: left; +margin-right: 2em; +} .pagination .nav_prev a, .pagination .nav_next a { -- cgit v1.2.3-54-g00ecf From 26053c186850a202d560c241ddc4e84106c46874 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 6 Feb 2009 15:22:48 -0500 Subject: Make adding and removing an incoming email in SMS settings Fixes Bug#1036. --- actions/smssettings.php | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'actions') diff --git a/actions/smssettings.php b/actions/smssettings.php index f89cbe1ab..a5f75d266 100644 --- a/actions/smssettings.php +++ b/actions/smssettings.php @@ -490,4 +490,55 @@ class SmssettingsAction extends ConnectSettingsAction common_redirect(common_local_url('confirmaddress', array('code' => $code))); } + + /** + * Handle a request to remove an incoming email address + * + * @return void + */ + + function removeIncoming() + { + $user = common_current_user(); + + if (!$user->incomingemail) { + $this->showForm(_('No incoming email address.')); + return; + } + + $orig = clone($user); + + $user->incomingemail = null; + + if (!$user->updateKeys($orig)) { + common_log_db_error($user, 'UPDATE', __FILE__); + $this->serverError(_("Couldn't update user record.")); + } + + $this->showForm(_('Incoming email address removed.'), true); + } + + /** + * Generate a new incoming email address + * + * @return void + * + * @see Emailsettings::newIncoming + */ + + function newIncoming() + { + $user = common_current_user(); + + $orig = clone($user); + + $user->incomingemail = mail_new_incoming_address(); + + if (!$user->updateKeys($orig)) { + common_log_db_error($user, 'UPDATE', __FILE__); + $this->serverError(_("Couldn't update user record.")); + } + + $this->showForm(_('New incoming email address added.'), true); + } } -- cgit v1.2.3-54-g00ecf