]>
src.bluestatic.org Git - bugdar.git/blob - includes/api_userhelp.php
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 $GLOBALS['isso:callback']->load('api', null);
24 require_once('./includes/functions_datastore.php');
30 * @copyright Copyright ©2002 - 2007, Blue Static
35 class UserHelpAPI
extends API
43 'keystring' => array(TYPE_STR
, REQ_AUTO
),
44 'title' => array(TYPE_STR
, REQ_YES
, 'verify_noempty'),
45 'body' => array(TYPE_STR
, REQ_YES
)
53 var $table = 'fieldhelp';
60 var $prefix = TABLE_PREFIX
;
62 // ###################################################################
64 * A static function that returns an array of all the keystrings that
65 * are not allowed to be deleted
69 * @return array Array of keystrings
71 function not_able_to_delete()
91 // ###################################################################
99 if (($err = $this->verify_keystring()) !== true)
105 // ###################################################################
111 function post_insert()
116 // ###################################################################
122 function post_update()
127 // ###################################################################
133 function pre_delete()
135 if (in_array($this->values
['keystring'], UserHelpAPI
::not_able_to_delete()))
142 // ###################################################################
148 function post_delete()
153 // ###################################################################
159 function verify_keystring()
161 if (!is_bool($ne = $this->verify_noempty('keystring')))
166 if (preg_match('#[^a-z0-9_]#', $this->values
['keystring']))
168 return T('The unique key can only contain lowercase letters, underscores, and numbers.');
171 if ($this->registry
->db
->query_first("SELECT * FROM " . TABLE_PREFIX
. "fieldhelp WHERE keystring = '" . $this->registry
->escape($this->values
['keystring']) . "'"))
173 return T('The unique key must be unique.');
180 /*=====================================================================*\
181 || ###################################################################
184 || ###################################################################
185 \*=====================================================================*/