} elseif ($sync_status == SYNC_NOT_SET_RUB) { fn_set_notification('W', __('warning'), __('rus_ruble.not_set_ruble')); } return array(CONTROLLER_STATUS_REDIRECT, 'addons.update?addon=rus_ruble'); } elseif ($mode == 'symbol_update') { $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) {
function fn_rus_ruble_gen_magic_key() { $magic_key = RusCurrency::currency_sync_generate_key(CRON_IMPORT_KEY_LENGTH); Registry::set('addons.rus_ruble.cron_key', $magic_key); return $magic_key; }