Пример #1
0
 public static function init($reinit = false, $config = array())
 {
     self::$active_debug_mode = false;
     self::$allow_backtrace_sql = isset($_REQUEST['sql_backtrace']);
     self::$debugger_cookie = !empty($_COOKIE['debugger']) ? $_COOKIE['debugger'] : '';
     if ($reinit) {
         Registry::registerCache('debugger', SESSION_ALIVE_TIME, Registry::cacheLevel('time'), true);
         self::$actives = fn_get_storage_data('debugger_active');
         self::$actives = !empty(self::$actives) ? unserialize(self::$actives) : array();
         $active_in_registry = !empty(self::$actives[self::$debugger_cookie]) && time() - self::$actives[self::$debugger_cookie] < 0 ? true : false;
     }
     $debugger_token = !empty($config) ? $config['debugger_token'] : Registry::get('config.debugger_token');
     switch (true) {
         case defined('AJAX_REQUEST') && substr($_REQUEST['dispatch'], 0, 8) !== 'debugger':
             break;
         case defined('DEBUG_MODE') && DEBUG_MODE == true:
         case !$reinit && (!empty(self::$debugger_cookie) || isset($_REQUEST[$debugger_token])):
             self::$active_debug_mode = true;
             break;
         case !$reinit:
             break;
             // next if reinit
         // next if reinit
         case !empty(self::$debugger_cookie) && !empty($active_in_registry):
             self::$active_debug_mode = true;
             break;
         case isset($_REQUEST[$debugger_token]):
             $salt = '';
             if ($_SESSION['auth']['user_type'] == 'A' && $_SESSION['auth']['is_root'] == 'Y') {
                 $user_admin = db_get_row('SELECT email, password FROM ?:users WHERE user_id = ?i', $_SESSION['auth']['user_id']);
                 $salt = $user_admin['email'] . $user_admin['password'];
             }
             if ($debugger_token != self::DEFAULT_TOKEN || !empty($salt)) {
                 // for non-default token allow full access
                 self::$debugger_cookie = substr(md5(SESSION::getId() . $salt), 0, 8);
                 $active_in_registry = true;
                 self::$active_debug_mode = true;
             }
             if (AREA == 'C' && !empty($_REQUEST[$debugger_token])) {
                 if (!empty(self::$actives[$_REQUEST[$debugger_token]]) && time() - self::$actives[$_REQUEST[$debugger_token]] < 0) {
                     $active_in_registry = true;
                     self::$debugger_cookie = $_REQUEST[$debugger_token];
                     self::$active_debug_mode = true;
                 }
             }
             fn_set_cookie('debugger', self::$debugger_cookie, SESSION_ALIVE_TIME);
             break;
     }
     if ($reinit && self::$active_debug_mode && !empty(self::$debugger_cookie)) {
         self::$actives[self::$debugger_cookie] = time() + self::EXPIRE_DEBUGGER;
         fn_set_storage_data('debugger_active', serialize(self::$actives));
         $active_in_registry = true;
     }
     if ($reinit && !empty(self::$debugger_cookie) && empty($active_in_registry)) {
         fn_set_cookie('debugger', '', 0);
         unset(self::$actives[self::$debugger_cookie]);
         fn_set_storage_data('debugger_active', serialize(self::$actives));
     }
     return self::$active_debug_mode;
 }
Пример #2
0
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */
function smarty_block_scripts($params, $content, &$smarty, &$repeat)
{
    if ($repeat == true) {
        Registry::set('runtime.inside_scripts', 1);
        return;
    }
    if (Registry::get('config.tweaks.dev_js')) {
        $content .= smarty_helper_inline_scripts($params, $content, $smarty, $repeat);
        return $content;
    }
    $scripts = array();
    $external_scripts = array();
    $dir_root = Registry::get('config.dir.root');
    $return = '';
    $current_location = Registry::get('config.current_location');
    if (preg_match_all('/\\<script(.*?)\\>(.*?)\\<\\/script\\>/s', $content, $m)) {
        $contents = '';
        foreach ($m[1] as $src) {
            if (!empty($src) && preg_match('/src ?= ?"([^"]+)"/', $src, $_m)) {
                if (strpos($_m[1], $current_location) !== false) {
                    $scripts[] = str_replace($current_location, '', preg_replace('/\\?.*?$/', '', $_m[1]));
                } else {
                    $external_scripts[] = $_m[1];
                }
            }
        }
        // Check file changes in dev mode
        $names = $scripts;
        if (Development::isEnabled('compile_check')) {
            foreach ($names as $index => $name) {
                if (is_file($dir_root . '/' . $name)) {
                    $names[$index] .= filemtime($dir_root . '/' . $name);
                }
            }
        }
        $filename = 'js/tygh/scripts-' . md5(implode(',', $names)) . fn_get_storage_data('cache_id') . '.js';
        if (!Storage::instance('statics')->isExist($filename)) {
            foreach ($scripts as $src) {
                $contents .= fn_get_contents(Registry::get('config.dir.root') . $src);
            }
            $contents = str_replace('[files]', implode("\n", $scripts), Registry::get('config.js_css_cache_msg')) . $contents;
            $contents = Minifier::minify($contents, array('flaggedComments' => false));
            Storage::instance('statics')->put($filename, array('contents' => $contents, 'compress' => false, 'caching' => true));
        }
        $return = '<script type="text/javascript" src="' . Storage::instance('statics')->getUrl($filename) . '?ver=' . PRODUCT_VERSION . '"></script>' . "\n";
        if (!empty($external_scripts)) {
            foreach ($external_scripts as $sc) {
                $return .= '<script type="text/javascript" src="' . $sc . '"></script>' . "\n";
            }
        }
        foreach ($m[2] as $sc) {
            if (!empty($sc)) {
                $return .= '<script type="text/javascript">' . $sc . '</script>' . "\n";
            }
        }
        $return .= smarty_helper_inline_scripts($params, $content, $smarty, $repeat);
    }
    return $return;
}
Пример #3
0
 protected static function getLastSynchronizationTimes()
 {
     $result = fn_get_storage_data('ebay_shipping_synchronization_time');
     $result = json_decode($result, true);
     if (!is_array($result)) {
         $result = array();
     }
     return $result;
 }
Пример #4
0
 /**
  * Reads development mode settings
  */
 private static function read()
 {
     if (is_null(self::$modes)) {
         $modes = fn_get_storage_data('dev_mode');
         if (!empty($modes)) {
             $modes = unserialize($modes);
         } else {
             $modes = array();
         }
         self::$modes = $modes;
     }
 }
Пример #5
0
function fn_rus_payments_uninstall()
{
    $payments = fn_get_schema('rus_payments', 'processors');
    fn_rus_payments_disable_payments($payments, true);
    foreach ($payments as $payment) {
        db_query("DELETE FROM ?:payment_processors WHERE admin_template = ?s", $payment['admin_template']);
    }
    $statuses = fn_get_schema('rus_payments', 'statuses', 'php', true);
    if (!empty($statuses)) {
        foreach ($statuses as $status_name => $status_data) {
            fn_delete_status(fn_get_storage_data($status_name), 'O');
        }
    }
}
Пример #6
0
 /**
  * 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);
 }
Пример #7
0
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */
function smarty_block_scripts($params, $content, &$smarty, &$repeat)
{
    if ($repeat == true) {
        return;
    }
    if (Registry::get('config.tweaks.dev_js')) {
        return $content;
    }
    $scripts = array();
    $dir_root = Registry::get('config.dir.root');
    $return = '';
    if (preg_match_all('/\\<script(.*?)\\>(.*?)\\<\\/script\\>/s', $content, $m)) {
        $contents = '';
        foreach ($m[1] as $src) {
            if (!empty($src) && preg_match('/src ?= ?"([^"]+)"/', $src, $_m)) {
                $scripts[] = str_replace(Registry::get('config.current_location'), '', preg_replace('/\\?.*?$/', '', $_m[1]));
            }
        }
        // Check file changes in dev mode
        $names = $scripts;
        if (Development::isEnabled('compile_check')) {
            foreach ($names as $index => $name) {
                if (is_file($dir_root . '/' . $name)) {
                    $names[$index] .= filemtime($dir_root . '/' . $name);
                }
            }
        }
        $gz_suffix = Registry::get('config.tweaks.gzip_css_js') ? '.gz' : '';
        $filename = 'js/tygh/scripts-' . md5(implode(',', $names)) . fn_get_storage_data('cache_id') . '.js';
        if (!Storage::instance('statics')->isExist($filename . $gz_suffix)) {
            foreach ($scripts as $src) {
                $contents .= fn_get_contents(Registry::get('config.dir.root') . $src);
            }
            $contents = str_replace('[files]', implode("\n", $scripts), Registry::get('config.js_css_cache_msg')) . $contents;
            Storage::instance('statics')->put($filename . $gz_suffix, array('contents' => $contents, 'compress' => Registry::get('config.tweaks.gzip_css_js'), 'caching' => true));
        }
        $return = '<script type="text/javascript" src="' . Storage::instance('statics')->getUrl($filename) . '?ver=' . PRODUCT_VERSION . '"></script>';
        foreach ($m[2] as $sc) {
            if (!empty($sc)) {
                $return .= '<script type="text/javascript">' . $sc . '</script>' . "\n";
            }
        }
    }
    return $return;
}
Пример #8
0
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;
        }
    }
}
Пример #9
0
/**
 * Merges css and less files
 *
 * @param array $files Array with style files
 * @param string $styles Style code
 * @param string $prepend_prefix Prepend prefix
 * @param array $params additional params
 */
function fn_merge_styles($files, $styles = '', $prepend_prefix = '', $params = array(), $area = AREA)
{
    $prefix = !empty($prepend_prefix) ? 'embedded' : 'standalone';
    $make_rtl = false;
    if (fn_is_rtl_language()) {
        $prefix .= '-rtl';
        $make_rtl = true;
    }
    $output = '';
    $less_output = '';
    $less_reflection = array();
    $compiled_less = '';
    $compiled_css = '';
    $relative_path = fn_get_theme_path('[relative]/[theme]/css', $area);
    $hashes = array();
    $names = array_map(function ($v) {
        return !empty($v['relative']) ? $v['relative'] : false;
    }, $files);
    // Check file changes
    if (Development::isEnabled('compile_check') || Debugger::isActive()) {
        $dir_root = Registry::get('config.dir.root');
        foreach ($names as $index => $name) {
            if (file_exists($dir_root . '/' . $name)) {
                $hashes[] = $name . filemtime($dir_root . '/' . $name);
            }
        }
    }
    $hashes[] = md5(implode('|', $names));
    $hashes[] = md5($styles);
    if ($area == 'C') {
        $hashes[] = Registry::get('runtime.layout.layout_id');
        $hashes[] = Registry::get('runtime.layout.style_id');
    }
    arsort($hashes);
    $hash = md5(implode(',', $hashes) . PRODUCT_VERSION) . fn_get_storage_data('cache_id');
    $filename = $prefix . '.' . $hash . '.css';
    $theme_manifest = Themes::factory(fn_get_theme_path('[theme]', 'C'))->getManifest();
    if (!Storage::instance('assets')->isExist($relative_path . '/' . $filename)) {
        Debugger::checkpoint('Before styles compilation');
        foreach ($files as $src) {
            $m_prefix = '';
            $m_suffix = '';
            if (!empty($src['media'])) {
                $m_prefix = "\n@media " . $src['media'] . " {\n";
                $m_suffix = "\n}\n";
            }
            if (strpos($src['file'], '.css') !== false) {
                $output .= "\n" . $m_prefix . fn_get_contents($src['file']) . $m_suffix;
            } elseif ($area != 'C' || empty($theme_manifest['converted_to_css'])) {
                $less_output_chunk = '';
                if (file_exists($src['file'])) {
                    if ($area == 'C' && (empty($theme_manifest['parent_theme']) || $theme_manifest['parent_theme'] == 'basic')) {
                        $less_output_chunk = "\n" . $m_prefix . fn_get_contents($src['file']) . $m_suffix;
                    } else {
                        $less_output_chunk = "\n" . $m_prefix . '@import "' . str_replace($relative_path . '/', '', $src['relative']) . '";' . $m_suffix;
                    }
                }
                if (!empty($params['reflect_less'])) {
                    if (preg_match('{/addons/([^/]+)/}is', $src['relative'], $m)) {
                        $less_reflection['output']['addons'][$m[1]] .= $less_output_chunk;
                    } else {
                        $less_reflection['output']['main'] .= $less_output_chunk;
                    }
                }
                $less_output .= $less_output_chunk;
            }
        }
        $header = str_replace('[files]', implode("\n", $names), Registry::get('config.js_css_cache_msg'));
        if (!empty($styles)) {
            $less_output .= $styles;
        }
        // Prepend all styles with prefix
        if (!empty($prepend_prefix)) {
            $less_output = $output . "\n" . $less_output;
            $output = '';
        }
        if (!empty($output)) {
            $compiled_css = Less::parseUrls($output, Storage::instance('assets')->getAbsolutePath($relative_path), fn_get_theme_path('[themes]/[theme]/media', $area));
        }
        if (!empty($theme_manifest['converted_to_css']) && $area == 'C') {
            $theme_css_path = fn_get_theme_path('[themes]/[theme]', $area) . '/css';
            $pcl_filepath = $theme_css_path . '/' . Themes::$compiled_less_filename;
            if (file_exists($pcl_filepath)) {
                $compiled_css .= fn_get_contents($pcl_filepath);
            }
            list($installed_addons) = fn_get_addons(array('type' => 'active'));
            foreach ($installed_addons as $addon) {
                $addon_pcl_filpath = $theme_css_path . "/addons/{$addon['addon']}/" . Themes::$compiled_less_filename;
                if (file_exists($pcl_filepath)) {
                    $compiled_css .= fn_get_contents($addon_pcl_filpath);
                }
            }
        }
        if (!empty($less_output)) {
            $less = new Less();
            if (!empty($params['compressed'])) {
                $less->setFormatter('compressed');
            }
            $less->setImportDir($relative_path);
            try {
                $compiled_less = $less->customCompile($less_output, Storage::instance('assets')->getAbsolutePath($relative_path), array(), $prepend_prefix, $area);
            } catch (Exception $e) {
                $skip_save = true;
                $shift = 4;
                $message = '<div style="border: 2px solid red; padding: 5px;">LESS ' . $e->getMessage();
                if (preg_match("/line: (\\d+)/", $message, $m)) {
                    $lo = explode("\n", $less_output);
                    $message .= '<br /><br /><pre>' . implode("\n", array_splice($lo, intval($m[1]) - $shift, $shift * 2)) . '</pre>';
                }
                $message .= '</div>';
                fn_set_notification('E', __('error'), $message);
            }
        }
        if (empty($skip_save)) {
            $compiled_content = $compiled_css . "\n" . $compiled_less;
            // Move all @import links to the Top of the file.
            if (preg_match_all('/@import url.*?;/', $compiled_content, $imports)) {
                $compiled_content = preg_replace('/@import url.*?;/', '', $compiled_content);
                foreach ($imports[0] as $import_link) {
                    $compiled_content = $import_link . "\n" . $compiled_content;
                }
            }
            if ($make_rtl) {
                $compiled_content = \CSSJanus::transform($compiled_content);
                $compiled_content = "body {\ndirection: rtl;\n}\n" . $compiled_content;
            }
            Storage::instance('assets')->put($relative_path . '/' . $filename, array('contents' => $header . $compiled_content, 'compress' => false, 'caching' => true));
            if (!empty($params['use_scheme'])) {
                fn_put_contents(fn_get_cache_path(false) . 'theme_editor/' . $filename, $output . '#LESS#' . $less_output);
            }
            if (!empty($params['reflect_less'])) {
                $less_reflection['import_dirs'] = array($relative_path);
                fn_put_contents(fn_get_cache_path(false) . 'less_reflection.json', json_encode($less_reflection));
            }
        }
        Debugger::checkpoint('After styles compilation');
    }
    $url = Storage::instance('assets')->getUrl($relative_path . '/' . $filename);
    return $url;
}
Пример #10
0
            $_SESSION[$description] = LIC_STAT_TR;
            break;
        case fn_simple_decode_str('gsff'):
        case fn_simple_decode_str('gvmm'):
            $_SESSION[$prefix . '_' . $description] = fn_simple_decode_str('BDUJWF');
            if ($mode == fn_simple_decode_str('gvmm')) {
                fn_set_notification('I', __(fn_simple_decode_str('tupsf`npef`dibohfe')), __(fn_simple_decode_str('ufyu`tupsf`npef`dibohfe`up`gvmm')));
                fn_clean_up_addons();
                fn_clear_cache();
                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`gvmm')), 'data' => array(), 'company_id' => Registry::get('runtime.company_id')), 'A', CART_LANGUAGE);
                fn_redirect(Registry::get('config.current_url'));
            }
    }
    unset($_SESSION[$description]);
}
$mode = fn_get_storage_data(fn_simple_decode_str('tupsf`npef'));
if (!isset($_SESSION[$description])) {
    if ($mode == fn_simple_decode_str('gsff')) {
        $_SESSION[$description] = LIC_STAT_FR;
    } elseif ($mode == fn_simple_decode_str('usjbm')) {
        $_SESSION[$description] = LIC_STAT_TR;
    } elseif ($mode == fn_simple_decode_str('gvmm')) {
        $_SESSION[$description] = LIC_STAT_FL;
    }
}
if (isset($_SESSION[$prefix . '_' . $description])) {
    $data = $_SESSION[$prefix . '_' . $description];
} else {
    $data = '';
}
if ($data == fn_simple_decode_str('MJDFOTF`JT`JOWBMJE')) {
Пример #11
0
* and use this program.                                                    *
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
use Tygh\Registry;
use Tygh\Settings;
use Tygh\Helpdesk;
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if ($mode == 'validate_request' && !empty($_REQUEST['token'])) {
        $result = 'invalid';
        if (fn_get_storage_data('hd_request_code') == trim($_REQUEST['token'])) {
            $result = 'valid';
        }
        echo $result;
        exit(0);
    } elseif ($mode == 'messages') {
        if (!empty($_REQUEST['token'])) {
            $uc_settings = Settings::instance()->getValues('Upgrade_center');
            $is_valid = fn_get_contents(Registry::get('config.resources.updates_server') . '/index.php?dispatch=validators.validate_request&token=' . $_REQUEST['token'] . '&license_key=' . $uc_settings['license_number']);
            if ($is_valid == 'valid') {
                $data = simplexml_load_string(urldecode($_REQUEST['request']));
                Helpdesk::processMessages($data->Messages);
                echo 'OK';
                exit(0);
            } else {
                return array(CONTROLLER_STATUS_NO_PAGE);
Пример #12
0
 protected static function getCategoryVersions()
 {
     $result = fn_get_storage_data('ebay_category_version');
     $result = json_decode($result, true);
     if (!is_array($result)) {
         $result = array();
     }
     return $result;
 }
Пример #13
0
 /**
  * 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;
 }
Пример #14
0
/**
 * 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;
}
Пример #15
0
/**
 * 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;
}
Пример #16
0
        case 'synchronization':
            return \Ebay\Controller::actionSynchronizationObjects();
            break;
        case 'clean_product_logs':
            \Ebay\ProductLogger::clean();
            return array(CONTROLLER_STATUS_OK, 'ebay.product_logs');
            break;
    }
    return array(CONTROLLER_STATUS_OK, 'ebay.manage');
}
if ($mode == 'manage') {
    $params = $_REQUEST;
    list($templates, $search) = fn_get_ebay_templates($params, Registry::get('settings.Appearance.admin_items_per_page'), DESCR_SL);
    \Ebay\Template::loadProductCount($templates);
    if (fn_get_ebay_trail_license_key() === Registry::get(str_rot13('nqqbaf.ronl.ronl_yvprafr_ahzore'))) {
        $time = fn_get_storage_data('ebay_trial_expiry_time');
        $days = 0;
        if (!empty($time)) {
            $datetime = new DateTime('@' . $time);
            $current_datetime = new DateTime();
            if ($datetime->getTimestamp() > $current_datetime->getTimestamp()) {
                $interval = $datetime->diff($current_datetime);
                $days = $interval->days;
                if ($interval->h > 0) {
                    $days++;
                }
            }
        }
        fn_set_notification('W', __('notice'), __('ebay_addon_used_trial_license', array('[ebay_license_url]' => fn_ebay_get_license_url(), '[days]' => __('ebay_addon_plural_days', array($days)))));
    }
    Tygh::$app['view']->assign('templates', $templates);
Пример #17
0
    if ($mode == 'delete') {
        if (!empty($_REQUEST['newsletter_id'])) {
            fn_delete_newsletter($_REQUEST['newsletter_id']);
        }
        $suffix = '.manage';
    }
    if ($mode == 'delete_campaign') {
        if (!empty($_REQUEST['campaign_id'])) {
            fn_delete_campaigns((array) $_REQUEST['campaign_id']);
        }
        $suffix = '.campaigns';
    }
    return array(CONTROLLER_STATUS_OK, 'newsletters' . $suffix);
}
if ($mode == 'batch_send' && !empty($_REQUEST['key'])) {
    $data = fn_get_storage_data('newsletters_batch_' . $_REQUEST['key']);
    if (!empty($data)) {
        $data = @unserialize($data);
    }
    if (is_array($data)) {
        // Ger newsletter data
        $newsletter_data = array();
        foreach ($data['send_ids'] as $newsletter_id) {
            $n = array();
            foreach (fn_get_translation_languages() as $lang_code => $v) {
                $n[$lang_code] = fn_get_newsletter_data($newsletter_id, $lang_code);
                $n[$lang_code]['body_html'] = fn_rewrite_links($n[$lang_code]['body_html'], $newsletter_id, $n[$lang_code]['campaign_id']);
            }
            $newsletter_data[] = $n;
        }
        foreach (array_splice($data['recipients'], 0, Registry::get('addons.newsletters.newsletters_per_pass')) as $subscriber) {
Пример #18
0
function fn_get_feedback_data($mode)
{
    $company_orders = db_get_hash_single_array("SELECT company_id, COUNT(order_id) as orders_count FROM ?:orders GROUP BY company_id", array('company_id', 'orders_count'));
    arsort($company_orders);
    $main_company_id = key($company_orders);
    $company_condition = '';
    if (fn_allowed_for('ULTIMATE')) {
        $company_condition = db_quote(" AND company_id = ?i", $main_company_id);
    }
    $fdata = array();
    $fdata['tracks']['version'] = PRODUCT_VERSION;
    $fdata['tracks']['type'] = PRODUCT_EDITION;
    $fdata['tracks']['status'] = PRODUCT_STATUS;
    $fdata['tracks']['build'] = PRODUCT_BUILD;
    $fdata['tracks']['domain'] = Registry::get('config.http_host');
    $fdata['tracks']['url'] = 'http://' . Registry::get('config.http_host') . Registry::get('config.http_path');
    $fdata['tracks']['mode'] = fn_get_storage_data('store_mode');
    $fdata['tracks']['live'] = fn_is_store_live();
    // Sales reports usage
    $fdata['general']['sales_reports'] = db_get_field("SELECT COUNT(*) FROM ?:sales_reports");
    $fdata['general']['sales_tables'] = db_get_field("SELECT COUNT(*) FROM ?:sales_reports_tables");
    $fdata['general']['layouts'] = db_get_field("SELECT COUNT(*) FROM ?:bm_layouts WHERE 1 {$company_condition}");
    $fdata['general']['locations'] = db_get_field("SELECT COUNT(*) FROM ?:bm_locations WHERE layout_id IN (SELECT layout_id FROM ?:bm_layouts WHERE is_default = 1 {$company_condition})");
    $fdata['general']['current_theme'] = db_get_field("SELECT theme_name FROM ?:bm_layouts WHERE is_default = 1 {$company_condition}");
    $fdata['general']['current_style'] = db_get_field("SELECT style_id FROM ?:bm_layouts WHERE is_default = 1 {$company_condition}");
    $fdata['general']['pages'] = db_get_field("SELECT COUNT(*) FROM ?:pages");
    if (!fn_allowed_for('ULTIMATE:FREE')) {
        /**
         * Get feedback data
         *
         * @param array $fdata Feedback data
         */
        fn_set_hook('get_feedback_data', $fdata);
        // Localizations
        $fdata['general']['localizations'] = db_get_field("SELECT COUNT(*) FROM ?:localizations WHERE status='A'");
        $fdata['general']['companies'] = db_get_field("SELECT COUNT(*) FROM ?:companies");
    }
    // Languages usage
    $fdata['languages'] = db_get_array("SELECT lang_code, status FROM ?:languages");
    // Payments info. Here we get information about how many payments are used and whether surcharges were set.
    $fdata['payments'] = db_get_array("SELECT payment_id, a.processor_id, processor_script, status, " . "IF(a_surcharge<>0 OR p_surcharge<>0, 'Y', 'N') as surcharge_exists " . "FROM ?:payments AS a LEFT JOIN ?:payment_processors USING(processor_id)");
    // Currencies info.
    $fdata['currencies'] = db_get_array("SELECT currency_code, is_primary, decimals_separator, thousands_separator, status FROM ?:currencies");
    // Settings info
    if (fn_allowed_for('ULTIMATE')) {
        $first_company_id = db_get_field("SELECT MIN(company_id) FROM ?:companies");
        if (!empty($first_company_id)) {
            $fdata['settings'] = fn_get_settings_feedback($mode, $first_company_id);
        }
    } else {
        $fdata['settings'] = fn_get_settings_feedback($mode);
    }
    // Users quantity
    $fdata['users']['customers'] = db_get_field("SELECT COUNT(*) FROM ?:users WHERE user_type='C' AND status='A'");
    $fdata['users']['admins'] = db_get_field("SELECT COUNT(*) FROM ?:users WHERE user_type='A' AND status='A'");
    $fdata['users']['affiliates'] = db_get_field("SELECT COUNT(*) FROM ?:users WHERE user_type='P' AND status='A'");
    $fdata['users']['vendors'] = db_get_field("SELECT COUNT(*) FROM ?:users WHERE user_type='V' AND status='A'");
    if (!fn_allowed_for('ULTIMATE:FREE')) {
        $fdata['users']['admin_usergroups'] = db_get_field("SELECT COUNT(*) FROM ?:usergroups WHERE type='A' AND status='A'");
        $fdata['users']['customer_usergroups'] = db_get_field("SELECT COUNT(*) FROM ?:usergroups WHERE type='C' AND status='A'");
    }
    // Taxes info
    $fdata['taxes'] = db_get_array("SELECT address_type, price_includes_tax FROM ?:taxes WHERE status='A'");
    // Shippings
    $fdata['shippings'] = db_get_array("SELECT rate_calculation, localization, a.service_id, module as carrier FROM " . "?:shippings AS a LEFT JOIN ?:shipping_services USING(service_id) WHERE a.status='A'");
    // Destinations
    $fdata['general']['destinations'] = db_get_field("SELECT COUNT(*) FROM ?:destinations WHERE status='A'");
    // Blocks
    $fdata['general']['blocks'] = db_get_field("SELECT COUNT(*) FROM ?:bm_blocks");
    $fdata['general']['block_links'] = db_get_field("SELECT COUNT(*) FROM ?:bm_snapping");
    // Images
    $fdata['general']['images'] = db_get_field("SELECT COUNT(*) FROM ?:images");
    // Product items
    $fdata['products_stat']['total'] = db_get_field("SELECT COUNT(*) as amount FROM ?:products");
    $fdata['products_stat']['prices'] = db_get_field("SELECT COUNT(*) FROM ?:product_prices");
    $fdata['products_stat']['features'] = db_get_field("SELECT COUNT(*) FROM ?:product_features WHERE status='A'");
    $fdata['products_stat']['features_values'] = db_get_field("SELECT COUNT(*) FROM ?:product_features_values");
    $fdata['products_stat']['files'] = db_get_field("SELECT COUNT(*) FROM ?:product_files");
    $fdata['products_stat']['options'] = db_get_field("SELECT COUNT(*) FROM ?:product_options");
    $fdata['products_stat']['global_options'] = db_get_field("SELECT COUNT(*) FROM ?:product_options WHERE product_id='0'");
    $fdata['products_stat']['option_variants'] = db_get_field("SELECT COUNT(*) FROM ?:product_option_variants");
    $fdata['products_stat']['options_inventory'] = db_get_field("SELECT COUNT(*) FROM ?:product_options_inventory");
    $fdata['products_stat']['configurable'] = db_get_field("SELECT COUNT(*) FROM ?:products WHERE product_type = 'C'");
    $fdata['products_stat']['edp'] = db_get_field("SELECT COUNT(*) FROM ?:products WHERE is_edp = 'Y'");
    $fdata['products_stat']['free_shipping'] = db_get_field("SELECT COUNT(*) FROM ?:products WHERE free_shipping = 'Y'");
    if (!fn_allowed_for('ULTIMATE:FREE')) {
        $fdata['products_stat']['options_exceptions'] = db_get_field("SELECT COUNT(*) FROM ?:product_options_exceptions");
        $fdata['products_stat']['filters'] = db_get_field("SELECT COUNT(*) FROM ?:product_filters WHERE status='A'");
    }
    // Promotions
    $fdata['promotions'] = db_get_array("SELECT stop, zone, status FROM ?:promotions");
    // Addons
    $fdata['addons'] = db_get_array("SELECT addon, status, priority FROM ?:addons ORDER BY addon");
    // Addon options
    $allowed_addons = array('access_restrictions', 'affiliate', 'discussion', 'gift_certificates', 'gift_registry', 'google_sitemap', 'barcode', 'polls', 'quickbooks', 'reward_points', 'rma', 'seo', 'tags');
    if (is_array($fdata['addons'])) {
        foreach ($fdata['addons'] as $k => $data) {
            if ($data['addon'] == 'suppliers') {
                $fdata['general']['suppliers'] = db_get_field("SELECT COUNT(*) FROM ?:suppliers");
            }
            if ($data['addon'] == 'news_and_emails') {
                $fdata['general']['subscribers'] = db_get_field("SELECT COUNT(*) FROM ?:subscribers");
            }
            if (!in_array($data['addon'], $allowed_addons)) {
                continue;
            }
            $section_info = Settings::instance()->getSectionByName($data['addon'], Settings::ADDON_SECTION);
            if (empty($section_info)) {
                continue;
            }
            $settings = array();
            if (fn_allowed_for('ULTIMATE')) {
                if (!empty($first_company_id)) {
                    $settings = Settings::instance()->getList($section_info['section_id'], 0, false, $first_company_id);
                }
            } else {
                $settings = Settings::instance()->getList($section_info['section_id']);
            }
            $settings = fn_check_feedback_value($settings);
            if ($mode == 'prepare') {
                // This line is to display addon options
                if (!empty($settings)) {
                    $addons_settings = array();
                    foreach ($settings as $subsection_id => $subsettings) {
                        foreach ($subsettings as $v) {
                            if (is_array($v['value'])) {
                                $v['value'] = json_encode($v['value']);
                            }
                            $addons_settings[$subsection_id . '.' . $v['name']] = $v['value'];
                        }
                    }
                    $fdata[__('options_for') . ' ' . $data['addon']] = $addons_settings;
                }
            } else {
                // This line is to send addon options
                $fdata['addons'][$k]['options'] = !empty($settings) ? serialize($settings) : array();
            }
        }
    }
    return $fdata;
}
Пример #19
0
 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);
 }
Пример #20
0
 public function generate($filepath = '')
 {
     @ignore_user_abort(1);
     @set_time_limit(0);
     register_shutdown_function(array($this, 'shutdownHandler'));
     if (!empty($filepath)) {
         $this->filepath_temp = $filepath;
     }
     fn_mkdir(dirname($this->filepath_temp));
     $continue = false;
     if (file_exists($this->filepath_temp) && $this->offset > 0) {
         $continue = true;
     }
     if ($continue) {
         $this->log->write(Logs::INFO, '', 'Continue ' . date('d.m.Y H:i:s', time()) . '. Offset ' . $this->offset);
     } else {
         $status_generate = fn_get_storage_data('yml2_status_generate_' . $this->price_id);
         if ($status_generate == 'active' && file_exists($this->filepath_temp)) {
             fn_echo(__("yml_export.generation_was_started"));
             exit;
         }
         fn_rm($this->filepath_temp);
         $this->offset = 0;
         $this->log->write(Logs::INFO, '', 'Start ' . date('d.m.Y H:i:s', time()));
         fn_set_storage_data('yml2_export_start_time_' . $this->price_id, time());
     }
     fn_set_storage_data('yml2_status_generate_' . $this->price_id, 'active');
     $file = fopen($this->filepath_temp, 'ab');
     if (!$continue) {
         $this->head($file);
     }
     $this->body($file);
     $this->bottom($file);
     fclose($file);
     $this->log->write(Logs::INFO, '', 'Finish ' . date('d.m.Y H:i:s', time()));
     $this->log->write(Logs::INFO, '', 'Product export ' . $this->yml2_product_export . '. Product skip ' . $this->yml2_product_skip);
     $data = array('[export]' => $this->yml2_product_export, '[skip]' => $this->yml2_product_skip, '[cron]' => defined('CONSOLE') ? 'Cron. ' : '');
     fn_log_event('yml_export', 'export', array('message' => __('text_log_action_export', $data)));
     if ($this->options['detailed_generation'] == 'Y') {
         $path = $this->log->getTempLogFile();
         if ($path) {
             $log = fopen($path, 'r');
             $line = fgets($log);
             $info_line = true;
             while (!feof($log)) {
                 $line = fgets($log);
                 if (empty($line)) {
                     continue;
                 }
                 $data = explode(';', $line);
                 if ($data[0] == '[INFO]' && !$info_line) {
                     fn_echo(NEW_LINE);
                 } elseif ($data[0] != '[INFO]' && $info_line) {
                     fn_echo(NEW_LINE);
                 }
                 $data[1] = isset($data[1]) ? $data[1] : '';
                 $data[2] = isset($data[2]) ? $data[2] : '';
                 fn_echo($data[0] . $data[1] . $data[2] . NEW_LINE);
                 $info_line = $data[0] == '[INFO]';
             }
             fclose($log);
         }
     }
     $this->log->rotate();
     if (empty($filepath)) {
         $this->backupYml();
         if (file_exists($this->filepath_temp)) {
             fn_rm($this->filepath);
             fn_rename($this->filepath_temp, $this->filepath);
         }
     }
     fn_set_storage_data('yml2_product_export_' . $this->price_id);
     fn_set_storage_data('yml2_product_skip_' . $this->price_id);
     fn_set_storage_data('yml2_export_start_time_' . $this->price_id);
     fn_set_storage_data('yml2_export_count_' . $this->price_id);
     fn_set_storage_data('yml2_export_offset_' . $this->price_id);
     fn_set_storage_data('yml2_export_time_' . $this->price_id, time());
     fn_set_storage_data('yml2_status_generate_' . $this->price_id, 'finish');
 }
Пример #21
0
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "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') {
Пример #22
0
function fn_twg_get_api_product_options_exceptions($product_id)
{
    $mode = fn_get_storage_data('store_mode');
    if ($mode == 'free') {
        return array();
    }
    $exceptions = db_get_array("SELECT *\n         FROM ?:product_options_exceptions\n         WHERE product_id = ?i\n         ORDER BY exception_id", $product_id);
    if (empty($exceptions)) {
        return array();
    }
    foreach ($exceptions as $k => $v) {
        $_comb = unserialize($v['combination']);
        $exceptions[$k]['combination'] = array();
        foreach ($_comb as $option_id => $variant_id) {
            $exceptions[$k]['combination'][] = array('option_id' => $option_id, 'variant_id' => $variant_id);
        }
    }
    return $exceptions;
}
Пример #23
0
/**
 * 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'));
        }
    }
}
Пример #24
0
 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;
 }
Пример #25
0
        if (!empty($time)) {
            $price_lists[$price_id]['time'] = fn_date_format($time, Registry::get('settings.Appearance.date_format') . " " . Registry::get('settings.Appearance.time_format'));
        }
        $runtime = fn_get_storage_data('yml2_export_start_time_' . $price_id);
        $price_lists[$price_id]['runtime'] = 0;
        if (!empty($runtime)) {
            $time = mktime(null, null, time() - $runtime);
            //$mktime = mktime(null, null, time() - $runtime);
            $price_lists[$price_id]['runtime'] = date("H:i:s", $time);
        }
        if ($price_lists[$price_id]['offset'] > $price_lists[$price_id]['count']) {
            $price_lists[$price_id]['offset'] = $price_lists[$price_id]['count'];
        }
        $price_lists[$price_id]['generate_link'] = fn_yml_get_generate_link($price);
        $price_lists[$price_id]['get_link'] = fn_yml_get_link($price);
        $generation_statuses[$price_id] = fn_get_storage_data('yml2_status_generate_' . $price_id);
        if ($generation_statuses[$price_id] == 'redirect') {
            $price_lists[$price_id]['count'] = 0;
            $generation_statuses[$price_id] = 'abort';
        }
    }
    Tygh::$app['view']->assign('price_lists', $price_lists);
    Tygh::$app['view']->assign('generation_statuses', $generation_statuses);
    if (defined('AJAX_REQUEST')) {
        Tygh::$app['view']->display('addons/yml_export/views/yml/manage.tpl');
        exit;
    }
} elseif ($mode == "update") {
    $price_list = array();
    $schema_price_list = fn_get_schema('yml', 'price_list');
    $schema_price_list = $schema_price_list['default'];
Пример #26
0
    $app->clearDownloadedPackages();
    $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])) {
Пример #27
0
 /**
  * Check needle synchronization sites from ebay
  * @return bool
  */
 public static function isNeedSynchronization()
 {
     $time = fn_get_storage_data('ebay_site_synchronization_time');
     return empty($time) || $time + self::SYNCHRONIZATION_PERIOD < time();
 }
Пример #28
0
                }
                $_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();
        return array(CONTROLLER_STATUS_REDIRECT, $redirect_url);
    }
    return array(CONTROLLER_STATUS_OK, 'settings' . $_suffix . '?section_id=' . Settings::instance()->getSectionTextId($section_id));
}
//
// OUPUT routines
//
if ($mode == 'manage') {
    $subsections = Settings::instance()->getSectionTabs($section_id, CART_LANGUAGE);
Пример #29
0
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! */