// Context

This commit is contained in:
rMalie
2011-07-12 13:50:15 +00:00
parent 89920e17fd
commit 286a374353
20 changed files with 319 additions and 264 deletions
+1 -2
View File
@@ -179,13 +179,12 @@ class BlockCms extends Module
if (!$context)
$context = Context::getContext();
$id_current_shop = Shop::getCurrentShop();
$cmsCategories = Db::getInstance()->ExecuteS('
SELECT bc.`id_cms_block`, bc.`id_cms_category`, bc.`display_store`, ccl.`link_rewrite`, ccl.`name` category_name, bcl.`name` block_name
FROM `'._DB_PREFIX_.'cms_block` bc
INNER JOIN `'._DB_PREFIX_.'cms_category_lang` ccl ON (bc.`id_cms_category` = ccl.`id_cms_category`)
INNER JOIN `'._DB_PREFIX_.'cms_block_lang` bcl ON (bc.`id_cms_block` = bcl.`id_cms_block`)
WHERE bc.`location` = '.(int)($location).' AND ccl.`id_lang` = '.(int)$context->language->id.' AND bcl.`id_lang` = '.(int)$context->language->id.' AND bc.id_shop='.(int)$id_current_shop.'
WHERE bc.`location` = '.(int)($location).' AND ccl.`id_lang` = '.(int)$context->language->id.' AND bcl.`id_lang` = '.(int)$context->language->id.' AND bc.id_shop='.$context->shop->getID().'
ORDER BY `position`');
$content = array();
@@ -186,8 +186,8 @@ class ReferralProgramModule extends ObjectModel
{
if (empty($email) OR !Validate::isEmail($email))
die (Tools::displayError('Email invalid.'));
// $return_id = false, $ignoreGuest = true, $id_group_shop = false, $id_shop = false
if ($checkCustomer === true AND Customer::customerExists($email, false, true, (int)Shop::getCurrentGroupShop(), (int)Shop::getCurrentShop()))
if ($checkCustomer === true AND Customer::customerExists($email))
return false;
$result = Db::getInstance()->getRow('
SELECT s.`id_referralprogram`
@@ -426,6 +426,7 @@ class ThemeInstallator extends Module
$hookedModule = array();
$position = array();
$msg = '';
$shopID = Context::getContext()->shop->getID();
foreach ($this->xml->modules->hooks->hook as $row)
{
@@ -455,17 +456,17 @@ class ThemeInstallator extends Module
WHERE `name` = \''.pSQL($row).'\'');
else if (!$obj OR !$obj->install())
continue;
Db::getInstance()->Execute('INSERT IGNORE INTO '._DB_PREFIX_.'module_shop (id_module, id_shop) VALUES('.(int)$obj->id.', '.(int)Shop::getCurrentShop().')');
Db::getInstance()->Execute('INSERT IGNORE INTO '._DB_PREFIX_.'module_shop (id_module, id_shop) VALUES('.(int)$obj->id.', '.$shopID.')');
$msg .= '<i>- '.pSQL($row).'</i><br />';
Db::getInstance()->Execute('
DELETE FROM `'._DB_PREFIX_.'hook_module`
WHERE `id_module` = '.pSQL($obj->id).' AND id_shop='.(int)Shop::getCurrentShop());
WHERE `id_module` = '.pSQL($obj->id).' AND id_shop='.$shopID);
$count = -1;
while (isset($hookedModule[++$count]))
if ($hookedModule[$count] == $row)
Db::getInstance()->Execute('
INSERT INTO `'._DB_PREFIX_.'hook_module` (`id_module`, `id_shop`, `id_hook`, `position`)
VALUES ('.(int)$obj->id.', '.(int)Shop::getCurrentShop().', '.(int)Hook::get($hook[$count]).', '.(int)$position[$count].')');
VALUES ('.(int)$obj->id.', '.$shopID.', '.(int)Hook::get($hook[$count]).', '.(int)$position[$count].')');
}
if (($val = (int)(Tools::getValue('nativeModules'))) != 1)
{
@@ -482,7 +483,7 @@ class ThemeInstallator extends Module
$msg .= '<i>- '.pSQL($row).'</i><br />';
Db::getInstance()->Execute('
DELETE FROM `'._DB_PREFIX_.'module_shop`
WHERE `id_module` = '.pSQL($obj->id).' AND id_shop='.(int)Shop::getCurrentShop(true));
WHERE `id_module` = '.pSQL($obj->id).' AND id_shop='.$shopID);
}
}
$flag = 0;
@@ -496,7 +497,7 @@ class ThemeInstallator extends Module
UPDATE `'._DB_PREFIX_.'module`
SET `active`= 1
WHERE `name` = \''.pSQL($row).'\'');
Db::getInstance()->Execute('INSERT IGNORE INTO '._DB_PREFIX_.'module_shop (id_module, id_shop) VALUES('.(int)$obj->id.', '.(int)Shop::getCurrentShop(true).')');
Db::getInstance()->Execute('INSERT IGNORE INTO '._DB_PREFIX_.'module_shop (id_module, id_shop) VALUES('.(int)$obj->id.', '.$shopID.')');
}
else if (!is_object($obj) OR !$obj->install())
continue ;
@@ -505,19 +506,19 @@ class ThemeInstallator extends Module
$msg .= '<i>- '.pSQL($row).'</i><br />';
Db::getInstance()->Execute('
DELETE FROM `'._DB_PREFIX_.'hook_module`
WHERE `id_module` = '.pSQL($obj->id).' AND id_shop='.(int)Shop::getCurrentShop(true));
WHERE `id_module` = '.pSQL($obj->id).' AND id_shop='.$shopID);
$count = -1;
while (isset($hookedModule[++$count]))
if ($hookedModule[$count] == $row)
{
Db::getInstance()->Execute('
INSERT INTO `'._DB_PREFIX_.'hook_module` (`id_module`, `id_shop`, `id_hook`, `position`)
VALUES ('.(int)$obj->id.', '.(int)Shop::getCurrentShop(true).', '.(int)Hook::get($hook[$count]).', '.(int)$position[$count].')');
VALUES ('.(int)$obj->id.', '.$shopID.', '.(int)Hook::get($hook[$count]).', '.(int)$position[$count].')');
foreach ($exceptions[$count] as $filename)
if (!empty($filename))
Db::getInstance()->Execute('
INSERT INTO `'._DB_PREFIX_.'hook_module_exceptions` (`id_module`, id_shop, `id_hook`, `file_name`)
VALUES ('.(int)$obj->id.', '.(int)Shop::getCurrentShop(true).', '.(int)Hook::get($hook[$count]).', "'.pSQL($filename).'")');
VALUES ('.(int)$obj->id.', '.$shopID.', '.(int)Hook::get($hook[$count]).', "'.pSQL($filename).'")');
}
}
}