fix created, messages

darcs-hash:20080517195201-84dde-8f8269284e5fc00e9f2a6d8187059d0f59eae007.gz
This commit is contained in:
Evan Prodromou 2008-05-17 15:52:01 -04:00
parent 850bfc0a35
commit 466f0489c3
6 changed files with 15 additions and 10 deletions

View File

@ -123,7 +123,7 @@ class AvatarAction extends SettingsAction {
$avatar->filename = $filename; $avatar->filename = $filename;
$avatar->original = true; $avatar->original = true;
$avatar->url = common_avatar_url($filename); $avatar->url = common_avatar_url($filename);
$avatar->created = date(DATE_RFC822); # current time
foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) { foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) {
$scaled[] = $this->scale_avatar($user, $avatar, $size); $scaled[] = $this->scale_avatar($user, $avatar, $size);
} }
@ -181,6 +181,7 @@ class AvatarAction extends SettingsAction {
$scaled->mediatype = ($avatar->mediattype == 'image/jpeg') ? 'image/jpeg' : 'image/png'; $scaled->mediatype = ($avatar->mediattype == 'image/jpeg') ? 'image/jpeg' : 'image/png';
$scaled->filename = $filename; $scaled->filename = $filename;
$scaled->url = common_avatar_url($filename); $scaled->url = common_avatar_url($filename);
$scaled->created = date(DATE_RFC822); # current time
return $scaled; return $scaled;
} }

View File

@ -29,8 +29,7 @@ class NewnoticeAction extends Action {
common_user_error(_t('Not logged in.')); common_user_error(_t('Not logged in.'));
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') { } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$id = $this->save_new_notice(); $id = $this->save_new_notice();
# if ($id) {
if ($id) {
common_broadcast_notices($id); common_broadcast_notices($id);
common_redirect(common_local_url('shownotice', common_redirect(common_local_url('shownotice',
array('notice' => $id)), 303); array('notice' => $id)), 303);
@ -49,7 +48,7 @@ class NewnoticeAction extends Action {
assert($notice); assert($notice);
$notice->profile_id = $user->id; # user id *is* profile id $notice->profile_id = $user->id; # user id *is* profile id
$notice->content = $this->arg('content'); $notice->content = $this->arg('content');
$notice->created = time(); $notice->created = date(DATE_RFC822); # current time
return $notice->insert(); return $notice->insert();
} }
@ -57,7 +56,9 @@ class NewnoticeAction extends Action {
common_element_start('form', array('id' => 'newnotice', 'method' => 'POST', common_element_start('form', array('id' => 'newnotice', 'method' => 'POST',
'action' => common_local_url('newnotice'))); 'action' => common_local_url('newnotice')));
common_element('span', 'nickname', $profile->nickname); common_element('span', 'nickname', $profile->nickname);
common_element('textarea', array('rows' => 4, 'cols' => 80, 'id' => 'content')); common_element('textarea', array('rows' => 4, 'cols' => 80,
'name' => 'content',
'id' => 'content'));
common_element('input', array('type' => 'submit', 'value' => 'Send')); common_element('input', array('type' => 'submit', 'value' => 'Send'));
common_element_end('form'); common_element_end('form');
} }

View File

@ -81,7 +81,7 @@ class RegisterAction extends Action {
# TODO: wrap this in a transaction! # TODO: wrap this in a transaction!
$profile = new Profile(); $profile = new Profile();
$profile->nickname = $nickname; $profile->nickname = $nickname;
$profile->created = time(); $profile->created = date(DATE_RFC822); # current time
$id = $profile->insert(); $id = $profile->insert();
if (!$id) { if (!$id) {
return FALSE; return FALSE;
@ -91,7 +91,7 @@ class RegisterAction extends Action {
$user->nickname = $nickname; $user->nickname = $nickname;
$user->password = common_munge_password($password, $id); $user->password = common_munge_password($password, $id);
$user->email = $email; $user->email = $email;
$user->created = time(); $user->created = date(DATE_RFC822); # current time
$result = $user->insert(); $result = $user->insert();
if (!$result) { if (!$result) {
# Try to clean up... # Try to clean up...
@ -135,5 +135,6 @@ class RegisterAction extends Action {
'id' => 'cancel', 'id' => 'cancel',
'value' => _t('Cancel'))); 'value' => _t('Cancel')));
common_element_end('form'); common_element_end('form');
common_show_footer();
} }
} }

View File

@ -81,7 +81,9 @@ class ShowstreamAction extends StreamAction {
function notice_form() { function notice_form() {
common_element_start('form', array('id' => 'newnotice', 'method' => 'POST', common_element_start('form', array('id' => 'newnotice', 'method' => 'POST',
'action' => common_local_url('newnotice'))); 'action' => common_local_url('newnotice')));
common_element('textarea', array('rows' => 4, 'cols' => 80, 'id' => 'content')); common_element('textarea', array('rows' => 4, 'cols' => 80,
'name' => 'content',
'id' => 'content'));
common_element('input', array('type' => 'submit', 'value' => 'Send')); common_element('input', array('type' => 'submit', 'value' => 'Send'));
common_element_end('form'); common_element_end('form');
} }

View File

@ -293,7 +293,7 @@ function common_local_url($action, $args=NULL) {
function common_date_string($dt) { function common_date_string($dt) {
// XXX: do some sexy date formatting // XXX: do some sexy date formatting
return date(DATE_RFC822); return date(DATE_RFC822, $dt);
} }
function common_redirect($url, $code=307) { function common_redirect($url, $code=307) {

View File

@ -42,7 +42,7 @@ class SettingsAction extends Action {
return false; return false;
} }
function show_message($msg, $success) { function message($msg, $success) {
if ($msg) { if ($msg) {
common_element('div', ($success) ? 'success' : 'error', common_element('div', ($success) ? 'success' : 'error',
$msg); $msg);