News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Bug in VmConfig::set

Started by balai, July 13, 2017, 11:25:11 AM

Previous topic - Next topic

balai

I am checking your VmConfig::set function.
You are using that in views like : components/com_virtuemart/views/category/view.html.php
Though none of these seem to work.

You can try your own
VmConfig::set('myVar', 10);
echo VmConfig::get('myVar',5); //gives 5

Ghost

You have to be logged in as VM admin for some reason https://dev.virtuemart.net/projects/virtuemart/repository/entry/branches/com_virtuemart.3.0.12.4/administrator/components/com_virtuemart/helpers/config.php

static function set($key, $value){

if (empty(self::$_jpConfig->_params)) {
self::loadConfig();
}

if($admin = JFactory::getUser()->authorise('core.admin', 'com_virtuemart')){
if (!empty(self::$_jpConfig->_params)) {
self::$_jpConfig->_params[$key] = $value;
}
}

}

balai

It makes no sense to be logged in, because this is used by the server to generate the front end views.

Milbo

Only admins are allowed to change the config!
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

balai

Max check your category view. It is used there, i suppose for backwards compatibility.

Milbo

You are right. Nice trap.The function is useless this way. I just notice, we have this lines in that function for more than 3 years. But we never used it before. I just remove it. The function is indeed meant for dynamic changes of the config and when someone reached this level, he can manipulate the config anyway.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/