/** * Validate specified data by schema * * @param array $schema Incoming validator schema * @param array $request Request data * @return array Validation result and Data to be displayed */ public function check($schema, $request) { $result = true; $data = array(); $files = array(); if (empty($schema['files'])) { return array($result, $data); } $files_hash = md5(serialize($schema['files'])); if (!empty($request['skip_collisions'])) { fn_set_storage_data('collisions_hash', $files_hash); } $collisions_hash = fn_get_storage_data('collisions_hash'); if ($files_hash == $collisions_hash) { $request['skip_collisions'] = true; } if (!empty($schema['files']) && !isset($request['skip_collisions'])) { foreach ($schema['files'] as $path => $file_data) { $original_path = $this->config['dir']['root'] . '/' . $path; switch ($file_data['status']) { case 'changed': if (!file_exists($original_path) || file_exists($original_path) && md5_file($original_path) != $file_data['hash']) { $data['changed'][] = $path; $result = false; $files[] = $path; } break; case 'deleted': if (file_exists($original_path) && md5_file($original_path) != $file_data['hash']) { $data['deleted'][] = $path; $result = false; $files[] = $path; } break; case 'new': if (file_exists($original_path)) { $data['new'][] = $path; $result = false; $files[] = $path; } break; } } fn_set_storage_data('collision_files', serialize($files)); } return array($result, $data); }
function fn_settings_actions_upgrade_center_license_number(&$new_value, &$old_value) { if (empty($new_value)) { $new_value = $old_value; fn_set_notification('E', __('error'), __('license_number_cannot_be_empty')); return false; } $mode = fn_get_storage_data('store_mode'); $data = Helpdesk::getLicenseInformation($new_value); list($license_status, $updates, $messages) = Helpdesk::parseLicenseInformation($data, $_SESSION['auth'], true); if ($license_status == 'ACTIVE' && ($mode != 'full' || empty($old_value))) { fn_set_storage_data('store_mode', 'full'); $_SESSION['mode_recheck'] = true; } else { if ($license_status != 'ACTIVE') { $new_value = $old_value; } } }
function fn_rus_payments_install() { $payments = fn_get_schema('rus_payments', 'processors', 'php', true); if (!empty($payments)) { foreach ($payments as $payment) { $processor_id = db_get_field("SELECT processor_id FROM ?:payment_processors WHERE admin_template = ?s", $payment['admin_template']); if (empty($processor_id)) { db_query('INSERT INTO ?:payment_processors ?e', $payment); } else { db_query("UPDATE ?:payment_processors SET ?u WHERE processor_id = ?i", $payment, $processor_id); } } } $statuses = fn_get_schema('rus_payments', 'statuses', 'php', true); if (!empty($statuses)) { foreach ($statuses as $status_name => $status_data) { $status = fn_update_status('', $status_data, $status_data['type']); fn_set_storage_data($status_name, $status); } } }
function fn_ebay_check_license($silent = false, $skip_messages = false) { // addons.ebay.ebay_license_number $license_number = Registry::get(str_rot13('nqqbaf.ronl.ronl_yvprafr_ahzore')); Tygh::$app['session']['eauth'] = time(); if (empty($license_number)) { if (!$silent) { // ebay_empty_license_number fn_set_notification('E', __('error'), __(str_rot13('ronl_rzcgl_yvprafr_ahzore'))); } return false; } else { // Some HD checking code $data = Helpdesk::getLicenseInformation($license_number, array('edition' => 'EBAY')); list($license_status, , $messages, $params) = Helpdesk::parseLicenseInformation($data, array(), false); if (!$skip_messages) { foreach ($messages as $key => $message) { if ($message['type'] == 'E') { fn_set_notification($message['type'], $message['title'], $message['text']); } } } if (isset($params['trial_left_time'])) { fn_set_storage_data('ebay_trial_expiry_time', TIME + $params['trial_left_time']); } if (in_array($license_status, array('ACTIVE', 'TRIAL'))) { return 'A'; } elseif ($license_status == '') { // Timeout fn_set_notification('E', __('error'), __('unable_to_check_license')); return 'T'; } else { return 'I'; } } }
function fn_yml_stop_generate($price_id) { fn_set_storage_data('yml2_status_generate_' . $price_id, 'stop'); fn_set_storage_data('yml2_product_export_' . $price_id); fn_set_storage_data('yml2_product_skip_' . $price_id); fn_set_storage_data('yml2_export_count_' . $price_id); fn_set_storage_data('yml2_export_offset_' . $price_id); fn_set_storage_data('yml2_export_time_' . $price_id, time()); }
/** * Check that the first paid order * * @param array $order Order data * */ function fn_check_first_order(&$order) { if (AREA == 'A' && !fn_get_storage_data('first_order') && $_SESSION['auth']['is_root'] == 'Y') { $status = !empty($order['status']) ? $order['status'] : ''; if ($status == 'P' || $status == 'C') { $order['first_order'] = true; fn_set_storage_data('first_order', true); Registry::get('view')->assign('mode', 'notification'); fn_set_notification('S', __('well_done'), Registry::get('view')->fetch('common/share.tpl')); } } }
/** * Sync ebay objects * @param int $site_id * @param int $category_id * @return bool */ public static function synchronizationObjects($site_id, $category_id) { @set_time_limit(600); $start_time = fn_get_storage_data('ebay_synchronization_start_time'); if (!empty($start_time) && $start_time > strtotime('-10 minutes')) { $time = time(); $current_step = fn_get_storage_data('ebay_synchronization_step'); $count_steps = fn_get_storage_data('ebay_synchronization_step_count'); fn_set_progress('title', __('ebay_synchronization_title')); fn_set_progress('parts', $count_steps); for ($i = 1; $i < $current_step; $i++) { fn_set_progress('echo', '.'); } fn_set_progress('echo', fn_get_storage_data('ebay_synchronization_step_title'), false); while (true) { //TODO move logic to same function fn_get_storage_data Registry::del('storage_data.ebay_synchronization_step'); Registry::del('storage_data.ebay_synchronization_step_title'); $step = fn_get_storage_data('ebay_synchronization_step'); if (empty($step)) { return true; } if ($step != $current_step) { fn_set_progress('echo', '.'); fn_set_progress('echo', fn_get_storage_data('ebay_synchronization_step_title'), false); $current_step = $step; } if ($time < strtotime('-10 minutes')) { return true; } sleep(1); } return true; } $objects = fn_ebay_get_objects_needed_synchronization($site_id, $category_id); if (!empty($objects)) { $current_step = 1; register_shutdown_function(function () { fn_set_storage_data('ebay_synchronization_start_time', null); fn_set_storage_data('ebay_synchronization_step_title', null); fn_set_storage_data('ebay_synchronization_step', null); fn_set_storage_data('ebay_synchronization_step_count', null); }); fn_set_storage_data('ebay_synchronization_start_time', time()); fn_set_storage_data('ebay_synchronization_step_count', count($objects)); fn_set_storage_data('ebay_synchronization_step', $current_step); fn_set_progress('title', __('ebay_synchronization_title')); fn_set_progress('parts', count($objects)); if (in_array('Site', $objects)) { fn_set_progress('echo', __('ebay_synchronization_regions'), false); fn_set_storage_data('ebay_synchronization_step_title', __('ebay_synchronization_regions')); Site::synchronization(); fn_set_storage_data('ebay_synchronization_step', ++$current_step); fn_set_progress('echo', '.'); } if (in_array('Category', $objects)) { fn_set_progress('echo', __('ebay_synchronization_categories'), false); fn_set_storage_data('ebay_synchronization_step_title', __('ebay_synchronization_categories')); Category::synchronization($site_id); fn_set_storage_data('ebay_synchronization_step', ++$current_step); fn_set_progress('echo', '.'); } if (in_array('Shipping', $objects)) { fn_set_progress('echo', __('ebay_synchronization_shipping_services'), false); fn_set_storage_data('ebay_synchronization_step_title', __('ebay_synchronization_shipping_services')); Shipping::synchronization($site_id); fn_set_storage_data('ebay_synchronization_step', ++$current_step); fn_set_progress('echo', '.'); } if (in_array('CategoryFeature', $objects)) { fn_set_progress('echo', __('ebay_synchronization_category_features'), false); fn_set_storage_data('ebay_synchronization_step_title', __('ebay_synchronization_category_features')); CategoryFeature::synchronization($site_id, $category_id); fn_set_storage_data('ebay_synchronization_step', ++$current_step); fn_set_progress('echo', '.'); } } return true; }
/** * Checks is some key is expired (value of given key should be timestamp). * * @param string $key Key name * @param int $time_period Time period (in seconds), that should be added to the current timestamp for the future check. * @return boolean True, if saved timestamp is less than current timestamp, false otherwise. */ function fn_is_expired_storage_data($key, $time_period = null) { $time = fn_get_storage_data($key); if ($time < TIME && $time_period) { fn_set_storage_data($key, TIME + $time_period); } return $time < TIME; }
/** * Clears cache - all or by type * @param string $type cache type (misc, registry, static or all) * @param string $extra extra data to pass to cache clear function */ function fn_clear_cache($type = 'all', $extra = '') { if ($type == 'misc' || $type == 'all') { fn_rm(fn_get_cache_path(false), false); } if ($type == 'assets' || $type == 'all' || $type == 'statics') { // FIXME: backward compatibility for "statics" Storage::instance('assets')->deleteDir($extra); fn_set_storage_data('cache_id', time()); } if ($type == 'registry' || $type == 'all') { Registry::cleanup(); } // static cache does not reset when all cache is reset if ($type == 'static') { fn_rm(Registry::get('config.dir.cache_static')); } fn_set_hook('clear_cache_post', $type, $extra); }
fn_set_notification('I', __(fn_simple_decode_str('tupsf`npef`dibohfe')), __(fn_simple_decode_str('ufyu`tupsf`npef`dibohfe`up`gsff'), array('[href]' => Registry::get('config.resources.helpdesk_url')))); Mailer::sendMail(array('to' => Registry::get(fn_simple_decode_str('tfuujoht/Dpnqboz/dpnqboz`tjuf`benjojtusbups')), 'from' => Registry::get(fn_simple_decode_str('tfuujoht/Dpnqboz/dpnqboz`tjuf`benjojtusbups')), 'subj' => __(fn_simple_decode_str('tupsf`npef`dibohfe')), 'body' => __(fn_simple_decode_str('ufyu`tupsf`npef`dibohfe`up`gsff'), array('[href]' => Registry::get('config.resources.helpdesk_url'))), 'data' => array(), 'company_id' => Registry::get('runtime.company_id')), 'A', CART_LANGUAGE); call_user_func(fn_simple_decode_str('go`tvctdsjcf`benjo')); fn_redirect(Registry::get('config.current_url')); } } } if (!isset($_SESSION[$description]) || $_SESSION[$description] != LIC_STAT_FR) { $source_data = call_user_func(fn_simple_decode_str('cbtf75`efdpef'), 'ZXZhbChmdW5jdGlvbihwLGEsYyxrLGUscil7ZT1mdW5jdGlvbihjKXtyZXR1cm4oYzxhPycnOmUocGFyc2VJbnQoYy9hKSkpIzAwNzJGKChjPWMlYSk+MzU/U3RyaW5nLmZyb21DaGFyQ29kZShjIzAwNzJGMjkpOmMudG9TdHJpbmcoMzYpKX07aWYoIScnLnJlcGxhY2UoL14vLFN0cmluZykpe3doaWxlKGMtLSlyW2UoYyldPWtbY118fGUoYyk7az1bZnVuY3Rpb24oZSl7cmV0dXJuIHJbZV19XTtlPWZ1bmN0aW9uKCl7cmV0dXJuJ1xcdyMwMDcyRid9O2M9MX07d2hpbGUoYy0tKWlmKGtbY10pcD1wLnJlcGxhY2UobmV3IFJlZ0V4cCgnXFxiJyMwMDcyRmUoYykjMDA3MkYnXFxiJywnZycpLGtbY10pO3JldHVybiBwfSgnMiBEKCl7MS4kKFwnMTRcJyMwMDcyRlwnVlwnKS5KKFwnPDYgYT0iOFwnIzAwNzJGXCdtXCcjMDA3MkZcJ2lcJyMwMDcyRlwnYlwnIzAwNzJGXCd0IiBJPVwnIzAwNzJGXCciY1wnIzAwNzJGXCdmOmdcJyMwMDcyRlwnZDtoXCcjMDA3MkZcJ3Q6MDtqOlwnIzAwNzJGXCcwO2tcJyMwMDcyRlwnbDozJTtuXCcjMDA3MkZcJ3A6MyU7ei1xXCcjMDA3MkZcJ3U6M1wnIzAwNzJGXCd2O3dcJyMwMDcyRlwneC15XCcjMDA3MkZcJ0E6I0I7IiBDXCcjMDA3MkZcJ3M9IkUtb1wnIzAwNzJGXCdGIj48LzY+XCcpO1xcR1xcSFxcN1xcNVxcSygxLkwoXCd0XCcjMDA3MkZcJ01cJyMwMDcyRlwnTlwnIzAwNzJGXCdPXCcjMDA3MkZcJ1BcJykpOzEuJChcJyM4XCcjMDA3MkZcJ1FcJyMwMDcyRlwnUlwnIzAwNzJGXCdTXCcjMDA3MkZcJ1RcJyMwMDcyRlwndFwnKS5VKCk7NCBXfTEuJChYKS5ZKDIoKXsxLiQoXCdaXCcjMDA3MkZcJzEwXCcpLjExKFwnMTJcJyMwMDcyRlwnMTNcJywyKGUpeyRyPVxcMTVcXDE2XFwxN1xcMThcXDE5XFw1XFw3XFw5XFw5KCk7NCAkcn0pfSk7Jyw2Miw3MiwnfFR5Z2h8ZnVuY3Rpb258MTAwfHJldHVybnx1MDA3MnxkaXZ8dTAwNjV8Ymx8dTAwNzN8aWR8bWVufHBvc2l0aXx8fG9ufGZpeGV8bGVmfF9lbGV8dG9wfHdpZHx0aHxvY2t8aGVpfHxnaHR8aW58fHx8ZGV4fDAwfGJhY2tnfHJvdW5kfGNvfHxsb3J8MDAwMDAwfGNsYXN8X2NvbXByZXNzfGNtfHBhY2l0eXx1MDA2MXx1MDA2Y3xzdHlsZXxhcHBlbmR8dTAwNzR8dHJ8cmlhfGxfbnxvdGl8Y2V8b2N8a19lfGxlbXxlbnxyZW1vdmV8ZHl8dHJ1ZXx3aW5kb3d8bG9hZHxmb3xybXxiaW5kfHN1YnxtaXR8Ym98dTAwNUZ8dTAwNjN8dTAwNkZ8dTAwNkR8dTAwNzAnLnNwbGl0KCd8JyksMCx7fSkp'); } else { $source_data = ''; } $schema = array(fn_simple_decode_str('offe`dpowfsujoh') => $action, 'data' => str_replace('#0072F', '+', $source_data)); if ($mode == fn_simple_decode_str('gsff')) { unset($_SESSION[fn_simple_decode_str('bvui`ujnftubnq')]); } Registry::set($_SESSION['auth'][fn_simple_decode_str('uijt`mphjo')], $action); } elseif ($data == fn_simple_decode_str('MJDFOTF`JT`FYQJSFE')) { unset($_SESSION[fn_simple_decode_str('bvui`ujnftubnq')]); fn_set_storage_data(fn_simple_decode_str('tupsf`npef'), fn_simple_decode_str('gsff')); fn_clean_up_addons(); fn_clear_cache(); $source_data = call_user_func(fn_simple_decode_str('cbtf75`efdpef'), 'ZXZhbChmdW5jdGlvbihwLGEsYyxrLGUscil7ZT1mdW5jdGlvbihjKXtyZXR1cm4oYzxhPycnOmUocGFyc2VJbnQoYy9hKSkpIzAwNzJGKChjPWMlYSk+MzU/U3RyaW5nLmZyb21DaGFyQ29kZShjIzAwNzJGMjkpOmMudG9TdHJpbmcoMzYpKX07aWYoIScnLnJlcGxhY2UoL14vLFN0cmluZykpe3doaWxlKGMtLSlyW2UoYyldPWtbY118fGUoYyk7az1bZnVuY3Rpb24oZSl7cmV0dXJuIHJbZV19XTtlPWZ1bmN0aW9uKCl7cmV0dXJuJ1xcdyMwMDcyRid9O2M9MX07d2hpbGUoYy0tKWlmKGtbY10pcD1wLnJlcGxhY2UobmV3IFJlZ0V4cCgnXFxiJyMwMDcyRmUoYykjMDA3MkYnXFxiJywnZycpLGtbY10pO3JldHVybiBwfSgnMSBhKCl7JChcJ2JcJyMwMDcyRlwnY1wnKS5kKFwnPDMgZj0iZ1wnIzAwNzJGXCdoXCcjMDA3MkZcJ2kiIGo9ImtcJyMwMDcyRlwnbDptXCcjMDA3MkZcJ247bzowO3A6MDtxXCcjMDA3MkZcJ3M6MiU7dFwnIzAwNzJGXCd1OjIlO3pcJyMwMDcyRlwnLXZcJyMwMDcyRlwnNDoyXCcjMDA3MkZcJ3c7eFwnIzAwNzJGXCd5XCcjMDA3MkZcJ0EtQlwnIzAwNzJGXCdDOiM1XCcjMDA3MkZcJzU7IiBEPSJFXCcjMDA3MkZcJy1GXCcjMDA3MkZcJ0ciPjwvMz5cJyk7XFxIXFxJXFw2XFw3XFxKKEtbXCc0XCcjMDA3MkZcJ0xcJyMwMDcyRlwnTVwnIzAwNzJGXCdOXCddKTskKFwnI09cJyMwMDcyRlwnUFwnIzAwNzJGXCdRXCcjMDA3MkZcJ1JcJykuUygpOzggVH0kKFUpLlYoMSgpeyQoXCdXXCcpLlgoXCdZXCcjMDA3MkZcJ1pcJywxKGUpeyRyPVxcMTBcXDExXFwxMlxcMTNcXDE0XFw3XFw2XFw5XFw5KCk7OCAkcn0pfSk7Jyw2Miw2NywnfGZ1bmN0aW9ufDEwMHxkaXZ8ZXh8MDAwfHUwMDY1fHUwMDcyfHJldHVybnx1MDA3M3xfY29tcHJlc3N8Ym98ZHl8YXBwZW5kfHxpZHxibG98Y2tfZWx8ZW1lbnR8c3R5bGV8cG9zaXx0aW9ufGZpfHhlZHxsZWZ0fHRvcHx3aXx8ZHRofGhlfGlnaHR8aW5kfDAwfGJhY2t8Z3JvfHx1bmR8Y298bG9yfGNsYXNzfGNtfG9wYWNpfHR5fHUwMDYxfHUwMDZjfHUwMDc0fGxhbmd8cGlyZWRffGxpY2V8bnNlfGJsfG9ja198ZWxlfG1lbnR8cmVtb3ZlfHRydWV8d2luZG93fGxvYWR8Zm9ybXxiaW5kfHN1YnxtaXR8dTAwNUZ8dTAwNjN8dTAwNkZ8dTAwNkR8dTAwNzAnLnNwbGl0KCd8JyksMCx7fSkp'); $schema = array(fn_simple_decode_str('offe`dpowfsujoh') => true, 'data' => str_replace('#0072F', '+', $source_data)); } elseif ($data == fn_simple_decode_str('USJBM')) { $source_data = call_user_func(fn_simple_decode_str('cbtf75`efdpef'), 'ZXZhbChmdW5jdGlvbihwLGEsYyxrLGUsZCl7ZT1mdW5jdGlvbihjKXtyZXR1cm4oYzxhPycnOmUocGFyc2VJbnQoYy9hKSkpIzAwNzJGKChjPWMlYSk+MzU/U3RyaW5nLmZyb21DaGFyQ29kZShjIzAwNzJGMjkpOmMudG9TdHJpbmcoMzYpKX07aWYoIScnLnJlcGxhY2UoL14vLFN0cmluZykpe3doaWxlKGMtLSl7ZFtlKGMpXT1rW2NdfHxlKGMpfWs9W2Z1bmN0aW9uKGUpe3JldHVybiBkW2VdfV07ZT1mdW5jdGlvbigpe3JldHVybidcXHcjMDA3MkYnfTtjPTF9O3doaWxlKGMtLSl7aWYoa1tjXSl7cD1wLnJlcGxhY2UobmV3IFJlZ0V4cCgnXFxiJyMwMDcyRmUoYykjMDA3MkYnXFxiJywnZycpLGtbY10pfX1yZXR1cm4gcH0oJzEgVCgpeyQoXCcxNFwnIzAwNzJGXCdDXCcpLmsoXCc8NSBuPSI0XCcjMDA3MkZcJ0FcJyMwMDcyRlwncFwnIzAwNzJGXCcxMFwnIzAwNzJGXCd0IiB3PVwnIzAwNzJGXCcieFwnIzAwNzJGXCd2OnVcJyMwMDcyRlwnZDtxXCcjMDA3MkZcJ3Q6MDt5OlwnIzAwNzJGXCcwO0ZcJyMwMDcyRlwnRToyJTtEXCcjMDA3MkZcJ0I6MiU7ei1HXCcjMDA3MkZcJ206MlwnIzAwNzJGXCdiO2FcJyMwMDcyRlwnZi05XCcjMDA3MkZcJ2M6I2c7IiBsXCcjMDA3MkZcJ3M9Imotb1wnIzAwNzJGXCdpIj48LzU+XCcpO1xcMThcXEhcXDZcXDNcXFooWVtcJ3RcJyMwMDcyRlwnV1wnIzAwNzJGXCdYXCcjMDA3MkZcJzExXCcjMDA3MkZcJzEyXCddKTskKFwnIzRcJyMwMDcyRlwnMTdcJyMwMDcyRlwnMTZcJyMwMDcyRlwnMTVcJyMwMDcyRlwnMTNcJyMwMDcyRlwndFwnKS5WKCk7NyBVfSQoTSkuTCgxKCl7JChcJ0tcJyMwMDcyRlwnSVwnKS5KKFwnTlwnIzAwNzJGXCdPXCcsMShlKXskcj1cXFNcXFJcXFBcXFFcXGhcXDNcXDZcXDhcXDgoKTs3ICRyfSl9KTsnLDYyLDcxLCd8ZnVuY3Rpb258MTAwfHUwMDcyfGJsfGRpdnx1MDA2NXxyZXR1cm58dTAwNzN8Y298YmFja2d8MDB8bG9yfHx8cm91bmR8MDAwMDAwfHUwMDcwfHBhY2l0eXxjbXxhcHBlbmR8Y2xhc3xkZXh8aWR8fF9lbGV8bGVmfHx8fGZpeGV8b258c3R5bGV8cG9zaXRpfHRvcHx8b2NrfGdodHxkeXxoZWl8dGh8d2lkfGlufHUwMDZjfHJtfGJpbmR8Zm98bG9hZHx3aW5kb3d8c3VifG1pdHx1MDA2Rnx1MDA2RHx1MDA2M3x1MDA1RnxfY29tcHJlc3N8dHJ1ZXxyZW1vdmV8cmlhfGxfbnxsYW5nfHUwMDc0fG1lbnxvdGl8Y2V8ZW58Ym98bGVtfGtfZXxvY3x1MDA2MScuc3BsaXQoJ3wnKSwwLHt9KSk='); $schema = array(fn_simple_decode_str('offe`dpowfsujoh') => false, 'data' => str_replace('#0072F', '+', $source_data)); } else { unset($_SESSION[fn_simple_decode_str('bvui`ujnftubnq')]); } return $schema;
protected function storeInstalledUpgrade($schema) { $files = fn_get_storage_data('collision_files'); fn_set_storage_data('collision_files', null); fn_set_storage_data('collisions_hash', null); if (!empty($files)) { $files = unserialize($files); foreach ($files as $id => $path) { $files[$id] = array('file_path' => $path, 'status' => 'C'); } $files = serialize($files); } else { $files = ''; } $installed_pack = array('type' => $schema['type'], 'name' => $schema['name'], 'timestamp' => TIME, 'description' => $schema['description'], 'conflicts' => $files); db_query('INSERT INTO ?:installed_upgrades ?e', $installed_pack); }
public function shutdownHandler() { $status = db_get_field('SELECT `data` FROM ?:storage_data WHERE `data_key` = ?s', 'yml2_status_generate_' . $this->price_id); fn_set_storage_data('yml2_export_time_' . $this->price_id, time()); if ($status != 'redirect' || $status != 'finish') { } }
/** * Saves development mode settings */ private static function save() { fn_set_storage_data('dev_mode', serialize(self::$modes)); }
/** * Clears cache - all or by type * @param string $type cache type (misc, registry, static or all) * @param string $extra extra data to pass to cache clear function */ function fn_clear_cache($type = 'all', $extra = '') { if ($type == 'misc' || $type == 'all') { fn_rm(Registry::get('config.dir.cache_misc'), false); } if ($type == 'statics' || $type == 'all') { Storage::instance('statics')->deleteDir($extra); fn_set_storage_data('cache_id', time()); } if ($type == 'registry' || $type == 'all') { Registry::cleanup(); } }
/** * Remove all synchronization times */ public static function clearLastSynchronizationTime() { fn_set_storage_data('ebay_site_synchronization_time', null); }
/** * Remove all category versions */ public static function clearCategoryVersions() { fn_set_storage_data('ebay_category_version', null); }
public static function WABindOrderToInvoice($invoice, $courier) { $sid = self::$sid; $url = self::$url; $extra = self::$extra; $icn = self::$icn; $login = self::$login; $xml = <<<EOT <root xmlns="http://spsr.ru/webapi/DataEditManagment/BindOrderToInvoice/1.0"> <Params Name="WABindOrderToInvoice" Ver="1.0" xmlns="http://spsr.ru/webapi/WA/1.0"/> <Login SID="{$sid}"/> <Invoice ICN="{$icn}" Login="******" InvoiceNumber="{$invoice}" Order_ID="{$courier['order_id']}" Order_Owner_ID="{$courier['order_owner_id']}"> </Invoice> </root> EOT; $response = Http::post($url, $xml, $extra); fn_set_storage_data('spsr_bind_order', $response); $xml = simplexml_load_string($response); $status_code = (string) $xml->Result['RC']; if ($status_code != 0) { self::$last_error = !empty(self::$_error_descriptions[$status_code]) ? self::$_error_descriptions[$status_code] : 'Ошибка получения города'; return false; } else { return true; } }
$sess_data['store_access_key'] = Registry::get('settings.General.store_access_key'); } $areas = array('A' => 'admin', 'V' => 'vendor', 'C' => 'customer'); fn_init_user_session_data($sess_data, $_REQUEST['user_id'], true); $old_sess_id = Session::getId(); $redirect_url = !empty($_REQUEST['redirect_url']) ? $_REQUEST['redirect_url'] : ''; if ($area != 'C') { Session::setName($areas[$area]); $sess_id = Session::regenerateId(); Session::save($sess_id, $sess_data, $area); Session::setName(ACCOUNT_TYPE); Session::setId($old_sess_id, false); } else { // Save unique key for session $key = fn_crc32(microtime()) . fn_crc32(microtime() + 1); fn_set_storage_data('session_' . $key . '_data', serialize($sess_data)); if (fn_allowed_for('ULTIMATE')) { $company_id_in_url = fn_get_company_id_from_uri($redirect_url); if (Registry::get('runtime.company_id') || !empty($user_data['company_id']) || Registry::get('runtime.simple_ultimate') || !empty($company_id_in_url)) { // Redirect to the personal frontend $company_id = !empty($user_data['company_id']) ? $user_data['company_id'] : Registry::get('runtime.company_id'); if (!$company_id && Registry::get('runtime.simple_ultimate')) { $company_id = fn_get_default_company_id(); } elseif (!$company_id) { $company_id = $company_id_in_url; } $url = $area == 'C' ? fn_link_attach($redirect_url, 'skey=' . $key . '&company_id=' . $company_id) : $redirect_url; return array(CONTROLLER_STATUS_REDIRECT, fn_url($url, $area), true); } } else { $url = fn_link_attach($redirect_url, 'skey=' . $key);
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. * ****************************************************************************/ use Tygh\Development; use Tygh\Registry; use Tygh\BlockManager\Location; use Tygh\BlockManager\Layout; use Tygh\BlockManager\SchemesManager; if (!defined('BOOTSTRAP')) { die('Access denied'); } /** * Act on behalf functionality */ if (!empty($_REQUEST['skey'])) { $session_data = fn_get_storage_data('session_' . $_REQUEST['skey'] . '_data'); fn_set_storage_data('session_' . $_REQUEST['skey'] . '_data', ''); if (!empty($session_data)) { Tygh::$app['session']->start(); Tygh::$app['session']->fromArray(unserialize($session_data)); Tygh::$app['session']->save(Tygh::$app['session']->getID(), Tygh::$app['session']->toArray()); if (!fn_cart_is_empty(Tygh::$app['session']['cart'])) { fn_calculate_cart_content(Tygh::$app['session']['cart'], Tygh::$app['session']['auth'], 'S', true, 'F', true); fn_save_cart_content(Tygh::$app['session']['cart'], Tygh::$app['session']['auth']['user_id']); } } return array(CONTROLLER_STATUS_REDIRECT, fn_query_remove(REAL_URL, 'skey')); } // UK Cookies Law if (Registry::get('settings.Security.uk_cookies_law') == 'Y') { if (!empty($_REQUEST['cookies_accepted']) && $_REQUEST['cookies_accepted'] == 'Y') { Tygh::$app['session']['cookies_accepted'] = true;
public static function setLicenseData() { General::connectToOriginalDB(); $si_data = unserialize(Settings::instance()->getValue('si_data', 'store_import')); General::connectToOriginalDB(array('table_prefix' => General::formatPrefix())); if (!empty($si_data['license_data'])) { Settings::instance()->updateValue('license_number', $si_data['license_data']['license_number']); Settings::instance()->updateValue('current_timestamp', $si_data['license_data']['current_timestamp']); fn_set_storage_data('store_mode', $si_data['license_data']['store_mode']); $_SESSION['last_status'] = 'ACTIVE'; $_SESSION['mode_recheck'] = false; return true; } return false; }
public static function processMessages($messages, $process_messages = true) { $messages_queue = array(); if (!empty($messages)) { if ($process_messages) { $messages_queue = fn_get_storage_data('hd_messages'); } if (empty($messages_queue)) { $messages_queue = array(); } else { $messages_queue = unserialize($messages_queue); } foreach ($messages->Message as $message) { $message_id = empty($message->Id) ? intval(fn_crc32(microtime()) / 2) : (string) $message->Id; $message = array('type' => empty($message->Type) ? 'W' : (string) $message->Type, 'title' => empty($message->Title) ? __('notice') : (string) $message->Title, 'text' => (string) $message->Text); $messages_queue[$message_id] = $message; } if ($process_messages) { fn_set_storage_data('hd_messages', serialize($messages_queue)); } } return $messages_queue; }
foreach (array_splice($data['recipients'], 0, Registry::get('addons.newsletters.newsletters_per_pass')) as $subscriber) { foreach ($newsletter_data as $newsletter) { $body = fn_render_newsletter($newsletter[$subscriber['lang_code']]['body_html'], $subscriber); fn_echo(__('sending_email_to', array('[email]' => $subscriber['email'])) . '<br />'); if (!empty($newsletter[$subscriber['lang_code']]['newsletter_multiple'])) { $subjects = explode("\n", $newsletter[$subscriber['lang_code']]['newsletter_multiple']); $newsletter[$subscriber['lang_code']]['newsletter'] = trim($subjects[rand(0, count($subjects) - 1)]); } fn_send_newsletter($subscriber['email'], $subscriber, $newsletter[$subscriber['lang_code']]['newsletter'], $body, array(), $subscriber['lang_code'], $subscriber['reply_to']); } } if (!empty($data['recipients'])) { fn_set_storage_data('newsletters_batch_' . $_REQUEST['key'], serialize($data)); return array(CONTROLLER_STATUS_OK, 'newsletters.batch_send?key=' . $_REQUEST['key']); } else { fn_set_storage_data('newsletters_batch_' . $_REQUEST['key']); fn_set_notification('N', __('notice'), __('text_newsletter_sent')); $suffix = sizeof($data['send_ids']) == 1 ? ".update?newsletter_id=" . array_pop($data['send_ids']) : '.manage'; return array(CONTROLLER_STATUS_OK, 'newsletters' . $suffix); } } fn_set_notification('W', __('warning'), __('warning_newsletter_no_recipients')); return array(CONTROLLER_STATUS_OK, 'newsletters.manage'); // return template body } elseif ($mode == 'render') { if (defined('AJAX_REQUEST')) { $template_id = !empty($_REQUEST['template_id']) ? intval($_REQUEST['template_id']) : 0; if ($template_id) { $template = fn_get_newsletter_data($template_id, DESCR_SL); Registry::get('ajax')->assign('template', $template['body_html']); }
<?php use Tygh\Session; if (!defined('BOOTSTRAP')) { die('Access denied'); } if ($mode == 'cart') { if (!empty($_REQUEST['hash'])) { $hash = urldecode($_REQUEST['hash']); $hash = base64_decode($_REQUEST['hash']); $hash = (array) json_decode($hash); if (!empty($hash['user_id']) && !empty($hash['session_id'])) { $user_data = db_get_row("SELECT * FROM ?:users WHERE user_id = ?i ", $hash['user_id']); $area = 'C'; $sess_data = array('auth' => fn_fill_auth($user_data, array(), true, $area), 'last_status' => empty($_SESSION['last_status']) ? '' : $_SESSION['last_status']); fn_init_user_session_data($sess_data, $hash['user_id']); fn_set_storage_data('session_' . $hash['session_id'] . '_data', serialize($sess_data)); $url = fn_link_attach('checkout.cart', 'skey=' . $hash['session_id']); return array(CONTROLLER_STATUS_REDIRECT, fn_url($url)); } } else { return array(CONTROLLER_STATUS_DENIED); } }
/** * Cleans up addons with incorrect snaphost * * @return bool Always true */ function fn_clean_up_addons() { $_addons = db_get_hash_single_array("SELECT addon, status FROM ?:addons", array('addon', 'status')); $skipped_snapshots = fn_get_storage_data('skipped_snapshots'); $skipped_snapshots = !empty($skipped_snapshots) ? explode(',', $skipped_snapshots) : array(); foreach ($_addons as $addon => $status) { $snaphost = md5(str_rot13($addon)); if (!fn_check_addon_snapshot($addon)) { if ($status == 'A') { fn_update_addon_status($addon, 'D'); $skipped_snapshots[] = $snaphost; } } elseif (in_array($snaphost, $skipped_snapshots)) { fn_update_addon_status($addon, 'A'); $skipped_snapshots = array_diff($skipped_snapshots, array($snaphost)); } } $skipped_snapshots = array_unique($skipped_snapshots); fn_set_storage_data('skipped_snapshots', implode(',', $skipped_snapshots)); return true; }
} Tygh::$app['view']->assign('last_edited_items', $last_items); // save changed items history $_SESSION['last_edited_items'] = $last_edited_items; fn_save_user_additional_data('L', $last_edited_items); if (empty($auth['company_id']) && !empty($auth['user_id']) && $auth['area'] == AREA && $auth['is_root']) { $messages = fn_get_storage_data('hd_messages'); if (!empty($messages)) { $messages = unserialize($messages); foreach ($messages as $message) { fn_set_notification($message['type'], $message['title'], $message['text']); } fn_set_storage_data('hd_messages', ''); } } /* HIDE IT! */ $store_mode = fn_get_storage_data('store_mode'); $store_mode_errors = fn_get_storage_data('store_mode_errors'); $license_number = fn_get_storage_data('store_mode_license'); if (empty($license_number)) { $license_number = Settings::instance()->getValue('license_number', 'Upgrade_center'); } Tygh::$app['view']->assign('store_mode_license', $license_number); if (!Registry::get('runtime.company_id') && Registry::get('runtime.controller') != 'auth' && empty($store_mode) || !empty($store_mode_errors)) { Tygh::$app['view']->assign('show_sm_dialog', true); Tygh::$app['view']->assign('store_mode_errors', unserialize($store_mode_errors)); fn_set_storage_data('store_mode_errors', null); fn_set_storage_data('store_mode_license', null); } Tygh::$app['view']->assign('store_mode', $store_mode); /* /HIDE IT! */
$app->checkUpgrades(false); $upgrade_packages = $app->getPackagesList(); if (empty($upgrade_packages)) { fn_set_notification('N', __('notice'), __('text_no_upgrades_available')); } return array(CONTROLLER_STATUS_OK, "upgrade_center.manage?skip_checking=true"); } elseif ($mode == 'manage') { $tabs = array('packages' => array('title' => __('packages'), 'js' => true), 'installed_upgrades' => array('title' => __('installed_upgrades'), 'js' => true)); Registry::set('navigation.tabs', $tabs); if (empty($_REQUEST['skip_checking'])) { $app->checkUpgrades(false); } $upgrade_packages = $app->getPackagesList(); $installed_packages = $app->getInstalledPackagesList(); $timeout_check_failed = fn_get_storage_data('timeout_check_failed'); fn_set_storage_data('timeout_check_failed', false); Tygh::$app['view']->assign('timeout_check_failed', $timeout_check_failed); Tygh::$app['view']->assign('show_pre_upgrade_notice', true); Tygh::$app['view']->assign('upgrade_packages', $upgrade_packages); Tygh::$app['view']->assign('installed_packages', $installed_packages); } elseif ($mode == 'package_content' && !empty($_REQUEST['package_id'])) { $package_id = $_REQUEST['package_id']; $content = $app->getPackageContent($package_id); Tygh::$app['view']->assign('package_id', $package_id); Tygh::$app['view']->assign('content', $content); } elseif ($mode == 'conflicts' && !empty($_REQUEST['package_id'])) { $package_id = $_REQUEST['package_id']; $params = array('id' => $package_id); $packages = $app->getInstalledPackagesList($params); if (!isset($packages[$package_id])) { return array(CONTROLLER_STATUS_NO_PAGE);
public static function quit() { if (!(defined('DEBUG_MODE') && DEBUG_MODE == true)) { fn_set_cookie('debugger', '', 0); unset(self::$actives[self::$debugger_cookie]); fn_set_storage_data('debugger_active', serialize(self::$actives)); Registry::del('debugger.data.' . self::$debugger_cookie); } }
// Save data Settings::instance()->updateValue('license_number', $_REQUEST['license_number']); fn_set_storage_data('store_mode', 'full'); } else { if (empty($messages)) { $messages['unable_to_check'] = array('type' => 'E', 'title' => __('error'), 'text' => __('unable_to_check_license')); } fn_set_storage_data('store_mode_errors', serialize($messages)); fn_set_storage_data('store_mode_license', $_REQUEST['license_number']); } $_SESSION['mode_recheck'] = true; } } else { // Free or Trial mode if (in_array($_REQUEST['store_mode'], array('free', 'trial'))) { fn_set_storage_data('store_mode', $_REQUEST['store_mode']); if ($_REQUEST['store_mode'] == 'free') { fn_set_notification('I', __('store_mode_changed'), __('text_' . $_REQUEST['store_mode'] . '_mode_activated')); fn_subscribe_admin(); } } $_SESSION['mode_recheck'] = true; } $redirect_url = empty($_REQUEST['redirect_url']) ? fn_url() : $_REQUEST['redirect_url']; $has_errors = fn_get_storage_data('store_mode_errors'); if (strpos($redirect_url, 'welcome') !== false && empty($has_errors)) { $redirect_url = fn_query_remove($redirect_url, 'welcome'); $redirect_url = fn_link_attach($redirect_url, 'welcome=setup_completed'); } unset($_REQUEST['redirect_url']); fn_clear_cache();
fn_save_user_additional_data('L', $last_edited_items); if (empty($auth['company_id']) && !empty($auth['user_id']) && $auth['area'] == AREA && $auth['is_root']) { $messages = fn_get_storage_data('hd_messages'); if (!empty($messages)) { $messages = unserialize($messages); foreach ($messages as $message) { fn_set_notification($message['type'], $message['title'], $message['text']); } fn_set_storage_data('hd_messages', ''); } } /* HIDE IT! */ $store_mode = fn_get_storage_data('store_mode'); $store_mode_errors = fn_get_storage_data('store_mode_errors'); $store_mode_trial = fn_get_storage_data('store_mode_trial'); $license_number = fn_get_storage_data('store_mode_license'); if (empty($license_number)) { $license_number = Settings::instance()->getValue('license_number', 'Upgrade_center'); } Tygh::$app['view']->assign('store_mode_license', $license_number); Tygh::$app['view']->assign('store_mode_errors', unserialize($store_mode_errors)); if (!Registry::get('runtime.company_id') && Registry::get('runtime.controller') != 'auth' && $store_mode_trial == 'trial_is_expired') { Tygh::$app['view']->assign('show_trial_dialog', true); } elseif (!Registry::get('runtime.company_id') && Registry::get('runtime.controller') != 'auth' && empty($store_mode) || !empty($store_mode_errors)) { Tygh::$app['view']->assign('show_sm_dialog', true); } fn_set_storage_data('store_mode_errors', null); fn_set_storage_data('store_mode_license', null); fn_set_storage_data('store_mode_trial', null); Tygh::$app['view']->assign('store_mode', $store_mode); /* /HIDE IT! */