From: Evan Prodromou Date: Sat, 17 May 2008 20:14:11 +0000 (-0400) Subject: use cast object for datetimes X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=564694c2f1799174fdf914f08d0ca9d8d2325c32;p=quix0rs-gnu-social.git use cast object for datetimes darcs-hash:20080517201411-84dde-7a6195517a5bded7b84266f61c035e2adbc49edd.gz --- diff --git a/actions/avatar.php b/actions/avatar.php index 0b1025a3c4..f378b3d15a 100644 --- a/actions/avatar.php +++ b/actions/avatar.php @@ -123,7 +123,7 @@ class AvatarAction extends SettingsAction { $avatar->filename = $filename; $avatar->original = true; $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) { $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->filename = $filename; $scaled->url = common_avatar_url($filename); - $scaled->created = date(DATE_RFC822); # current time + $scaled->created = DB_DataObject_Cast::dateTime(); # current time return $scaled; } diff --git a/actions/newnotice.php b/actions/newnotice.php index 50d676eb50..fa7badd3de 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -47,8 +47,8 @@ class NewnoticeAction extends Action { $notice = DB_DataObject::factory('notice'); assert($notice); $notice->profile_id = $user->id; # user id *is* profile id + $notice->created = DB_DataObject_Cast::dateTime(); $notice->content = $this->arg('content'); - $notice->created = date(DATE_RFC822); # current time return $notice->insert(); } diff --git a/actions/register.php b/actions/register.php index c156b46b2e..5c30fa1b36 100644 --- a/actions/register.php +++ b/actions/register.php @@ -81,7 +81,7 @@ class RegisterAction extends Action { # TODO: wrap this in a transaction! $profile = new Profile(); $profile->nickname = $nickname; - $profile->created = date(DATE_RFC822); # current time + $profile->created = DB_DataObject_Cast::dateTime(); # current time $id = $profile->insert(); if (!$id) { return FALSE; @@ -91,7 +91,7 @@ class RegisterAction extends Action { $user->nickname = $nickname; $user->password = common_munge_password($password, $id); $user->email = $email; - $user->created = date(DATE_RFC822); # current time + $user->created = DB_DataObject_Cast::dateTime(); # current time $result = $user->insert(); if (!$result) { # Try to clean up... diff --git a/actions/subscribe.php b/actions/subscribe.php index 68fdd24e98..4edf3e714e 100644 --- a/actions/subscribe.php +++ b/actions/subscribe.php @@ -48,7 +48,7 @@ class SubscribeAction extends Action { $sub->subscriber = $user->id; $sub->subscribed = $other->id; - $sub->created = time(); + $sub->created = DB_DataObject_Cast::dateTime(); # current time if (!$sub->insert()) { common_server_error(_t('Couldn\'t create subscription.')); diff --git a/lib/common.php b/lib/common.php index 730dae3957..fe44fa82f7 100644 --- a/lib/common.php +++ b/lib/common.php @@ -31,6 +31,7 @@ define('MAX_AVATAR_SIZE', 256 * 1024); require_once('PEAR.php'); require_once('DB/DataObject.php'); +require_once('DB/DataObject/Cast.php'); # for dates // default configuration, overwritten in config.php