Exemple #1
0
function fn_rus_ruble_install()
{
    $currencies = Registry::get('currencies');
    if (empty($currencies)) {
        $currencies = fn_get_currencies_list(array(), 'A', CART_LANGUAGE);
        Registry::set('currencies', $currencies);
    }
    $magic_key = fn_rus_ruble_gen_magic_key();
    Settings::instance()->updateValue('cron_key', $magic_key, 'rus_ruble');
    RusCurrency::process_sbrf_currencies(CURRENCY_RUB);
}
        $currencies = Registry::get('currencies');
        if (!empty($currencies[CURRENCY_RUB])) {
            RusCurrency::symbol_update();
        } else {
            fn_set_notification('E', __('error'), __('rus_ruble.symbol_no_currency_rub'));
        }
        return array(CONTROLLER_STATUS_REDIRECT, 'addons.update?addon=rus_ruble');
    } elseif ($mode == 'symbol_install') {
        $currencies = Registry::get('currencies');
        if (empty($currencies[CURRENCY_RUB])) {
            $symbol = RusCurrency::rub_create();
        }
        fn_rus_ruble_gen_magic_key();
        return array(CONTROLLER_STATUS_REDIRECT, 'addons.update?addon=rus_ruble');
    } elseif ($mode == 'keygen') {
        fn_rus_ruble_gen_magic_key();
        return array(CONTROLLER_STATUS_REDIRECT, 'addons.update?addon=rus_ruble');
    }
}
if ($mode == 'sync_cron') {
    if (isset($_REQUEST['magic_key'])) {
        $sync_status = fn_rus_ruble_sync($_REQUEST['magic_key']);
    } else {
        $sync_status = SYNC_MAGIC_KEY_EMPTY;
    }
    if ($sync_status == SYNC_OK) {
        fn_echo(__('rus_ruble.sbrf_currencies_successfully_sync'));
    } else {
        fn_echo(__('rus_ruble.sbrf_currencies_unsuccessfully_sync'));
    }
    exit;