From 2549985e09592dee5e2388ed0fa8ca40fbde8dc9 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 16 Sep 2008 12:58:02 -0400 Subject: [PATCH] Update api_automation.php --- includes/api_attachment.php | 16 +++--- includes/api_automation.php | 110 ++++++++++++++++++------------------ 2 files changed, 63 insertions(+), 63 deletions(-) diff --git a/includes/api_attachment.php b/includes/api_attachment.php index cb8c510..c98530d 100644 --- a/includes/api_attachment.php +++ b/includes/api_attachment.php @@ -22,14 +22,14 @@ require_once ISSO . '/Api.php'; /** -* API: Attachment -* -* @author Blue Static -* @copyright Copyright ©2002 - 2007, Blue Static -* @version $Revision$ -* @package Bugdar -* -*/ + * API: Attachment + * + * @author Blue Static + * @copyright Copyright ©2002 - 2007, Blue Static + * @version $Revision$ + * @package Bugdar + * + */ class AttachmentAPI extends BSApi { /** diff --git a/includes/api_automation.php b/includes/api_automation.php index becfda3..0e079f8 100644 --- a/includes/api_automation.php +++ b/includes/api_automation.php @@ -19,95 +19,95 @@ || ################################################################### \*=====================================================================*/ -$GLOBALS['isso:callback']->load('api', null); - +require_once ISSO . '/Api.php'; require_once('./includes/functions_datastore.php'); /** -* API: Automation -* -* @author Blue Static -* @copyright Copyright ©2002 - 2007, Blue Static -* @version $Revision$ -* @package Bugdar -* -*/ -class AutomationAPI extends API + * API: Automation + * + * @author Blue Static + * @copyright Copyright ©2002 - 2007, Blue Static + * @version $Revision$ + * @package Bugdar + * + */ +class AutomationAPI extends BSApi { /** - * Fields - * @var array - * @access private - */ - var $fields = array( - 'actionid' => array(TYPE_UINT, REQ_AUTO, 'verify_nozero'), - 'name' => array(TYPE_STR, REQ_YES, 'verify_noempty'), + * Fields + * @var array + */ + protected $fields = array( + 'actionid' => array(TYPE_UINT, REQ_AUTO), + 'name' => array(TYPE_STR, REQ_YES), 'description' => array(TYPE_STR, REQ_NO), - 'fieldchanges' => array(TYPE_NONE, REQ_YES, ':self'), + 'fieldchanges' => array(TYPE_NONE, REQ_YES), 'comment' => array(TYPE_STR, REQ_NO) ); /** - * Table - * @var string - * @access private - */ - var $table = 'automation'; + * Table + * @var string + */ + protected $table = 'automation'; /** - * Table prefix - * @var string - * @access private - */ - var $prefix = TABLE_PREFIX; + * Table prefix + * @var string + */ + protected $prefix = TABLE_PREFIX; - // ################################################################### /** - * Post-insert - * - * @access private - */ - function post_insert() + * Post-insert + */ + protected function post_insert() { build_automations(); } - // ################################################################### /** - * Post-update - * - * @access private - */ - function post_update() + * Post-update + */ + protected function post_update() { build_automations(); } - // ################################################################### /** - * Post-delete - * - * @access private - */ - function post_delete() + * Post-delete + */ + protected function post_delete() { build_automations(); } - // ################################################################### /** - * Verify: fieldchanges - * - * @access private - */ - function verify_fieldchanges() + * Validate: actionid + */ + protected function validate_actionid($field) + { + return $this->_verifyIsNotZero($field); + } + + /** + * Validate: name + */ + protected function validate_name($field) + { + return $this->_verifyIsNotEmpty($field); + } + + /** + * Validate: fieldchanges + */ + protected function validate_fieldchanges() { - if (!is_array($this->values['fieldchanges']) OR sizeof($this->values['fieldchanges']) != 2 OR !is_array($this->values['fieldchanges']['custom']) OR !is_array($this->values['fieldchanges']['builtin'])) + if (!is_array($this->values['fieldchanges']) || sizeof($this->values['fieldchanges']) != 2 || !is_array($this->values['fieldchanges']['custom']) || !is_array($this->values['fieldchanges']['builtin'])) { return T('Invalid array type passed. The fieldchaneges array must be a two-dimensional array: array("builtin" => array("fieldname" => "newvalue" ...), "custom" => array("fieldname" => "fieldvalue" ...))'); } - if (sizeof($this->values['fieldchanges']['custom']) < 1 AND sizeof($this->values['fieldchanges']['builtin']) < 1) + if (sizeof($this->values['fieldchanges']['custom']) < 1 && sizeof($this->values['fieldchanges']['builtin']) < 1) { return T('You need to specify some fields to change.'); } -- 2.22.5