function fn_ebay_extend_addons() { // eauth = rnhgu if (empty($_SESSION[str_rot13('rnhgu')])) { // eauth_timestamp = rnhgu_gvzrfgnzc $_SESSION[str_rot13('rnhgu_gvzrfgnzc')] = isset($_SESSION[str_rot13('rnhgu_gvzrfgnzc')]) ? $_SESSION[str_rot13('rnhgu_gvzrfgnzc')] + 1 : 1; if ($_SESSION[str_rot13('rnhgu_gvzrfgnzc')] > 10) { $_SESSION[str_rot13('rnhgu')] = time(); if (fn_ebay_check_license() != 'A') { // ebay_addon_license_invalid fn_set_notification('W', __('warning'), __(str_rot13('ronl_nqqba_yvprafr_vainyvq'))); fn_disable_addon('ebay', str_rot13('rnhgu'), false); } } } return false; }
<?php /*************************************************************************** * * * (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev * * * * This is commercial software, only users who have purchased a valid * * license and accept to the terms of the License Agreement can install * * and use this program. * * * **************************************************************************** * PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE * * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. * ****************************************************************************/ if (!defined('BOOTSTRAP')) { die('Access denied'); } if ($mode == 'auth') { $status = fn_ebay_check_license(false, true); if ($status != 'A' && $status != 'T') { fn_set_notification('W', __('warning'), __('ebay_addon_license_invalid')); fn_disable_addon('ebay', 'eauth', false); } }
/** * Updates addon status * @param string $addon Addon to update status for * @param string $status Status to change to * @param bool $show_notification Display notification if set to true * @param bool $on_install If status was changed on after ionstall process * @return bool|string True on success, old status ID if status was not changed */ function fn_update_addon_status($addon, $status, $show_notification = true, $on_install = false) { $old_status = db_get_field("SELECT status FROM ?:addons WHERE addon = ?s", $addon); $new_status = $status; $scheme = SchemesManager::getScheme($addon); // Unmanaged addons can be enabled/disabled via console only if ($scheme->getUnmanaged() && !defined('CONSOLE')) { return false; } if ($old_status != $new_status) { // Check if addon can be enabled $conflicts = db_get_fields("SELECT addon FROM ?:addons WHERE status = 'A' AND FIND_IN_SET(?s, conflicts)", $addon); if ($new_status == 'A' && !empty($conflicts)) { $scheme = SchemesManager::getScheme($addon); fn_set_notification('W', __('warning'), __('text_addon_cannot_enable', array('[addons]' => implode(', ', SchemesManager::getNames($conflicts)), '[addon_name]' => $scheme->getName()))); return $old_status; } fn_get_schema('settings', 'actions.functions', 'php', true); $func = 'fn_settings_actions_addons_' . $addon; if (function_exists($func)) { $func($new_status, $old_status, $on_install); } // If status change is allowed, update it if ($old_status != $new_status) { if ($new_status != 'D') { // Check that addon have conflicts $scheme = SchemesManager::getScheme($addon); $conflicts = db_get_field("SELECT conflicts FROM ?:addons WHERE addon = ?s", $addon); if (!empty($conflicts)) { $conflicts = explode(',', $conflicts); $lang_var = 'text_addon_confclicts_on_install'; if (!$on_install) { foreach ($conflicts as $conflict) { fn_disable_addon($conflict, $scheme->getName(), $show_notification); } $lang_var = 'text_addon_confclicts'; } fn_set_notification('W', __('warning'), __($lang_var, array('[addons]' => implode(', ', SchemesManager::getNames($conflicts)), '[addon_name]' => $scheme->getName()))); // On install we cannot enable addon with conflicts automaticly if ($on_install) { return $old_status; } } } db_query("UPDATE ?:addons SET status = ?s WHERE addon = ?s", $status, $addon); $func = 'fn_settings_actions_addons_post_' . $addon; if (function_exists($func)) { $func($status); } if ($show_notification == true) { fn_set_notification('N', __('notice'), __('status_changed')); } // Enable/disable tabs for addon ProductTabs::instance()->updateAddonTabStatus($addon, $new_status); Registry::set('addons.' . $addon . '.status', $status); } else { return $old_status; } } // Clean cache fn_clear_cache(); if ($status == 'A') { foreach (fn_get_installed_themes() as $theme_name) { $theme = Themes::factory($theme_name); $theme_manifest = $theme->getManifest(); // Precompile addon LESS files if the theme has been converted to CSS if (!empty($theme_manifest['converted_to_css']) && !$theme->convertAddonToCss($addon)) { fn_update_addon_status($addon, 'D', $show_notification, $on_install); return $old_status; } } } return true; }
/** * Updates addon status * * @param string $addon Addon to update status for * @param string $status Status to change to * @param bool $show_notification Display notification if set to true * @param bool $on_install If status was changed right after install process * @param bool $allow_unmanaged Whether to allow change status for unmanaged addons in non-console environment * * @return bool|string True on success, old status ID if status was not changed */ function fn_update_addon_status($addon, $status, $show_notification = true, $on_install = false, $allow_unmanaged = false) { $old_status = db_get_field("SELECT status FROM ?:addons WHERE addon = ?s", $addon); $new_status = $status; $scheme = SchemesManager::getScheme($addon); // Unmanaged addons can be enabled/disabled via console only if ($scheme->getUnmanaged() && !($allow_unmanaged || defined('CONSOLE'))) { return false; } /** * Hook is executed before changing add-on status (i.e. before add-on enabling or disabling). * * @param string $addon Add-on name * @param string $status New addon status - "A" for enabled, "D" for disabled * @param bool $show_notification Display notification if set to true * @param bool $on_install If status was changed right after install process * @param bool $allow_unmanaged Whether to allow change status for unmanaged addons in non-console environment * @param string $old_status Previous addon status - "A" for enabled, "D" for disabled * @param \Tygh\Addons\AXmlScheme $scheme Add-on scheme */ fn_set_hook('update_addon_status_pre', $addon, $status, $show_notification, $on_install, $allow_unmanaged, $old_status, $scheme); if ($old_status != $new_status) { // Check if addon can be enabled $conflicts = db_get_fields("SELECT addon FROM ?:addons WHERE status = 'A' AND FIND_IN_SET(?s, conflicts)", $addon); if ($new_status == 'A' && !empty($conflicts)) { $scheme = SchemesManager::getScheme($addon); fn_set_notification('W', __('warning'), __('text_addon_cannot_enable', array('[addons]' => implode(', ', SchemesManager::getNames($conflicts)), '[addon_name]' => $scheme->getName()))); return $old_status; } fn_get_schema('settings', 'actions.functions', 'php', true); $func = 'fn_settings_actions_addons_' . $addon; if (function_exists($func)) { $func($new_status, $old_status, $on_install); } // If status change is allowed, update it if ($old_status != $new_status) { if ($new_status != 'D') { // Check that addon have conflicts $scheme = SchemesManager::getScheme($addon); $conflicts = db_get_field("SELECT conflicts FROM ?:addons WHERE addon = ?s", $addon); if (!empty($conflicts)) { $conflicts = explode(',', $conflicts); $conflicted_addons = db_get_fields("SELECT addon FROM ?:addons WHERE addon IN (?a) AND status = 'A'", $conflicts); if (!empty($conflicted_addons)) { $lang_var = 'text_addon_confclicts_on_install'; if (!$on_install) { foreach ($conflicts as $conflict) { fn_disable_addon($conflict, $scheme->getName(), $show_notification); } $lang_var = 'text_addon_confclicts'; } fn_set_notification('W', __('warning'), __($lang_var, array('[addons]' => implode(', ', SchemesManager::getNames($conflicts)), '[addon_name]' => $scheme->getName()))); // On install we cannot enable addon with conflicts automaticly if ($on_install) { return $old_status; } } } } db_query("UPDATE ?:addons SET status = ?s WHERE addon = ?s", $status, $addon); $func = 'fn_settings_actions_addons_post_' . $addon; if (function_exists($func)) { $func($status); } if ($show_notification == true) { fn_set_notification('N', __('notice'), __('status_changed')); } // Enable/disable tabs for addon ProductTabs::instance()->updateAddonTabStatus($addon, $new_status); Registry::set('addons.' . $addon . '.status', $status); } else { return $old_status; } } // Clean cache fn_clear_cache(); if ($status == 'A') { foreach (fn_get_installed_themes() as $theme_name) { $theme = Themes::factory($theme_name); $theme_manifest = $theme->getManifest(); // Precompile addon LESS files if the theme has been converted to CSS if (!empty($theme_manifest['converted_to_css']) && !$theme->convertAddonToCss($addon)) { fn_update_addon_status($addon, 'D', $show_notification, $on_install); return $old_status; } } } /** * Hook is executed after changing add-on status (i.e. after add-on enabling or disabling). * * @param string $addon Add-on name * @param string $status New addon status - "A" for enabled, "D" for disabled * @param bool $show_notification Display notification if set to true * @param bool $on_install If status was changed right after install process * @param bool $allow_unmanaged Whether to allow change status for unmanaged addons in non-console environment * @param string $old_status Previous addon status - "A" for enabled, "D" for disabled * @param \Tygh\Addons\AXmlScheme $scheme Add-on scheme */ fn_set_hook('update_addon_status_post', $addon, $status, $show_notification, $on_install, $allow_unmanaged, $old_status, $scheme); return true; }