本文整理汇总了PHP中VmTable::check方法的典型用法代码示例。如果您正苦于以下问题:PHP VmTable::check方法的具体用法?PHP VmTable::check怎么用?PHP VmTable::check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VmTable
的用法示例。
在下文中一共展示了VmTable::check方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check
function check()
{
if (empty($this->shopper_group_name)) {
vmError(JText::_('COM_VIRTUEMART_SHOPPERGROUP_RECORDS_MUST_HAVE_NAME'));
return false;
} else {
if (function_exists('mb_strlen')) {
if (mb_strlen($this->shopper_group_name) > 32) {
vmError(JText::_('COM_VIRTUEMART_SHOPPERGROUP_NAME_LESS_THAN_32_CHARACTERS'));
return false;
}
} else {
if (strlen($this->shopper_group_name) > 32) {
vmError(JText::_('COM_VIRTUEMART_SHOPPERGROUP_NAME_LESS_THAN_32_CHARACTERS'));
return false;
}
}
}
/* commented by PATRICK This set always shoppergroup to 1 if you do a new shoppergroup
if(empty($this->virtuemart_shoppergroup_id)){
$q = 'SELECT `virtuemart_shoppergroup_id` FROM `#__virtuemart_shoppergroups` WHERE `default`="1" AND `virtuemart_vendor_id`="1" ';
$this->_db->setQuery($q);
$this->virtuemart_shoppergroup_id=$this->_db->loadResult();
}
*/
return parent::check();
}
示例2: check
function check()
{
if (empty($this->shopper_group_name)) {
vmError('COM_VIRTUEMART_SHOPPERGROUP_RECORDS_MUST_HAVE_NAME');
return false;
} else {
if (function_exists('mb_strlen')) {
$length = mb_strlen($this->shopper_group_name);
} else {
$length = strlen($this->shopper_group_name);
}
if ($length > 128) {
vmError('COM_VIRTUEMART_SHOPPERGROUP_NAME_128');
}
}
if ($this->virtuemart_shoppergroup_id == 1) {
$this->default = 2;
$this->sgrp_additional = 0;
}
if ($this->virtuemart_shoppergroup_id == 2) {
$this->default = 1;
$this->sgrp_additional = 0;
}
return parent::check();
}
示例3: check
function check()
{
if (empty($this->notify_email) || !filter_var($this->notify_email, FILTER_VALIDATE_EMAIL)) {
vmError(JText::_('COM_VIRTUEMART_ENTER_A_VALID_EMAIL_ADDRESS'), JText::_('COM_VIRTUEMART_ENTER_A_VALID_EMAIL_ADDRESS'));
return false;
}
return parent::check();
}
示例4: check
/**
* Validates the userfields record fields.
*
* @return boolean True if the table buffer is contains valid data, false otherwise.
*/
function check($nrOfValues)
{
if (preg_match('/[^a-z0-9\\._\\-]/i', $this->group_name) > 0) {
vmError(JText::_('COM_VIRTUEMART_PERMISSION_GROUP_NAME_INVALID_CHARACTERS'));
return false;
}
return parent::check();
}
示例5: check
function check()
{
if (!empty($this->customfield_price)) {
$this->customfield_price = str_replace(array(',', ' '), array('.', ''), $this->customfield_price);
} else {
$this->customfield_price = null;
}
return parent::check();
}
示例6: check
/**
* Validates the userfields record fields.
*
* @return boolean True if the table buffer is contains valid data, false otherwise.
*/
function check()
{
if (preg_match('/[^a-z0-9\\._\\-]/i', $this->name) > 0) {
vmError(vmText::_('COM_VIRTUEMART_NAME_OF_USERFIELD_CONTAINS_INVALID_CHARACTERS'));
return false;
}
if ($this->name != 'virtuemart_country_id' and $this->name != 'virtuemart_state_id') {
$reqValues = array('select', 'multiselect', 'radio', 'multicheckbox');
if (in_array($this->type, $reqValues) and $this->_nrOfValues == 0) {
vmError(vmText::_('COM_VIRTUEMART_VALUES_ARE_REQUIRED_FOR_THIS_TYPE'));
return false;
}
}
return parent::check();
}
示例7: check
/**
* Validates the order status record fields.
*
* @return boolean True if the table buffer is contains valid data, false otherwise.
*/
function check()
{
$db = JFactory::getDBO();
$q = 'SELECT count(*),virtuemart_orderstate_id FROM `#__virtuemart_orderstates` ';
$q .= 'WHERE `order_status_code`="' . $this->order_status_code . '"';
$db->setQuery($q);
$row = $db->loadRow();
if (is_array($row)) {
if ($row[0] > 0) {
if ($row[1] != $this->virtuemart_orderstate_id) {
vmError(vmText::_('COM_VIRTUEMART_ORDER_STATUS_CODE_EXISTS'));
return false;
}
}
}
return parent::check();
}
示例8: check
function check()
{
if (empty($this->shopper_group_name)) {
vmError(JText::_('COM_VIRTUEMART_SHOPPERGROUP_RECORDS_MUST_HAVE_NAME'));
return false;
} else {
if (function_exists('mb_strlen')) {
if (mb_strlen($this->shopper_group_name) > 32) {
vmError(JText::_('COM_VIRTUEMART_SHOPPERGROUP_NAME_LESS_THAN_32_CHARACTERS'));
return false;
}
} else {
if (strlen($this->shopper_group_name) > 32) {
vmError(JText::_('COM_VIRTUEMART_SHOPPERGROUP_NAME_LESS_THAN_32_CHARACTERS'));
return false;
}
}
}
return parent::check();
}
示例9: check
function check()
{
$ok = TRUE;
$notice = TRUE;
if (empty($this->file_type) and empty($this->file_is_forSale)) {
$ok = FALSE;
vmError(vmText::sprintf('COM_VIRTUEMART_MEDIA_NO_TYPE'), $this->file_name);
}
if (!empty($this->file_url)) {
if (function_exists('mb_strlen')) {
$length = mb_strlen($this->file_url);
} else {
$length = strlen($this->file_url);
}
if ($length > 254) {
vmError(JText::sprintf('COM_VIRTUEMART_URL_TOO_LONG', $length));
}
if (strpos($this->file_url, '..') !== FALSE) {
$ok = FALSE;
vmError(vmText::sprintf('COM_VIRTUEMART_URL_NOT_VALID', $this->file_url));
}
if (empty($this->virtuemart_media_id)) {
$q = 'SELECT `virtuemart_media_id`,`file_url` FROM `' . $this->_tbl . '` WHERE `file_url` = "' . $this->_db->escape($this->file_url) . '" ';
$this->_db->setQuery($q);
$unique_id = $this->_db->loadAssocList();
$count = count($unique_id);
if ($count !== 0) {
if ($count == 1) {
if (empty($this->virtuemart_media_id)) {
$this->virtuemart_media_id = $unique_id[0]['virtuemart_media_id'];
} else {
vmError(vmText::_('COM_VIRTUEMART_MEDIA_IS_ALREADY_IN_DB'));
$ok = FALSE;
}
} else {
// vmError(vmText::_('COM_VIRTUEMART_MEDIA_IS_DOUBLED_IN_DB'));
vmError(vmText::_('COM_VIRTUEMART_MEDIA_IS_DOUBLED_IN_DB'));
$ok = FALSE;
}
}
}
} else {
vmError(vmText::_('COM_VIRTUEMART_MEDIA_MUST_HAVE_URL'));
$ok = FALSE;
}
if (empty($this->file_title) && !empty($this->file_name)) {
$this->file_title = $this->file_name;
}
if (!empty($this->file_title)) {
if (strlen($this->file_title) > 126) {
vmError(vmText::sprintf('COM_VIRTUEMART_TITLE_TOO_LONG', strlen($this->file_title)));
}
$q = 'SELECT * FROM `' . $this->_tbl . '` ';
$q .= 'WHERE `file_title`="' . $this->_db->escape($this->file_title) . '" AND `file_type`="' . $this->_db->escape($this->file_type) . '"';
$this->_db->setQuery($q);
$unique_id = $this->_db->loadAssocList();
$tblKey = 'virtuemart_media_id';
if (!empty($unique_id)) {
foreach ($unique_id as $item) {
if ($item['virtuemart_media_id'] != $this->virtuemart_media_id) {
$lastDir = substr($this->file_url, 0, strrpos($this->file_url, '/'));
$lastDir = substr($lastDir, strrpos($lastDir, '/') + 1);
if (!empty($lastDir)) {
$this->file_title = $this->file_title . '_' . $lastDir;
} else {
$this->file_title = $this->file_title . '_' . rand(1, 9);
}
}
}
}
} else {
vmError(vmText::_('COM_VIRTUEMART_MEDIA_MUST_HAVE_TITLE'));
$ok = FALSE;
}
if (!empty($this->file_description)) {
if (strlen($this->file_description) > 254) {
vmError(vmText::sprintf('COM_VIRTUEMART_DESCRIPTION_TOO_LONG', strlen($this->file_description)));
}
}
// $app = JFactory::getApplication();
//vmError('Checking '.$this->file_url);
if (empty($this->file_mimetype)) {
$rel_path = str_replace('/', DS, $this->file_url);
//The function mime_content_type is deprecated, we may use
/*function _mime_content_type($filename)
{
$result = new finfo();
if (is_resource($result) === true)
{
return $result->file($filename, FILEINFO_MIME_TYPE);
}
return false;
}
if (function_exists ('mime_content_type')) {
$ok = TRUE;
$app = JFactory::getApplication ();
if (!$this->file_is_forSale) {
//.........这里部分代码省略.........
示例10: check
/**
* Validates the userfields record fields.
*
* @return boolean True if the table buffer is contains valid data, false otherwise.
*/
function check($nrOfValues)
{
// if (!$this->name) {
// vmError(JText::_('COM_VIRTUEMART_USERFIELD_MUST_HAVE_NAME'));
// return false;
// }
// if (!$this->title) {
// vmError(JText::_('COM_VIRTUEMART_USERFIELD_MUST_HAVE_TITLE'));
// return false;
// }
if (preg_match('/[^a-z0-9\\._\\-]/i', $this->name) > 0) {
vmError(JText::_('COM_VIRTUEMART_NAME_OF_USERFIELD_CONTAINS_INVALID_CHARACTERS'));
return false;
}
$reqValues = array('select', 'multiselect', 'radio', 'multicheckbox');
if (in_array($this->type, $reqValues) && $nrOfValues == 0) {
vmError(JText::_('COM_VIRTUEMART_VALUES_ARE_REQUIRED_FOR_THIS_TYPE'));
return false;
}
/** if ($this->virtuemart_userfield_id == 0) {
$_sql = 'SELECT COUNT(*) AS c '
. 'FROM `#__virtuemart_userfields`'
. "WHERE name = '" . $this->_db->getEscaped($this->name) . "' ";
$this->_db->setQuery($_sql);
$_c = $this->_db->loadResultArray();
if ($_c[0] > 0) {
vmError(JText::_('COM_VIRTUEMART_USERFIELD_ERR_ALREADY', $this->name));
return false;
}
}*/
return parent::check();
}
示例11: check
function check()
{
if (empty($this->shopper_group_name)) {
vmError(vmText::_('COM_VIRTUEMART_SHOPPERGROUP_RECORDS_MUST_HAVE_NAME'));
return false;
} else {
if (function_exists('mb_strlen')) {
if (mb_strlen($this->shopper_group_name) > 128) {
vmError(vmText::_('COM_VIRTUEMART_SHOPPERGROUP_NAME_LESS_THAN_32_CHARACTERS'));
return false;
}
} else {
if (strlen($this->shopper_group_name) > 128) {
vmError(vmText::_('COM_VIRTUEMART_SHOPPERGROUP_NAME_LESS_THAN_32_CHARACTERS'));
return false;
}
}
}
if ($this->virtuemart_shoppergroup_id == 1) {
$this->default = 2;
$this->sgrp_additional = 0;
}
if ($this->virtuemart_shoppergroup_id == 2) {
$this->default = 1;
$this->sgrp_additional = 0;
}
return parent::check();
}
示例12: check
function check()
{
if (empty($this->order_number)) {
if (!class_exists('VirtueMartModelOrders')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
}
$this->order_number = VirtueMartModelOrders::generateOrderNumber((string) time());
}
if (empty($this->order_pass)) {
$this->order_pass = 'p_' . substr(md5((string) time() . $this->order_number), 0, 5);
}
return parent::check();
}
示例13: check
function check()
{
if (empty($this->order_number)) {
if (!class_exists('VirtueMartModelOrders')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
}
$this->order_number = VirtueMartModelOrders::generateOrderNumber((string) time());
}
if (empty($this->order_pass)) {
$this->order_pass = 'p_' . substr(md5((string) time() . $this->order_number), 0, 5);
}
$adminID = JFactory::getSession()->get('vmAdminID');
if (isset($adminID)) {
$this->created_by = $adminID;
}
return parent::check();
}
示例14: check
/**
* Validates the userfields record fields.
*
* @return boolean True if the table buffer is contains valid data, false otherwise.
*/
function check($nrOfValues)
{
if (preg_match('/[^a-z0-9\\._\\-]/i', $this->name) > 0) {
vmError(JText::_('COM_VIRTUEMART_NAME_OF_USERFIELD_CONTAINS_INVALID_CHARACTERS'));
return false;
}
$reqValues = array('select', 'multiselect', 'radio', 'multicheckbox');
if (in_array($this->type, $reqValues) && $nrOfValues == 0) {
vmError(JText::_('COM_VIRTUEMART_VALUES_ARE_REQUIRED_FOR_THIS_TYPE'));
return false;
}
return parent::check();
}
示例15: check
public function check()
{
$csValue = $this->limit_list_step;
if (!empty($csValue)) {
$sequenceArray = explode(',', $csValue);
foreach ($sequenceArray as &$csV) {
$csV = (int) trim($csV);
}
$this->limit_list_step = implode(',', $sequenceArray);
}
return parent::check();
}