more fixes for events
This commit is contained in:
		@@ -112,7 +112,7 @@ class Happening extends Managed_DataObject
 | 
				
			|||||||
        );
 | 
					        );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function saveNew($profile, $start_time, $end_time, $title, $location, $description, $options)
 | 
					    function saveNew($profile, $start_time, $end_time, $title, $location, $description, $options=array())
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if (array_key_exists('uri', $options)) {
 | 
					        if (array_key_exists('uri', $options)) {
 | 
				
			||||||
            $other = Happening::staticGet('uri', $options['uri']);
 | 
					            $other = Happening::staticGet('uri', $options['uri']);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -93,6 +93,14 @@ class NeweventAction extends Action
 | 
				
			|||||||
        $this->location    = $this->trimmed('location');
 | 
					        $this->location    = $this->trimmed('location');
 | 
				
			||||||
        $this->description = $this->trimmed('description');
 | 
					        $this->description = $this->trimmed('description');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $start_date = $this->trimmed('start_date');
 | 
				
			||||||
 | 
					        $start_time = $this->trimmed('start_time');
 | 
				
			||||||
 | 
					        $end_date   = $this->trimmed('end_date');
 | 
				
			||||||
 | 
					        $end_time   = $this->trimmed('end_time');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->start_time = strtotime($start_date . ' ' . $start_time);
 | 
				
			||||||
 | 
					        $this->end_time   = strtotime($end_date . ' ' . $end_time);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -130,16 +138,20 @@ class NeweventAction extends Action
 | 
				
			|||||||
                throw new ClientException(_('Event must have a title.'));
 | 
					                throw new ClientException(_('Event must have a title.'));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (empty($this->url)) {
 | 
					            if (empty($this->start_time)) {
 | 
				
			||||||
                throw new ClientException(_('Event must have an URL.'));
 | 
					                throw new ClientException(_('Event must have a start time.'));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (empty($this->end_time)) {
 | 
				
			||||||
 | 
					                throw new ClientException(_('Event must have an end time.'));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $saved = Event::saveNew($this->user->getProfile(),
 | 
					            $saved = Event::saveNew($this->user->getProfile(),
 | 
				
			||||||
                                              $this->title,
 | 
					                                    $this->start_time,
 | 
				
			||||||
                                              $this->url,
 | 
					                                    $this->end_time,
 | 
				
			||||||
                                              $this->tags,
 | 
					                                    $this->title,
 | 
				
			||||||
                                              $this->description);
 | 
					                                    $this->location,
 | 
				
			||||||
 | 
					                                    $this->description);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        } catch (ClientException $ce) {
 | 
					        } catch (ClientException $ce) {
 | 
				
			||||||
            $this->error = $ce->getMessage();
 | 
					            $this->error = $ce->getMessage();
 | 
				
			||||||
@@ -147,7 +159,7 @@ class NeweventAction extends Action
 | 
				
			|||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        common_redirect($saved->bestUrl(), 303);
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user