array(TYPE_UINT, REQ_AUTO, 'verify_nozero'), 'bugid' => array(TYPE_UINT, REQ_YES, 'verify_nozero'), 'userid' => array(TYPE_UINT, REQ_NO), 'dateline' => array(TYPE_UINT, REQ_SET), 'parselinks' => array(TYPE_BOOL, REQ_NO), 'comment' => array(TYPE_STR, REQ_YES, 'verify_noempty'), 'comment_parsed' => array(TYPE_NONE, REQ_SET), 'hidden' => array(TYPE_BOOL, REQ_NO) ); /** * Database table * @var string * @access private */ var $table = 'comment'; /** * Table prefix * @var string * @access private */ var $prefix = TABLE_PREFIX; // ################################################################### /** * Set field: dateline * * @access private */ function set_dateline() { $this->set('dateline', time()); } // ################################################################### /** * Set field: comment_parsed * * @access private */ function set_comment_parsed() { $comment = $this->values['comment']; if ($this->values['parselinks']) { $comment = str_replace('bug://new', '' . T('New Bug') . '', $comment); $comment = preg_replace('#bug://((report|problem)/)?([0-9]*)#i', 'bug \3', $comment); $comment = preg_replace('#(https?://|www\.)\S+#i', '\0', $comment); } if (bugdar::$options['allowhtml']) { $this->set('comment_parsed', nl2br($this->registry->unsanitize($comment))); } else { $this->set('comment_parsed', nl2br($comment)); } } // ################################################################### /** * Pre-update * * @access private */ function pre_update() { $this->set_comment_parsed(); } // ################################################################### /** * Pre-delete * * @access private */ function pre_delete() { if ($this->registry->db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE initialreport = " . $this->values['commentid'])) { $this->error(T('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).')); } } } /*=====================================================================*\ || ################################################################### || # $HeadURL$ || # $Id$ || ################################################################### \*=====================================================================*/ ?>