use cast object for datetimes

darcs-hash:20080517201411-84dde-7a6195517a5bded7b84266f61c035e2adbc49edd.gz
This commit is contained in:
Evan Prodromou 2008-05-17 16:14:11 -04:00
parent a88e18e5af
commit 564694c2f1
5 changed files with 7 additions and 6 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 $avatar->created = DB_DataObject_Cast::dateTime(); # 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,7 +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 $scaled->created = DB_DataObject_Cast::dateTime(); # current time
return $scaled; return $scaled;
} }

View File

@ -47,8 +47,8 @@ class NewnoticeAction extends Action {
$notice = DB_DataObject::factory('notice'); $notice = DB_DataObject::factory('notice');
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->created = DB_DataObject_Cast::dateTime();
$notice->content = $this->arg('content'); $notice->content = $this->arg('content');
$notice->created = date(DATE_RFC822); # current time
return $notice->insert(); return $notice->insert();
} }

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 = date(DATE_RFC822); # current time $profile->created = DB_DataObject_Cast::dateTime(); # 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 = date(DATE_RFC822); # current time $user->created = DB_DataObject_Cast::dateTime(); # current time
$result = $user->insert(); $result = $user->insert();
if (!$result) { if (!$result) {
# Try to clean up... # Try to clean up...

View File

@ -48,7 +48,7 @@ class SubscribeAction extends Action {
$sub->subscriber = $user->id; $sub->subscriber = $user->id;
$sub->subscribed = $other->id; $sub->subscribed = $other->id;
$sub->created = time(); $sub->created = DB_DataObject_Cast::dateTime(); # current time
if (!$sub->insert()) { if (!$sub->insert()) {
common_server_error(_t('Couldn\'t create subscription.')); common_server_error(_t('Couldn\'t create subscription.'));

View File

@ -31,6 +31,7 @@ define('MAX_AVATAR_SIZE', 256 * 1024);
require_once('PEAR.php'); require_once('PEAR.php');
require_once('DB/DataObject.php'); require_once('DB/DataObject.php');
require_once('DB/DataObject/Cast.php'); # for dates
// default configuration, overwritten in config.php // default configuration, overwritten in config.php