]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
use cast object for datetimes
authorEvan Prodromou <evan@prodromou.name>
Sat, 17 May 2008 20:14:11 +0000 (16:14 -0400)
committerEvan Prodromou <evan@prodromou.name>
Sat, 17 May 2008 20:14:11 +0000 (16:14 -0400)
darcs-hash:20080517201411-84dde-7a6195517a5bded7b84266f61c035e2adbc49edd.gz

actions/avatar.php
actions/newnotice.php
actions/register.php
actions/subscribe.php
lib/common.php

index 0b1025a3c4b2d0b658f3a47aababf937fa068cb5..f378b3d15a3986084b68a0f01184a1dd540b0d31 100644 (file)
@@ -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;
        }
index 50d676eb50c659a8df1798b3a186d329770352a1..fa7badd3def07fb7906b2061c7ebd1af34e92136 100644 (file)
@@ -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();
        }
        
index c156b46b2eda579c055f90864d78d8182f93795e..5c30fa1b36e91b4d517927bc8aca8db5f6bf22c0 100644 (file)
@@ -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...
index 68fdd24e98d5bca9679b7b1d9cfc81570d054d69..4edf3e714ea5207ac0111078d573a1379df74ed8 100644 (file)
@@ -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.'));
index 730dae39571b525298e9e975e8271096b8ed9306..fe44fa82f79bde79bd7ac1fdec7edc7574edaf20 100644 (file)
@@ -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