function __construct($method,$paypalPlugin) { parent::__construct($method,$paypalPlugin); //Set the credentials if ($this->_method->sandbox ) { $this->api_login_id = $this->_method->sandbox_api_login_id; $this->api_signature = $this->_method->sandbox_api_signature; $this->api_password = $this->_method->sandbox_api_password; $this->payflow_partner = $this->_method->sandbox_payflow_partner; $this->payflow_vendor = $this->_method->sandbox_payflow_vendor; } else { $this->api_login_id = $this->_method->api_login_id; $this->api_signature = $this->_method->api_signature; $this->api_password = $this->_method->api_password; } if (empty($this->api_login_id) || empty($this->api_signature) || empty($this->api_password)) { $text = JText::sprintf('VMPAYMENT_PAYPAL_CREDENTIALS_NOT_SET', $this->_method->payment_name, $this->_method->virtuemart_paymentmethod_id); vmError($text, $text); } if ((empty ($this->_method->payflow_partner) OR empty($this->_method->sandbox_payflow_partner))) { $sandbox = ""; if ($this->_method->sandbox ) { $sandbox = 'SANDBOX_'; } $text = JText::sprintf('VMPAYMENT_PAYPAL_PARAMETER_REQUIRED', JText::_('VMPAYMENT_PAYPAL_' . $sandbox . 'PAYFLOW_PARTNER'), $this->_method->payment_name, $this->_method->virtuemart_paymentmethod_id); vmError($text); } }
function __construct($method, $paypalPlugin) { parent::__construct($method, $paypalPlugin); //Set the credentials if ($this->_method->sandbox) { $this->api_login_id = $this->_method->sandbox_api_login_id; if ($this->_method->authentication == 'signature') { $this->api_signature = trim($this->_method->sandbox_api_signature); $this->api_certificate = ''; } else { $this->api_signature = ''; $this->api_certificate = trim($this->_method->sandbox_api_certificate); } $this->api_password = trim($this->_method->sandbox_api_password); $this->merchant_email = trim($this->_method->sandbox_merchant_email); } else { $this->api_login_id = trim($this->_method->api_login_id); $this->api_signature = trim($this->_method->api_signature); $this->api_certificate = trim($this->_method->api_certificate); $this->api_password = trim($this->_method->api_password); $this->merchant_email = trim($this->_method->paypal_merchant_email); } if (!$this->ExpCredentialsValid() or !$this->isAacceleratedOnboardingValid()) { $text = vmText::sprintf('VMPAYMENT_PAYPAL_CREDENTIALS_NOT_SET', $this->_method->payment_name, $this->_method->virtuemart_paymentmethod_id); vmError($text, $text); } if (empty($this->_method->expected_maxamount)) { $text = vmText::sprintf('VMPAYMENT_PAYPAL_PARAMETER_REQUIRED', vmText::_('VMPAYMENT_PAYPAL_EXPECTEDMAXAMOUNT'), $this->_method->payment_name, $this->_method->virtuemart_paymentmethod_id); vmError($text, $text); } }
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(); }
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(); }
/** * This function does not allow unicode, replacement for JPath::clean * and makesafe * @param $string * @param bool $forceNoUni * @return mixed|string */ static function filterPath($str) { if (empty($str)) { vmError('filterPath empty string check your paths '); vmTrace('Critical error, empty string in filterPath'); return VMPATH_ROOT; } $str = trim($str); // Delete all '?' $str = str_replace('?', '', $str); // Replace double byte whitespaces by single byte (East Asian languages) $str = preg_replace('/\\xE3\\x80\\x80/', ' ', $str); $unicodeslugs = VmConfig::get('transliterateSlugs', false); if ($unicodeslugs) { $lang = JFactory::getLanguage(); $str = $lang->transliterate($str); } //This is a path, so remove all strange slashes $str = str_replace('/', DS, $str); //Clean from possible injection while (strpos($str, '..') !== false) { $str = str_replace('..', '', $str); } $str = preg_replace('#[/\\\\]+#', DS, $str); $str = filter_var($str, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW); return $str; }
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(); }
/** * Records in this table do not need to exist, so we might need to create a record even * if the primary key is set. Therefore we need to overload the store() function. * * @author Max Milbers * @see libraries/joomla/database/JTable#store($updateNulls) */ public function store($updateNulls = false) { $this->setLoggableFieldsForStore(); $this->storeParams(); $tblKey = $this->_tbl_key; $pKey = $this->_pkey; if($tblKey == $pKey){ vmdebug('VmTableData '.get_class($this). ' need not to be a vmtabledata $tblKey == $pKey'); $res = false; if(!empty($this->$tblKey)){ $_qry = 'SELECT `'.$this->_tbl_key.'` ' . 'FROM `'.$this->_tbl.'` ' . 'WHERE `'.$this->_tbl_key.'` = "' . $this->$tblKey.'" '; $this->_db->setQuery($_qry); $res = $this->_db->loadResult(); } if($res){ $returnCode = $this->_db->updateObject($this->_tbl, $this, $this->_tbl_key, $updateNulls); } else { $returnCode = $this->_db->insertObject($this->_tbl, $this, $this->_tbl_key); } } else { if(!empty($this->$pKey)){ $_qry = 'SELECT `'.$this->_tbl_key.'` ' . 'FROM `'.$this->_tbl.'` ' . 'WHERE `'.$this->_pkey.'` = "' . $this->$pKey.'" '; $this->_db->setQuery($_qry); //Yes, overwriting $this->$tblKey is correct ! $this->$tblKey = $this->_db->loadResult(); } if ( !empty($this->$tblKey) ) { $returnCode = $this->_db->updateObject($this->_tbl, $this, $this->_tbl_key, $updateNulls); } else { $returnCode = $this->_db->insertObject($this->_tbl, $this, $this->_tbl_key); } } //reset Params if(isset($this->_tmpParams)){ foreach($this->_tmpParams as $k => $v){ $this->$k = $v; } } $this->_tmpParams = false; if (!$returnCode) { vmError(get_class($this) . '::store failed - ' . $this->_db->getErrorMsg()); return false; } else { return true; } }
function check() { if (empty($this->notify_email) || !filter_var($this->notify_email, FILTER_VALIDATE_EMAIL)) { vmError(tsmText::_('com_tsmart_ENTER_A_VALID_EMAIL_ADDRESS'), tsmText::_('com_tsmart_ENTER_A_VALID_EMAIL_ADDRESS')); return false; } return parent::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(); }
/** * 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(); }
function displayErrors($errors) { foreach ($errors as $error) { vmError(vmText::sprintf('VMPAYMENT_SOFORT_ERROR_FROM', $error['message'], $error['field'], $error['code'])); vmInfo(vmText::sprintf('VMPAYMENT_SOFORT_ERROR_FROM', $error['message'], $error['field'], $error['code'])); if ($error['message'] == 401) { vmdebug('check you payment parameters: custom_id, project_id, api key'); } } }
function display($tpl = 'pdf') { if (!file_exists(JPATH_VM_LIBRARIES . '/tcpdf/tcpdf.php')) { vmError('View pdf: For the pdf invoice, you must install the tcpdf library at ' . JPATH_VM_LIBRARIES . '/tcpdf'); } else { $viewName = jRequest::getWord('view', 'productdetails'); $class = 'VirtueMartView' . ucfirst($viewName); JLoader::register($class, JPATH_VM_SITE . '/views/' . $viewName . '/view.html.php'); $view = new $class(); $view->display($tpl); } }
public function bindChecknStore(&$data, $preload = false) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('products_en_gb.tsmart_product_id')->from('#__tsmart_products AS products')->leftJoin('#__tsmart_products_en_gb AS products_en_gb USING(tsmart_product_id)')->where('products_en_gb.tsmart_product_id!=' . (int) $data['tsmart_product_id'])->where('products_en_gb.product_name = ' . $query->q("{$data['product_name']}")); $db->setQuery($query); $list_tour = $db->loadObjectList(); if (count($list_tour) > 0) { vmError('tour name exists, please select other tour name'); return false; } return parent::bindChecknStore($data, $preload); // TODO: Change the autogenerated stub }
function display($tpl = 'pdf') { if (!file_exists(JPATH_VM_LIBRARIES . DS . 'tcpdf' . DS . 'tcpdf.php')) { vmError('View pdf: For the pdf invoice, you must install the tcpdf library at ' . JPATH_VM_LIBRARIES . DS . 'tcpdf'); } else { $viewName = jRequest::getWord('view', 'productdetails'); $class = 'VirtueMartView' . ucfirst($viewName); if (!class_exists($class)) { require JPATH_VM_SITE . DS . 'views' . DS . $viewName . DS . 'view.html.php'; } $view = new $class(); $view->display($tpl); } }
public function bindChecknStore(&$data, $preload = false) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('itinerary.tsmart_itinerary_id')->from('#__tsmart_itinerary AS itinerary')->where('itinerary.tsmart_itinerary_id!=' . (int) $data['tsmart_itinerary_id'])->where('itinerary.tsmart_product_id=' . (int) $data['tsmart_product_id'])->where('itinerary.title = ' . $query->q("{$data['title']}")); $db->setQuery($query); $list_itinerary = $db->loadObjectList(); if (count($list_itinerary) > 0) { vmError('itinerary title exists, please select other itinerary title'); return false; } return parent::bindChecknStore($data, $preload); // TODO: Change the autogenerated stub }
/** * Delete all record ids selected * * @return boolean True is the remove was successful, false otherwise. */ function remove($categoryIds) { $table = $this->getTable('manufacturercategories'); foreach ($categoryIds as $categoryId) { if ($table->checkManufacturer($categoryId)) { if (!$table->delete($categoryId)) { return false; } } else { vmError(get_class($this) . '::remove ' . $categoryId . ' failed'); return false; } } return true; }
/** * 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(); }
/** * @param $cData */ public function __construct($cData) { $this->path = JPATH_VMKLARNAPLUGIN . '/klarna/'; if (!class_exists('ShopFunctions')) { require VMPATH_ADMIN . DS . 'helpers' . DS . 'shopfunctions.php'; } $this->cData = $cData; //$this->currencyId = ShopFunctions::getCurrencyIDByName($this->cData['currency_code']); //vmdebug ('klarna_productPrice', $this->cData); try { $this->klarna_virtuemart = new Klarna_virtuemart(); $this->klarna_virtuemart->config($this->cData['eid'], $this->cData['secret'], $this->cData['country'], $this->cData['language'], $this->cData['currency'], $this->cData['mode'], VMKLARNA_PC_TYPE, KlarnaHandler::getKlarna_pc_type(), FALSE); } catch (Exception $e) { vmDebug('klarna_productPrice', $e->getMessage(), $e->getFile(), $e->getLine(), $this->cData); vmError('klarna_productPrice', 'klarna_productPrice: ' . $e->getMessage() . " country:" . $this->cData['country_code_3']); unset($this->klarna); } }
function __construct($method, $paypalPlugin) { parent::__construct($method, $paypalPlugin); //Set the credentials if ($this->_method->sandbox) { $this->merchant_email = $this->_method->sandbox_merchant_email; } else { $this->merchant_email = $this->_method->paypal_merchant_email; } if (empty($this->merchant_email)) { $sandbox = ""; if ($this->_method->sandbox) { $sandbox = 'SANDBOX_'; } $text = vmText::sprintf('VMPAYMENT_PAYPAL_PARAMETER_REQUIRED', vmText::_('VMPAYMENT_PAYPAL_' . $sandbox . 'MERCHANT'), $this->_method->payment_name, $this->_method->virtuemart_paymentmethod_id); vmError($text, $text); return FALSE; } }
function __construct($method, $paypalPlugin) { parent::__construct($method, $paypalPlugin); //Set the credentials if ($this->_method->sandbox) { $this->api_login_id = trim($this->_method->sandbox_api_login_id); $this->api_signature = trim($this->_method->sandbox_api_signature); $this->api_password = trim($this->_method->sandbox_api_password); } else { $this->api_login_id = trim($this->_method->api_login_id); $this->api_signature = trim($this->_method->api_signature); $this->api_password = trim($this->_method->api_password); } if (empty($this->api_login_id) || empty($this->api_signature) || empty($this->api_password)) { $text = tsmText::sprintf('VMPAYMENT_PAYPAL_CREDENTIALS_NOT_SET', $this->_method->payment_name, $this->_method->virtuemart_paymentmethod_id); vmError($text, $text); } }
/** * Bind the post data to the manufacturer table and save it * * @author Roland * @author Max Milbers * @return boolean True is the save was successful, false otherwise. */ public function store(&$data) { // Setup some place holders $table = $this->getTable('manufacturers'); $table->bindChecknStore($data); $errors = $table->getErrors(); foreach ($errors as $error) { vmError($error); } // Process the images $mediaModel = VmModel::getModel('Media'); $mediaModel->storeMedia($data, 'manufacturer'); $errors = $mediaModel->getErrors(); foreach ($errors as $error) { vmError($error); } return $table->virtuemart_manufacturer_id; }
/** * Delete all record ids selected * * @return boolean True is the remove was successful, false otherwise. */ function remove($categoryIds) { if (!vmAccess::manager('manufacturercategories')) { vmWarn('Insufficient permissions to delete manufacturer category'); return false; } $table = $this->getTable('manufacturercategories'); foreach ($categoryIds as $categoryId) { if ($table->checkManufacturer($categoryId)) { if (!$table->delete($categoryId)) { return false; } } else { vmError(get_class($this) . '::remove ' . $categoryId . ' failed'); return false; } } return true; }
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(); }
/** * Records in this table do not need to exist, so we might need to create a record even * if the primary key is set. Therefore we need to overload the store() function. * * @author Max Milbers * @see libraries/joomla/database/JTable#store($updateNulls) */ public function store($updateNulls = false) { $this->setLoggableFieldsForStore(); $this->storeParams(); $tblKey = $this->_tbl_key; $pKey = $this->_pkey; if ($tblKey == $pKey) { $res = false; if (!empty($this->{$tblKey})) { $_qry = 'SELECT `' . $this->_tbl_key . '` ' . 'FROM `' . $this->_tbl . '` ' . 'WHERE `' . $this->_tbl_key . '` = "' . $this->{$tblKey} . '" '; $this->_db->setQuery($_qry); $res = $this->_db->loadResult(); } if ($res) { $returnCode = $this->_db->updateObject($this->_tbl, $this, $this->_tbl_key, $updateNulls); } else { $returnCode = $this->_db->insertObject($this->_tbl, $this, $this->_tbl_key); } } else { if (!empty($this->{$pKey})) { $_qry = 'SELECT `' . $this->_tbl_key . '` ' . 'FROM `' . $this->_tbl . '` ' . 'WHERE `' . $this->_pkey . '` = "' . $this->{$pKey} . '" '; $this->_db->setQuery($_qry); //Yes, overwriting $this->$tblKey is correct ! $this->{$tblKey} = $this->_db->loadResult(); } if (!empty($this->{$tblKey})) { $returnCode = $this->_db->updateObject($this->_tbl, $this, $this->_tbl_key, $updateNulls); } else { $returnCode = $this->_db->insertObject($this->_tbl, $this, $this->_tbl_key); } } // vmdebug('$_qry',$_qry,$pKey,$tblKey, $this->$tblKey); // vmError($_qry,'$_qry'); if (!$returnCode) { vmError(get_class($this) . '::store failed - ' . $this->_db->getErrorMsg()); return false; } else { return true; } }
/** * Add, change or drop userfields * * @param string $_act Action: ADD, DROP or CHANGE (synonyms available, see the switch cases) * @param string $_col Column name * @param string $_type Fieldtype * @return boolean True on success */ function _modifyColumn($_act, $_col, $_type = '') { $_sql = "ALTER TABLE `#__virtuemart_order_userinfos` "; $_check_act = strtoupper(substr($_act, 0, 3)); switch ($_check_act) { case 'ADD': case 'CRE': // Create $_sql .= "ADD {$_col} {$_type} "; break; case 'DRO': // Drop // Drop case 'DEL': // Delete $_sql .= "DROP {$_col} "; break; case 'MOD': // Modify // Modify case 'UPD': // Update // Update case 'CHA': // Change $_sql .= "CHANGE {$_col} {$_col} {$_type} "; break; } $this->_db->setQuery($_sql); $this->_db->query(); if ($this->_db->getErrorNum() != 0) { vmError(get_class($this) . '::modify table - ' . $this->_db->getErrorMsg()); return false; } return true; }
private function initRealexInterface($loadCDFromPost = true) { // TODO check if cart is empty $virtuemart_paymentmethod_id = vRequest::getInt('pm', false); $this->_currentMethod = $this->getVmPluginMethod($virtuemart_paymentmethod_id); if (!$this->selectedThisElement($this->_currentMethod->payment_element)) { vmError('Programmer error: missing the pm parameter'); $this->redirectToCart(); return FALSE; } $realexInterface = $this->_loadRealexInterface(); $realexInterface->loadCustomerData($loadCDFromPost); $order_number = vRequest::getString('order_number', false); if (!($virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number))) { $this->redirectToCart(); return FALSE; } $orderModel = VmModel::getModel('orders'); $order = $orderModel->getOrder($virtuemart_order_id); $realexInterface->setOrder($order); $realexInterface->setPaymentCurrency(); $realexInterface->setTotalInPaymentCurrency($order['details']['BT']->order_total); return $realexInterface; }
public static function storeConfig() { $user = JFactory::getUser(); if ($user->authorise('core.admin', 'com_virtuemart')) { $installed = VirtueMartModelConfig::checkVirtuemartInstalled(); if ($installed) { VirtueMartModelConfig::installVMconfigTable(); $confData = array(); $confData['virtuemart_config_id'] = 1; $confData['config'] = VmConfig::$_jpConfig->toString(); $confTable = VmTable::getInstance('configs', 'Table', array()); if (!$confTable->bindChecknStore($confData)) { vmError('storeConfig was not able to store config'); } } else { self::$_virtuemart_vendor_id = 1; } } }
/** * Delete all calcs selected * * @author Max Milbers * @param array $cids categories to remove * @return boolean if the item remove was successful */ public function remove($cids) { JRequest::checkToken() or jexit( 'Invalid Token, in remove category'); $table = $this->getTable($this->_maintablename); $cat = $this->getTable('calc_categories'); $sgrp = $this->getTable('calc_shoppergroups'); $countries = $this->getTable('calc_countries'); $states = $this->getTable('calc_states'); $ok = true; foreach($cids as $id) { $id = (int)$id; vmdebug('remove '.$id); if (!$table->delete($id)) { vmError(get_class( $this ).'::remove '.$id.' '.$table->getError()); $ok = false; } if (!$cat->delete($id)) { vmError(get_class( $this ).'::remove '.$id.' '.$cat->getError()); $ok = false; } if (!$sgrp->delete($id)) { vmError(get_class( $this ).'::remove '.$id.' '.$sgrp->getError()); $ok = false; } if (!$countries->delete($id)) { vmError(get_class( $this ).'::remove '.$id.' '.$countries->getError()); $ok = false; } if (!$states->delete($id)) { vmError(get_class( $this ).'::remove '.$id.' '.$states->getError()); $ok = false; } // if(!class_exists('vmPSPlugin')) require(JPATH_VM_PLUGINS.DS.'vmpsplugin.php'); JPluginHelper::importPlugin('vmcalculation'); $dispatcher = JDispatcher::getInstance(); $returnValues = $dispatcher->trigger('plgVmDeleteCalculationRow', array( $id)); } return $ok; }
/** * Add customer to the waiting list for specific product * * @author Seyi Awofadeju * @return insert_id if the save was successful, false otherwise. */ public function adduser($data) { JRequest::checkToken() or jexit('Invalid Token, in notify customer'); $field = $this->getTable('waitingusers'); if (!$field->bind($data)) { // Bind data vmError($field->getError()); return FALSE; } if (!$field->check()) { // Perform data checks vmError($field->getError()); return FALSE; } $_id = $field->store(); if ($_id === FALSE) { // Write data to the DB vmError($field->getError()); return FALSE; } //jexit(); return $_id; }
/** * Delete all record ids selected * * @return boolean True is the remove was successful, false otherwise. */ function remove($userIds) { $user = JFactory::getUser(); if ($user->authorise('core.admin', 'com_virtuemart') or $user->authorise('core.manage', 'com_virtuemart')) { $userInfo = $this->getTable('userinfos'); $vm_shoppergroup_xref = $this->getTable('vmuser_shoppergroups'); $vmusers = $this->getTable('vmusers'); $_status = true; foreach ($userIds as $userId) { $_JUser = JUser::getInstance($userId); if ($this->getSuperAdminCount() <= 1) { // Prevent deletion of the only Super Admin //$_u = JUser::getInstance($userId); if ($_JUser->get('gid') == __SUPER_ADMIN_GID) { vmError(vmText::_('COM_VIRTUEMART_USER_ERR_LASTSUPERADMIN')); $_status = false; continue; } } $user = JFactory::getUser(); if ($user->authorise('core.admin', 'com_virtuemart') or $user->authorise('core.manage', 'com_virtuemart')) { if ($_JUser->get('gid') == __SUPER_ADMIN_GID) { vmError(vmText::_('COM_VIRTUEMART_USER_ERR_LASTSUPERADMIN')); $_status = false; continue; } } if (!$userInfo->delete($userId)) { vmError($userInfo->getError()); return false; } if (!$vm_shoppergroup_xref->delete($userId)) { vmError($vm_shoppergroup_xref->getError()); // Signal but continue $_status = false; continue; } if (!$vmusers->delete($userId)) { vmError($vmusers->getError()); // Signal but continue $_status = false; continue; } if (!$_JUser->delete()) { vmError($_JUser->getError()); $_status = false; continue; } } } return $_status; }