/** * @access public * @param array Array of tag attributes */ function processAttribs($attribs) { parent::processAttribs($attribs); if (isset($attribs['function'])) { $this->setCustomFunction($attribs['function']); } }
/** * Validate a Registrar Module * * Verifies that the Registrar Module exists and is enabled * * @param string $data Field data * @return ModuleDBO Module DBO for this Registrar * @throws RecordNotFoundException */ public function validate($data) { $data = parent::validate($data); try { $moduleDBO = load_ModuleDBO($data); } catch (DBNoRowsFoundException $e) { throw new RecordNotFoundException("RegistrarModule"); } return $moduleDBO; }
/** * @access public * @param array Array of tag attributes */ function processAttribs($attribs) { parent::processAttribs($attribs); if (isset($attribs['regexp'])) { $this->setRegexp($attribs['regexp']); } if (isset($attribs['regexpperl'])) { $this->setRegexpPerl($attribs['regexpperl']); } }
/** * Validate a IPAddress Field * * Verifies that an IP address is in the form: 255.255.255.255. * * @param string $data Field data * @return string This function may alter data before validating it, if so this is the result * @throws FieldException */ public function validate($data) { $data = parent::validate($data); $ip = ip2long($data); if ($ip === false || $ip == -1) { // Not a valid IP address throw new FieldException("[PLEASE_ENTER_A_VALID_IP_ADDRESS]"); } return $data; }
/** * Validate an User * * Verifies that the user exists. * * @param string $data Field data * @return UserDBO User DBO for this User ID * @throws RecordNotFoundException */ public function validate($data) { $data = parent::validate($data); try { $userDBO = load_UserDBO($data); } catch (DBNoRowsFoundException $e) { throw new RecordNotFoundException("User"); } return $userDBO; }
/** * Validate an Account ID * * Verifies that the account exists. * * @param string $data Field data * @return AccountDBO Account DBO for this Account ID * @throws RecordNotFoundException */ public function validate($data) { $data = parent::validate($data); try { $accountDBO = load_AccountDBO(intval($data)); } catch (DBNoRowsFoundException $e) { throw new RecordNotFoundException("Account"); } return $accountDBO; }
/** * Validate an Invoice ID * * Verifies that the invoice exists. * * @param array $config Field configuration * @param string $data Field data * @return InvoiceDBO Invoice DBO for this Invoice ID * @throws RecordNotFoundException */ public function validate($data) { $data = parent::validate($data); try { $invoiceDBO = load_InvoiceDBO(intval($data)); } catch (DBNoRowsFoundException $e) { throw new RecordNotFoundException("Invoice"); } return $invoiceDBO; }
/** * Validate a Domain Service Price * * Verifies that the domain service price exists. * * @param string $data Field data * @return DomainServiceDBO DomainService DBO for this DomainService ID * @throws RecordNotFoundException */ public function validate($data) { $data = parent::validate($data); $id = explode("-", $data); try { $priceDBO = load_DomainServicePriceDBO($id[0], $id[1], intval($id[2])); } catch (DBNoRowsFoundException $e) { throw new RecordNotFoundException("DomainServicePrice"); } return $priceDBO; }
/** * Validate a Hosting Service ID * * Verifies that the hosting service exists. * * @param string $data Field data * @return HostingServiceDBO HostingService DBO for this HostingService ID * @throws RecordNotFoundException */ public function validate($data) { $data = parent::validate($data); try { $hostingDBO = load_HostingServiceDBO(intval($data)); } catch (DBRowNotFoundException $e) { throw new RecordNotFoundException("HostingService"); } if ($this->fieldConfig['publicitemsonly'] && !$hostingDBO->isPublic()) { throw new RecordNotFoundException("HostingService"); } return $hostingDBO; }
/** * Validate a Domain Service TLD * * Verifies that the domain service exists. * * @param string $data Field data * @return DomainServiceDBO Domain Service DBO for this TLD * @throws RecordNotFoundException */ public function validate($data) { $data = parent::validate($data); try { $domainDBO = load_DomainServiceDBO($data); } catch (DBNoRowsFoundException $e) { throw new RecordNotFoundException("DomainService"); } if ($this->fieldConfig['publicitemsonly'] && !$domainDBO->isPublic()) { throw new RecordNotFoundException("DomainService"); } return $domainDBO; }
/** * Validate an OrderItem ID * * Verifies that the order exists. * * @param string $data Field data * @return OrderItemDBO OrderItem DBO for this OrderItem ID * @throws RecordNotFoundException */ public function validate($data) { $data = parent::validate($data); if ($this->order == null) { // Can not validate an order item without an order property throw new SWException("Attempted to validate an OrderItem without giving an OrderDBO!"); } if (null == ($orderItemDBO = $this->order->getItem(intval($data)))) { // Order Item does not exist throw new RecordNotFoundException("OrderItem"); } return $orderItemDBO; }
/** * Validate a Payment ID * * Verifies that the payment exists. * * @param string $data Field data * @return PaymentDBO Payment DBO for this Payment ID * @throws RecordNotFoundException */ public function validate($data) { $data = parent::validate($data); try { $paymentDBO = load_PaymentDBO(intval($data)); } catch (DBNoRowsFoundException $e) { throw new RecordNotFoundException("Payment"); } // Verify that this payment belongs to the invocie specified if (isset($this->invoiceID) && $paymentDBO->getInvoiceID() != $this->invoiceID) { throw new FieldException("Invoice/Payment mismatch"); } return $paymentDBO; }
/** * Validate a Product Purchase ID * * Verifies that the server exists. * * @param string $data Field data * @return ProductPurchaseDBO Purchase DBO for this ProductPurchase ID * @throws RecordNotFoundException */ public function validate($data) { $data = parent::validate($data); try { $purchaseDBO = load_ProductPurchaseDBO(intval($data)); } catch (DBNoRowsFoundException $e) { throw new RecordNotFoundException("ProductPurchase"); } // Verify that this purchase is for a specific account if (isset($this->accountID) && $purchaseDBO->getAccountID() != $this->accountID) { throw new FieldException("Purchase/Account mismatch"); } return $purchaseDBO; }
/** * Validate a Module * * Verifies that a module exists. * * @param string $data Field data * @return ModuleDBO Module DBO for this Module ID * @throws RecordNotFoundException */ public function validate($data) { global $conf; $data = parent::validate($data); try { $module = ModuleRegistry::getModuleRegistry()->getModule($data); if (isset($this->type) && $module->getType() != $this->type) { throw new FieldException("Invalid module type"); } } catch (ModuleDoesNotExistException $e) { throw new RecordNotFoundException("Module"); } return $module; }
public function getJsonData() { return array_merge(parent::getJsonData(), array('any' => $this->allowAny(), 'value' => $this->value)); }
<?php $clinic_id = Request::Field("clinic_id"); $vnd_id = intval(Request::Field('vnd_id')); $fieldsArr['vnd_first_name'] = Request::Field('vnd_first_name'); $fieldsArr['vnd_last_name'] = Request::Field('vnd_last_name'); $fieldsArr['vnd_email'] = Request::Field('vnd_email'); $fieldsArr['vnd_active'] = Request::Field('vnd_active'); $fieldsArr['vnd_username'] = Request::Field('vnd_username'); $fieldsArr['vnd_password'] = Request::Field('vnd_password'); $Doctor = new Doctor($vnd_id); if (FieldValidator::validateFields($fieldsArr, $Doctor) != 1) { Redirect("/admin/dashboard/doctors/edit?Message=" . urlencode(FieldValidator::$error) . "&novalid=1&" . Request::getQueryString()); } if ($vnd_id == 0) { $fieldsArr['vnd_entrydate'] = date("Y-m-d H:i:s"); $fieldsArr['vnd_entryip'] = $_SERVER['REMOTE_ADDR']; Database::Insert("vnd_doctors", $fieldsArr); Redirect("/admin/dashboard/doctors?clinic_id={$clinic_id}&Message=" . urlencode("You have added this Doctor.")); } else { Database::Update("vnd_doctors", $fieldsArr, $vnd_id, "vnd_id"); Redirect("/admin/dashboard/doctors?clinic_id={$clinic_id}&Message=" . urlencode("You have updated this Doctor.")); }
public function getJsonData() { return array_merge(parent::getJsonData(), array('checked' => $this->checked)); }
/** * Returns the validation error message for a field. * * @param Field $field A field. * * @return string (X)HTML. */ protected function validateField(Field $field) { $fieldValidator = new FieldValidator($this->form->getName(), $field); return $fieldValidator->validate(); }
public function getJsonData() { return array_merge(parent::getJsonData(), array('pattern' => $this->localPattern)); }
<?php $vnd_id = intval(Request::Field('vnd_id')); $fieldsArr['vnd_id'] = Request::Field('vnd_id'); $fieldsArr['vnd_username'] = Request::Field('vnd_username'); $fieldsArr['vnd_first_name'] = Request::Field('vnd_first_name'); $fieldsArr['vnd_last_name'] = Request::Field('vnd_last_name'); $fieldsArr['vnd_email'] = Request::Field('vnd_email'); $fieldsArr['vnd_date_created'] = Request::Field('vnd_date_created'); $fieldsArr['vnd_last_login'] = Request::Field('vnd_last_login'); $fieldsArr['vnd_user_type'] = Request::Field('vnd_user_type'); $fieldsArr['vnd_access_level'] = Request::Field('vnd_access_level'); $fieldsArr['vnd_deleted'] = Request::Field('vnd_deleted'); $fieldsArr['vnd_entry_ip'] = Request::Field('vnd_entry_ip'); $fieldsArr['vnd_password'] = Request::Field('vnd_password'); $User = new User($vnd_id); if (FieldValidator::validateFields($fieldsArr, $User) != -1) { Redirect("/dashboard/users/edit?Message=" . urlencode(FieldValidator::$error) . "&novalid=1&" . Request::getQueryString()); } if ($vnd_id == 0) { Database::Insert("vnd_users", $fieldsArr); Redirect("/dashboard/users.php?Message=" . urlencode("You have added this User.")); } else { Database::Update("vnd_users", $fieldsArr, vnd_id); Redirect("/dashboard/users.php?Message=" . urlencode("You have updated this User.")); }