From dab386219e6d3a2b19ae6a63e5a7b4f4cd16da49 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 16 Sep 2008 12:54:16 -0400 Subject: [PATCH] Update api_attachment.php --- includes/api_attachment.php | 60 +++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/includes/api_attachment.php b/includes/api_attachment.php index d739611..cb8c510 100644 --- a/includes/api_attachment.php +++ b/includes/api_attachment.php @@ -33,47 +33,57 @@ require_once ISSO . '/Api.php'; class AttachmentAPI extends BSApi { /** - * Fields - * @var array - * @access private - */ - var $fields = array( - 'attachmentid' => array(TYPE_UINT, REQ_AUTO, 'verify_nozero'), - 'bugid' => array(TYPE_UINT, REQ_YES, null, array('includes/api_bug.php', 'BugAPI')), - 'filename' => array(TYPE_STR, REQ_YES, 'verify_noempty'), + * Fields + * @var array + */ + protected $fields = array( + 'attachmentid' => array(TYPE_UINT, REQ_AUTO), + 'bugid' => array(TYPE_UINT, REQ_YES), + 'filename' => array(TYPE_STR, REQ_YES), 'mimetype' => array(TYPE_STR, REQ_YES), 'filesize' => array(TYPE_INT, REQ_NO), 'attachment' => array(TYPE_BIN, REQ_YES), 'description' => array(TYPE_STR, REQ_YES), 'dateline' => array(TYPE_UINT, REQ_SET), - 'userid' => array(TYPE_UINT, REQ_YES, null, array('includes/api_user.php', 'UserAPI')), + 'userid' => array(TYPE_UINT, REQ_YES), 'obsolete' => array(TYPE_BOOL, REQ_NO) ); /** - * Database table - * @var string - * @access private - */ - var $table = 'attachment'; + * Database table + * @var string + */ + protected $table = 'attachment'; /** - * Table prefix - * @var string - * @access private - */ - var $prefix = TABLE_PREFIX; + * Table prefix + * @var string + */ + protected $prefix = TABLE_PREFIX; - // ################################################################### /** - * Set field: dateline - * - * @access private - */ - function set_dateline() + * Set field: dateline + */ + protected function set_dateline() { $this->set('dateline', time()); } + + /** + * Validate: attachmentid + */ + protected function validate_attachmentid($field) + { + return $this->_verifyIsNotZero($field); + } + + /** + * Validate: filename + */ + protected function validate_filename($field) + { + return $this->_verifyIsNotEmpty($field); + } } /*=====================================================================*\ -- 2.22.5