]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'master' into 0.9.x
authorEvan Prodromou <evan@status.net>
Tue, 29 Dec 2009 20:09:17 +0000 (12:09 -0800)
committerEvan Prodromou <evan@status.net>
Tue, 29 Dec 2009 20:09:17 +0000 (12:09 -0800)
1  2 
classes/Notice.php

diff --combined classes/Notice.php
index 9f68c52553d0647ae382685f2ec0ba50c6924ba0,0bb3b861c7b46b88a9f2e4b7a39ba25b74a58082..fe3f3c0170365b69ae6168451326e7d842ea53ab
@@@ -289,11 -289,21 +289,11 @@@ class Notice extends Memcached_DataObje
          if (!empty($lat) && !empty($lon)) {
              $notice->lat = $lat;
              $notice->lon = $lon;
 +        }
 +
 +        if (!empty($location_ns) && !empty($location_id)) {
              $notice->location_id = $location_id;
              $notice->location_ns = $location_ns;
 -        } else if (!empty($location_ns) && !empty($location_id)) {
 -            $location = Location::fromId($location_id, $location_ns);
 -            if (!empty($location)) {
 -                $notice->lat = $location->lat;
 -                $notice->lon = $location->lon;
 -                $notice->location_id = $location_id;
 -                $notice->location_ns = $location_ns;
 -            }
 -        } else {
 -            $notice->lat         = $profile->lat;
 -            $notice->lon         = $profile->lon;
 -            $notice->location_id = $profile->location_id;
 -            $notice->location_ns = $profile->location_ns;
          }
  
          if (Event::handle('StartNoticeSave', array(&$notice))) {
          $xs->element('id', null, $this->uri);
  
          $xs->element('published', null, common_date_w3dtf($this->created));
-         $xs->element('updated', null, common_date_w3dtf($this->modified));
+         $xs->element('updated', null, common_date_w3dtf($this->created));
  
          if ($this->reply_to) {
              $reply_notice = Notice::staticGet('id', $this->reply_to);
  
          return $ids;
      }
 +
 +    function locationOptions($lat, $lon, $location_id, $location_ns, $profile = null)
 +    {
 +        $options = array();
 +
 +        if (!empty($location_id) && !empty($location_ns)) {
 +
 +            $options['location_id'] = $location_id;
 +            $options['location_ns'] = $location_ns;
 +
 +            $location = Location::fromId($location_id, $location_ns);
 +
 +            if (!empty($location)) {
 +                $options['lat'] = $location->lat;
 +                $options['lon'] = $location->lon;
 +            }
 +
 +        } else if (!empty($lat) && !empty($lon)) {
 +
 +            $options['lat'] = $lat;
 +            $options['lon'] = $lon;
 +
 +            $location = Location::fromLatLon($lat, $lon);
 +
 +            if (!empty($location)) {
 +                $options['location_id'] = $location->location_id;
 +                $options['location_ns'] = $location->location_ns;
 +            }
 +        } else if (!empty($profile)) {
 +
 +            if (isset($profile->lat) && isset($profile->lon)) {
 +                $options['lat'] = $profile->lat;
 +                $options['lon'] = $profile->lon;
 +            }
 +
 +            if (isset($profile->location_id) && isset($profile->location_ns)) {
 +                $options['location_id'] = $profile->location_id;
 +                $options['location_ns'] = $profile->location_ns;
 +            }
 +        }
 +
 +        return $options;
 +    }
  }