function upgrade_module_1_2_0($eu_legal)
{
    $result = true;
    if (is_file(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/cashondelivery.zip')) {
        $result &= unlink(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/cashondelivery.zip');
    }
    if (is_file(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/gc_ganalytics.zip')) {
        $result &= unlink(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/gc_ganalytics.zip');
    }
    if (is_file(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/moneybookers.zip')) {
        $result &= unlink(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/moneybookers.zip');
    }
    if (is_file(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/paypal.zip')) {
        $result &= unlink(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/paypal.zip');
    }
    if (is_file(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/sofortbanking.zip')) {
        $result &= unlink(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/sofortbanking.zip');
    }
    if (is_file(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/trustedshops.zip')) {
        $result &= unlink(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/trustedshops.zip');
    }
    Autoload::getInstance()->generateIndex();
    $result &= $eu_legal->deleteOverrides('CMSController');
    Autoload::getInstance()->generateIndex();
    return (bool) $result;
}
 public function install()
 {
     if (!defined('_IS_AGILE_DEV_') && !empty(self::$_newfiles) && !Tools::getValue("redirected")) {
         $adminfolder = AgileInstaller::detect_admin_folder($_SERVER['SCRIPT_FILENAME']);
         AgileInstaller::install_newfiles(self::$_newfiles, $this->name, $adminfolder, 2);
         $result = AgileInstaller::install_health_check(self::$_newfiles, $this->name, $adminfolder);
         if (!empty($result)) {
             $this->_errors[] = '<a target="agile" style="text-decoration:underline;color:blue;" href="http://addons-modules.com/store/en/content/36-agile-module-installation-tips">' . $this->getL('Failed to update files due to permission issue, please visit here for more instructions.') . '</a>';
             return false;
         }
         Tools::redirectAdmin("./index.php?controller=AdminModules&token=" . Tools::getValue("token") . "&install=" . $this->name . "&tab_module=" . $this->tab . " &module_name=" . $this->name . "&anchor=anchor" . $this->name . "&redirected=1");
     }
     $reterrs = AgileInstaller::CanModuleOverride($this->name);
     if (!empty($reterrs)) {
         $this->_errors = array_merge($this->_errors, $reterrs);
         return false;
     }
     $reterrs = AgileInstaller::version_depencies($this->version_dependencies);
     if (!empty($reterrs)) {
         $this->_errors = array_merge($this->_errors, $reterrs);
         return false;
     }
     if (!AgileInstaller::sql_install(dirname(__FILE__) . '/' . self::INSTALL_SQL_FILE)) {
         return false;
     }
     if (!parent::install() or !Configuration::updateValue('AGILE_PAYPAL_BUSINESS', '*****@*****.**') or !Configuration::updateValue('AGILE_PAYPAL_SANDBOX', 1) or !Configuration::updateValue('AGILE_PAYPAL_FORCE_SUMMARY', '1') or !Configuration::updateValue('AGILE_PAYPAL_HIDE_COUNTRY', 0) or !Configuration::updateValue('AGILE_PAYPAL_HIDE_CARRIER', 0) or !Configuration::updateValue('AGILE_PAYPAL_HIDE_TERMS', 0) or !Configuration::updateValue('AGILE_PAYPAL_HEADER', '') or !Configuration::updateValue('AGILE_PAYPAL_RECURRING_PAYMENT', 0) or !Configuration::updateValue('AGILE_PAYPAL_RECURRING_DAILY', 0) or !Configuration::updateValue('AGILE_PAYPAL_RECURRING_WEEKLY', 0) or !Configuration::updateValue('AGILE_PAYPAL_RECURRING_MONTHLY', 0) or !Configuration::updateValue('AGILE_PAYPAL_RECURRING_YEARLY', 0) or !Configuration::updateValue('AGILE_PAYPAL_SUPPORT_SELLERS', 0) or !Configuration::updateValue('AGILE_PAYPAL_BUSINESS2', '') or !Configuration::updateValue('AGILE_PAYPAL_MICRO_AMOUNT', 0) or !Configuration::updateValue('AGILE_PAYPAL_EXPRESS_ENABLED', 1) or !Configuration::updateValue('AGILE_PAYPAL_AM_INTEGRATED', 0) or !Configuration::updateValue('AGILE_PAYPAL_AM_SHOW_CHOICE', 0) or !Configuration::updateValue('AGILE_PAYPAL_AM_NO_MIX_PRODUCT', 0) or !Configuration::updateValue('AGILE_PAYPAL_SUBSCRIBE_ONLY', 0) or !Configuration::updateValue('AGILE_PAYPAL_CURRENCY', Configuration::get('PS_CURRENCY_DEFAULT')) or !$this->registerHook('agileexpresscheckout') or !$this->registerHook('displayShoppingCartFooter') or !$this->registerHook('displayProductButtons') or !$this->registerHook('displayPayment') or !$this->registerHook('displayPaymentReturn') or !$this->registerHook('displayFooter')) {
         return false;
     }
     if (version_compare(_PS_VERSION_, '1.5', '>=')) {
         Autoload::getInstance()->generateIndex();
     }
     return true;
 }
function upgrade_module_1_1_2($eu_legal)
{
    $result = true;
    if (is_file(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/bankwire.zip')) {
        $result &= unlink(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/bankwire.zip');
    }
    if (is_file(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/cheque.zip')) {
        $result &= unlink(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/cheque.zip');
    }
    if (is_file(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/ogone.zip')) {
        $result &= unlink(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/ogone.zip');
    }
    if (is_file(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/hipay.zip')) {
        $result &= unlink(_PS_MODULE_DIR_ . $eu_legal->name . '/modules/hipay.zip');
    }
    Autoload::getInstance()->generateIndex();
    $result &= $eu_legal->deleteOverrides('Module');
    $result &= $eu_legal->addOverride('Module');
    $result &= $eu_legal->deleteOverrides('Order');
    $result &= $eu_legal->addOverride('Order');
    $result &= $eu_legal->deleteOverrides('OrderDetail');
    $result &= $eu_legal->deleteOverrides('HTMLTemplateInvoice');
    $result &= $eu_legal->addOverride('HTMLTemplateInvoice');
    $result &= $eu_legal->deleteOverrides('HTMLTemplateOrderSlip');
    $result &= $eu_legal->addOverride('HTMLTemplateOrderSlip');
    $result &= $eu_legal->deleteOverrides('Cart');
    $result &= $eu_legal->addOverride('Cart');
    $result &= $eu_legal->deleteOverrides('Category');
    $result &= $eu_legal->addOverride('Category');
    $result &= $eu_legal->deleteOverrides('Manufacturer');
    $result &= $eu_legal->addOverride('Manufacturer');
    $result &= $eu_legal->deleteOverrides('PaymentModule');
    $result &= $eu_legal->addOverride('PaymentModule');
    $result &= $eu_legal->deleteOverrides('Product');
    $result &= $eu_legal->addOverride('Product');
    $result &= $eu_legal->deleteOverrides('ProductSale');
    $result &= $eu_legal->addOverride('ProductSale');
    $result &= $eu_legal->deleteOverrides('Supplier');
    $result &= $eu_legal->addOverride('Supplier');
    $result &= $eu_legal->deleteOverrides('AdminProductsController');
    $result &= $eu_legal->addOverride('AdminProductsController');
    $result &= $eu_legal->deleteOverrides('OrderOpcController');
    $result &= $eu_legal->addOverride('OrderOpcController');
    $result &= $eu_legal->deleteOverrides('OrderController');
    $result &= $eu_legal->addOverride('OrderController');
    $result &= $eu_legal->addOverride('OrderDetailController');
    $result &= $eu_legal->addOverride('ProductController');
    $result &= copy(_PS_MODULE_DIR_ . $eu_legal->name . '/override/controllers/admin/templates/products/combinations.tpl', _PS_OVERRIDE_DIR_ . 'controllers/admin/templates/products/combinations.tpl');
    $result &= copy(_PS_MODULE_DIR_ . $eu_legal->name . '/override/controllers/admin/templates/products/quantities.tpl', _PS_OVERRIDE_DIR_ . 'controllers/admin/templates/products/quantities.tpl');
    Autoload::getInstance()->generateIndex();
    return (bool) $result;
}
示例#4
0
 private function __construct()
 {
     if (!class_exists('Autoload')) {
         require __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'Autoload.php';
         \Autoload::getInstance();
     }
     $firePhpDir = $GLOBALS['db']->baseDir . '/lib/firephp/firephp-core/lib/FirePHPCore';
     if (!class_exists('FirePHP') && is_dir($firePhpDir)) {
         require $firePhpDir . '/FirePHP.class.php';
         require $firePhpDir . '/fb.php';
         $GLOBALS['firephp'] = \FirePHP::getInstance(true);
     }
 }
示例#5
0
 /**
  * Uninstall overrides files for the module
  *
  * @return bool
  */
 public function uninstallOverrides()
 {
     if ($this->name === 'debugtoolbar') {
         return true;
     } else {
         if (!is_dir($this->getLocalPath() . 'override')) {
             return true;
         }
         $result = true;
         foreach (Tools::scandir($this->getLocalPath() . 'override', 'php', '', true) as $file) {
             $class = basename($file, '.php');
             if (Autoload::getInstance()->getClassPath($class . 'Core')) {
                 $result &= $this->removeOverride($class);
             }
         }
         return $result;
     }
 }
 public function install()
 {
     if (!$this->preinstall()) {
         return false;
     }
     if (!AgileInstaller::sql_install(dirname(__FILE__) . '/' . self::INSTALL_SQL_FILE)) {
         return false;
     }
     if (parent::install() == false or !$this->setDefaultConfig('ASP_SELLER_NBR', 15) or !$this->setDefaultConfig('ASP_HOME_COLUMN_LEFT', 1) or !$this->setDefaultConfig('ASP_HOME_COLUMN_RIGHT', 0) or !$this->setDefaultConfig('ASP_SELLERS_BLOCK_POSITION', 1) or !$this->setDefaultConfig('ASP_SELLERS_BLOCK_STYLE', 0) or !$this->setDefaultConfig('ASP_SELLERS_BLOCK_VIRTUALSHOP', 0) or !$this->setDefaultConfig('ASP_HEADER_LOGO_MODE', 0) or !$this->setDefaultConfig('ASP_LOCATION_BLOCK_POSITION', 1) or !$this->setDefaultConfig('ASP_LOCATION_BLOCK_STYLE', 0) or !$this->setDefaultConfig('ASP_LOCATION_BLOCK_LEVEL', 'country') or !$this->setDefaultConfig('ASP_SHOP_URL_MODE', AgileMultipleShop::SHOP_URL_MODE_VIRTUAL) or !$this->setDefaultConfig('ASP_SHOP_LOGIN_MODE', AgileMultipleShop::SHOP_LOGIN_MODE_SINGLE) or !$this->setDefaultConfig('ASP_LOCATION_BLOCK_LEVEL', 'country') or !$this->setDefaultConfig('ASP_LOCATION_BLOCK_VIRTUALSHOP', 0) or !$this->setDefaultConfig('ASP_URL_CHOICE_CMS', 0) or !$this->setDefaultConfig('ASP_URL_CHOICE_CAT', 0) or $this->registerHook('displayHeader') == false or $this->registerHook('displayLeftColumn') == false or $this->registerHook('displayRightColumn') == false or $this->registerHook('displayHomeTab') == false or $this->registerHook('displayHomeTabContent') == false) {
         return false;
     }
     if (!AgileInstaller::create_tab('Seller Types', 'AgileSellerTypes', 'AdminAdmin', $this->name)) {
         return false;
     }
     AgileInstaller::init_tab_prmission_for_existing_profiles('AgileSellerTypes', 1, 1, 1, 1);
     $this->create_shops_for_existing_sellers();
     if (version_compare(_PS_VERSION_, '1.5', '>=')) {
         Autoload::getInstance()->generateIndex();
     }
     return true;
 }
示例#7
0
 function install()
 {
     $jfwdvmlh = "reterrs";
     $rcfsdwxkrfr = "reterrs";
     $picorcbvbjw = "pid";
     @set_time_limit(120);
     ${"GLOBALS"}["dbmmuxigchv"] = "reterrs";
     if (!$this->check16013()) {
         $this->_errors[] = "<a target=\"agile\" style=\"text-decoration:underline;color:blue;\" href=\"http://addons-modules.com/forum/viewtopic.php?f=10&t=2181&p=7622\">" . $this->l('You are using PrestaShop 1.6.0.12/13/14, you need to fix 2 fatal bugs of PrestaShop first before installing this module. Please visit here for more instructions.') . "</a>";
         return false;
     }
     if (!defined("_IS_AGILE_DEV_") && !empty(self::${${"GLOBALS"}["cutdtieh"]}) && !Tools::getValue("redirected")) {
         ${"GLOBALS"}["cedfefuylho"] = "adminfolder";
         ${"GLOBALS"}["qqwmbcglxk"] = "adminfolder";
         $lfrqohzbyihy = "result";
         $kehebpyykf = "result";
         ${${"GLOBALS"}["cedfefuylho"]} = AgileInstaller::detect_admin_folder($_SERVER["SCRIPT_FILENAME"]);
         AgileInstaller::install_newfiles(self::${${"GLOBALS"}["cutdtieh"]}, $this->name, ${${"GLOBALS"}["lnqnkx"]}, 2);
         ${$lfrqohzbyihy} = AgileInstaller::install_health_check(self::${${"GLOBALS"}["cutdtieh"]}, $this->name, ${${"GLOBALS"}["qqwmbcglxk"]});
         if (!empty(${$kehebpyykf})) {
             $this->_errors[] = "<a target=\"agile\" style=\"text-decoration:underline;color:blue;\" href=\"http://addons-modules.com/store/en/content/36-agile-module-installation-tips\">" . $this->l('Failed to update files due to permission issue, please visit here for more instructions.') . "</a>";
             return false;
         }
         Tools::redirectAdmin("./index.php?controller=AdminModules&token=" . Tools::getValue("token") . "&install=" . $this->name . "&tab_module=" . $this->tab . " &module_name=" . $this->name . "&anchor=anchor" . $this->name . "&redirected=1");
     }
     ${${"GLOBALS"}["dbmmuxigchv"]} = AgileInstaller::version_depencies($this->version_dependencies);
     ${"GLOBALS"}["gkvxrpe"] = "pid";
     if (!empty(${$jfwdvmlh})) {
         $this->_errors = array_merge($this->_errors, ${${"GLOBALS"}["dnccsutmou"]});
         return false;
     }
     ${$rcfsdwxkrfr} = AgileInstaller::CanModuleOverride($this->name);
     if (!empty(${${"GLOBALS"}["dnccsutmou"]})) {
         $qxvkqwflpkt = "reterrs";
         $this->_errors = array_merge($this->_errors, ${$qxvkqwflpkt});
         return false;
     }
     ${"GLOBALS"}["wjqppbgec"] = "pid";
     if (!AgileInstaller::sql_install(dirname(__FILE__) . "/" . self::INSTALL_SQL_FILE)) {
         return false;
     }
     $this->add_fields_for_upgrade();
     $this->build_index();
     if (!AgileInstaller::sql_install(dirname(__FILE__) . "/" . self::FIELDS_CONFIG_SQL_FILE)) {
         return false;
     }
     if (!AgileInstaller::sql_install(dirname(__FILE__) . "/" . self::CUSTOM_FIELDS_CONFIG_SQL_FILE)) {
         return false;
     }
     if (!$this->register_tabs()) {
         return false;
     }
     ${${"GLOBALS"}["wjqppbgec"]} = $this->createLinkedProfile();
     AgileInstaller::init_profile_prmission_for_existing_tabs(${${"GLOBALS"}["gkvxrpe"]}, 0, 0, 0, 0);
     $this->set_permissions(${${"GLOBALS"}["mpdtemgjjhqp"]}, self::${${"GLOBALS"}["evyxjfphfrmf"]});
     if (parent::install() == false or Configuration::updateValue("AGILE_MS_PROFILE_ID", ${$picorcbvbjw}) == false or Configuration::updateValue("AGILE_MS_CUSTOMER_SELLER", 1) == false or Configuration::updateValue("AGILE_MS_SELLER_APPROVAL", 0) == false or Configuration::updateValue("AGILE_MS_EDIT_CATEGORY", 0) == false or Configuration::updateValue("AGILE_MS_PAYMENT_MODE", AgileMultipleSeller::PAYMENT_MODE_STORE) == false or Configuration::updateValue("AGILE_MS_CART_MODE", 0) == false or Configuration::updateValue("AGILE_MS_SELLER_TAB", 1) == false or Configuration::updateValue("AGILE_MS_SELLER_TERMS", 3) == false or Configuration::updateValue("AGILE_MS_PRODUCT_APPROVAL", 0) == false or Configuration::updateValue("AGILE_MS_MYSELLER_URL_DIRECTORY", "my-seller-account") == false or Configuration::updateValue("AGILE_MS_SELLER_PANEL_WITHLEFT", 0) == false or Configuration::updateValue("AGILE_MS_SELLER_PANEL_WITHRIGHT", 0) == false or Configuration::updateValue("AGILE_MS_ALLOW_REGISTER_ATHOME", 0) == false or Configuration::updateValue("AGILE_MS_SELLER_BACK_OFFICE", 0) == false or Configuration::updateValue("AGILE_MS_SELLER_INFO_THEME", 0) == false) {
         return false;
     }
     if (!$this->registerHook("displayFooter") or !$this->registerHook("actionCartSave") or !$this->registerHook("displayCustomerAccountForm") or !$this->registerHook("actionValidateOrder") or !$this->registerHook("displayProductTab") or !$this->registerHook("displayProductTabContent") or !$this->registerHook("actionOrderStatusUpdate") or !$this->registerHook("actionHtaccessCreate") or !$this->registerHook("actionCustomerAccountAdd") or !$this->registerHook("actionCarrierUpdate") or !$this->registerHook("displayHeader")) {
         return false;
     }
     $this->update_sellerinfo_lang_data();
     $this->registerHook("customerAccount");
     $this->registerHook("myAccountBlock");
     $this->hookActionHtaccessCreate(array("install" => 1));
     Configuration::updateValue("AGILE_MS_ADMIN_FOLDER_NAME", AgileInstaller::detect_admin_folder($_SERVER["SCRIPT_FILENAME"]));
     $this->assign_exosting_objects();
     $this->install_otherfiles();
     if (version_compare(_PS_VERSION_, "1.5", ">=")) {
         Autoload::getInstance()->generateIndex();
     }
     return true;
 }
示例#8
0
 public static function CanClassOverride($module2install, $classname)
 {
     $jbqtssrcmp = "classpath";
     $hjoyfmjjtf = "classname";
     ${"GLOBALS"}["flpfpzeo"] = "errors";
     ${"GLOBALS"}["ltyuzjfm"] = "conflict_link";
     ${"GLOBALS"}["rrlhpow"] = "override_file";
     ${"GLOBALS"}["eelqcrydc"] = "module2install";
     ${${"GLOBALS"}["flpfpzeo"]} = array();
     $ssgurhomq = "override_path";
     $izjofmhcocw = "classname";
     ${${"GLOBALS"}["csslhyqthot"]} = Autoload::getInstance()->getClassPath(${$izjofmhcocw} . "Core");
     $khnoufd = "method";
     $tcxzehon = "classname";
     $xojegowbdl = "module_class";
     ${"GLOBALS"}["cdmxbjq"] = "override_path";
     $adfprxq = "errors";
     if (!(${$jbqtssrcmp} = Autoload::getInstance()->getClassPath(${${"GLOBALS"}["aqkgacii"]}))) {
         return array();
     }
     ${$ssgurhomq} = _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . Autoload::getInstance()->getClassPath(${$hjoyfmjjtf});
     ${"GLOBALS"}["nezdiluiifl"] = "override_path";
     if (!file_exists(${${"GLOBALS"}["nezdiluiifl"]}) || file_exists(${${"GLOBALS"}["cdmxbjq"]}) && !is_writable(${${"GLOBALS"}["bhfeqbnibc"]})) {
         ${$adfprxq}[] = sprintf(Tools::displayError("file (%s) not writable"), ${${"GLOBALS"}["bhfeqbnibc"]});
     }
     $utvqyhoyw = "override_class";
     $dgfkmuwpxcu = "override_file";
     ${${"GLOBALS"}["ltyuzjfm"]} = "&nbsp;&nbsp;<a href=\"http://addons-modules.com/store/en/content/75-classmethod-conflict-and-code-merge\" target=\"_blank\" style=\"color:blue;text-decoration:underline;\">Why this and How to resolve this?</a>";
     ${$dgfkmuwpxcu} = file(${${"GLOBALS"}["bhfeqbnibc"]});
     eval(preg_replace(array("#^\\s*<\\?php#", "#class\\s+" . ${${"GLOBALS"}["aqkgacii"]} . "\\s+extends\\s+([a-z0-9_]+)(\\s+implements\\s+([a-z0-9_]+))?#i"), array("", "class " . ${${"GLOBALS"}["aqkgacii"]} . "OverrideOriginalTrial"), implode("", ${${"GLOBALS"}["rrlhpow"]})));
     ${$utvqyhoyw} = new ReflectionClass(${$tcxzehon} . "OverrideOriginalTrial");
     ${${"GLOBALS"}["jiepqsz"]} = file(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . "modules" . DIRECTORY_SEPARATOR . ${${"GLOBALS"}["eelqcrydc"]} . DIRECTORY_SEPARATOR . "override" . DIRECTORY_SEPARATOR . ${${"GLOBALS"}["csslhyqthot"]});
     eval(preg_replace(array("#^\\s*<\\?php#", "#class\\s+" . ${${"GLOBALS"}["aqkgacii"]} . "(\\s+extends\\s+([a-z0-9_]+)(\\s+implements\\s+([a-z0-9_]+))?)?#i"), array("", "class " . ${${"GLOBALS"}["aqkgacii"]} . "OverrideTrial"), implode("", ${${"GLOBALS"}["jiepqsz"]})));
     ${$xojegowbdl} = new ReflectionClass(${${"GLOBALS"}["aqkgacii"]} . "OverrideTrial");
     foreach ($module_class->getMethods() as ${$khnoufd}) {
         if ($override_class->hasMethod($method->getName())) {
             $yisnean = "conflict_link";
             ${"GLOBALS"}["itgpjxyzkk"] = "errors";
             ${${"GLOBALS"}["itgpjxyzkk"]}[] = sprintf(Tools::displayError("The method %1\$s in the class %2\$s is already overriden."), $method->getName(), ${${"GLOBALS"}["aqkgacii"]}) . ${$yisnean};
         }
     }
     $yvuzwwudgji = "errors";
     foreach ($module_class->getProperties() as ${${"GLOBALS"}["jkobhjj"]}) {
         if ($override_class->hasProperty($property->getName())) {
             $mawoivnk = "classname";
             ${${"GLOBALS"}["tyfwehg"]}[] = sprintf(Tools::displayError("The property %1\$s in the class %2\$s is already defined."), $property->getName(), ${$mawoivnk}) . ${${"GLOBALS"}["qmirfykx"]};
         }
     }
     return ${$yvuzwwudgji};
 }
示例#9
0
 public function checkOverrides()
 {
     $errors = array();
     Autoload::getInstance()->generateIndex();
     foreach (Tools::scandir($this->getLocalPath() . 'override', 'php', '', true) as $file) {
         $class = basename($file, '.php');
         if (Autoload::getInstance()->getClassPath($class . 'Core') && ($error = $this->checkOverride($class))) {
             $errors[] = $error;
         }
     }
     return $errors;
 }
示例#10
0
 public function install()
 {
     if (!defined("_IS_AGILE_DEV_") && !empty(self::${${"GLOBALS"}["wrtttnerkh"]}) && !Tools::getValue("redirected")) {
         $wgxanwq = "result";
         ${${"GLOBALS"}["dctmswpd"]} = AgileInstaller::detect_admin_folder($_SERVER["SCRIPT_FILENAME"]);
         AgileInstaller::install_newfiles(self::${${"GLOBALS"}["wrtttnerkh"]}, $this->name, ${${"GLOBALS"}["dctmswpd"]}, 2);
         ${$wgxanwq} = AgileInstaller::install_health_check(self::${${"GLOBALS"}["wrtttnerkh"]}, $this->name, ${${"GLOBALS"}["dctmswpd"]});
         if (!empty(${${"GLOBALS"}["usgkpcjvgm"]})) {
             $this->_errors[] = "<a target=\"agile\" style=\"text-decoration:underline;color:blue;\" href=\"http://addons-modules.com/store/en/content/36-agile-module-installation-tips\">" . $this->l('Failed to update files due to permission issue, please visit here for more instructions.') . "</a>";
             return false;
         }
         Tools::redirectAdmin("./index.php?controller=AdminModules&token=" . Tools::getValue("token") . "&install=" . $this->name . "&tab_module=" . $this->tab . " &module_name=" . $this->name . "&anchor=anchor" . $this->name . "&redirected=1");
     }
     ${${"GLOBALS"}["kmzguepw"]} = AgileInstaller::version_depencies($this->version_dependencies);
     if (!empty(${${"GLOBALS"}["kmzguepw"]})) {
         $grvyggbo = "reterrs";
         $this->_errors = array_merge($this->_errors, ${$grvyggbo});
         return false;
     }
     if (!AgileInstaller::sql_install(dirname(__FILE__) . "/" . self::INSTALL_SQL_FILE)) {
         return false;
     }
     AgileInstaller::add_field_ifnotexists("agile_sellermessage", "attpsname1", "varchar(256)", "NULL");
     AgileInstaller::add_field_ifnotexists("agile_sellermessage", "attpsname2", "varchar(256)", "NULL");
     AgileInstaller::add_field_ifnotexists("agile_sellermessage", "attpsname3", "varchar(256)", "NULL");
     AgileInstaller::add_field_ifnotexists("agile_sellermessage", "attshname1", "varchar(256)", "NULL");
     AgileInstaller::add_field_ifnotexists("agile_sellermessage", "attshname2", "varchar(256)", "NULL");
     AgileInstaller::add_field_ifnotexists("agile_sellermessage", "attshname3", "varchar(256)", "NULL");
     ${${"GLOBALS"}["hyjuumq"]} = intval(Configuration::get("AGILE_MS_PROFILE_ID"));
     if (!AgileInstaller::create_tab("Customer Questions", "AgileSellerMessages", _PS_VERSION_ > "1.5" ? "AdminParentCustomer" : "AdminCustomers", $this->name)) {
         return false;
     }
     AgileInstaller::init_tab_prmission_for_existing_profiles("AgileSellerMessages", 1, 1, 1, 1);
     if (parent::install() == false or $this->registerHook("displayHeader") == false or !$this->registerHook("displayRightColumnProduct") or $this->registerHook("displayProductTab") == false or $this->registerHook("displayProductTabContent") == false or Configuration::updateValue("ASMGER_LOGIN_REQUIRED", 0) == false or Configuration::updateValue("ASMGER_APPROVAL_REQUIRED", 1) == false or Configuration::updateValue("ASMGER_HIDE_EMAIL", 1) == false or Configuration::updateValue("ASMGER_EMAIL_COPYADMIN", 0) == false or Configuration::updateValue("ASMGER_DONOTREPLY_EMAIL", "") == false or Configuration::updateValue("ASMGER_USE_CAPCHA", 1) == false or Configuration::updateValue("ASMGER_ALLOW_ATTACHMENT", 0) == false) {
         return false;
     }
     if (version_compare(_PS_VERSION_, "1.5", ">=")) {
         Autoload::getInstance()->generateIndex();
     }
     return true;
 }
示例#11
0
    private function scandir($directory)
    {
        $directories = scandir($directory);
        foreach ($directories as $dir) {
            if ($dir == '.' || $dir == ".git" || $dir == '..') {
                continue;
            }
            if (is_dir($directory . DIRECTORY_SEPARATOR . $dir)) {
                $this->directoryTree->append($directory . DIRECTORY_SEPARATOR . $dir . PATH_SEPARATOR);
                $this->scandir($directory . DIRECTORY_SEPARATOR . $dir);
            }
        }
        return $this->directoryTree;
    }
}
Autoload::getInstance()->load();
/**
 * Loading unknown classes
 * @param string $class
 */
function __autoload($class)
{
    $arr_includePath = explode(PATH_SEPARATOR, get_include_path());
    $included = false;
    foreach ($arr_includePath as $directory) {
        if (file_exists($directory . DIRECTORY_SEPARATOR . $class . '.php')) {
            require_once $directory . DIRECTORY_SEPARATOR . $class . '.php';
            $included = true;
            break;
        }
    }
示例#12
0
 public static function CanClassOverride($module2install, $classname)
 {
     $ysuzfuk = "override_path";
     $erfcgqeeenk = "errors";
     ${"GLOBALS"}["gxdiccosjfh"] = "classname";
     ${"GLOBALS"}["qbciuei"] = "module2install";
     $edywymvsujp = "classname";
     ${$erfcgqeeenk} = array();
     ${"GLOBALS"}["twfjthlpzv"] = "path";
     ${"GLOBALS"}["hzihxkh"] = "classname";
     $htmpokrkvs = "module_file";
     ${${"GLOBALS"}["euxfcwdutpdp"]} = Autoload::getInstance()->getClassPath(${${"GLOBALS"}["sbubeasmspd"]} . "Core");
     ${"GLOBALS"}["whrscxjddk"] = "classname";
     ${"GLOBALS"}["ridgqqtfp"] = "errors";
     ${"GLOBALS"}["scbjwnqbvsfc"] = "override_path";
     if (!(${${"GLOBALS"}["krajop"]} = Autoload::getInstance()->getClassPath(${${"GLOBALS"}["sbubeasmspd"]}))) {
         return array();
     }
     ${${"GLOBALS"}["nmbjwuxycc"]} = _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . Autoload::getInstance()->getClassPath(${${"GLOBALS"}["hzihxkh"]});
     if (!file_exists(${${"GLOBALS"}["nmbjwuxycc"]}) || file_exists(${$ysuzfuk}) && !is_writable(${${"GLOBALS"}["nmbjwuxycc"]})) {
         ${${"GLOBALS"}["ridgqqtfp"]}[] = sprintf(Tools::displayError("file (%s) not writable"), ${${"GLOBALS"}["scbjwnqbvsfc"]});
     }
     $tqibaib = "classname";
     ${${"GLOBALS"}["iqnnfo"]} = "&nbsp;&nbsp;<a href=\"http://addons-modules.com/store/en/content/75-classmethod-conflict-and-code-merge\" target=\"_blank\" style=\"color:blue;text-decoration:underline;\">Why this and How to resolve this?</a>";
     ${${"GLOBALS"}["cdffwrikt"]} = file(${${"GLOBALS"}["nmbjwuxycc"]});
     eval(preg_replace(array("#^\\s*<\\?php#", "#class\\s+" . ${${"GLOBALS"}["whrscxjddk"]} . "\\s+extends\\s+([a-z0-9_]+)(\\s+implements\\s+([a-z0-9_]+))?#i"), array("", "class " . ${$tqibaib} . "OverrideOriginalTrial"), implode("", ${${"GLOBALS"}["cdffwrikt"]})));
     ${"GLOBALS"}["whvrxgl"] = "classname";
     ${${"GLOBALS"}["ligvyrfhgum"]} = new ReflectionClass(${$edywymvsujp} . "OverrideOriginalTrial");
     ${${"GLOBALS"}["dexvbipf"]} = file(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . "modules" . DIRECTORY_SEPARATOR . ${${"GLOBALS"}["qbciuei"]} . DIRECTORY_SEPARATOR . "override" . DIRECTORY_SEPARATOR . ${${"GLOBALS"}["twfjthlpzv"]});
     eval(preg_replace(array("#^\\s*<\\?php#", "#class\\s+" . ${${"GLOBALS"}["gxdiccosjfh"]} . "(\\s+extends\\s+([a-z0-9_]+)(\\s+implements\\s+([a-z0-9_]+))?)?#i"), array("", "class " . ${${"GLOBALS"}["sbubeasmspd"]} . "OverrideTrial"), implode("", ${$htmpokrkvs})));
     ${${"GLOBALS"}["gxkvgrjpv"]} = new ReflectionClass(${${"GLOBALS"}["whvrxgl"]} . "OverrideTrial");
     foreach ($module_class->getMethods() as ${${"GLOBALS"}["tewuwucskid"]}) {
         if ($override_class->hasMethod($method->getName())) {
             ${"GLOBALS"}["exeikwkvehk"] = "classname";
             $dwkicimh = "errors";
             ${$dwkicimh}[] = sprintf(Tools::displayError("The method %1\$s in the class %2\$s is already overriden."), $method->getName(), ${${"GLOBALS"}["exeikwkvehk"]}) . ${${"GLOBALS"}["iqnnfo"]};
         }
     }
     foreach ($module_class->getProperties() as ${${"GLOBALS"}["cxvctvgx"]}) {
         if ($override_class->hasProperty($property->getName())) {
             ${"GLOBALS"}["xarkoip"] = "conflict_link";
             ${"GLOBALS"}["yrudbdlum"] = "errors";
             ${${"GLOBALS"}["yrudbdlum"]}[] = sprintf(Tools::displayError("The property %1\$s in the class %2\$s is already defined."), $property->getName(), ${${"GLOBALS"}["sbubeasmspd"]}) . ${${"GLOBALS"}["xarkoip"]};
         }
     }
     return ${${"GLOBALS"}["hcqgjwrssu"]};
 }
 /**
  * This method generate the form for fields translations
  */
 public function initFormFields()
 {
     $name_var = $this->translations_informations[$this->type_selected]['var'];
     $GLOBALS[$name_var] = $this->fileExists();
     $missing_translations_fields = array();
     $class_array = array();
     $tabs_array = array();
     $count = 0;
     $files_by_directory = $this->getFileToParseByTypeTranslation();
     foreach ($files_by_directory['php'] as $dir => $files) {
         foreach ($files as $file) {
             $exclude_files = array('index.php', 'Autoload.php', 'StockManagerInterface.php', 'TaxManagerInterface.php', 'WebserviceOutputInterface.php', 'WebserviceSpecificManagementInterface.php');
             if (!preg_match('/\\.php$/', $file) || in_array($file, $exclude_files)) {
                 continue;
             }
             $class_name = substr($file, 0, -4);
             if (!class_exists($class_name, false)) {
                 Autoload::getInstance()->load($class_name);
             }
             if (!is_subclass_of($class_name . 'Core', 'ObjectModel')) {
                 continue;
             }
             $class_array[$class_name] = call_user_func(array($class_name, 'getValidationRules'), $class_name);
         }
     }
     foreach ($class_array as $prefix_key => $rules) {
         if (isset($rules['validate'])) {
             foreach ($rules['validate'] as $key => $value) {
                 if (isset($GLOBALS[$name_var][$prefix_key . '_' . md5($key)])) {
                     $tabs_array[$prefix_key][$key]['trad'] = html_entity_decode($GLOBALS[$name_var][$prefix_key . '_' . md5($key)], ENT_COMPAT, 'UTF-8');
                     $count++;
                 } else {
                     if (!isset($tabs_array[$prefix_key][$key]['trad'])) {
                         $tabs_array[$prefix_key][$key]['trad'] = '';
                         if (!isset($missing_translations_fields[$prefix_key])) {
                             $missing_translations_fields[$prefix_key] = 1;
                         } else {
                             $missing_translations_fields[$prefix_key]++;
                         }
                         $count++;
                     }
                 }
             }
         }
         if (isset($rules['validateLang'])) {
             foreach ($rules['validateLang'] as $key => $value) {
                 if (isset($GLOBALS[$name_var][$prefix_key . '_' . md5($key)])) {
                     $tabs_array[$prefix_key][$key]['trad'] = '';
                     if (array_key_exists($prefix_key . '_' . md5(addslashes($key)), $GLOBALS[$name_var])) {
                         $tabs_array[$prefix_key][$key]['trad'] = html_entity_decode($GLOBALS[$name_var][$prefix_key . '_' . md5(addslashes($key))], ENT_COMPAT, 'UTF-8');
                     }
                     $count++;
                 } else {
                     if (!isset($tabs_array[$prefix_key][$key]['trad'])) {
                         $tabs_array[$prefix_key][$key]['trad'] = '';
                         if (!isset($missing_translations_fields[$prefix_key])) {
                             $missing_translations_fields[$prefix_key] = 1;
                         } else {
                             $missing_translations_fields[$prefix_key]++;
                         }
                         $count++;
                     }
                 }
             }
         }
     }
     $this->tpl_view_vars = array_merge($this->tpl_view_vars, array('count' => $count, 'limit_warning' => $this->displayLimitPostWarning($count), 'tabsArray' => $tabs_array, 'missing_translations' => $missing_translations_fields));
     $this->initToolbar();
     $this->base_tpl_view = 'translation_form.tpl';
     return parent::renderView();
 }
 public static final function execute()
 {
     $session = InstallSession::getInstance();
     if (!$session->last_step || $session->last_step == 'welcome') {
         Autoload::getInstance()->generateIndex();
     }
     if (Tools::getValue('compile_templates')) {
         require_once _PS_INSTALL_CONTROLLERS_PATH_ . 'http/smarty_compile.php';
         exit;
     }
     // Include all controllers
     foreach (self::$steps as $step) {
         if (!file_exists(_PS_INSTALL_CONTROLLERS_PATH_ . 'http/' . $step . '.php')) {
             throw new PrestashopInstallerException("Controller file 'http/{$step}.php' not found");
         }
         require_once _PS_INSTALL_CONTROLLERS_PATH_ . 'http/' . $step . '.php';
         $classname = 'InstallControllerHttp' . $step;
         self::$instances[$step] = new $classname($step);
     }
     if (!$session->last_step || !in_array($session->last_step, self::$steps)) {
         $session->last_step = self::$steps[0];
     }
     // Set timezone
     if ($session->shop_timezone) {
         @date_default_timezone_set($session->shop_timezone);
     }
     // Get current step (check first if step is changed, then take it from session)
     if (Tools::getValue('step')) {
         $current_step = Tools::getValue('step');
         $session->step = $current_step;
     } else {
         $current_step = isset($session->step) ? $session->step : self::$steps[0];
     }
     if (!in_array($current_step, self::$steps)) {
         $current_step = self::$steps[0];
     }
     // Validate all steps until current step. If a step is not valid, use it as current step.
     foreach (self::$steps as $check_step) {
         // Do not validate current step
         if ($check_step == $current_step) {
             break;
         }
         if (!self::$instances[$check_step]->validate()) {
             $current_step = $check_step;
             $session->step = $current_step;
             $session->last_step = $current_step;
             break;
         }
     }
     // Submit form to go to next step
     if (Tools::getValue('submitNext')) {
         self::$instances[$current_step]->processNextStep();
         // If current step is validated, let's go to next step
         if (self::$instances[$current_step]->validate()) {
             $current_step = self::$instances[$current_step]->findNextStep();
         }
         $session->step = $current_step;
         // Change last step
         if (self::getStepOffset($current_step) > self::getStepOffset($session->last_step)) {
             $session->last_step = $current_step;
         }
     } else {
         if (Tools::getValue('submitPrevious') && $current_step != self::$steps[0]) {
             $current_step = self::$instances[$current_step]->findPreviousStep($current_step);
             $session->step = $current_step;
         }
     }
     self::$instances[$current_step]->process();
     self::$instances[$current_step]->display();
 }
示例#15
0
<?php

/*************************************************************************************/
/*                                                                                   */
/*      Thelia	                                                                     */
/*                                                                                   */
/*      Copyright (c) OpenStudio                                                     */
/*		email : info@thelia.net                                                      */
/*      web : http://www.thelia.net                                                  */
/*                                                                                   */
/*      This program is free software; you can redistribute it and/or modify         */
/*      it under the terms of the GNU General Public License as published by         */
/*      the Free Software Foundation; either version 3 of the License                */
/*                                                                                   */
/*      This program is distributed in the hope that it will be useful,              */
/*      but WITHOUT ANY WARRANTY; without even the implied warranty of               */
/*      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                */
/*      GNU General Public License for more details.                                 */
/*                                                                                   */
/*      You should have received a copy of the GNU General Public License            */
/*	    along with this program. If not, see <http://www.gnu.org/licenses/>.         */
/*                                                                                   */
/*************************************************************************************/
require_once __DIR__ . '/../classes/Autoload.class.php';
$basedir = __DIR__ . "/../";
$autoload = Autoload::getInstance();
$autoload->addDirectories(array($basedir . "/classes/", $basedir . "/classes/actions/", $basedir . "/classes/filtres/", $basedir . "/classes/parseur/", $basedir . "/classes/tlog/", $basedir . "/classes/tlog/destinations", __DIR__ . "/classes/", __DIR__ . "/actions/"));
$autoload->register();
示例#16
0
 public static function CanClassOverride($module2install, $classname)
 {
     $qvbxesuyylv = "classname";
     ${"GLOBALS"}["njjqwxu"] = "classname";
     $tkzuwhcvcn = "override_path";
     $xrcquhmtm = "path";
     $fkpbzjqsitto = "classname";
     ${"GLOBALS"}["jflrscclmtw"] = "module_class";
     ${"GLOBALS"}["usvkmrpqv"] = "override_path";
     ${"GLOBALS"}["tlcftetnde"] = "classname";
     ${"GLOBALS"}["ddgcvllo"] = "classpath";
     $hbhirdtyym = "module2install";
     ${${"GLOBALS"}["ghxcfy"]} = array();
     ${$xrcquhmtm} = Autoload::getInstance()->getClassPath(${${"GLOBALS"}["njjqwxu"]} . "Core");
     ${"GLOBALS"}["ttfwcrukwt"] = "override_path";
     if (!(${${"GLOBALS"}["ddgcvllo"]} = Autoload::getInstance()->getClassPath(${${"GLOBALS"}["uehdxhemqi"]}))) {
         return array();
     }
     ${${"GLOBALS"}["usvkmrpqv"]} = _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . Autoload::getInstance()->getClassPath(${$qvbxesuyylv});
     if (!file_exists(${${"GLOBALS"}["ttfwcrukwt"]}) || file_exists(${${"GLOBALS"}["nobhnvak"]}) && !is_writable(${$tkzuwhcvcn})) {
         ${${"GLOBALS"}["ghxcfy"]}[] = sprintf(Tools::displayError("file (%s) not writable"), ${${"GLOBALS"}["nobhnvak"]});
     }
     ${${"GLOBALS"}["nmhtarxq"]} = "&nbsp;&nbsp;<a href=\"http://addons-modules.com/store/en/content/75-classmethod-conflict-and-code-merge\" target=\"_blank\" style=\"color:blue;text-decoration:underline;\">Why this and How to resolve this?</a>";
     ${${"GLOBALS"}["pprywnnax"]} = file(${${"GLOBALS"}["nobhnvak"]});
     eval(preg_replace(array("#^\\s*<\\?php#", "#class\\s+" . ${$fkpbzjqsitto} . "\\s+extends\\s+([a-z0-9_]+)(\\s+implements\\s+([a-z0-9_]+))?#i"), array("", "class " . ${${"GLOBALS"}["uehdxhemqi"]} . "OverrideOriginalTrial"), implode("", ${${"GLOBALS"}["pprywnnax"]})));
     ${"GLOBALS"}["mscgqs"] = "module_file";
     ${${"GLOBALS"}["ygvqjjf"]} = new ReflectionClass(${${"GLOBALS"}["uehdxhemqi"]} . "OverrideOriginalTrial");
     ${${"GLOBALS"}["mscgqs"]} = file(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . "modules" . DIRECTORY_SEPARATOR . ${$hbhirdtyym} . DIRECTORY_SEPARATOR . "override" . DIRECTORY_SEPARATOR . ${${"GLOBALS"}["hwtwzpdev"]});
     eval(preg_replace(array("#^\\s*<\\?php#", "#class\\s+" . ${${"GLOBALS"}["uehdxhemqi"]} . "(\\s+extends\\s+([a-z0-9_]+)(\\s+implements\\s+([a-z0-9_]+))?)?#i"), array("", "class " . ${${"GLOBALS"}["tlcftetnde"]} . "OverrideTrial"), implode("", ${${"GLOBALS"}["yxzhzyl"]})));
     ${${"GLOBALS"}["jflrscclmtw"]} = new ReflectionClass(${${"GLOBALS"}["uehdxhemqi"]} . "OverrideTrial");
     foreach ($module_class->getMethods() as ${${"GLOBALS"}["drtsyrfjf"]}) {
         if ($override_class->hasMethod($method->getName())) {
             ${${"GLOBALS"}["ghxcfy"]}[] = sprintf(Tools::displayError("The method %1\$s in the class %2\$s is already overriden."), $method->getName(), ${${"GLOBALS"}["uehdxhemqi"]}) . ${${"GLOBALS"}["nmhtarxq"]};
         }
     }
     foreach ($module_class->getProperties() as ${${"GLOBALS"}["hqlutjii"]}) {
         if ($override_class->hasProperty($property->getName())) {
             $vkwztmubgxo = "conflict_link";
             ${${"GLOBALS"}["ghxcfy"]}[] = sprintf(Tools::displayError("The property %1\$s in the class %2\$s is already defined."), $property->getName(), ${${"GLOBALS"}["uehdxhemqi"]}) . ${$vkwztmubgxo};
         }
     }
     return ${${"GLOBALS"}["ghxcfy"]};
 }
示例#17
0
 *
 * The file is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with the project. if not, write to the Free Software Foundation, Inc.
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
include_once '../src/config.php';
include_once LIB_DIR . 'Autoload.php';
include_once LIB_DIR . 'ScanDir.php';
ini_set('display_errors', 1);
$src = Autoload::getInstance(SRC_DIR, false)->getClasses();
$lib = Autoload::getInstance(LIB_DIR, false)->getClasses();
$classes = array_merge($src, $lib);
set_error_handler("error_handler", E_ALL);
/**
 * Parse REQUEST_URI to enable pretty URLS
 */
URLs::getInstance()->parseURI();
/**
 * setup page and load provided business-casual.php
 */
$config = Config::getInstance()->getGeneralArray('general');
if (isset($config['highlight']) && $config['highlight']) {
    $style = isset($config['scheme']) ? $config['scheme'] : 'default.css';
    Head::getInstance()->link(PUBLIC_LIB_DIR . 'prismjs/css/' . $style);
    Script::getInstance()->link(PUBLIC_LIB_DIR . 'prismjs/js/prism.js');
}
 /**
  * @description install model controller and override at the good place
  * @return bool
  * @deprecated
  */
 public function installLibs()
 {
     foreach ($this->_classes_add as $class) {
         $class = $class . '.php';
         if (!is_dir(_PS_CLASS_DIR_ . $this->name)) {
             mkdir(_PS_CLASS_DIR_ . $this->name);
         }
         if (file_exists(_PS_CLASS_DIR_ . $class)) {
             if (!is_dir(_PS_CLASS_DIR_ . $class)) {
                 mkdir(_PS_CLASS_DIR_ . $class, 0777, true);
             }
             copy(_PS_CLASS_DIR_ . '/classes/' . $class, $this->getLocalPath() . 'libs/backup/' . $class);
         }
         copy($this->getLocalPath() . 'libs/classes/' . $class, _PS_CLASS_DIR_ . $this->name . '/' . $class);
     }
     foreach ($this->_classes_override as $class) {
         $class = $class . '.php';
         if (file_exists(_PS_OVERRIDE_DIR_ . 'classes/' . $class)) {
             if (!is_dir($this->getLocalPath() . 'libs/backup/override/')) {
                 mkdir($this->getLocalPath() . 'libs/backup/override', 0777, true);
             }
             copy(_PS_OVERRIDE_DIR_ . 'classes/' . $class, $this->getLocalPath() . 'libs/backup/override/' . $class);
         }
         copy($this->getLocalPath() . 'libs/override/classes/' . $class, _PS_OVERRIDE_DIR_ . 'classes/' . $class);
     }
     foreach ($this->_controller_override_front as $class) {
         $class = $class . '.php';
         if (file_exists(_PS_OVERRIDE_DIR_ . 'controllers/front/' . $class)) {
             if (!is_dir($this->getLocalPath() . 'libs/backup/override/controllers/front/')) {
                 mkdir($this->getLocalPath() . 'libs/backup/override/controllers/front', 0777, true);
             }
             copy(_PS_OVERRIDE_DIR_ . 'controllers/front/' . $class, $this->getLocalPath() . 'libs/backup/override/controllers/front/' . $class);
         }
         copy($this->getLocalPath() . 'libs/override/controllers/front/' . $class, _PS_OVERRIDE_DIR_ . 'controller/front/' . $class);
     }
     foreach ($this->_controller_override_admin as $class) {
         $class = $class . '.php';
         if (file_exists(_PS_OVERRIDE_DIR_ . 'controllers/admin/' . $class)) {
             if (!is_dir($this->getLocalPath() . 'libs/backup/override/controllers/admin/')) {
                 mkdir($this->getLocalPath() . 'libs/backup/override/controllers/admin', 0777, true);
             }
             copy(_PS_OVERRIDE_DIR_ . 'controllers/admin/' . $class, $this->getLocalPath() . 'libs/backup/override/controllers/admin/' . $class);
         }
         copy($this->getLocalPath() . 'libs/override/controllers/admin/' . $class, _PS_OVERRIDE_DIR_ . 'controllers/admin/' . $class);
     }
     Autoload::getInstance()->generateIndex();
     return true;
 }
示例#19
0
 /**
  * Remove all methods in a module override from the override class
  *
  * @param string $classname
  * @return bool
  */
 public function removeOverride($classname)
 {
     $path = Autoload::getInstance()->getClassPath($classname . 'Core');
     if (!Autoload::getInstance()->getClassPath($classname)) {
         return true;
     }
     // Check if override file is writable
     $override_path = _PS_ROOT_DIR_ . '/' . Autoload::getInstance()->getClassPath($classname);
     if (!is_writable($override_path)) {
         return false;
     }
     // Get a uniq id for the class, because you can override a class (or remove the override) twice in the same session and we need to avoid redeclaration
     do {
         $uniq = uniqid();
     } while (class_exists($classname . 'OverrideOriginal_remove', false));
     // Make a reflection of the override class and the module override class
     $override_file = file($override_path);
     eval(preg_replace(array('#^\\s*<\\?(?:php)?#', '#class\\s+' . $classname . '\\s+extends\\s+([a-z0-9_]+)(\\s+implements\\s+([a-z0-9_]+))?#i'), array(' ', 'class ' . $classname . 'OverrideOriginal_remove' . $uniq), implode('', $override_file)));
     $override_class = new ReflectionClass($classname . 'OverrideOriginal_remove' . $uniq);
     $module_file = file($this->getLocalPath() . 'override/' . $path);
     eval(preg_replace(array('#^\\s*<\\?(?:php)?#', '#class\\s+' . $classname . '(\\s+extends\\s+([a-z0-9_]+)(\\s+implements\\s+([a-z0-9_]+))?)?#i'), array(' ', 'class ' . $classname . 'Override_remove' . $uniq), implode('', $module_file)));
     $module_class = new ReflectionClass($classname . 'Override_remove' . $uniq);
     // Remove methods from override file
     $override_file = file($override_path);
     foreach ($module_class->getMethods() as $method) {
         if (!$override_class->hasMethod($method->getName())) {
             continue;
         }
         $method = $override_class->getMethod($method->getName());
         $length = $method->getEndLine() - $method->getStartLine() + 1;
         array_splice($override_file, $method->getStartLine() - 1, $length, array_pad(array(), $length, '#--remove--#'));
     }
     // Remove properties from override file
     foreach ($module_class->getProperties() as $property) {
         if (!$override_class->hasProperty($property->getName())) {
             continue;
         }
         // Remplacer la ligne de declaration par "remove"
         foreach ($override_file as $line_number => &$line_content) {
             if (preg_match('/(public|private|protected|const)\\s+(static\\s+)?(\\$)?' . $property->getName() . '/i', $line_content)) {
                 $line_content = '#--remove--#';
                 break;
             }
         }
     }
     // Rewrite nice code
     $code = '';
     foreach ($override_file as $line) {
         if ($line == '#--remove--#') {
             continue;
         }
         $code .= $line;
     }
     file_put_contents($override_path, $code);
     return true;
 }
示例#20
0
<?php

/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <*****@*****.**>
*  @copyright  2007-2013 PrestaShop SA
*  @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
// Include some alias functions
require_once dirname(__FILE__) . '/alias.php';
require_once dirname(__FILE__) . '/../classes/Autoload.php';
spl_autoload_register(array(Autoload::getInstance(), 'load'));
    public function postProcess()
    {
        /* PrestaShop demo mode */
        if (_PS_MODE_DEMO_) {
            $this->errors[] = Tools::displayError('This functionality has been disabled.');
            return;
        }
        Hook::exec('action' . get_class($this) . ucfirst($this->action) . 'Before', array('controller' => $this));
        if (Tools::isSubmit('submitAddServer')) {
            if ($this->tabAccess['add'] === '1') {
                if (!Tools::getValue('memcachedIp')) {
                    $this->errors[] = Tools::displayError('The Memcached IP is missing.');
                }
                if (!Tools::getValue('memcachedPort')) {
                    $this->errors[] = Tools::displayError('The Memcached port is missing.');
                }
                if (!Tools::getValue('memcachedWeight')) {
                    $this->errors[] = Tools::displayError('The Memcached weight is missing.');
                }
                if (!count($this->errors)) {
                    if (CacheMemcache::addServer(pSQL(Tools::getValue('memcachedIp')), (int) Tools::getValue('memcachedPort'), (int) Tools::getValue('memcachedWeight'))) {
                        Tools::redirectAdmin(self::$currentIndex . '&token=' . Tools::getValue('token') . '&conf=4');
                    } else {
                        $this->errors[] = Tools::displayError('The Memcached server cannot be added.');
                    }
                }
            } else {
                $this->errors[] = Tools::displayError('You do not have permission to add this.');
            }
        }
        if (Tools::getValue('deleteMemcachedServer')) {
            if ($this->tabAccess['add'] === '1') {
                if (CacheMemcache::deleteServer((int) Tools::getValue('deleteMemcachedServer'))) {
                    Tools::redirectAdmin(self::$currentIndex . '&token=' . Tools::getValue('token') . '&conf=4');
                } else {
                    $this->errors[] = Tools::displayError('There was an error when attempting to delete the Memcached server.');
                }
            } else {
                $this->errors[] = Tools::displayError('You do not have permission to delete this.');
            }
        }
        $redirectAdmin = false;
        if ((bool) Tools::getValue('smarty_up')) {
            if ($this->tabAccess['edit'] === '1') {
                Configuration::updateValue('PS_SMARTY_FORCE_COMPILE', Tools::getValue('smarty_force_compile', _PS_SMARTY_NO_COMPILE_));
                Configuration::updateValue('PS_SMARTY_CACHE', Tools::getValue('smarty_cache', 0));
                Configuration::updateValue('PS_SMARTY_CONSOLE', Tools::getValue('smarty_console', 0));
                Configuration::updateValue('PS_SMARTY_CONSOLE_KEY', Tools::getValue('smarty_console_key', 'SMARTY_DEBUG'));
                $redirecAdmin = true;
            } else {
                $this->errors[] = Tools::displayError('You do not have permission to edit this.');
            }
        }
        if ((bool) Tools::getValue('features_detachables_up')) {
            if ($this->tabAccess['edit'] === '1') {
                if (!Combination::isCurrentlyUsed()) {
                    Configuration::updateValue('PS_COMBINATION_FEATURE_ACTIVE', Tools::getValue('combination'));
                }
                Configuration::updateValue('PS_FEATURE_FEATURE_ACTIVE', Tools::getValue('feature'));
                $redirectAdmin = true;
            } else {
                $this->errors[] = Tools::displayError('You do not have permission to edit this.');
            }
        }
        if ((bool) Tools::getValue('ccc_up')) {
            if ($this->tabAccess['edit'] === '1') {
                $theme_cache_directory = _PS_ALL_THEMES_DIR_ . $this->context->shop->theme_directory . '/cache/';
                if (((bool) Tools::getValue('PS_CSS_THEME_CACHE') || (bool) Tools::getValue('PS_JS_THEME_CACHE')) && !is_writable($theme_cache_directory)) {
                    $this->errors[] = Tools::displayError(sprintf($this->l('To use Smart Cache directory %s must be writable.'), realpath($theme_cache_directory)));
                }
                if (!Configuration::updateValue('PS_CSS_THEME_CACHE', (int) Tools::getValue('PS_CSS_THEME_CACHE')) || !Configuration::updateValue('PS_JS_THEME_CACHE', (int) Tools::getValue('PS_JS_THEME_CACHE')) || !Configuration::updateValue('PS_HTML_THEME_COMPRESSION', (int) Tools::getValue('PS_HTML_THEME_COMPRESSION')) || !Configuration::updateValue('PS_JS_HTML_THEME_COMPRESSION', (int) Tools::getValue('PS_JS_HTML_THEME_COMPRESSION')) || !Configuration::updateValue('PS_HTACCESS_CACHE_CONTROL', (int) Tools::getValue('PS_HTACCESS_CACHE_CONTROL'))) {
                    $this->errors[] = Tools::displayError('Unknown error.');
                } else {
                    $redirectAdmin = true;
                    if (Configuration::get('PS_HTACCESS_CACHE_CONTROL')) {
                        Tools::generateHtaccess();
                    }
                }
            } else {
                $this->errors[] = Tools::displayError('You do not have permission to edit this.');
            }
        }
        if ((bool) Tools::getValue('media_server_up')) {
            if ($this->tabAccess['edit'] === '1') {
                if (Tools::getValue('_MEDIA_SERVER_1_') != null && !Validate::isFileName(Tools::getValue('_MEDIA_SERVER_1_'))) {
                    $this->errors[] = Tools::displayError('Media server #1 is invalid');
                }
                if (Tools::getValue('_MEDIA_SERVER_2_') != null && !Validate::isFileName(Tools::getValue('_MEDIA_SERVER_2_'))) {
                    $this->errors[] = Tools::displayError('Media server #2 is invalid');
                }
                if (Tools::getValue('_MEDIA_SERVER_3_') != null && !Validate::isFileName(Tools::getValue('_MEDIA_SERVER_3_'))) {
                    $this->errors[] = Tools::displayError('Media server #3 is invalid');
                }
                if (!count($this->errors)) {
                    $base_urls = array();
                    $base_urls['_MEDIA_SERVER_1_'] = Tools::getValue('_MEDIA_SERVER_1_');
                    $base_urls['_MEDIA_SERVER_2_'] = Tools::getValue('_MEDIA_SERVER_2_');
                    $base_urls['_MEDIA_SERVER_3_'] = Tools::getValue('_MEDIA_SERVER_3_');
                    if ($base_urls['_MEDIA_SERVER_1_'] || $base_urls['_MEDIA_SERVER_2_'] || $base_urls['_MEDIA_SERVER_3_']) {
                        Configuration::updateValue('PS_MEDIA_SERVERS', 1);
                    } else {
                        Configuration::updateValue('PS_MEDIA_SERVERS', 0);
                    }
                    rewriteSettingsFile($base_urls, null, null);
                    Tools::clearSmartyCache();
                    Media::clearCache();
                    Tools::generateHtaccess(null, null, null, '', null, array($base_urls['_MEDIA_SERVER_1_'], $base_urls['_MEDIA_SERVER_2_'], $base_urls['_MEDIA_SERVER_3_']));
                    unset($this->_fieldsGeneral['_MEDIA_SERVER_1_']);
                    unset($this->_fieldsGeneral['_MEDIA_SERVER_2_']);
                    unset($this->_fieldsGeneral['_MEDIA_SERVER_3_']);
                    $redirectAdmin = true;
                }
            } else {
                $this->errors[] = Tools::displayError('You do not have permission to edit this.');
            }
        }
        if ((bool) Tools::getValue('ciphering_up') && Configuration::get('PS_CIPHER_ALGORITHM') != (int) Tools::getValue('PS_CIPHER_ALGORITHM')) {
            if ($this->tabAccess['edit'] === '1') {
                $algo = (int) Tools::getValue('PS_CIPHER_ALGORITHM');
                $prev_settings = file_get_contents(dirname(__FILE__) . '/../../config/settings.inc.php');
                $new_settings = $prev_settings;
                if ($algo) {
                    if (!function_exists('mcrypt_encrypt')) {
                        $this->errors[] = Tools::displayError('The PHP "Mcrypt" extension is not activated on this server.');
                    } else {
                        if (!strstr($new_settings, '_RIJNDAEL_KEY_')) {
                            $key_size = mcrypt_get_key_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB);
                            $key = Tools::passwdGen($key_size);
                            $new_settings = preg_replace('/define\\(\'_COOKIE_KEY_\', \'([a-z0-9=\\/+-_]+)\'\\);/i', 'define(\'_COOKIE_KEY_\', \'\\1\');' . "\n" . 'define(\'_RIJNDAEL_KEY_\', \'' . $key . '\');', $new_settings);
                        }
                        if (!strstr($new_settings, '_RIJNDAEL_IV_')) {
                            $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB);
                            $iv = base64_encode(mcrypt_create_iv($iv_size, MCRYPT_RAND));
                            $new_settings = preg_replace('/define\\(\'_COOKIE_IV_\', \'([a-z0-9=\\/+-_]+)\'\\);/i', 'define(\'_COOKIE_IV_\', \'\\1\');' . "\n" . 'define(\'_RIJNDAEL_IV_\', \'' . $iv . '\');', $new_settings);
                        }
                    }
                }
                if (!count($this->errors)) {
                    // If there is not settings file modification or if the backup and replacement of the settings file worked
                    if ($new_settings == $prev_settings || copy(dirname(__FILE__) . '/../../config/settings.inc.php', dirname(__FILE__) . '/../../config/settings.old.php') && (bool) file_put_contents(dirname(__FILE__) . '/../../config/settings.inc.php', $new_settings)) {
                        Configuration::updateValue('PS_CIPHER_ALGORITHM', $algo);
                        $redirectAdmin = true;
                    } else {
                        $this->errors[] = Tools::displayError('The settings file cannot be overwritten.');
                    }
                }
            } else {
                $this->errors[] = Tools::displayError('You do not have permission to edit this.');
            }
        }
        if ((bool) Tools::getValue('cache_up')) {
            if ($this->tabAccess['edit'] === '1') {
                $prev_settings = file_get_contents(dirname(__FILE__) . '/../../config/settings.inc.php');
                $new_settings = $prev_settings;
                if (!Tools::getValue('active')) {
                    $cache_active = 0;
                } else {
                    $cache_active = 1;
                }
                if (!($caching_system = Tools::getValue('caching_system'))) {
                    $this->errors[] = Tools::displayError('The caching system is missing.');
                } else {
                    $new_settings = preg_replace('/define\\(\'_PS_CACHING_SYSTEM_\', \'([a-z0-9=\\/+-_]+)\'\\);/Ui', 'define(\'_PS_CACHING_SYSTEM_\', \'' . $caching_system . '\');', $new_settings);
                }
                if ($cache_active && $caching_system == 'CacheMemcache' && !extension_loaded('memcache')) {
                    $this->errors[] = Tools::displayError('To use Memcached, you must install the Memcache PECL extension on your server.') . '
						<a href="http://www.php.net/manual/en/memcache.installation.php">http://www.php.net/manual/en/memcache.installation.php</a>';
                } elseif ($cache_active && $caching_system == 'CacheApc' && !extension_loaded('apc')) {
                    $this->errors[] = Tools::displayError('To use APC cache, you must install the APC PECL extension on your server.') . '
						<a href="http://fr.php.net/manual/fr/apc.installation.php">http://fr.php.net/manual/fr/apc.installation.php</a>';
                } elseif ($cache_active && $caching_system == 'CacheXcache' && !extension_loaded('xcache')) {
                    $this->errors[] = Tools::displayError('To use Xcache, you must install the Xcache extension on your server.') . '
						<a href="http://xcache.lighttpd.net">http://xcache.lighttpd.net</a>';
                } else {
                    if ($cache_active && $caching_system == 'CacheXcache' && !ini_get('xcache.var_size')) {
                        $this->errors[] = Tools::displayError('To use Xcache, you must configure "xcache.var_size" for the Xcache extension (recommended value 16M to 64M).') . '
						<a href="http://xcache.lighttpd.net/wiki/XcacheIni">http://xcache.lighttpd.net/wiki/XcacheIni</a>';
                    } elseif ($cache_active && $caching_system == 'CacheFs' && !is_writable(_PS_CACHEFS_DIRECTORY_)) {
                        $this->errors[] = sprintf(Tools::displayError('To use CacheFS, the directory %s must be writable.'), realpath(_PS_CACHEFS_DIRECTORY_));
                    }
                }
                if ($caching_system == 'CacheFs' && $cache_active) {
                    if (!($depth = Tools::getValue('ps_cache_fs_directory_depth'))) {
                        $this->errors[] = Tools::displayError('Please set a directory depth.');
                    }
                    if (!count($this->errors)) {
                        CacheFs::deleteCacheDirectory();
                        CacheFs::createCacheDirectories((int) $depth);
                        Configuration::updateValue('PS_CACHEFS_DIRECTORY_DEPTH', (int) $depth);
                    }
                } elseif ($caching_system == 'CacheMemcache' && $cache_active && !_PS_CACHE_ENABLED_ && _PS_CACHING_SYSTEM_ == 'CacheMemcache') {
                    Cache::getInstance()->flush();
                }
                if (!count($this->errors)) {
                    $new_settings = preg_replace('/define\\(\'_PS_CACHE_ENABLED_\', \'([0-9])\'\\);/Ui', 'define(\'_PS_CACHE_ENABLED_\', \'' . (int) $cache_active . '\');', $new_settings);
                    // If there is not settings file modification or if the backup and replacement of the settings file worked
                    if ($new_settings == $prev_settings || copy(dirname(__FILE__) . '/../../config/settings.inc.php', dirname(__FILE__) . '/../../config/settings.old.php') && (bool) file_put_contents(dirname(__FILE__) . '/../../config/settings.inc.php', $new_settings)) {
                        $redirectAdmin = true;
                    } else {
                        $this->errors[] = Tools::displayError('The settings file cannot be overwritten.');
                    }
                }
            } else {
                $this->errors[] = Tools::displayError('You do not have permission to edit this.');
            }
        }
        if ((bool) Tools::getValue('empty_smarty_cache')) {
            $redirectAdmin = true;
            Tools::clearSmartyCache();
            Media::clearCache();
            Autoload::getInstance()->generateIndex();
        }
        if (Tools::isSubmit('submitAddconfiguration') && _PS_MODE_DEV_) {
            Configuration::updateGlobalValue('PS_DISABLE_NON_NATIVE_MODULE', (int) Tools::getValue('native_module'));
            Configuration::updateGlobalValue('PS_DISABLE_OVERRIDES', (int) Tools::getValue('overrides'));
            if (Tools::getValue('overrides')) {
                Autoload::getInstance()->_include_override_path = false;
            }
            Autoload::getInstance()->generateIndex();
        }
        if ($redirectAdmin && (!isset($this->errors) || !count($this->errors))) {
            Hook::exec('action' . get_class($this) . ucfirst($this->action) . 'After', array('controller' => $this, 'return' => ''));
            Tools::redirectAdmin(self::$currentIndex . '&token=' . Tools::getValue('token') . '&conf=4');
        }
    }
示例#22
0
 public static function CanClassOverride($module2install, $classname)
 {
     $xaqmabua = "override_file";
     $kjqwautbqrf = "classname";
     $wqtmhucwu = "errors";
     ${"GLOBALS"}["ywmddpovdu"] = "override_path";
     ${"GLOBALS"}["lsjqpvv"] = "classname";
     ${"GLOBALS"}["cdlyqsbzh"] = "override_path";
     $orbjsjclfw = "override_file";
     $ukyfsho = "classname";
     ${"GLOBALS"}["nabgpqu"] = "override_path";
     $qdobeypmjo = "classname";
     ${"GLOBALS"}["xflyglxhtpm"] = "classname";
     $ehdxosrmxo = "errors";
     ${$ehdxosrmxo} = array();
     ${"GLOBALS"}["nfvtbyce"] = "override_path";
     $ftwrmwqt = "classname";
     ${"GLOBALS"}["nbqysohjyn"] = "classpath";
     ${${"GLOBALS"}["lzkrjentxai"]} = Autoload::getInstance()->getClassPath(${$qdobeypmjo} . "Core");
     if (!(${${"GLOBALS"}["nbqysohjyn"]} = Autoload::getInstance()->getClassPath(${$ftwrmwqt}))) {
         return array();
     }
     ${"GLOBALS"}["ylxtdwsdym"] = "method";
     ${"GLOBALS"}["naucseovzto"] = "override_path";
     ${${"GLOBALS"}["nfvtbyce"]} = _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . Autoload::getInstance()->getClassPath(${${"GLOBALS"}["hhnjswxlh"]});
     $hwjybemesk = "path";
     if (!file_exists(${${"GLOBALS"}["naucseovzto"]}) || file_exists(${${"GLOBALS"}["nabgpqu"]}) && !is_writable(${${"GLOBALS"}["cdlyqsbzh"]})) {
         ${$wqtmhucwu}[] = sprintf(Tools::displayError("file (%s) not writable"), ${${"GLOBALS"}["cddtomtntyib"]});
     }
     ${${"GLOBALS"}["jpjxbmiwehyp"]} = "&nbsp;&nbsp;<a href=\"http://addons-modules.com/store/en/content/75-classmethod-conflict-and-code-merge\" target=\"_blank\" style=\"color:blue;text-decoration:underline;\">Why this and How to resolve this?</a>";
     $hhdouoldl = "module_class";
     ${$orbjsjclfw} = file(${${"GLOBALS"}["ywmddpovdu"]});
     eval(preg_replace(array("#^\\s*<\\?php#", "#class\\s+" . ${$kjqwautbqrf} . "\\s+extends\\s+([a-z0-9_]+)(\\s+implements\\s+([a-z0-9_]+))?#i"), array("", "class " . ${${"GLOBALS"}["hhnjswxlh"]} . "OverrideOriginalTrial"), implode("", ${$xaqmabua})));
     ${${"GLOBALS"}["tmxibq"]} = new ReflectionClass(${${"GLOBALS"}["xflyglxhtpm"]} . "OverrideOriginalTrial");
     ${${"GLOBALS"}["yjwgudbhfvr"]} = file(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . "modules" . DIRECTORY_SEPARATOR . ${${"GLOBALS"}["ydbrox"]} . DIRECTORY_SEPARATOR . "override" . DIRECTORY_SEPARATOR . ${$hwjybemesk});
     eval(preg_replace(array("#^\\s*<\\?php#", "#class\\s+" . ${${"GLOBALS"}["hhnjswxlh"]} . "(\\s+extends\\s+([a-z0-9_]+)(\\s+implements\\s+([a-z0-9_]+))?)?#i"), array("", "class " . ${$ukyfsho} . "OverrideTrial"), implode("", ${${"GLOBALS"}["yjwgudbhfvr"]})));
     ${$hhdouoldl} = new ReflectionClass(${${"GLOBALS"}["lsjqpvv"]} . "OverrideTrial");
     foreach ($module_class->getMethods() as ${${"GLOBALS"}["ylxtdwsdym"]}) {
         if ($override_class->hasMethod($method->getName())) {
             ${"GLOBALS"}["xffkbnrbmjo"] = "classname";
             ${${"GLOBALS"}["tpumobykwqww"]}[] = sprintf(Tools::displayError("The method %1\$s in the class %2\$s is already overriden."), $method->getName(), ${${"GLOBALS"}["xffkbnrbmjo"]}) . ${${"GLOBALS"}["jpjxbmiwehyp"]};
         }
     }
     foreach ($module_class->getProperties() as ${${"GLOBALS"}["gltxik"]}) {
         if ($override_class->hasProperty($property->getName())) {
             ${"GLOBALS"}["vtohgq"] = "classname";
             $kbcjxuv = "errors";
             ${$kbcjxuv}[] = sprintf(Tools::displayError("The property %1\$s in the class %2\$s is already defined."), $property->getName(), ${${"GLOBALS"}["vtohgq"]}) . ${${"GLOBALS"}["jpjxbmiwehyp"]};
         }
     }
     return ${${"GLOBALS"}["tpumobykwqww"]};
 }
示例#23
0
function upgrade_module_1_5($object, $install = false)
{
    // Install overrides
    try {
        $object->installOverrides();
    } catch (Exception $e) {
        Tools::displayError(sprintf(Tools::displayError('Unable to install override: %s'), $e->getMessage()));
        //$this->uninstallOverrides(); remove this line because if module a install an override, then module b install same override, this line will remove override of module a (if you find a bug related to this line please don't forget what i say before)
        return false;
    }
    $classindex = realpath(dirname(__FILE__) . '/../..') . '/cache/class_index.php';
    unset($classindex);
    if (version_compare(_PS_VERSION_, '1.6', '>=')) {
        PrestashopAutoload::getInstance()->generateIndex();
    } else {
        Autoload::getInstance()->generateIndex();
    }
    if (!Hook::getIdByName('actionBeforeAddOrder')) {
        $hook = new Hook();
        $hook->name = 'actionBeforeAddOrder';
        $hook->title = 'Execute actions before order is added to database';
        $hook->description = 'Custom hook for Order Add function';
        $hook->position = true;
        $hook->live_edit = false;
        $hook->add();
    }
    if (!Hook::getIdByName('actionBeforeAddOrderInvoice')) {
        $hook2 = new Hook();
        $hook2->name = 'actionBeforeAddOrderInvoice';
        $hook2->title = 'Execute actions before invoice is added to database';
        $hook2->description = 'Custom hook for Order setLastInvoiceNumber function';
        $hook2->position = true;
        $hook2->live_edit = false;
        $hook2->add();
    }
    if (!Hook::getIdByName('actionBeforeAddDeliveryNumber')) {
        $hook3 = new Hook();
        $hook3->name = 'actionBeforeAddDeliveryNumber';
        $hook3->title = 'Execute actions before delivery number is added to database';
        $hook3->description = 'Custom hook for Order setDeliveryNumber function';
        $hook3->position = true;
        $hook3->live_edit = false;
        $hook3->add();
    }
    $id_new_hook = Hook::getIdByName('actionBeforeAddOrder');
    $id_new_hook2 = Hook::getIdByName('actionBeforeAddOrderInvoice');
    $id_new_hook3 = Hook::getIdByName('actionBeforeAddDeliveryNumber');
    $id_old_hook = Hook::getIdByName('actionValidateOrder');
    $mod_new_hook = Hook::getModulesFromHook($id_new_hook, $object->id);
    $mod_new_hook2 = Hook::getModulesFromHook($id_new_hook2, $object->id);
    $mod_new_hook3 = Hook::getModulesFromHook($id_new_hook3, $object->id);
    $mod_old_hook = Hook::getModulesFromHook($id_old_hook, $object->id);
    if (empty($mod_new_hook)) {
        $object->registerHook('actionBeforeAddOrder');
    }
    if (empty($mod_new_hook2)) {
        $object->registerHook('actionBeforeAddOrderInvoice');
    }
    if (empty($mod_new_hook3)) {
        $object->registerHook('actionBeforeAddDeliveryNumber');
    }
    if (!empty($mod_old_hook)) {
        $object->unregisterHook('actionValidateOrder');
    }
    return true;
}
示例#24
0
 public function install()
 {
     if (!$this->preinstall()) {
         return false;
     }
     if (!AgileInstaller::sql_install(dirname(__FILE__) . "/" . self::INSTALL_SQL_FILE)) {
         return false;
     }
     if (parent::install() == false or !$this->setDefaultConfig("ASP_SELLER_NBR", 15) or !$this->setDefaultConfig("ASP_HOME_COLUMN_LEFT", 1) or !$this->setDefaultConfig("ASP_HOME_COLUMN_RIGHT", 0) or !$this->setDefaultConfig("ASP_SELLERS_BLOCK_POSITION", 1) or !$this->setDefaultConfig("ASP_SELLERS_BLOCK_STYLE", 0) or !$this->setDefaultConfig("ASP_SELLERS_BLOCK_VIRTUALSHOP", 0) or !$this->setDefaultConfig("ASP_HEADER_LOGO_MODE", 0) or !$this->setDefaultConfig("ASP_LOCATION_BLOCK_POSITION", 1) or !$this->setDefaultConfig("ASP_LOCATION_BLOCK_STYLE", 0) or !$this->setDefaultConfig("ASP_LOCATION_BLOCK_LEVEL", "country") or !$this->setDefaultConfig("ASP_SHOP_URL_MODE", AgileMultipleShop::SHOP_URL_MODE_VIRTUAL) or !$this->setDefaultConfig("ASP_SHOP_LOGIN_MODE", AgileMultipleShop::SHOP_LOGIN_MODE_SINGLE) or !$this->setDefaultConfig("ASP_LOCATION_BLOCK_LEVEL", "country") or !$this->setDefaultConfig("ASP_LOCATION_BLOCK_VIRTUALSHOP", 0) or !$this->setDefaultConfig("ASP_URL_CHOICE_CMS", 0) or !$this->setDefaultConfig("ASP_URL_CHOICE_CAT", 0) or $this->registerHook("displayHeader") == false or $this->registerHook("displayLeftColumn") == false or $this->registerHook("displayRightColumn") == false or $this->registerHook("displayHomeTab") == false or $this->registerHook("displayHomeTabContent") == false) {
         return false;
     }
     if (!AgileInstaller::create_tab("Seller Types", "AgileSellerTypes", "AdminAdmin", $this->name)) {
         return false;
     }
     AgileInstaller::init_tab_prmission_for_existing_profiles("AgileSellerTypes", 1, 1, 1, 1);
     $this->create_shops_for_existing_sellers();
     if (version_compare(_PS_VERSION_, "1.5", ">=")) {
         Autoload::getInstance()->generateIndex();
     }
     return true;
 }