-
Notifications
You must be signed in to change notification settings - Fork 0
/
comment_Add.php
49 lines (43 loc) · 1.69 KB
/
comment_Add.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/*
* Practical Agile Scrum tool
*
* Copyright 2013-2017, P.P. Labuschagne
* Released under the MIT license.
* https://github.com/paul-lab/practical-agile/blob/master/_Licence.txt
*
* Homepage:
* http://practicalagile.co.uk
* http://practicalagile.uk
*
*/
require_once('include/dbconfig.inc.php');
require_once('include/common.php');
$user_details = check_user($_SESSION['user_identifier']);
if(!$user_details){
exit();
}
if($_REQUEST['Type']=="s"){
$q = "INSERT INTO comment (Parent_ID, User_Name, Story_AID, Comment_Text) VALUES (".$_REQUEST['Parent_ID'].", '".$_REQUEST[User_Name]."', ".$_REQUEST['Story_AID'].", '".$_REQUEST['comment_text']."' )";
auditit($_REQUEST['PID'],$_REQUEST['Story_AID'],$_SESSION['Email'],'Added Comment','',$_REQUEST['comment_text']);
}else{
if ($_REQUEST['Story_AID']==0) { // this means an iteration that has no comments against it.
$icoid=NextIterationCommentObject(); // so get the next comment object id
$q='Update Iteration set Comment_Object_ID='.$icoid.' where ID='.$_REQUEST['Iteration_ID']; // and set it
$DBConn->directsql($q);
}else{
$icoid=$_REQUEST['Story_AID'];
}
$q = "INSERT INTO comment (Parent_ID, User_Name, Comment_Object_ID, Comment_Text) VALUES (".$_REQUEST['Parent_ID'].", '".$_REQUEST[User_Name]."', ".$icoid.", '".$_REQUEST['comment_text']."' )";
auditit($_REQUEST['PID'],0,$_SESSION['Email'],'Added Iteration Comment','',$_REQUEST['comment_text']);
}
$row = $DBConn->directsql($q);
if($row!=0) {
$r = 'select * from comment where ID='.$row;
$row = $DBConn->directsql($r);
GetComments($row[0], $_REQUEST['replyid'], $_REQUEST['Type']);
}else {
echo $q;
echo "Comment cannot be posted. Please try again.";
}
?>