Example #1
0
 /**
  * Returns current license status
  * @param  string $license_key
  * @param  string $host_name   If host_name was specified, license will be checked
  * @return bool
  */
 public static function getLicenseInformation($license_number = '', $extra_fields = array())
 {
     if (empty($license_number)) {
         $uc_settings = Settings::instance()->getValues('Upgrade_center');
         $license_number = $uc_settings['license_number'];
     }
     if (empty($license_number)) {
         return 'LICENSE_IS_INVALID';
     }
     $store_ip = fn_get_ip();
     $store_ip = $store_ip['host'];
     $request = array('license_number' => $license_number, 'ver' => PRODUCT_VERSION, 'product_status' => PRODUCT_STATUS, 'product_build' => strtoupper(PRODUCT_BUILD), 'edition' => isset($extra_fields['edition']) ? $extra_fields['edition'] : PRODUCT_EDITION, 'lang' => strtoupper(CART_LANGUAGE), 'store_uri' => fn_url('', 'C', 'http'), 'secure_store_uri' => fn_url('', 'C', 'https'), 'https_enabled' => Registry::get('settings.Security.secure_storefront') != 'none' || Registry::get('settings.Security.secure_admin') == 'Y' ? 'Y' : 'N', 'admin_uri' => str_replace(fn_get_index_script('A'), '', fn_url('', 'A', 'http')), 'store_ip' => $store_ip);
     $request = array('Request@action=check_license@api=3' => array_merge($extra_fields, $request));
     $request = '<?xml version="1.0" encoding="UTF-8"?>' . fn_array_to_xml($request);
     $data = Http::get(Registry::get('config.resources.updates_server') . '/index.php?dispatch=product_updates.check_available', array('request' => $request), array('timeout' => 10));
     if (empty($data)) {
         $data = fn_get_contents(Registry::get('config.resources.updates_server') . '/index.php?dispatch=product_updates.check_available&request=' . urlencode($request));
     }
     return $data;
 }
Example #2
0
/**
 * Converts URN to URI
 *
 * @param string $url URN (Uniform Resource Name or Query String)
 * @param string $area Area
 * @param string $protocol Output URL protocol (protocol://). If equals 'rel', no protocol will be included
 * @param string $lang_code 2 letters language code
 * @param bool $override_area
 * @return string URI
 */
function fn_url($url = '', $area = AREA, $protocol = 'current', $lang_code = CART_LANGUAGE, $override_area = false)
{
    static $init_vars = false;
    static $indexes, $_admin_index, $vendor_index, $customer_index, $http_location, $https_location, $current_location;
    /**
     * Prepares parameters before building URL
     *
     * @param  string $url           URN (Uniform Resource Name or Query String)
     * @param  string $area          Area
     * @param  string $protocol      Output URL protocol (protocol://). If equals 'rel', no protocol will be included
     * @param  string $lang_code     2 letters language code
     * @param  bool   $override_area
     * @return bool   Always true
     */
    fn_set_hook('url_pre', $url, $area, $protocol, $lang_code, $override_area);
    if (!$init_vars) {
        $vendor_index = Registry::get('config.vendor_index');
        $_admin_index = Registry::get('config.admin_index');
        $customer_index = Registry::get('config.customer_index');
        $http_location = Registry::get('config.http_location');
        $https_location = Registry::get('config.https_location');
        $current_location = Registry::get('config.current_location');
        $init_vars = true;
    }
    $admin_index_area = $override_area ? 'A' : ACCOUNT_TYPE;
    if (isset($indexes[$admin_index_area])) {
        $admin_index = $indexes[$admin_index_area];
    } else {
        $admin_index = $indexes[$admin_index_area] = fn_get_index_script($admin_index_area);
    }
    if ($area != 'A' && $area != 'C') {
        $prev_admin_index = $admin_index;
        if (isset($indexes[$area])) {
            $admin_index = $indexes[$area];
        } else {
            $admin_index = $indexes[$area] = fn_get_index_script($area);
        }
        $area = 'A';
    }
    $url = str_replace('&amp;', '&', $url);
    $parsed_url = parse_url($url);
    $no_shorted = false;
    $full_query = false;
    if (!empty($parsed_url['scheme']) || !empty($parsed_url['host'])) {
        if (!empty($parsed_url['scheme'])) {
            // do not prefix URL is its absolute already
            $protocol = 'no_prefix';
        }
        $no_shorted = true;
    } else {
        if (!empty($parsed_url['path'])) {
            if (stripos($parsed_url['path'], $_admin_index) !== false) {
                $area = 'A';
                $no_shorted = true;
            } elseif (stripos($parsed_url['path'], $customer_index) !== false) {
                $area = 'C';
                $no_shorted = true;
            } elseif (!empty($vendor_index) && stripos($parsed_url['path'], $vendor_index) !== false) {
                $area = 'A';
                $no_shorted = true;
            }
        } else {
            if (strpos($url, '?') === 0) {
                $full_query = true;
            } else {
                $no_shorted = true;
                $url = $_url = $area == 'C' ? $customer_index : $admin_index;
            }
        }
    }
    $index_script = $area == 'C' ? $customer_index : $admin_index;
    $_url = '';
    if ($no_shorted) {
        // full url passed
        $_url = $url;
    } elseif ($full_query) {
        // full query passed
        $_url = $index_script . $url;
    } else {
        $_url = $index_script . '?dispatch=' . str_replace('?', '&', $url);
    }
    if ($protocol != 'rel' || defined('DISPLAY_FULL_PATHS')) {
        if ($protocol == 'http') {
            $_url = $http_location . '/' . $_url;
        } elseif ($protocol == 'https') {
            $_url = $https_location . '/' . $_url;
        } elseif ($protocol == 'current' || defined('DISPLAY_FULL_PATHS')) {
            $_url = $current_location . '/' . $_url;
        }
    }
    $company_id_in_url = fn_get_company_id_from_uri($url);
    /**
     * Prepares parameters before building URL
     *
     * @param string $_url              Output URL
     * @param string $area              Area
     * @param string $url               Input URL
     * @param string $lang_code         2 letters language code
     * @param string $protocol          Output URL protocol (protocol://). If equals 'rel', no protocol will be included
     * @param int    $company_id_in_url Equals company_id if it is present in $url, otherwise false
     */
    fn_set_hook('url_post', $_url, $area, $url, $protocol, $company_id_in_url, $lang_code);
    if (!empty($prev_admin_index)) {
        $admin_index = $prev_admin_index;
    }
    return $_url;
}
    function content_55dc792dd01bf9_65081325($_smarty_tpl)
    {
        if (!is_callable('smarty_block_inline_script')) {
            include '/var/www/html/market/app/functions/smarty_plugins/block.inline_script.php';
        }
        fn_preload_lang_vars(array('administration_panel', 'access_denied', 'page_not_found', 'access_denied_text', 'page_not_found_text', 'go_back', 'go_to_the_admin_homepage'));
        $_smarty_tpl->_capture_stack[0][] = array("mainbox", null, null);
        ob_start();
        if (!$_smarty_tpl->tpl_vars['auth']->value['user_id']) {
            ?>
    <span class="right"><span>&nbsp;</span></span>

    <h1 class="clear exception-header">
        <span><?php 
            echo $_smarty_tpl->__("administration_panel");
            ?>
</span>
    </h1>
<?php 
        }
        ?>

<div class="exception-body login-content">

<h2><?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['exception_status']->value, ENT_QUOTES, 'UTF-8');
        ?>
</h2>

<h3>
    <?php 
        if ($_smarty_tpl->tpl_vars['exception_status']->value == "403") {
            ?>
        <?php 
            echo $_smarty_tpl->__("access_denied");
            ?>

    <?php 
        } elseif ($_smarty_tpl->tpl_vars['exception_status']->value == "404") {
            ?>
        <?php 
            echo $_smarty_tpl->__("page_not_found");
            ?>

    <?php 
        }
        ?>
</h3>

<div class="exception-content">
    <?php 
        if ($_smarty_tpl->tpl_vars['exception_status']->value == "403") {
            ?>
        <h4><?php 
            echo $_smarty_tpl->__("access_denied_text");
            ?>
</h4>
    <?php 
        } elseif ($_smarty_tpl->tpl_vars['exception_status']->value == "404") {
            ?>
        <h4><?php 
            echo $_smarty_tpl->__("page_not_found_text");
            ?>
</h4>
    <?php 
        }
        ?>
    
    <ul class="exception-menu">
        <li id="go_back"><a class="cm-back-link"><?php 
        echo $_smarty_tpl->__("go_back");
        ?>
</a></li>
        <li><a href="<?php 
        echo htmlspecialchars(fn_url(fn_get_index_script($_smarty_tpl->tpl_vars['auth']->value)), ENT_QUOTES, 'UTF-8');
        ?>
"><?php 
        echo $_smarty_tpl->__("go_to_the_admin_homepage");
        ?>
</a></li>
    </ul>

    <?php 
        $_smarty_tpl->smarty->_tag_stack[] = array('inline_script', array());
        $_block_repeat = true;
        echo smarty_block_inline_script(array(), null, $_smarty_tpl, $_block_repeat);
        while ($_block_repeat) {
            ob_start();
            echo '<script';
            ?>
 type="text/javascript">
    
    Tygh.$(document).ready(function() {
        var $ = Tygh.$;
        $.each($.browser, function(i, val) {
            if ((i == 'opera') && (val == true)) {
                if (history.length == 0) {
                    $('#go_back').hide();
                }
            } else {
                if (history.length == 1) {
                    $('#go_back').hide();
                }
            }
        });
    });
    
    <?php 
            echo '</script';
            ?>
><?php 
            $_block_content = ob_get_clean();
            $_block_repeat = false;
            echo smarty_block_inline_script(array(), $_block_content, $_smarty_tpl, $_block_repeat);
        }
        array_pop($_smarty_tpl->smarty->_tag_stack);
        ?>

</div>

</div>
<?php 
        list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
        if (!empty($_capture_buffer)) {
            if (isset($_capture_assign)) {
                $_smarty_tpl->assign($_capture_assign, ob_get_contents());
            }
            if (isset($_capture_append)) {
                $_smarty_tpl->append($_capture_append, ob_get_contents());
            }
            Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
        } else {
            $_smarty_tpl->capture_error();
        }
        echo $_smarty_tpl->getSubTemplate("common/mainbox.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('content' => Smarty::$_smarty_vars['capture']['mainbox']), 0);
        ?>

<?php 
    }
Example #4
0
/**
 * Return trail license key for installation
 * @return string
 */
function fn_get_ebay_trail_license_key()
{
    return 'EBAY_TRIAL_' . md5(str_replace(fn_get_index_script('A'), '', fn_url('', 'A', 'http')));
}