$args = $this->returnToArgs();
$this->user = common_current_user();
$this->photoid = $args[1]['photoid'];
- $this->photo = GNUsocialPhoto::staticGet('id', $this->photoid);
+ $this->photo = GNUsocialPhoto::getKV('id', $this->photoid);
return true;
}
return;
}
+ //showForm() data
+ if(!empty($this->msg)) {
+ $class = ($this->success) ? 'success' : 'error';
+ $this->element('p', array('class' => $class), $this->msg);
+ }
+
$this->element('img', array('src' => $this->photo->uri));
$this->elementStart('form', array('method' => 'post',
'action' => '/editphoto/' . $this->photo->id));
$profile_id = $cur->id;
- $album = GNUsocialPhotoAlbum::staticGet('album_id', $this->trimmed('album'));
+ $album = GNUsocialPhotoAlbum::getKV('album_id', $this->trimmed('album'));
if ($album->profile_id != $profile_id) {
$this->showForm(_('Error: This is not your album!'));
return;
return;
}
common_redirect('/photo/' . $this->photo->id, '303');
- $this->showForm(_('Success!'));
-
+ // common_redirect exits
}
function deletePhoto()
//For redirection
$oldalbum = $this->album_id;
- $notice = Notice::staticGet('id', $this->photo->notice_id);
+ $notice = Notice::getKV('id', $this->photo->notice_id);
$this->photo->delete();
if (Event::handle('StartDeleteOwnNotice', array($this->user, $notice))) {
- $notice->delete();
+ $notice->deleteAs($this->scoped);
Event::handle('EndDeleteOwnNotice', array($this->user, $notice));
}
$this->showForm(_('Success!'));
common_redirect('/' . $this->user->nickname . '/photos/' . $oldalbum, '303');
- return;
}
}