예제 #1
0
파일: func.php 프로젝트: arpad9/bygmarket
/**
 * Prepare first part of settings which is used to render page
 */
function fn_twg_get_boot_settings()
{
    $settings = array();
    $addon_settings = TwigmoSettings::get();
    if (defined('HTTPS')) {
        $request_url = 'https://' . Registry::get('config.https_host') . Registry::get('config.https_path');
    } else {
        $request_url = 'http://' . Registry::get('config.http_host') . Registry::get('config.http_path');
    }
    $settings['url'] = array('base' => defined('HTTPS') ? Registry::get('config.https_path') : Registry::get('config.http_path'), 'host' => $request_url . '/', 'index' => Registry::get('config.customer_index'), 'dispatch' => '?dispatch=twigmo.post');
    $settings['logoURL'] = empty($addon_settings['logo_url']) ? TwigmoImage::getDefaultLogoUrl() : $addon_settings['logo_url'];
    $settings['logoURL'] = str_replace(array('http://', 'https://'), '//', $settings['logoURL']);
    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'get_settings.js' && isset($_SESSION['twg_state']['boot_request'])) {
        $settings['request'] = $_SESSION['twg_state']['boot_request'];
    } else {
        $settings['request'] = $_SESSION['twg_state']['boot_request'] = $_REQUEST;
    }
    $settings['cacheRequest'] = fn_twg_get_cache_request($settings['request']);
    $controller = $addon_settings['home_page_content'] == 'home_page_blocks' ? 'index.index' : 'twigmo.post';
    $settings['home_page_title'] = fn_twg_get_location_page_title($controller);
    $settings['companyName'] = Registry::get('settings.Company.company_name');
    $settings['geolocation'] = isset($addon_settings['geolocation']) ? $addon_settings['geolocation'] : 'Y';
    fn_set_hook('twg_get_boot_settings', $settings);
    return $settings;
}
예제 #2
0
            $company_id = fn_twg_get_current_company_id();
            TwigmoSettings::set(array('customer_connections' => array($company_id => $_REQUEST['tw_settings'])));
        }
        return array(CONTROLLER_STATUS_REDIRECT, 'addons.update?addon=twigmo');
    }
} elseif ($mode == 'update') {
    if ($_REQUEST['addon'] == 'twigmo') {
        if (!empty($_REQUEST['selected_section']) and $_REQUEST['selected_section'] == 'twigmo_addon') {
            fn_delete_notification('twigmo_upgrade');
        }
        if (!fn_twg_is_updated()) {
            fn_set_notification('W', __('notice'), __('twgadmin_reinstall'));
        }
        $company_id = fn_twg_get_current_company_id();
        $view = Registry::get('view');
        $view->assign('default_logo', TwigmoImage::getDefaultLogoUrl($company_id));
        $urls = TwigmoConnector::getMobileScriptsUrls();
        $view->assign('favicon', $urls['favicon']);
        $view->assign('logo_object_id', $company_id * 10 + 1);
        $view->assign('favicon_object_id', $company_id * 10 + 2);
        $tw_register['version'] = TWIGMO_VERSION;
        $view->assign('tw_register', $tw_register);
        $view->assign('next_version_info', TwigmoUpgrade::getNextVersionInfo());
        $view->assign('twg_is_connected', TwigmoConnector::anyFrontendIsConnected());
        $stores = fn_twg_get_stores();
        $platinum_stores = fn_twg_init_push_comment(fn_twg_filter_connected_platinum_stores($stores));
        $view->assign('stores', $stores);
        $view->assign('platinum_stores', $platinum_stores);
        $view->assign('max_push_length', TwigmoConnector::MAX_PUSH_LENGTH);
        $view->assign('twg_all_stores_connected', TwigmoConnector::allStoresAreConnected($stores));
        $view->assign('reset_pass_link', TwigmoConnector::getResetPassLink());