本文整理汇总了PHP中vmWarn函数的典型用法代码示例。如果您正苦于以下问题:PHP vmWarn函数的具体用法?PHP vmWarn怎么用?PHP vmWarn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vmWarn函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getOrderShipmentHtml
function getOrderShipmentHtml($virtuemart_order_id)
{
$db = JFactory::getDBO();
$q = 'SELECT * FROM `' . $this->_tablename . '` ' . 'WHERE `virtuemart_order_id` = ' . $virtuemart_order_id;
$db->setQuery($q);
if (!($method = $db->loadObject())) {
vmWarn(500, $q . " " . $db->getErrorMsg());
return '';
}
if (!class_exists('CurrencyDisplay')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php';
}
$currency = CurrencyDisplay::getInstance();
$tax = ShopFunctions::getTaxByID($method->tax_id);
$taxDisplay = is_array($tax) ? $tax['calc_value'] . ' ' . $tax['calc_value_mathop'] : $method->tax_id;
$taxDisplay = $taxDisplay == -1 ? JText::_('COM_VIRTUEMART_PRODUCT_TAX_NONE') : $taxDisplay;
//geting selected parcel
$parcels = $this->_quote();
$title = $parcels[$method->selected_parcel]['title'];
$html = '<table class="adminlist">' . "\n";
$html .= $this->getHtmlHeaderBE();
$html .= $this->getHtmlRowBE('POST24_SM', 'Omniva');
$html .= $this->getHtmlRowBE('POST24_SELECTED_PARCEL', $title);
$html .= $this->getHtmlRowBE('POST24_TOPHONE', $method->phone);
$html .= '</table>' . "\n";
return $html;
}
开发者ID:jflash,项目名称:moodulid25,代码行数:27,代码来源:post24.php
示例2: display
function display($tpl = null)
{
if (!class_exists('VmHTML')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
}
$this->SetViewTitle();
$model = tmsModel::getModel();
$this->state = $model->getItem();
$this->tsmart_country_id = vRequest::getInt('tsmart_country_id', $this->state->tsmart_country_id);
$isNew = count($this->state) < 1;
if (empty($countryId) && $isNew) {
vmWarn('Country id is 0');
return false;
}
$country = tmsModel::getModel('country');
$country->setId($this->tsmart_country_id);
$this->country_name = $country->getData()->country_name;
$layoutName = vRequest::getCmd('layout', 'default');
if ($layoutName == 'edit') {
$zoneModel = tmsModel::getModel('Worldzones');
$this->worldZones = $zoneModel->getWorldZonesSelectList();
$this->addStandardEditViewCommands();
} else {
//get list country
require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmcountries.php';
$list_country = tsmcountries::get_countries();
$this->assignRef('list_country', $list_country);
//end get list country
$this->addStandardDefaultViewCommandsEditInline();
$this->addStandardDefaultViewLists($model);
$this->items = $model->getItemList();
$this->pagination = $model->getPagination();
}
parent::display($tpl);
}
开发者ID:cuongnd,项目名称:etravelservice,代码行数:35,代码来源:view.html.php
示例3: display
function display($tpl = null)
{
if (!class_exists('VmHTML')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
}
$this->SetViewTitle();
$model = VmModel::getModel();
$this->state = $model->getSingleState();
$this->virtuemart_country_id = vRequest::getInt('virtuemart_country_id', $this->state->virtuemart_country_id);
$isNew = count($this->state) < 1;
if (empty($countryId) && $isNew) {
vmWarn('Country id is 0');
return false;
}
$country = VmModel::getModel('country');
$country->setId($this->virtuemart_country_id);
$this->country_name = $country->getData()->country_name;
$layoutName = vRequest::getCmd('layout', 'default');
if ($layoutName == 'edit') {
$zoneModel = VmModel::getModel('Worldzones');
$this->worldZones = $zoneModel->getWorldZonesSelectList();
$this->addStandardEditViewCommands();
} else {
$this->addStandardDefaultViewCommands();
$this->addStandardDefaultViewLists($model);
$this->states = $model->getStates($this->virtuemart_country_id);
$this->pagination = $model->getPagination();
}
parent::display($tpl);
}
开发者ID:brenot,项目名称:forumdesenvolvimento,代码行数:30,代码来源:view.html.php
示例4: display
function display($tpl = null) {
// Load the helper(s)
if (!class_exists('VmHTML'))
require(VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php');
$this->SetViewTitle();
$model = VmModel::getModel();
// $stateId = vRequest::getVar('virtuemart_state_id');
// $model->setId($stateId);
$state = $model->getSingleState();
$countryId = vRequest::getInt('virtuemart_country_id', 0);
if(empty($countryId)) $countryId = $state->virtuemart_country_id;
$this->assignRef('virtuemart_country_id', $countryId);
$isNew = (count($state) < 1);
if(empty($countryId) && $isNew){
vmWarn('Country id is 0');
return false;
}
$country = VmModel::getModel('country');
$country->setId($countryId);
$this->assignRef('country_name', $country->getData()->country_name);
$layoutName = vRequest::getCmd('layout', 'default');
if ($layoutName == 'edit') {
$this->assignRef('state', $state);
$zoneModel = VmModel::getModel('Worldzones');
$wzsList = $zoneModel->getWorldZonesSelectList();
$this->assignRef('worldZones', $wzsList);
$this->addStandardEditViewCommands();
} else {
$this->addStandardDefaultViewCommands();
$this->addStandardDefaultViewLists($model);
$states = $model->getStates($countryId);
$this->assignRef('states', $states);
$pagination = $model->getPagination();
$this->assignRef('pagination', $pagination);
}
parent::display($tpl);
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:60,代码来源:view.html.php
示例5: remove
function remove($ids)
{
if (!vmAccess::manager('paymentsetting')) {
vmWarn('Insufficient permissions to remove paymentsetting');
return false;
}
return parent::remove($ids);
}
开发者ID:cuongnd,项目名称:etravelservice,代码行数:8,代码来源:paymentsetting.php
示例6: store
function store(&$data)
{
if (!vmAccess::manager('manufacturercategories')) {
vmWarn('Insufficient permissions to store manufacturer category');
return false;
}
return parent::store($data);
}
开发者ID:cuongnd,项目名称:etravelservice,代码行数:8,代码来源:manufacturercategories.php
示例7: check
/**
* Validates the user info record fields.
*
* @author RickG, RolandD, Max Milbers
* @return boolean True if the table buffer is contains valid data, false otherwise.
*/
public function check()
{
if ($this->address_type == 'BT' or $this->address_type == 'ST') {
if ($this->address_type == 'ST' and empty($this->address_type_name)) {
$this->address_type_name = 'Delivery Address ' . rand(1, 9);
vmWarn('Table userinfos check failed: address_type ' . $this->address_type . ' without name, autogenerated ' . $this->address_type_name, 'check failed: ST has no name, autogenerated ' . $this->address_type_name);
//return false;
}
} else {
vmError('Table userinfos check failed: Unknown address_type ' . $this->address_type, 'check failed: Unknown address_type ');
vmdebug('Table userinfos check failed: Unknown address_type ' . $this->address_type . ' virtuemart_user_id ' . $this->virtuemart_user_id . ' name ' . $this->name);
return false;
}
if (!empty($this->virtuemart_userinfo_id)) {
$this->virtuemart_userinfo_id = (int) $this->virtuemart_userinfo_id;
if (!class_exists('Permissions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
}
if (!Permissions::getInstance()->check("admin")) {
$q = "SELECT virtuemart_user_id\n\t\t\t\t\t\t\t\t\t\tFROM #__virtuemart_userinfos\n\t\t\t\t\t\t\t\t\t\tWHERE virtuemart_userinfo_id = " . $this->virtuemart_userinfo_id;
$this->_db->setQuery($q);
$total = $this->_db->loadResultArray();
if (count($total) > 0) {
$userId = JFactory::getUser()->id;
if ($total[0] != $userId) {
vmError('Hacking attempt uid check, you got logged');
echo 'Hacking attempt uid check, you got logged';
return false;
}
}
}
//return parent::check();
} else {
if (empty($this->address_type)) {
$this->address_type = 'BT';
}
/* Check if a record exists */
$q = "SELECT virtuemart_userinfo_id\n\t\t\tFROM #__virtuemart_userinfos\n\t\t\tWHERE virtuemart_user_id = " . $this->virtuemart_user_id . "\n\t\t\tAND address_type = " . $this->_db->Quote($this->address_type);
if ($this->address_type != 'BT') {
$q .= " AND address_type_name = " . $this->_db->Quote($this->address_type_name);
}
$this->_db->setQuery($q);
$total = $this->_db->loadResultArray();
if (count($total) > 0) {
$this->virtuemart_userinfo_id = (int) $total[0];
} else {
$this->virtuemart_userinfo_id = 0;
//md5(uniqid($this->virtuemart_user_id));
}
}
if (empty($this->virtuemart_user_id)) {
$user = JFactory::getUser();
if (!empty($user->id)) {
$this->virtuemart_user_id = $user->id;
}
}
return parent::check();
}
开发者ID:juanmcortez,项目名称:Lectorum,代码行数:64,代码来源:userinfos.php
示例8: check
/**
* Validates the user info record fields.
*
* @author RickG, RolandD, Max Milbers
* @return boolean True if the table buffer is contains valid data, false otherwise.
*/
public function check()
{
if ($this->address_type == 'BT' or $this->address_type == 'ST') {
if ($this->address_type == 'ST' and empty($this->address_type_name)) {
$this->address_type_name = 'Delivery Address ' . rand(1, 9);
vmWarn('Table userinfos check failed: address_type ' . $this->address_type . ' without name, autogenerated ' . $this->address_type_name, 'check failed: ST has no name, autogenerated ' . $this->address_type_name);
}
} else {
vmError('Table userinfos check failed: Unknown address_type ' . $this->address_type, 'check failed: Unknown address_type ');
vmdebug('Table userinfos check failed: Unknown address_type ' . $this->address_type . ' virtuemart_user_id ' . $this->virtuemart_user_id . ' name ' . $this->name);
return false;
}
if (!empty($this->virtuemart_userinfo_id)) {
$this->virtuemart_userinfo_id = (int) $this->virtuemart_userinfo_id;
$user = JFactory::getUser();
if (!$user->authorise('core.admin', 'com_virtuemart')) {
$q = "SELECT virtuemart_user_id\n\t\t\t\t\t\t\t\t\t\tFROM #__virtuemart_userinfos\n\t\t\t\t\t\t\t\t\t\tWHERE virtuemart_userinfo_id = " . $this->virtuemart_userinfo_id;
$this->_db->setQuery($q);
$total = $this->_db->loadColumn();
if (count($total) > 0) {
$userId = JFactory::getUser()->id;
if ($total[0] != $userId) {
vmError('Hacking attempt uid check, you got logged');
echo 'Hacking attempt uid check, you got logged';
return false;
}
}
}
//return parent::check();
} else {
if (empty($this->address_type)) {
$this->address_type = 'BT';
}
/* Check if a record exists */
$q = "SELECT virtuemart_userinfo_id\n\t\t\tFROM #__virtuemart_userinfos\n\t\t\tWHERE virtuemart_user_id = " . $this->virtuemart_user_id . "\n\t\t\tAND address_type = " . $this->_db->Quote($this->address_type);
if ($this->address_type != 'BT') {
$q .= " AND address_type_name = " . $this->_db->Quote($this->address_type_name);
}
$this->_db->setQuery($q);
$total = $this->_db->loadColumn();
if (count($total) > 0) {
$this->virtuemart_userinfo_id = (int) $total[0];
} else {
$this->virtuemart_userinfo_id = 0;
//md5(uniqid($this->virtuemart_user_id));
}
}
if (empty($this->virtuemart_user_id)) {
$user = JFactory::getUser();
if (!empty($user->id)) {
$this->virtuemart_user_id = $user->id;
}
}
return parent::check();
}
开发者ID:lenard112,项目名称:cms,代码行数:61,代码来源:userinfos.php
示例9: plgVmOnShowOrderBEPayment
function plgVmOnShowOrderBEPayment($virtuemart_order_id, $virtuemart_payment_id)
{
if (!$this->selectedThisByMethodId($virtuemart_payment_id)) {
return null;
// Another method was selected, do nothing
}
$db = JFactory::getDBO();
$q = 'SELECT * FROM `' . $this->_tablename . '` ' . 'WHERE `virtuemart_order_id` = ' . $virtuemart_order_id;
$db->setQuery($q);
if (!($paymentTable = $db->loadObject())) {
vmWarn(500, $q . " " . $db->getErrorMsg());
return '';
}
$this->getPaymentCurrency($paymentTable);
$html = '<table class="adminlist">' . "\n";
$html .= $this->getHtmlHeaderBE();
$html .= $this->getHtmlRowBE('MAKSEKESKUS_PAYMENT_NAME', $paymentTable->payment_name);
$html .= '</table>' . "\n";
return $html;
}
开发者ID:jflash,项目名称:moodulid25,代码行数:20,代码来源:maksekeskus.php
示例10: getInventory
/**
* Select the products to list on the product list page
* @author Max Milbers
*/
public function getInventory()
{
if (!vmAccess::manager('inventory')) {
vmWarn('Insufficient permissions to remove shipmentmethod');
return false;
}
$select = ' `#__tsmart_products`.`tsmart_product_id`,
`#__tsmart_products`.`product_parent_id`,
`product_name`,
`product_sku`,
`product_in_stock`,
`product_weight`,
`published`,
`product_price`';
$joinedTables = 'FROM `#__tsmart_products`
LEFT JOIN `#__tsmart_product_prices`
ON `#__tsmart_products`.`tsmart_product_id` = `#__tsmart_product_prices`.`tsmart_product_id`
LEFT JOIN `#__tsmart_shoppergroups`
ON `#__tsmart_product_prices`.`tsmart_shoppergroup_id` = `#__tsmart_shoppergroups`.`tsmart_shoppergroup_id`';
return $this->_data = $this->exeSortSearchListQuery(0, $select, $joinedTables, $this->getInventoryFilter(), '', $this->_getOrdering());
}
开发者ID:cuongnd,项目名称:etravelservice,代码行数:25,代码来源:inventory.php
示例11: checkCountryCondition
function checkCountryCondition($method, $country_code, $cart)
{
if (!class_exists('CurrencyDisplay')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php';
}
$active_country = "klarna_active_" . strtolower($country_code);
if (!isset($method->{$active_country}) or !$method->{$active_country}) {
return false;
}
if (empty($country_code)) {
$msg = JText::_('VMPAYMENT_KLARNA_GET_SWEDISH_ADDRESS');
$country_code = "swe";
vmWarn($msg);
//return false;
}
// convert price in euro
//$euro_currency_id = ShopFunctions::getCurrencyByName( 'EUR');
$price = KlarnaHandler::convertPrice($cart->pricesUnformatted['salesPrice'], 'EUR');
if (strtolower($country_code) == 'nld' && $price > 250) {
// We can't show our payment options for Dutch customers
// if price exceeds 250 euro. Will be replaced with ILT in
// the future.
return false;
}
// Get the country settings
if (!class_exists('KlarnaHandler')) {
require JPATH_VMKLARNAPLUGIN . DS . 'klarna' . DS . 'helpers' . DS . 'klarnahandler.php';
}
$cData = KlarnaHandler::getCountryData($method, $country_code);
if ($cData['eid'] == '' || $cData['eid'] == 0) {
return false;
}
return $cData;
}
开发者ID:joselapria,项目名称:virtuemart,代码行数:34,代码来源:klarna.php
示例12: setMenuItemId
private function setMenuItemId()
{
$app = JFactory::getApplication();
$menus = $app->getMenu('site');
$component = JComponentHelper::getComponent('com_virtuemart');
$items = $menus->getItems('componentid', $component->id);
if (empty($items)) {
VmConfig::loadJLang('com_virtuemart', true);
vmWarn(JText::_('COM_VIRTUEMART_ASSIGN_VM_TO_MENU'));
} else {
// Search Virtuemart itemID in joomla menu
foreach ($items as $item) {
$view = $item->query['view'];
if ($view == 'virtuemart') {
$this->menu['virtuemart'] = $item->id;
}
$dbKey = $this->dbview[$view];
if (isset($item->query['virtuemart_' . $dbKey . '_id'])) {
$this->menu['virtuemart_' . $dbKey . '_id'][$item->query['virtuemart_' . $dbKey . '_id']] = $item->id;
} else {
$this->menu[$view] = $item->id;
}
}
}
// init unsetted views to defaut front view or nothing(prevent duplicates routes)
if (!isset($this->menu['virtuemart'][0])) {
$this->menu['virtuemart'][0] = null;
}
if (!isset($this->menu['manufacturer'])) {
$this->menu['manufacturer'] = $this->menu['virtuemart'][0];
}
}
开发者ID:Roma48,项目名称:abazherka_old,代码行数:32,代码来源:router.php
示例13: plgVmOnStoreInstallPaymentPluginTable
/**
* Create the table for this plugin if it does not yet exist.
* This functions checks if the called plugin is active one.
* When yes it is calling the standard method to create the tables
*
*/
public function plgVmOnStoreInstallPaymentPluginTable($jplugin_id)
{
if ($jplugin_id != $this->_jid) {
return FALSE;
}
$this->_currentMethod = $this->getPluginMethod(vRequest::getInt('virtuemart_paymentmethod_id'));
if ($this->_currentMethod->published) {
$required_parameters = array('merchant_id', 'shared_secret', 'subaccount');
foreach ($required_parameters as $required_parameter) {
if (empty($this->_currentMethod->{$required_parameter})) {
$text = vmText::sprintf('VMPAYMENT_REALEX_HPP_API_PARAMETER_REQUIRED', vmText::_('VMPAYMENT_REALEX_HPP_API_' . $required_parameter), $this->_currentMethod->payment_name, $this->_currentMethod->virtuemart_paymentmethod_id);
vmWarn($text);
}
}
}
$this->createPayerRefTable();
$this->createPmtRefTable();
return $this->onStoreInstallPluginTable($jplugin_id);
}
开发者ID:virtuemart-fr,项目名称:virtuemart-fr,代码行数:25,代码来源:realex_hpp_api.php
示例14: plgVmOnStoreInstallPaymentPluginTable
/**
* @param $jplugin_id
* @return bool|mixed
*/
function plgVmOnStoreInstallPaymentPluginTable($jplugin_id) {
if ($jplugin_id != $this->_jid) {
return FALSE;
}
$this->_currentMethod = $this->getPluginMethod(JRequest::getInt('virtuemart_paymentmethod_id'));
if ($this->_currentMethod->published) {
$sandbox = "";
if ($this->_currentMethod->sandbox ) {
$sandbox = 'SANDBOX_';
$sandbox_param = 'sandbox_';
}
if ($this->_currentMethod->paypalproduct == 'std') {
if ($this->_currentMethod->sandbox ) {
$param = 'sandbox_merchant_email';
} else {
$param = 'paypal_merchant_email';
}
if (empty ($this->_currentMethod->$param)) {
$text = JText::sprintf('VMPAYMENT_PAYPAL_PARAMETER_REQUIRED', JText::_('VMPAYMENT_PAYPAL_' . $sandbox . 'MERCHANT'), $this->_currentMethod->payment_name, $this->_currentMethod->virtuemart_paymentmethod_id);
vmWarn($text);
}
}
if ($this->_currentMethod->paypalproduct == 'exp' OR $this->_currentMethod->paypalproduct == 'hosted' OR $this->_currentMethod->paypalproduct == 'api') {
$param = $sandbox_param . 'api_login_id';
if (empty ($this->_currentMethod->$param)) {
$text = JText::sprintf('VMPAYMENT_PAYPAL_PARAMETER_REQUIRED', JText::_('VMPAYMENT_PAYPAL_' . $sandbox . 'USERNAME'), $this->_currentMethod->payment_name, $this->_currentMethod->virtuemart_paymentmethod_id);
vmWarn($text);
}
$param = $sandbox_param . 'api_password';
if (empty ($this->_currentMethod->$param)) {
$text = JText::sprintf('VMPAYMENT_PAYPAL_PARAMETER_REQUIRED', JText::_('VMPAYMENT_PAYPAL_' . $sandbox . 'PASSWORD'), $this->_currentMethod->payment_name, $this->_currentMethod->virtuemart_paymentmethod_id);
vmWarn($text);
}
if ($this->_currentMethod->authentication == 'signature') {
$param = $sandbox_param . 'api_signature';
if (empty ($this->_currentMethod->$param)) {
$text = JText::sprintf('VMPAYMENT_PAYPAL_PARAMETER_REQUIRED', JText::_('VMPAYMENT_PAYPAL_' . $sandbox . 'SIGNATURE'), $this->_currentMethod->payment_name, $this->_currentMethod->virtuemart_paymentmethod_id);
vmWarn($text);
}
} else {
$param = $sandbox_param . 'api_certificate';
if (empty ($this->_currentMethod->$param)) {
$text = JText::sprintf('VMPAYMENT_PAYPAL_PARAMETER_REQUIRED', JText::_('VMPAYMENT_PAYPAL_' . $sandbox . 'CERTIFICATE'), $this->_currentMethod->payment_name, $this->_currentMethod->virtuemart_paymentmethod_id);
vmWarn($text);
}
}
}
if ($this->_currentMethod->paypalproduct == 'hosted') {
$param = $sandbox_param . 'payflow_partner';
if (empty ($this->_currentMethod->$param)) {
$text = JText::sprintf('VMPAYMENT_PAYPAL_PARAMETER_REQUIRED', JText::_('VMPAYMENT_PAYPAL_' . $sandbox . 'PAYFLOW_PARTNER'), $this->_currentMethod->payment_name, $this->_currentMethod->virtuemart_paymentmethod_id);
vmWarn($text);
}
}
if ($this->_currentMethod->paypalproduct == 'exp' AND empty ($this->_currentMethod->expected_maxamount)) {
$text = JText::sprintf('VMPAYMENT_PAYPAL_PARAMETER_REQUIRED', JText::_('VMPAYMENT_PAYPAL_EXPECTEDMAXAMOUNT'), $this->_currentMethod->payment_name, $this->_currentMethod->virtuemart_paymentmethod_id);
vmWarn($text);
}
}
return $this->onStoreInstallPluginTable($jplugin_id);
}
开发者ID:sergy444,项目名称:joomla,代码行数:71,代码来源:paypal.php
示例15: alterColumns
/**
* @author Max Milbers
* @param unknown_type $tablename
* @param unknown_type $fields
* @param unknown_type $command
*/
public function alterColumns($tablename, $fields, $reCreatePrimary)
{
$after = ' FIRST';
$dropped = 0;
$altered = 0;
$added = 0;
$this->_app = JFactory::getApplication();
$demandFieldNames = array();
foreach ($fields as $i => $line) {
$demandFieldNames[] = $i;
}
$query = 'SHOW FULL COLUMNS FROM `' . $tablename . '` ';
//$q = 'SHOW CREATE TABLE '.$this->_tbl;
$this->_db->setQuery($query);
$fullColumns = $this->_db->loadObjectList();
$columns = $this->_db->loadColumn(0);
//vmdebug('alterColumns',$fullColumns);
//Attention user_infos is not in here, because it an contain customised fields. #__virtuemart_order_userinfos #__virtuemart_userinfos
//This is currently not working as intended, because the config is not deleted before, it is better to create an extra command for this, when we need it later
$upDelCols = (int) VmConfig::get('updelcols', 0);
if ($upDelCols == 1 and !($tablename == $this->_prefix . 'virtuemart_userfields' or $tablename == $this->_prefix . 'virtuemart_userinfos' or $tablename == $this->_prefix . 'virtuemart_order_userinfos')) {
foreach ($columns as $fieldname) {
if (!in_array($fieldname, $demandFieldNames)) {
$query = 'ALTER TABLE `' . $tablename . '` DROP COLUMN `' . $fieldname . '` ';
$action = 'DROP';
$dropped++;
$this->_db->setQuery($query);
if (!$this->_db->execute()) {
$this->_app->enqueueMessage('alterTable ' . $action . ' ' . $tablename . '.' . $fieldname . ' :' . $this->_db->getErrorMsg());
}
}
}
}
foreach ($fields as $fieldname => $alterCommand) {
if (microtime(true) - $this->starttime >= $this->maxScriptTime) {
vmWarn('alterColumns alterKey not finished, please rise execution time and update tables again');
return false;
}
$query = '';
$action = '';
if (empty($alterCommand)) {
vmdebug('empty alter command ' . $fieldname);
continue;
}
// we remove the auto_increment, to be free to set the primary key
if (strpos($alterCommand, 'AUTO_INCREMENT') !== false and $reCreatePrimary) {
$alterCommand = str_replace('AUTO_INCREMENT', '', $alterCommand);
}
if (in_array($fieldname, $columns)) {
$key = array_search($fieldname, $columns);
$oldColumn = $this->reCreateColumnByTableAttributes($fullColumns[$key]);
//Attention, we give for a primary the auto_increment back, so we cant decide if a key is used as primary,
//but has no auto increment, so wie alter it anytime
if (strpos($alterCommand, 'AUTO_INCREMENT') !== false and $reCreatePrimary) {
$query = 'ALTER TABLE `' . $tablename . '` CHANGE COLUMN `' . $fieldname . '` `' . $fieldname . '` ' . $alterCommand;
$action = 'CHANGE';
$altered++;
// vmdebug('$fieldname just auto '.$fieldname,$alterCommand,$oldColumn);
} else {
// while (strpos($oldColumn,' ')){
// str_replace(' ', ' ', $oldColumn);
// }
while (strpos($alterCommand, ' ')) {
$alterCommand = str_replace(' ', ' ', trim($alterCommand));
}
// str_replace(' ', ' ', $alterCommand);
// $compare = strcasecmp( $oldColumn, $alterCommand);
// $compare = strcasecmp( $oldColumn, $alterCommand);
// if (!empty($compare)) {
$oldColumn = strtoupper($oldColumn);
$alterCommand = strtoupper(trim($alterCommand));
// vmdebug('reCreateColumnByTableAttributes ',$fullColumns[$key]);
if ($oldColumn != $alterCommand) {
$query = 'ALTER TABLE `' . $tablename . '` CHANGE COLUMN `' . $fieldname . '` `' . $fieldname . '` ' . $alterCommand . $after;
$action = 'CHANGE';
$altered++;
vmdebug($tablename . ' Alter field ' . $fieldname . ' oldcolumn ', $oldColumn, $alterCommand);
// vmdebug('Alter field new column ',$fullColumns[$key]);
// vmdebug('Alter field new column '.$this->reCreateColumnByTableAttributes($fullColumns[$key])); //,$fullColumns[$key]);
}
}
} else {
$query = 'ALTER TABLE `' . $tablename . '` ADD ' . $fieldname . ' ' . $alterCommand . ' ' . $after;
$action = 'ADD';
$added++;
// vmdebug('$fieldname '.$fieldname);
}
if (!empty($query)) {
$this->_db->setQuery($query);
$err = $this->_db->getErrorMsg();
if (!$this->_db->execute() or !empty($err)) {
vmError('alterTable ' . $action . ' ' . $tablename . '.' . $fieldname . ' : ' . $err);
} else {
vmInfo('alterTable ' . $action . ' ' . $tablename . '.' . $fieldname . ' : ' . $query);
//.........这里部分代码省略.........
开发者ID:brenot,项目名称:forumdesenvolvimento,代码行数:101,代码来源:tableupdater.php
示例16: getInstance
/**
*
* Gives back the format of the currency, gets $style if none is set, with the currency Id, when nothing is found it tries the vendorId.
* When no param is set, you get the format of the mainvendor
*
* @author Max Milbers
* @param int $currencyId Id of the currency
* @param int $vendorId Id of the vendor
* @param string $style The vendor_currency_display_code
* FORMAT:
1: id,
2: CurrencySymbol,
3: NumberOfDecimalsAfterDecimalSymbol,
4: DecimalSymbol,
5: Thousands separator
6: Currency symbol position with Positive values :
7: Currency symbol position with Negative values :
EXAMPLE: ||€|2|,||1|8
* @return string
*/
public static function getInstance($currencyId = 0, $vendorId = 0)
{
// if(empty(self::$_instance) || empty(self::$_instance->_currency_id) || ($currencyId!=self::$_instance->_currency_id && !empty($currencyId)) ){
if (empty(self::$_instance) || (!empty($currencyId) and $currencyId != self::$_instance->_currency_id)) {
self::$_instance = new CurrencyDisplay($vendorId);
if (empty($currencyId)) {
if (self::$_instance->_app->isSite()) {
self::$_instance->_currency_id = self::$_instance->_app->getUserStateFromRequest("virtuemart_currency_id", 'virtuemart_currency_id', vRequest::getInt('virtuemart_currency_id', 0));
}
if (empty(self::$_instance->_currency_id)) {
self::$_instance->_currency_id = self::$_instance->_vendorCurrency;
}
} else {
self::$_instance->_currency_id = $currencyId;
}
$vendorM = VmModel::getModel('currency');
$style = $vendorM->getData((int) self::$_instance->_currency_id);
if (!empty($style)) {
self::$_instance->setCurrencyDisplayToStyleStr($style);
} else {
$uri = JFactory::getURI();
VmConfig::loadJLang('com_virtuemart');
if (empty(self::$_instance->_currency_id)) {
$link = $uri->root() . 'administrator/index.php?option=com_virtuemart&view=user&task=editshop';
vmWarn(vmText::sprintf('COM_VIRTUEMART_CONF_WARN_NO_CURRENCY_DEFINED', '<a href="' . $link . '">' . $link . '</a>'));
} else {
if (vRequest::getCmd('view') != 'currency') {
$link = $uri->root() . 'administrator/index.php?option=com_virtuemart&view=currency&task=edit&cid[]=' . self::$_instance->_currency_id;
vmWarn(vmText::sprintf('COM_VIRTUEMART_CONF_WARN_NO_FORMAT_DEFINED', '<a href="' . $link . '">' . $link . '</a>'));
}
}
// self::$_instance->setCurrencyDisplayToStyleStr($currencyId);
//would be nice to automatically unpublish the product/currency or so
}
}
self::$_instance->setPriceArray();
return self::$_instance;
}
开发者ID:lenard112,项目名称:cms,代码行数:59,代码来源:currencydisplay.php
示例17: store
/**
* Bind the post data to the JUser object and the VM tables, then saves it
* It is used to register new users
* This function can also change already registered users, this is important when a registered user changes his email within the checkout.
*
* @author Max Milbers
* @author Oscar van Eijk
* @return boolean True is the save was successful, false otherwise.
*/
public function store(&$data)
{
$message = '';
vRequest::vmCheckToken('Invalid Token, while trying to save user');
if (empty($data)) {
vmError('Developer notice, no data to store for user');
return false;
}
//To find out, if we have to register a new user, we take a look on the id of the usermodel object.
//The constructor sets automatically the right id.
$new = false;
if (empty($this->_id) or $this->_id < 1) {
$new = true;
$user = new JUser();
//thealmega http://forum.tsmart.net/index.php?topic=99755.msg393758#msg393758
} else {
$cUser = JFactory::getUser();
if (!vmAccess::manager('user.edit') and $cUser->id != $this->_id) {
vmWarn('Insufficient permission');
return false;
}
$user = JFactory::getUser($this->_id);
}
$gid = $user->get('gid');
// Save original gid
// Preformat and control user datas by plugin
JPluginHelper::importPlugin('vmuserfield');
$dispatcher = JDispatcher::getInstance();
$valid = true;
$dispatcher->trigger('plgVmOnBeforeUserfieldDataSave', array(&$valid, $this->_id, &$data, $user));
// $valid must be false if plugin detect an error
if (!$valid) {
return false;
}
// Before I used this "if($cart && !$new)"
// This construction is necessary, because this function is used to register a new JUser, so we need all the JUser data in $data.
// On the other hand this function is also used just for updating JUser data, like the email for the BT address. In this case the
// name, username, password and so on is already stored in the JUser and dont need to be entered again.
if (empty($data['email'])) {
$email = $user->get('email');
if (!empty($email)) {
$data['email'] = $email;
}
} else {
$data['email'] = vRequest::getEmail('email', '');
}
//$data['email'] = str_replace(array('\'','"',',','%','*','/','\\','?','^','`','{','}','|','~'),array(''),$data['email']);
//This is important, when a user changes his email address from the cart,
//that means using view user layout edit_address (which is called from the cart)
$user->set('email', $data['email']);
if (empty($data['name'])) {
$name = $user->get('name');
if (!empty($name)) {
$data['name'] = $name;
}
} else {
$data['name'] = vRequest::getWord('name', '');
}
$data['name'] = str_replace(array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $data['name']);
if (empty($data['username'])) {
$username = $user->get('username');
if (!empty($username)) {
$data['username'] = $username;
} else {
$data['username'] = vRequest::getWord('username', '');
}
}
if (empty($data['password'])) {
$data['password'] = vRequest::getCmd('password', '');
if ($data['password'] != vRequest::get('password')) {
vmError('Password contained invalid character combination.');
return false;
}
}
if (empty($data['password2'])) {
$data['password2'] = vRequest::getCmd('password2');
if ($data['password2'] != vRequest::get('password2')) {
vmError('Password2 contained invalid character combination.');
return false;
}
}
if (!$new and empty($data['password2'])) {
unset($data['password']);
unset($data['password2']);
}
if (!vmAccess::manager('core')) {
$whiteDataToBind = array();
if (isset($data['name'])) {
$whiteDataToBind['name'] = $data['name'];
}
if (isset($data['username'])) {
//.........这里部分代码省略.........
开发者ID:cuongnd,项目名称:etravelservice,代码行数:101,代码来源:user.php
示例18: _getLayoutPath
/**
* Note: We have 2 subfolders for versions > J15 for 3rd parties developers, to avoid 2 installers
* Note: from Version 2.12: it is possible to have the tmpl folder directly in $pluginName folder
* @author Max Milbers, Valérie Isaksen
*/
private function _getLayoutPath($pluginName, $group, $layout = 'default')
{
$layoutPath = $templatePathWithGroup = $defaultPathWithGroup = '';
jimport('joomla.filesystem.file');
// First search in the new system
if (!class_exists('VmTemplate')) {
require VMPATH_SITE . DS . 'helpers' . DS . 'vmtemplate.php';
}
$vmStyle = VmTemplate::loadVmTemplateStyle();
$template = $vmStyle['template'];
$templatePath = VMPATH_ROOT . DS . 'templates' . DS . $template . DS . 'html' . DS . $group . DS . $pluginName . DS . $layout . '.php';
$defaultPath = VMPATH_ROOT . DS . 'plugins' . DS . $group . DS . $pluginName . DS . 'tmpl' . DS . $layout . '.php';
$defaultPathWithGroup = VMPATH_ROOT . DS . 'plugins' . DS . $group . DS . $pluginName . DS . $pluginName . DS . 'tmpl' . DS . $layout . '.php';
if (JFile::exists($templatePath)) {
$layoutPath = $templatePath;
} elseif (JFile::exists($defaultPath)) {
$layoutPath = $defaultPath;
} elseif (JFile::exists($defaultPathWithGroup)) {
$layoutPath = $defaultPathWithGroup;
}
if (empty($layoutPath)) {
$warn = 'The layout: ' . $layout . ' does not exist in:';
$warn .= '<br />' . $templatePath . '<br />' . $defaultPath;
if (!empty($defaultPathWithGroup)) {
$warn .= '<br />' . $defaultPathWithGroup . '<br />';
}
vmWarn($warn);
return false;
}
return $layoutPath;
}
开发者ID:cuongnd,项目名称:etravelservice,代码行数:36,代码来源:vmplugin.php
示例19: getCategoryRecurse
public function getCategoryRecurse($virtuemart_category_id, $catMenuId, $idsArr = true)
{
static $resId = array();
if ($idsArr and !is_array($idsArr)) {
$idsArr = array();
$this->categoryRecursed = 0;
} else {
if ($this->categoryRecursed > 10) {
vmWarn('Stopped getCategoryRecurse after 10 rekursions');
return false;
}
}
$hash = $virtuemart_category_id . 'c' . $catMenuId;
if (isset($resId[$hash])) {
$ids = $resId[$hash];
} else {
$db = JFactory::getDBO();
$q = "SELECT `category_child_id` AS `child`, `category_parent_id` AS `parent`\n\t\t\t\tFROM #__virtuemart_category_categories AS `xref`\n\t\t\t\tWHERE `xref`.`category_child_id`= " . (int) $virtuemart_category_id;
$db->setQuery($q);
$ids = $resId[$hash] = $db->loadObject();
}
if (isset($ids->child)) {
$idsArr[] = $ids->child;
if ($ids->parent != 0 and $catMenuId != $virtuemart_category_id and $catMenuId != $ids->parent) {
$this->categoryRecursed++;
$idsArr = $this->getCategoryRecurse($ids->parent, $catMenuId, $idsArr);
}
}
return $idsArr;
}
开发者ID:sam-akopyan,项目名称:hamradio,代码行数:30,
|
请发表评论