Exemple #1
0
/**
 * Form error notice and make redirect. Used in fn_init_company_id
 *
 * @param array $params request parameters
 * @param string $message language variable name for message
 * @param int $redirect_company_id New company id for redirecting, if null, company id saved in session will be used
 * @return array with init data (init status, redirect url in case of redirect)
 */
function fn_init_company_id_redirect(&$params, $message, $redirect_company_id = null)
{
    if ('access_denied' == $message) {
        Tygh::$app['session']['auth'] = array();
        $redirect_url = 'auth.login_form' . (!empty($params['return_url']) ? '?return_url=' . urldecode($params['return_url']) : '');
    } elseif ('company_not_found' == $message) {
        $dispatch = !empty($params['dispatch']) ? $params['dispatch'] : 'auth.login_form';
        unset($params['dispatch']);
        $params['switch_company_id'] = null === $redirect_company_id ? fn_init_company_id_find_in_session() : $redirect_company_id;
        $redirect_url = $dispatch . '?' . http_build_query($params);
    }
    if (!defined('CART_LANGUAGE')) {
        fn_init_language($params);
        // we need CART_LANGUAGE in Tygh\Languages\Values::getLangVar()
        fn_init_currency($params);
        // we need CART_SECONDARY_CURRENCY in Tygh\Languages\Values::getLangVar()
        $params['dispatch'] = 'index.index';
        // we need dispatch in Tygh\Languages\Values::getLangVar()
    }
    fn_set_notification('E', __('error'), __($message));
    return array(INIT_STATUS_REDIRECT, $redirect_url);
}
Exemple #2
0
    if (AREA == 'A' && !empty($_SESSION['auth']['company_id'])) {
        fn_define('COMPANY_ID', $_SESSION['auth']['company_id']);
    }
}
// Init addons
fn_init_addons();
// get route to controller
fn_get_route();
// initialize store localization
if (AREA == 'C') {
    fn_init_localization($_REQUEST);
}
// initialize store language
fn_init_language($_REQUEST);
// initialize store currency
fn_init_currency($_REQUEST);
// initialize selected company
fn_init_company($_REQUEST);
// Second-level (a) cache: different for dispatch-language-currency
define('CACHE_LEVEL_LOCALE', (defined('CART_LOCALIZATION') ? CART_LOCALIZATION . '_' : '') . CART_LANGUAGE . '_' . CART_SECONDARY_CURRENCY);
// Init addon multilingual options
fn_init_addon_options();
// init revisions
if (AREA == 'A' && Registry::get('settings.General.active_revisions_objects')) {
    require DIR_CORE . 'fn.revisions.php';
    fn_init_revisions();
}
// select the skin to display
fn_init_skin($_REQUEST);
// initialize templater
fn_init_templater();