create_story delete_story
create_admin_user
create_comments
+ create_comment delete_comment
create_users
+ create_journal delete_journal
update_user_passwd
get_anonymous_user
srcid
my $args = {@_};
my $stories = $app->model('stories');
+ if ($args->{params}) {
+ my $p = $args->{params};
+ delete $args->{params};
+ $args = {%$args, %$p};
+ }
return if !$app;
return if !$user;
return 1;
}
+sub create_journal {
+ my $app = shift;
+ my $user = shift;
+ my $args = {@_};
+
+ my $journals = $app->model('journals');
+ if ($args->{params}) {
+ my $p = $args->{params};
+ delete $args->{params};
+ $args = {%$args, %$p};
+ }
+
+ return if !$app;
+ return if !$user;
+ my $id = $journals->create(user => $user,
+ description => $args->{title} || "test title",
+ article => $args->{intro_text} || $args->{introtext} || "test journal",
+ commentstatus => $args->{commentstatus} || $args->{comment_status} || "enabled",
+ posttype => 2);
+ if (!$id) {
+ warn($journals->last_error);
+ return;
+ }
+ my $journal = $journals->select(journal_id => $id);
+ return $journal;
+}
+
+sub delete_journal {
+ my ($app, $id) = @_;
+ my $rs = $app->model('journals')->hard_delete(id => $id);
+ return $rs;
+}
+
sub create_comment {
my ($app, $user, $discussion_id, $title, $comment, $pid) = @_;
my $params = {
return $comm;
}
+sub delete_comment {
+ my ($app, $cid) = @_;
+ my $rs = $app->model('comments')->hard_delete(cid => $cid);
+ return $rs;
+}
+
sub create_comments {
my ($app, $discussion_id, $comms, $pid) = @_;
my $rs = {};