CMS  Version 3.9
publish_comment.inc
Go to the documentation of this file.
1 <?php
2 /*
3  * publish/Un-Publish a comment.
4  *
5  *
6  */
7 
8 Fakoli::using("comment");
9 
10 $comment_id = checkNumeric($_GET["comment_id"]);
11 
12 $comment = new Comment();
13 
14 if ($comment_id)
15 {
16  $comment->load($comment_id);
17 }
18 
19 if(!$comment->published)
20 {
21  $comment->published = true;
22 }
23 else
24 {
25  $comment->published = false;
26 }
27 
28 if ($comment->save())
29 {
30  Fakoli::end("OK");
31 }
32 else
33 {
34  Fakoli::end("save failed");
35 }
36 
37 ?>
static using()
Import the datamodels, views and manifest for the specified component(s).
Definition: core.inc:116
static end($message="")
Use this method to terminate execution of a script instead of using the php keywords exit() or die().
Definition: core.inc:1149
$comment
$comment_id