@@ -58,11 +58,10 @@ public function get() {
58
58
}
59
59
60
60
public function post () {
61
- {
62
- $ app = JFactory::getApplication ();
63
- $ my = JFactory::getUser ();
64
- $ config = EasyBlogHelper::getConfig ();
65
- $ acl = EasyBlogACLHelper::getRuleSet ();
61
+ $ app = JFactory::getApplication ();
62
+ $ my = $ this ->plugin ->getUser ();
63
+ $ config = EasyBlogHelper::getConfig ();
64
+ $ acl = EasyBlogACLHelper::getRuleSet ();
66
65
$ post = $ app ->input ->post ->getArray ();
67
66
68
67
if ( empty ($ acl ->rules ->allow_comment ) && (empty ($ my ->id ) && !$ config ->get ('main_allowguestcomment ' )) )
@@ -235,10 +234,28 @@ public function post() {
235
234
236
235
//update the sent flag to sent
237
236
$ comment ->updateSent ();
237
+
238
+ // @TODO - Move this to a map comment function
239
+ $ item = new CommentSimpleSchema ;
240
+ $ item ->commentid = $ comment ->id ;
241
+ $ item ->postid = $ comment ->post_id ;
242
+ $ item ->title = $ comment ->title ;
243
+ $ item ->text = EasyBlogCommentHelper::parseBBCode ($ comment ->comment );
244
+ $ item ->textplain = strip_tags (EasyBlogCommentHelper::parseBBCode ($ comment ->comment ));
245
+ $ item ->created_date = $ comment ->created ;
246
+ $ item ->created_date_elapsed = EasyBlogDateHelper::getLapsedTime ( $ comment ->created );
247
+ $ item ->updated_date = $ comment ->modified ;
238
248
239
- $ this ->plugin ->setResponse ( $ comment );
249
+ // Author
250
+ $ item ->author ->name = isset ($ comment ->poster ->nickname ) ? $ comment ->poster ->nickname : $ comment ->name ;
251
+ $ item ->author ->photo = isset ($ comment ->poster ->avatar ) ? $ comment ->poster ->avatar : 'default_blogger.png ' ;
252
+ $ item ->author ->photo = JURI ::root () . 'components/com_easyblog/assets/images/ ' . $ item ->author ->photo ;
253
+ $ item ->author ->email = $ comment ->email ;
254
+ $ item ->author ->website = isset ($ comment ->poster ->url ) ? $ comment ->poster ->url : $ comment ->url ;
255
+
256
+ $ this ->plugin ->setResponse ( $ item );
240
257
241
- }}
258
+ }
242
259
243
260
public static function getName () {
244
261
0 commit comments