2 /*=====================================================================*\
3 || ###################################################################
5 || # Copyright ©2002-2007 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 2 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 require_once ISSO
. '/Api.php';
28 * @copyright Copyright ©2002 - 2007, Blue Static
33 class AttachmentAPI
extends BSApi
39 protected $fields = array(
40 'attachmentid' => array(TYPE_UINT
, REQ_AUTO
),
41 'bugid' => array(TYPE_UINT
, REQ_YES
),
42 'filename' => array(TYPE_STR
, REQ_YES
),
43 'mimetype' => array(TYPE_STR
, REQ_YES
),
44 'filesize' => array(TYPE_INT
, REQ_NO
),
45 'attachment' => array(TYPE_BIN
, REQ_YES
),
46 'description' => array(TYPE_STR
, REQ_YES
),
47 'dateline' => array(TYPE_UINT
, REQ_SET
),
48 'userid' => array(TYPE_UINT
, REQ_YES
),
49 'obsolete' => array(TYPE_BOOL
, REQ_NO
)
56 protected $table = 'attachment';
62 protected $prefix = TABLE_PREFIX
;
67 protected function set_dateline()
69 $this->set('dateline', time());
73 * Validate: attachmentid
75 protected function validate_attachmentid($field)
77 return $this->_verifyIsNotZero($field);
83 protected function validate_filename($field)
85 return $this->_verifyIsNotEmpty($field);
89 /*=====================================================================*\
90 || ###################################################################
93 || ###################################################################
94 \*=====================================================================*/