]>
src.bluestatic.org Git - bugdar.git/blob - includes/api_comment.php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Blue Static
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
22 $GLOBALS [ 'isso:callback' ]-> load ( 'api' , null );
28 * @copyright Copyright ©2002 - [#]year[#], Blue Static
33 class CommentAPI
extends API
41 'commentid' => array ( TYPE_UINT
, REQ_AUTO
, 'verify_nozero' ),
42 'bugid' => array ( TYPE_UINT
, REQ_YES
, 'verify_nozero' ),
43 'userid' => array ( TYPE_UINT
, REQ_NO
, null , array ( 'includes/api_user.php' , 'UserAPI' )),
44 'dateline' => array ( TYPE_UINT
, REQ_SET
),
45 'comment' => array ( TYPE_STR
, REQ_YES
, 'verify_noempty' ),
46 'comment_parsed' => array ( TYPE_NONE
, REQ_SET
),
47 'hidden' => array ( TYPE_BOOL
, REQ_NO
)
55 var $table = 'comment' ;
62 var $prefix = TABLE_PREFIX
;
64 // ###################################################################
70 function set_dateline ()
72 $this- > set ( 'dateline' , time ());
75 // ###################################################################
77 * Set field: comment_parsed
81 function set_comment_parsed ()
83 if ( $this- > registry
-> options
[ 'allowhtml' ])
85 $this- > set ( 'comment_parsed' , nl2br ( $this- > registry
-> unsanitize ( $this- > values
[ 'comment' ])));
89 $this- > set ( 'comment_parsed' , nl2br ( $this- > values
[ 'comment' ]));
93 // ###################################################################
101 $this- > set_comment_parsed ();
104 // ###################################################################
110 function pre_delete ()
112 if ( $this- > registry
-> db
-> query_first ( "SELECT * FROM " . TABLE_PREFIX
. "bug WHERE initialreport = " . $this- > values
[ 'commentid' ]))
114 $this- > error ( _ ( 'You cannot delete this comment because it is attached to the bug as the first comment. You have to delete the entire bug instead (which is not recommended unless it is spam).' ));
119 /*=====================================================================*\
120 || ###################################################################
123 || ###################################################################
124 \*=====================================================================*/