From 148310e5fc78e69f6bde3683855009dc3d8d485b Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 28 Mar 2009 17:36:39 -0400 Subject: welcome notice, default sub for new users --- README | 14 ++++++++++++++ classes/User.php | 42 ++++++++++++++++++++++++++++++++++++++++++ lib/common.php | 3 +++ lib/noticelist.php | 1 + 4 files changed, 60 insertions(+) diff --git a/README b/README index 71760ce4f..73cb95367 100644 --- a/README +++ b/README @@ -1169,6 +1169,20 @@ banned: an array of usernames and/or profile IDs of 'banned' profiles. not be accepted at all. (Compare with blacklisted users above, whose posts just won't show up in the public stream.) +newuser +------- + +Options with new users. + +subscribe: nickname of a user account to automatically subscribe new + users to. Typically this would be system account for e.g. + service updates or announcements. Users are able to unsub + if they want. Default is null; no auto subscribe. +welcome: nickname of a user account that sends welcome messages to new + users. Can be the same as 'subscribe' account, although on + busy servers it may be a good idea to keep that one just for + 'urgent' messages. Default is null; no message. + Troubleshooting =============== diff --git a/classes/User.php b/classes/User.php index d9f30bec5..e9e472fe1 100644 --- a/classes/User.php +++ b/classes/User.php @@ -273,12 +273,54 @@ class User extends Memcached_DataObject $user->emailChanged(); } + // Default system subscription + + $defnick = common_config('newuser', 'default'); + + if (!empty($defnick)) { + $defuser = User::staticGet('nickname', $defnick); + if (empty($defuser)) { + common_log(LOG_WARNING, sprintf("Default user %s does not exist.", $defnick), + __FILE__); + } else { + $defsub = new Subscription(); + $defsub->subscriber = $user->id; + $defsub->subscribed = $defuser->id; + $defsub->created = $user->created; + + $result = $defsub->insert(); + + if (!$result) { + common_log_db_error($defsub, 'INSERT', __FILE__); + return false; + } + } + } + $profile->query('COMMIT'); if ($email && !$user->email) { mail_confirm_address($user, $confirm->code, $profile->nickname, $email); } + // Welcome message + + $welcome = common_config('newuser', 'welcome'); + + if (!empty($welcome)) { + $welcomeuser = User::staticGet('nickname', $welcome); + if (empty($welcomeuser)) { + common_log(LOG_WARNING, sprintf("Welcome user %s does not exist.", $defnick), + __FILE__); + } else { + $notice = Notice::saveNew($welcomeuser->id, + sprintf(_('Welcome to %1$s, @%2$s!'), + common_config('site', 'name'), + $user->nickname), + 'system'); + } + } + return $user; } diff --git a/lib/common.php b/lib/common.php index 1ca9e521b..caad705a4 100644 --- a/lib/common.php +++ b/lib/common.php @@ -151,6 +151,9 @@ $config = array('notify' => array()), 'inboxes' => array('enabled' => true), # on by default for new sites + 'newuser' => + array('subscribe' => null, + 'welcome' => null), ); $config['db'] = &PEAR::getStaticProperty('DB_DataObject','options'); diff --git a/lib/noticelist.php b/lib/noticelist.php index 8523f2e63..4182d8808 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -391,6 +391,7 @@ class NoticeListItem extends Widget case 'xmpp': case 'mail': case 'omb': + case 'system': case 'api': $this->out->element('dd', null, $source_name); break; -- cgit v1.2.3-54-g00ecf From e00508d188de053caeb19595b94452973d87da3b Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 30 Mar 2009 11:30:58 -0400 Subject: correct setting for default user --- README | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README b/README index 95f9edcea..f080d32bc 100644 --- a/README +++ b/README @@ -1184,10 +1184,10 @@ newuser Options with new users. -subscribe: nickname of a user account to automatically subscribe new - users to. Typically this would be system account for e.g. - service updates or announcements. Users are able to unsub - if they want. Default is null; no auto subscribe. +default: nickname of a user account to automatically subscribe new + users to. Typically this would be system account for e.g. + service updates or announcements. Users are able to unsub + if they want. Default is null; no auto subscribe. welcome: nickname of a user account that sends welcome messages to new users. Can be the same as 'subscribe' account, although on busy servers it may be a good idea to keep that one just for -- cgit v1.2.3-54-g00ecf From 47b89aa2c3a3e07d6dc63cd5be1d558af8ece233 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 30 Mar 2009 15:05:50 -0400 Subject: Changes to router setup to make notice search RSS feed work Conflicts: lib/router.php --- lib/router.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/router.php b/lib/router.php index 135e07a0f..77794aaf7 100644 --- a/lib/router.php +++ b/lib/router.php @@ -136,10 +136,14 @@ class Router foreach (array('group', 'people', 'notice') as $s) { $m->connect('search/'.$s, array('action' => $s.'search')); - $m->connect('search/'.$s.'?q=:q', array('action' => $s.'search'), array('q' => '.+')); + $m->connect('search/'.$s.'?q=:q', array('action' => $s.'search'),array('q' => '.+')); } + // The second of these is needed to make the link work correctly + // when inserted into the page. The first is needed to match the + // route on the way in. Seems to be another Net_URL_Mapper bug to me. $m->connect('search/notice/rss', array('action' => 'noticesearchrss')); + $m->connect('search/notice/rss?q=:q', array('action' => 'noticesearchrss'),array('q' => '.+')); // notice -- cgit v1.2.3-54-g00ecf From d5032a02774fcf2f01d92aa1c5ac182c9f2b618a Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Mon, 30 Mar 2009 19:47:55 +0000 Subject: trac#776 changed db collations from utf8_bin to utf8_general_ci for case insensitive search --- db/laconica.sql | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/db/laconica.sql b/db/laconica.sql index 098fa4fd1..a790a3fd2 100644 --- a/db/laconica.sql +++ b/db/laconica.sql @@ -13,7 +13,7 @@ create table profile ( index profile_nickname_idx (nickname), FULLTEXT(nickname, fullname, location, bio, homepage) -) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_bin; +) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci; create table avatar ( profile_id integer not null comment 'foreign key to profile table' references profile (id), @@ -73,7 +73,7 @@ create table user ( modified timestamp comment 'date this record was modified', index user_smsemail_idx (smsemail) -) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; +) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci; /* remote people */ @@ -103,7 +103,6 @@ create table subscription ( ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; create table notice ( - id integer auto_increment primary key comment 'unique identifier', profile_id integer not null comment 'who made the update' references profile (id), uri varchar(255) unique key comment 'universally unique identifier, usually a tag URI', @@ -119,7 +118,7 @@ create table notice ( index notice_profile_id_idx (profile_id), index notice_created_idx (created), FULLTEXT(content) -) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_bin; +) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci; create table notice_source ( code varchar(32) primary key not null comment 'source code', @@ -130,7 +129,6 @@ create table notice_source ( ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; create table reply ( - notice_id integer not null comment 'notice that is the reply' references notice (id), profile_id integer not null comment 'profile replied to' references profile (id), modified timestamp not null comment 'date this record was modified', @@ -144,7 +142,6 @@ create table reply ( ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; create table fave ( - notice_id integer not null comment 'notice that is the favorite' references notice (id), user_id integer not null comment 'user who likes this notice' references user (id), modified timestamp not null comment 'date this record was modified', @@ -321,7 +318,6 @@ create table invitation ( ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; create table message ( - id integer auto_increment primary key comment 'unique identifier', uri varchar(255) unique key comment 'universally unique identifier', from_profile integer not null comment 'who the message is from' references profile (id), @@ -336,10 +332,9 @@ create table message ( index message_from_idx (from_profile), index message_to_idx (to_profile), index message_created_idx (created) -) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; +) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci; create table notice_inbox ( - user_id integer not null comment 'user receiving the message' references user (id), notice_id integer not null comment 'notice received' references notice (id), created datetime not null comment 'date the notice was created', @@ -362,7 +357,6 @@ create table profile_tag ( ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; create table profile_block ( - blocker integer not null comment 'user making the block' references user (id), blocked integer not null comment 'profile that is blocked' references profile (id), modified timestamp comment 'date of blocking', @@ -372,7 +366,6 @@ create table profile_block ( ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; create table user_group ( - id integer auto_increment primary key comment 'unique identifier', nickname varchar(64) unique key comment 'nickname for addressing', @@ -391,10 +384,9 @@ create table user_group ( index user_group_nickname_idx (nickname) -) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; +) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci; create table group_member ( - group_id integer not null comment 'foreign key to user_group' references user_group (id), profile_id integer not null comment 'foreign key to profile table' references profile (id), is_admin boolean default false comment 'is this user an admin?', @@ -409,7 +401,6 @@ create table group_member ( ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; create table related_group ( - group_id integer not null comment 'foreign key to user_group' references user_group (id), related_group_id integer not null comment 'foreign key to user_group' references user_group (id), -- cgit v1.2.3-54-g00ecf From 3861e348a4b4f00f3c0dcc5ba004e7dd80296078 Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Mon, 30 Mar 2009 21:07:48 +0000 Subject: added filler text to public timeline for when it's empty, encouraging user to post and/or register. --- actions/public.php | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/actions/public.php b/actions/public.php index 9b22e0a2c..96c766a57 100644 --- a/actions/public.php +++ b/actions/public.php @@ -166,6 +166,50 @@ class PublicAction extends Action $nav->show(); } + function showPageNotice() + { + $notice = Notice::publicStream(0, 1); + + if (!$notice) { + $this->serverError(_('Could not retrieve public stream.')); + return; + } + + // no notices in the public stream, let's get out of here + if ($notice->count()) { + return; + } + + $message = _('This is the public timeline for %%site.name%% but noone has posted anything yet.') . ' '; + + if (common_logged_in()) { + $message .= _('Be the first to post!'); +/* + sprintf(_('You are logged in... %%%%site.name%%%% groups let you find and talk with ' . + 'people of similar interests. After you join a group ' . + 'you can send messages to all other members using the ' . + 'syntax "!groupname". Don\'t see a group you like? Try ' . + '[searching for one](%%%%action.groupsearch%%%%) or ' . + '[start your own!](%%%%action.newgroup%%%%)')); +*/ + } + else { + $message .= _('Why not [register an account](%%action.register%%) and be the first to post!'); +/* + sprintf(_('You are not logged in... %%%%site.name%%%% groups let you find and talk with ' . + 'people of similar interests. After you join a group ' . + 'you can send messages to all other members using the ' . + 'syntax "!groupname". Don\'t see a group you like? Try ' . + '[searching for one](%%%%action.groupsearch%%%%) or ' . + '[start your own!](%%%%action.newgroup%%%%)')); +*/ + } + + $this->elementStart('div', 'blankfiller'); + $this->raw(common_markup_to_html($message)); + $this->elementEnd('div'); + } + /** * Fill the content area * -- cgit v1.2.3-54-g00ecf From e149f3d64b5c0a58b299fb607824a1cd515836a4 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 26 Mar 2009 15:03:59 -0400 Subject: Support SSL for some, all, or no pages Support SSL URLs either for all pages; no pages; or for sensitive pages accepting passwords, like login, registration, API, and others. --- README | 10 ++++++++++ config.php.sample | 10 ++++++++++ lib/common.php | 2 ++ lib/util.php | 31 ++++++++++++++++++++++++++----- 4 files changed, 48 insertions(+), 5 deletions(-) diff --git a/README b/README index 73cb95367..70815c141 100644 --- a/README +++ b/README @@ -925,6 +925,16 @@ dupelimit: Time in which it's not OK for the same person to post the same notice; default = 60 seconds. logo: URL of an image file to use as the logo for the site. Overrides the logo in the theme, if any. +ssl: Whether to use SSL and https:// URLs for some or all pages. + Possible values are 'always' (use it for all pages), 'never' + (don't use it for any pages), or 'sometimes' (use it for + sensitive pages that include passwords like login and registration, + but not for regular pages). Default to 'never'. +sslserver: use an alternate server name for SSL URLs, like + 'secure.example.org'. You should be careful to set cookie + parameters correctly so that both the SSL server and the + "normal" server can access the session cookie and + preferably other cookies as well. db -- diff --git a/config.php.sample b/config.php.sample index 529e86f15..d62a54fe7 100644 --- a/config.php.sample +++ b/config.php.sample @@ -174,3 +174,13 @@ $config['sphinx']['port'] = 3312; #http://taguri.org/ Examples: #$config['integration']['taguri'] = 'example.net,2008'; #$config['integration']['taguri'] = 'admin@example.net,2009-03-09' + +#Don't use SSL +#$config['site']['ssl'] = 'never'; +#Use SSL only for sensitive pages (like login, password change) +#$config['site']['ssl'] = 'sometimes'; +#Use SSL for all pages +#$config['site']['ssl'] = 'always'; + +#Use a different hostname for SSL-encrypted pages +#$config['site']['sslserver'] = 'secure.example.org'; diff --git a/lib/common.php b/lib/common.php index caad705a4..c2037c3ad 100644 --- a/lib/common.php +++ b/lib/common.php @@ -87,6 +87,8 @@ $config = 'closed' => false, 'inviteonly' => false, 'private' => false, + 'ssl' => 'never', + 'sslserver' => null, 'dupelimit' => 60), # default for same person saying the same thing 'syslog' => array('appname' => 'laconica', # for syslog diff --git a/lib/util.php b/lib/util.php index ef73adc36..fdcae0aca 100644 --- a/lib/util.php +++ b/lib/util.php @@ -721,25 +721,46 @@ function common_relative_profile($sender, $nickname, $dt=null) function common_local_url($action, $args=null, $params=null, $fragment=null) { + static $sensitive = array('login', 'register', 'passwordsettings', + 'twittersettings', 'finishopenidlogin', + 'api'); + $r = Router::get(); $path = $r->build($action, $args, $params, $fragment); + $ssl = in_array($action, $sensitive); + if (common_config('site','fancy')) { - $url = common_path(mb_substr($path, 1)); + $url = common_path(mb_substr($path, 1), $ssl); } else { if (mb_strpos($path, '/index.php') === 0) { - $url = common_path(mb_substr($path, 1)); + $url = common_path(mb_substr($path, 1), $ssl); } else { - $url = common_path('index.php'.$path); + $url = common_path('index.php'.$path, $ssl); } } return $url; } -function common_path($relative) +function common_path($relative, $ssl=false) { $pathpart = (common_config('site', 'path')) ? common_config('site', 'path')."/" : ''; - return "http://".common_config('site', 'server').'/'.$pathpart.$relative; + + if (($ssl && (common_config('site', 'ssl') === 'sometimes')) + || common_config('site', 'ssl') === 'always') { + $proto = 'https'; + if (is_string(common_config('site', 'sslserver')) && + mb_strlen(common_config('site', 'sslserver')) > 0) { + $serverpart = common_config('site', 'sslserver'); + } else { + $serverpart = common_config('site', 'server'); + } + } else { + $proto = 'http'; + $serverpart = common_config('site', 'server'); + } + + return $proto.'://'.$serverpart.'/'.$pathpart.$relative; } function common_date_string($dt) -- cgit v1.2.3-54-g00ecf From 1fbf9a042e2e7ed1f67dfad9b7fe3b96019bd1a3 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 31 Mar 2009 10:09:11 -0400 Subject: give the correct root url when SSL enabled --- lib/openid.php | 2 +- lib/util.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/openid.php b/lib/openid.php index 3aa488b6d..f3769c6fc 100644 --- a/lib/openid.php +++ b/lib/openid.php @@ -160,7 +160,7 @@ function oid_authenticate($openid_url, $returnto, $immediate=false) $auth_request->addExtension($sreg_request); } - $trust_root = common_path(''); + $trust_root = common_root_url(true); $process_url = common_local_url($returnto); if ($auth_request->shouldSendRedirect()) { diff --git a/lib/util.php b/lib/util.php index fdcae0aca..98a3ae844 100644 --- a/lib/util.php +++ b/lib/util.php @@ -952,9 +952,9 @@ function common_profile_url($nickname) // Should make up a reasonable root URL -function common_root_url() +function common_root_url($ssl=false) { - return common_path(''); + return common_path('', $ssl); } // returns $bytes bytes of random data as a hexadecimal string -- cgit v1.2.3-54-g00ecf From b112b326402200c164fc5c9678d4aff656f7afd4 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 1 Apr 2009 01:03:00 +0000 Subject: Selector to allow styles when a user is logged in. --- lib/action.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/action.php b/lib/action.php index f0baa062c..5d0d5b758 100644 --- a/lib/action.php +++ b/lib/action.php @@ -326,7 +326,9 @@ class Action extends HTMLOutputter // lawsuit */ function showBody() { - $this->elementStart('body', array('id' => $this->trimmed('action'))); + $this->elementStart('body', (common_current_user()) ? array('id' => $this->trimmed('action'), + 'class' => 'user_in') + : array('id' => $this->trimmed('action'))); $this->elementStart('div', array('id' => 'wrap')); if (Event::handle('StartShowHeader', array($this))) { $this->showHeader(); -- cgit v1.2.3-54-g00ecf From 783d292739886811ab41215c614940d24214358f Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 1 Apr 2009 01:03:00 +0000 Subject: Selector to allow styles when a user is logged in. --- lib/action.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/action.php b/lib/action.php index 975c2bfcb..f9f3c35d9 100644 --- a/lib/action.php +++ b/lib/action.php @@ -299,7 +299,9 @@ class Action extends HTMLOutputter // lawsuit */ function showBody() { - $this->elementStart('body', array('id' => $this->trimmed('action'))); + $this->elementStart('body', (common_current_user()) ? array('id' => $this->trimmed('action'), + 'class' => 'user_in') + : array('id' => $this->trimmed('action'))); $this->elementStart('div', array('id' => 'wrap')); if (Event::handle('StartShowHeader', array($this))) { $this->showHeader(); -- cgit v1.2.3-54-g00ecf From e7381493ad036e686f82f432066f00ff911ad5d5 Mon Sep 17 00:00:00 2001 From: CiaranG Date: Wed, 1 Apr 2009 18:11:02 +0100 Subject: Return redirect code correctly as HTTP status, not a header. Fixes ticket #1371 --- lib/util.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/util.php b/lib/util.php index fdcae0aca..26f1ff179 100644 --- a/lib/util.php +++ b/lib/util.php @@ -850,7 +850,7 @@ function common_redirect($url, $code=307) 303 => "See Other", 307 => "Temporary Redirect"); - header("Status: ${code} $status[$code]"); + header('HTTP/1.1 '.$code.' '.$status[$code]); header("Location: $url"); $xo = new XMLOutputter(); -- cgit v1.2.3-54-g00ecf From c172cbafaa9ba17ff8ca5c6dd07741bd0de96871 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 1 Apr 2009 15:30:59 -0400 Subject: Try to do intelligent redirect codes After fixing the redirect code output, there are a lot of weirdnesses with e.g. form handling. Try to add explicit redirect codes where needed -- principly when handling a POST. --- actions/block.php | 11 ++++++----- actions/deletenotice.php | 2 +- actions/disfavor.php | 5 +++-- actions/editgroup.php | 3 +-- actions/favor.php | 7 ++++--- actions/finishaddopenid.php | 2 +- actions/finishopenidlogin.php | 5 +++-- actions/finishremotesubscribe.php | 3 ++- actions/joingroup.php | 3 ++- actions/leavegroup.php | 3 ++- actions/login.php | 2 +- actions/logout.php | 8 ++++---- actions/newgroup.php | 2 +- actions/nudge.php | 7 ++++--- actions/remotesubscribe.php | 4 ++-- actions/smssettings.php | 3 ++- actions/subedit.php | 3 ++- actions/subscribe.php | 3 ++- actions/tag.php | 4 +++- actions/tagother.php | 3 ++- actions/unblock.php | 5 +++-- actions/unsubscribe.php | 3 ++- lib/openid.php | 2 +- lib/settingsaction.php | 4 ++-- 24 files changed, 56 insertions(+), 41 deletions(-) diff --git a/actions/block.php b/actions/block.php index e77b634c8..34f991dc6 100644 --- a/actions/block.php +++ b/actions/block.php @@ -93,7 +93,8 @@ class BlockAction extends Action if ($this->arg('no')) { $cur = common_current_user(); $other = Profile::staticGet('id', $this->arg('blockto')); - common_redirect(common_local_url('showstream', array('nickname' => $other->nickname))); + common_redirect(common_local_url('showstream', array('nickname' => $other->nickname)), + 303); } elseif ($this->arg('yes')) { $this->blockProfile(); } elseif ($this->arg('blockto')) { @@ -102,7 +103,6 @@ class BlockAction extends Action } } - function showContent() { $this->areYouSureForm(); } @@ -110,7 +110,7 @@ class BlockAction extends Action function title() { return _('Block user'); } - + function showNoticeForm() { // nop } @@ -178,10 +178,11 @@ class BlockAction extends Action } if ($action) { - common_redirect(common_local_url($action, $args)); + common_redirect(common_local_url($action, $args), 303); } else { common_redirect(common_local_url('subscriptions', - array('nickname' => $cur->nickname))); + array('nickname' => $cur->nickname)), + 303); } } } diff --git a/actions/deletenotice.php b/actions/deletenotice.php index 16e2df889..6c350b33a 100644 --- a/actions/deletenotice.php +++ b/actions/deletenotice.php @@ -141,6 +141,6 @@ class DeletenoticeAction extends DeleteAction $url = common_local_url('public'); } - common_redirect($url); + common_redirect($url, 303); } } diff --git a/actions/disfavor.php b/actions/disfavor.php index 90bab3cca..bc13b09da 100644 --- a/actions/disfavor.php +++ b/actions/disfavor.php @@ -49,7 +49,7 @@ class DisfavorAction extends Action { /** * Class handler. - * + * * @param array $args query arguments * * @return void @@ -100,7 +100,8 @@ class DisfavorAction extends Action $this->elementEnd('html'); } else { common_redirect(common_local_url('showfavorites', - array('nickname' => $user->nickname))); + array('nickname' => $user->nickname)), + 303); } } } diff --git a/actions/editgroup.php b/actions/editgroup.php index e7e79040a..39dad0465 100644 --- a/actions/editgroup.php +++ b/actions/editgroup.php @@ -166,7 +166,6 @@ class EditgroupAction extends Action return; } - $nickname = common_canonical_nickname($this->trimmed('nickname')); $fullname = $this->trimmed('fullname'); $homepage = $this->trimmed('homepage'); @@ -221,7 +220,7 @@ class EditgroupAction extends Action if ($this->group->nickname != $orig->nickname) { common_redirect(common_local_url('editgroup', array('nickname' => $nickname)), - 307); + 303); } else { $this->showForm(_('Options saved.')); } diff --git a/actions/favor.php b/actions/favor.php index 3940df688..3b7d979eb 100644 --- a/actions/favor.php +++ b/actions/favor.php @@ -52,7 +52,7 @@ class FavorAction extends Action { /** * Class handler. - * + * * @param array $args query arguments * * @return void @@ -100,13 +100,14 @@ class FavorAction extends Action $this->elementEnd('html'); } else { common_redirect(common_local_url('showfavorites', - array('nickname' => $user->nickname))); + array('nickname' => $user->nickname)), + 303); } } /** * Notifies a user when his notice is favorited. - * + * * @param class $notice favorited notice * @param class $user user declaring a favorite * diff --git a/actions/finishaddopenid.php b/actions/finishaddopenid.php index 8f10505cf..32bceecfd 100644 --- a/actions/finishaddopenid.php +++ b/actions/finishaddopenid.php @@ -139,7 +139,7 @@ class FinishaddopenidAction extends Action oid_set_last($display); - common_redirect(common_local_url('openidsettings')); + common_redirect(common_local_url('openidsettings'), 303); } } diff --git a/actions/finishopenidlogin.php b/actions/finishopenidlogin.php index 52d9be29c..952185742 100644 --- a/actions/finishopenidlogin.php +++ b/actions/finishopenidlogin.php @@ -271,7 +271,8 @@ class FinishopenidloginAction extends Action common_rememberme($user); } unset($_SESSION['openid_rememberme']); - common_redirect(common_local_url('showstream', array('nickname' => $user->nickname))); + common_redirect(common_local_url('showstream', array('nickname' => $user->nickname)), + 303); } function connectUser() @@ -324,7 +325,7 @@ class FinishopenidloginAction extends Action array('nickname' => $nickname)); } - common_redirect($url); + common_redirect($url, 303); } function bestNewNickname($display, $sreg) diff --git a/actions/finishremotesubscribe.php b/actions/finishremotesubscribe.php index eaf57c2d8..d54c29a60 100644 --- a/actions/finishremotesubscribe.php +++ b/actions/finishremotesubscribe.php @@ -230,7 +230,8 @@ class FinishremotesubscribeAction extends Action # show up close to the top of the page common_redirect(common_local_url('subscribers', array('nickname' => - $user->nickname))); + $user->nickname)), + 303); } function add_avatar($profile, $url) diff --git a/actions/joingroup.php b/actions/joingroup.php index eeea4a37b..a5d82ddc7 100644 --- a/actions/joingroup.php +++ b/actions/joingroup.php @@ -143,7 +143,8 @@ class JoingroupAction extends Action $this->elementEnd('html'); } else { common_redirect(common_local_url('groupmembers', array('nickname' => - $this->group->nickname))); + $this->group->nickname)), + 303); } } } \ No newline at end of file diff --git a/actions/leavegroup.php b/actions/leavegroup.php index eb30d0e50..215ccd901 100644 --- a/actions/leavegroup.php +++ b/actions/leavegroup.php @@ -147,7 +147,8 @@ class LeavegroupAction extends Action $this->elementEnd('html'); } else { common_redirect(common_local_url('groupmembers', array('nickname' => - $this->group->nickname))); + $this->group->nickname)), + 303); } } } diff --git a/actions/login.php b/actions/login.php index b049791fb..59c6b4874 100644 --- a/actions/login.php +++ b/actions/login.php @@ -138,7 +138,7 @@ class LoginAction extends Action $nickname)); } - common_redirect($url); + common_redirect($url, 303); } /** diff --git a/actions/logout.php b/actions/logout.php index 3977f90a0..b7681be38 100644 --- a/actions/logout.php +++ b/actions/logout.php @@ -46,10 +46,10 @@ require_once INSTALLDIR.'/lib/openid.php'; */ class LogoutAction extends Action { - + /** * This is read only. - * + * * @return boolean true */ function isReadOnly() @@ -59,7 +59,7 @@ class LogoutAction extends Action /** * Class handler. - * + * * @param array $args array of arguments * * @return nothing @@ -73,7 +73,7 @@ class LogoutAction extends Action common_set_user(null); common_real_login(false); // not logged in common_forgetme(); // don't log back in! - common_redirect(common_local_url('public')); + common_redirect(common_local_url('public'), 303); } } } diff --git a/actions/newgroup.php b/actions/newgroup.php index cbd8dfeec..67cd6b2f1 100644 --- a/actions/newgroup.php +++ b/actions/newgroup.php @@ -193,7 +193,7 @@ class NewgroupAction extends Action $group->query('COMMIT'); - common_redirect($group->homeUrl(), 307); + common_redirect($group->homeUrl(), 303); } function nicknameExists($nickname) diff --git a/actions/nudge.php b/actions/nudge.php index bc3d48478..b4e5e01dd 100644 --- a/actions/nudge.php +++ b/actions/nudge.php @@ -50,7 +50,7 @@ class NudgeAction extends Action { /** * Class handler. - * + * * @param array $args array of arguments * * @return nothing @@ -75,7 +75,7 @@ class NudgeAction extends Action // CSRF protection $token = $this->trimmed('token'); - + if (!$token || $token != common_session_token()) { $this->clientError(_('There was a problem with your session token. Try again, please.')); return; @@ -100,7 +100,8 @@ class NudgeAction extends Action } else { // display a confirmation to the user common_redirect(common_local_url('showstream', - array('nickname' => $other->nickname))); + array('nickname' => $other->nickname)), + 303); } } diff --git a/actions/remotesubscribe.php b/actions/remotesubscribe.php index af130f425..2e721a38b 100644 --- a/actions/remotesubscribe.php +++ b/actions/remotesubscribe.php @@ -99,7 +99,7 @@ class RemotesubscribeAction extends Action $this->elementStart('fieldset'); $this->element('legend', 'Subscribe to a remote user'); $this->hidden('token', common_session_token()); - + $this->elementStart('ul', 'form_data'); $this->elementStart('li'); $this->input('nickname', _('User nickname'), $this->nickname, @@ -407,7 +407,7 @@ class RemotesubscribeAction extends Action # Redirect to authorization service - common_redirect($req->to_url()); + common_redirect($req->to_url(), 303); return; } } diff --git a/actions/smssettings.php b/actions/smssettings.php index a5f75d266..922bab9a4 100644 --- a/actions/smssettings.php +++ b/actions/smssettings.php @@ -488,7 +488,8 @@ class SmssettingsAction extends ConnectSettingsAction } common_redirect(common_local_url('confirmaddress', - array('code' => $code))); + array('code' => $code)), + 303); } /** diff --git a/actions/subedit.php b/actions/subedit.php index 89081ffc7..8ca2d7914 100644 --- a/actions/subedit.php +++ b/actions/subedit.php @@ -85,7 +85,8 @@ class SubeditAction extends Action } common_redirect(common_local_url('subscriptions', - array('nickname' => $cur->nickname))); + array('nickname' => $cur->nickname)), + 303); } } } diff --git a/actions/subscribe.php b/actions/subscribe.php index f761992de..0bc522867 100644 --- a/actions/subscribe.php +++ b/actions/subscribe.php @@ -75,7 +75,8 @@ class SubscribeAction extends Action $this->elementEnd('html'); } else { common_redirect(common_local_url('subscriptions', array('nickname' => - $user->nickname))); + $user->nickname)), + 303); } } } diff --git a/actions/tag.php b/actions/tag.php index 231f2c299..d15f64498 100644 --- a/actions/tag.php +++ b/actions/tag.php @@ -33,7 +33,9 @@ class TagAction extends Action } if ($this->tag != $taginput) { - common_redirect(common_local_url('tag', array('tag' => $this->tag))); + common_redirect(common_local_url('tag', array('tag' => $this->tag)), + 301); + return false; } $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; diff --git a/actions/tagother.php b/actions/tagother.php index 0d18945a0..0c5bb7cf3 100644 --- a/actions/tagother.php +++ b/actions/tagother.php @@ -221,7 +221,8 @@ class TagotherAction extends Action $this->elementEnd('html'); } else { common_redirect(common_local_url($action, array('nickname' => - $user->nickname))); + $user->nickname)), + 303); } } diff --git a/actions/unblock.php b/actions/unblock.php index bad496353..8573b2a87 100644 --- a/actions/unblock.php +++ b/actions/unblock.php @@ -116,10 +116,11 @@ class UnblockAction extends Action } } if ($action) { - common_redirect(common_local_url($action, $args)); + common_redirect(common_local_url($action, $args), 303); } else { common_redirect(common_local_url('subscriptions', - array('nickname' => $cur->nickname))); + array('nickname' => $cur->nickname)), + 303); } } } diff --git a/actions/unsubscribe.php b/actions/unsubscribe.php index b1e2b6425..7dcab04c0 100644 --- a/actions/unsubscribe.php +++ b/actions/unsubscribe.php @@ -77,7 +77,8 @@ class UnsubscribeAction extends Action $this->elementEnd('html'); } else { common_redirect(common_local_url('subscriptions', array('nickname' => - $user->nickname))); + $user->nickname)), + 303); } } } diff --git a/lib/openid.php b/lib/openid.php index f3769c6fc..3af7a39cf 100644 --- a/lib/openid.php +++ b/lib/openid.php @@ -171,7 +171,7 @@ function oid_authenticate($openid_url, $returnto, $immediate=false) } else if (Auth_OpenID::isFailure($redirect_url)) { return sprintf(_('Could not redirect to server: %s'), $redirect_url->message); } else { - common_redirect($redirect_url); + common_redirect($redirect_url, 303); } } else { // Generate form markup and render it. diff --git a/lib/settingsaction.php b/lib/settingsaction.php index 53c807c6f..db20c5804 100644 --- a/lib/settingsaction.php +++ b/lib/settingsaction.php @@ -78,9 +78,9 @@ class SettingsAction extends Action common_set_returnto($this->selfUrl()); $user = common_current_user(); if ($user->hasOpenID()) { - common_redirect(common_local_url('openidlogin')); + common_redirect(common_local_url('openidlogin'), 303); } else { - common_redirect(common_local_url('login')); + common_redirect(common_local_url('login'), 303); } } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { $this->handlePost(); -- cgit v1.2.3-54-g00ecf From 36f73bffbc717d895370e905070c310062127529 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 2 Apr 2009 06:29:49 +0000 Subject: Better support for 800px ~ 1024px width viewport/screen resolutions. --- theme/base/css/display.css | 42 +++++++++++++++++++++--------------------- theme/base/css/ie.css | 31 +++++++++++++++++++------------ theme/base/css/ie6.css | 16 ++++++++++++++++ theme/default/css/display.css | 2 +- theme/identica/css/display.css | 2 +- 5 files changed, 58 insertions(+), 35 deletions(-) diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 997342429..4c9b52254 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -250,6 +250,7 @@ position:absolute; top:65px; right:18px; width:250px; +width:24%; } #page_notice { clear:both; @@ -259,9 +260,8 @@ margin-bottom:18px; #anon_notice { float:left; -width:432px; -width:28.052em; -padding:11px; +width:43.2%; +padding:1.1%; border-radius:7px; -moz-border-radius:7px; -webkit-border-radius:7px; @@ -369,7 +369,9 @@ margin-right:4px; #wrap { margin:0 auto; -width:1003px; +width:100%; +min-width:760px; +max-width:1003px; overflow:hidden; } @@ -381,14 +383,16 @@ margin-bottom:1em; } #content { -width:644px; -padding:18px; +width:64.009%; +padding:1.795%; float:left; border-radius:7px; -moz-border-radius:7px; -moz-border-radius-topleft:0; -webkit-border-radius:7px; -webkit-border-top-left-radius:0; +border-style:solid; +border-width:1px; } #content_inner { @@ -398,10 +402,10 @@ float:left; } #aside_primary { -width:280px; +width:27.917%; float:left; -margin-left:4px; -padding:18px; +margin-left:0.395%; +padding:1.795%; border-radius:7px; -moz-border-radius:7px; -webkit-border-radius:7px; @@ -409,9 +413,8 @@ border-width:1px; border-style:solid; } -/*Start: FORM NOTICE*/ #form_notice { -width:458px; +width:45.664%; float:left; position:relative; line-height:1; @@ -428,7 +431,7 @@ float:left; border-radius:7px; -moz-border-radius:7px; -webkit-border-radius:7px; -width:370px; +width:80.789%; height:67px; line-height:1.5; padding:7px 7px 16px 7px; @@ -458,8 +461,9 @@ line-height:1.15; padding:1px 2px; } #form_notice #notice_action-submit { -width:60px; -padding:8px; +width:14%; +height:47px; +padding:0; position:absolute; bottom:0; right:0; @@ -472,13 +476,12 @@ margin-bottom:7px; margin-left:18px; float:left; } -/*end FORM NOTICE*/ /* entity_profile */ .entity_profile { position:relative; -width:475px; +width:67.702%; min-height:123px; float:left; margin-bottom:18px; @@ -508,7 +511,6 @@ margin-bottom:18px; .entity_profile .entity_tags { margin-left:113px; margin-bottom:4px; -width:322px; } .entity_profile .entity_fn, @@ -536,14 +538,14 @@ display:none; .entity_profile h2 { display:none; } - /* entity_profile */ /*entity_actions*/ .entity_actions { float:right; -margin-left:28px; +margin-left:4.35%; +max-width:25%; } .entity_actions h2 { display:none; @@ -911,8 +913,6 @@ display:none; border:0; padding:0; } -/*END: NOTICES */ - #new_group, #group_search { diff --git a/theme/base/css/ie.css b/theme/base/css/ie.css index 45176a201..5d8bea8ae 100644 --- a/theme/base/css/ie.css +++ b/theme/base/css/ie.css @@ -1,8 +1,21 @@ /* IE specific styles */ - -#aside_primary { -padding-left:11px; +legend { +margin-left:-7px; +} +input.checkbox { +top:0; +} +#form_notice textarea { +width:78%; +} +#form_notice #notice_action-submit { +width:17%; +max-width:17%; } +#anon_notice { +max-width:39%; +} + .notice-options input.submit { font-size:0; margin-top:3px; @@ -11,15 +24,9 @@ text-align:right; text-indent:0; width:24px; } - -input.checkbox { -top:0; -} - -legend { -margin-left:-7px; -} - .notice div.entry-content .timestamp a { margin-right:4px; } +.entity_profile { +width:64%; +} diff --git a/theme/base/css/ie6.css b/theme/base/css/ie6.css index fa6ec92d2..76a82c004 100644 --- a/theme/base/css/ie6.css +++ b/theme/base/css/ie6.css @@ -1,4 +1,17 @@ /* IE6 specific styles */ +address { +margin-left:7px; +} +address .fn { +display:none; +} +#content { +width:70%; +} +#aside_primary { +padding:5%; +width:29.5%; +} .entity_profile .entity_nickname, .entity_profile .entity_location, .entity_profile .entity_url, @@ -9,6 +22,9 @@ margin-left:0; .entity_profile .entity_depiction { margin-bottom:123px; } +.entity_actions { +width:20%; +} .notice div.entry-content { width:63%; } diff --git a/theme/default/css/display.css b/theme/default/css/display.css index 12303dd68..bf46fc6bf 100644 --- a/theme/default/css/display.css +++ b/theme/default/css/display.css @@ -17,7 +17,7 @@ font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif; font-size:1em; } address { -margin-right:71px; +margin-right:7.18%; } input, textarea, select, option { diff --git a/theme/identica/css/display.css b/theme/identica/css/display.css index 5235c34a4..9e7c10ac5 100644 --- a/theme/identica/css/display.css +++ b/theme/identica/css/display.css @@ -17,7 +17,7 @@ font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif; font-size:1em; } address { -margin-right:71px; +margin-right:7.18%; } input, textarea, select, option { -- cgit v1.2.3-54-g00ecf