Skip to main content
add paragraph about manual whitelisting
Source Link
Fabian Schmengler
  • 66.2k
  • 25
  • 191
  • 422

For the sake of completeness, you can manually add blocks and variables to the white lists under System > Permissions > Variables and System > Permissions > Blocks. The codes you add there are in the form web/unsecure/base_url (config path) or rss/order_new (block class alias).

Original answer

My upgrade script looks like this:

My upgrade script looks like this:

For the sake of completeness, you can manually add blocks and variables to the white lists under System > Permissions > Variables and System > Permissions > Blocks. The codes you add there are in the form web/unsecure/base_url (config path) or rss/order_new (block class alias).

Original answer

My upgrade script looks like this:

update script for easier insertion into existing scripts
Source Link
Fabian Schmengler
  • 66.2k
  • 25
  • 191
  • 422
/* * Make sure the upgrade is not performed on installations without the tables * (i.e. unpatched shops). If so, return without doing anything. */ $adminVersion = Mage::getConfig()->getModuleConfig('Mage_Admin')->version; if (version_compare($adminVersion, '1.6.1.2', '<''>=')) {   return; } $blockNames = array(   'cms/block',   'catalog/product_list',   'germany/impressum',   'page/html',   'magesetup/imprint_field',   'magesetup/imprint_content'  );  foreach ($blockNames as $blockName) {   $whitelistBlock = Mage::getModel('admin/block')->load($blockName, 'block_name');   $whitelistBlock->setData('block_name', $blockName);   $whitelistBlock->setData('is_allowed', 1);   $whitelistBlock->save();  }    $variableNames = array(   'design/email/logo_alt',   'design/email/logo_width',   'design/email/logo_height',  );    foreach ($variableNames as $variableName) {   $whitelistVar = Mage::getModel('admin/variable')->load($variableName, 'variable_name');   $whitelistVar->setData('variable_name', $variableName);   $whitelistVar->setData('is_allowed', 1);   $whitelistVar->save(); } } 
/* * Make sure the upgrade is not performed on installations without the tables * (i.e. unpatched shops). If so, return without doing anything. */ $adminVersion = Mage::getConfig()->getModuleConfig('Mage_Admin')->version; if (version_compare($adminVersion, '1.6.1.2', '<')) { return; } $blockNames = array( 'cms/block', 'catalog/product_list', 'germany/impressum', 'page/html', 'magesetup/imprint_field', 'magesetup/imprint_content' ); foreach ($blockNames as $blockName) { $whitelistBlock = Mage::getModel('admin/block')->load($blockName, 'block_name'); $whitelistBlock->setData('block_name', $blockName); $whitelistBlock->setData('is_allowed', 1); $whitelistBlock->save(); } $variableNames = array( 'design/email/logo_alt', 'design/email/logo_width', 'design/email/logo_height', ); foreach ($variableNames as $variableName) { $whitelistVar = Mage::getModel('admin/variable')->load($variableName, 'variable_name'); $whitelistVar->setData('variable_name', $variableName); $whitelistVar->setData('is_allowed', 1); $whitelistVar->save(); } 
/* * Make sure the upgrade is not performed on installations without the tables * (i.e. unpatched shops). */ $adminVersion = Mage::getConfig()->getModuleConfig('Mage_Admin')->version; if (version_compare($adminVersion, '1.6.1.2', '>=')) {   $blockNames = array(   'cms/block',   'catalog/product_list',   'germany/impressum',   'page/html',   'magesetup/imprint_field',   'magesetup/imprint_content'  );  foreach ($blockNames as $blockName) {   $whitelistBlock = Mage::getModel('admin/block')->load($blockName, 'block_name');   $whitelistBlock->setData('block_name', $blockName);   $whitelistBlock->setData('is_allowed', 1);   $whitelistBlock->save();  }    $variableNames = array(   'design/email/logo_alt',   'design/email/logo_width',   'design/email/logo_height',  );    foreach ($variableNames as $variableName) {   $whitelistVar = Mage::getModel('admin/variable')->load($variableName, 'variable_name');   $whitelistVar->setData('variable_name', $variableName);   $whitelistVar->setData('is_allowed', 1);   $whitelistVar->save(); } } 
Nicer check thanks to https://gist.github.com/mam08ixo/3937df764da7a6816a1d
Source Link
Fabian Schmengler
  • 66.2k
  • 25
  • 191
  • 422
/* * CheckMake ifsure admin_blockthe andupgrade admin_variableis tablesnot exist,performed ifon not, installations *without wethe havetables  an* (i.e. unpatched shopshops). andIf so, return without doing anything. */ try {  $adminVersion = $this->getTableMage::getConfig('admin/permission_block'); $this->getTable>getModuleConfig('admin/permission_variable''Mage_Admin');->version; } catchif (Mage_Core_Exceptionversion_compare($adminVersion, $e'1.6.1.2', '<')) { return; } $blockNames = array( 'cms/block', 'catalog/product_list', 'germany/impressum', 'page/html', 'magesetup/imprint_field', 'magesetup/imprint_content' ); foreach ($blockNames as $blockName) { $whitelistBlock = Mage::getModel('admin/block')->load($blockName, 'block_name'); $whitelistBlock->setData('block_name', $blockName); $whitelistBlock->setData('is_allowed', 1); $whitelistBlock->save(); } $variableNames = array( 'design/email/logo_alt', 'design/email/logo_width', 'design/email/logo_height', ); foreach ($variableNames as $variableName) { $whitelistVar = Mage::getModel('admin/variable')->load($variableName, 'variable_name'); $whitelistVar->setData('variable_name', $variableName); $whitelistVar->setData('is_allowed', 1); $whitelistVar->save(); } 
/* * Check if admin_block and admin_variable tables exist, if not,  * we have an unpatched shop and return without doing anything */ try {   $this->getTable('admin/permission_block'); $this->getTable('admin/permission_variable'); } catch (Mage_Core_Exception $e) { return; } $blockNames = array( 'cms/block', 'catalog/product_list', 'germany/impressum', 'page/html', 'magesetup/imprint_field', 'magesetup/imprint_content' ); foreach ($blockNames as $blockName) { $whitelistBlock = Mage::getModel('admin/block')->load($blockName, 'block_name'); $whitelistBlock->setData('block_name', $blockName); $whitelistBlock->setData('is_allowed', 1); $whitelistBlock->save(); } $variableNames = array( 'design/email/logo_alt', 'design/email/logo_width', 'design/email/logo_height', ); foreach ($variableNames as $variableName) { $whitelistVar = Mage::getModel('admin/variable')->load($variableName, 'variable_name'); $whitelistVar->setData('variable_name', $variableName); $whitelistVar->setData('is_allowed', 1); $whitelistVar->save(); } 
/* * Make sure the upgrade is not performed on installations without the tables  * (i.e. unpatched shops). If so, return without doing anything. */ $adminVersion = Mage::getConfig()->getModuleConfig('Mage_Admin')->version; if (version_compare($adminVersion, '1.6.1.2', '<')) { return; } $blockNames = array( 'cms/block', 'catalog/product_list', 'germany/impressum', 'page/html', 'magesetup/imprint_field', 'magesetup/imprint_content' ); foreach ($blockNames as $blockName) { $whitelistBlock = Mage::getModel('admin/block')->load($blockName, 'block_name'); $whitelistBlock->setData('block_name', $blockName); $whitelistBlock->setData('is_allowed', 1); $whitelistBlock->save(); } $variableNames = array( 'design/email/logo_alt', 'design/email/logo_width', 'design/email/logo_height', ); foreach ($variableNames as $variableName) { $whitelistVar = Mage::getModel('admin/variable')->load($variableName, 'variable_name'); $whitelistVar->setData('variable_name', $variableName); $whitelistVar->setData('is_allowed', 1); $whitelistVar->save(); } 
added 22 characters in body
Source Link
Fabian Schmengler
  • 66.2k
  • 25
  • 191
  • 422
Loading
Add check for new tables
Source Link
Fabian Schmengler
  • 66.2k
  • 25
  • 191
  • 422
Loading
Source Link
Fabian Schmengler
  • 66.2k
  • 25
  • 191
  • 422
Loading