示例#1
0
/**
 * Get list of objects, available for revisioning
 */
function fn_settings_variants_general_active_revisions_objects()
{
    include_once DIR_CORE . 'fn.revisions.php';
    fn_init_revisions();
    $revisions = Registry::get('revisions');
    if (empty($revisions['objects'])) {
        return array();
    }
    $data = array();
    foreach ($revisions['objects'] as $object => $entry) {
        $data[$object] = fn_get_lang_var($entry['title']);
    }
    return $data;
}
示例#2
0
    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();
// Second-level (b) cache: different for dispatch-language-currency
define('CACHE_LEVEL_DISPATCH', AREA . '_' . $_SERVER['REQUEST_METHOD'] . '_' . str_replace('.', '_', $_REQUEST['dispatch']) . '_' . (defined('CART_LOCALIZATION') ? CART_LOCALIZATION . '_' : '') . CART_LANGUAGE . '_' . CART_SECONDARY_CURRENCY);
Registry::register_cache('lang_cache', array('language_values'), CACHE_LEVEL_DISPATCH, true);
if (!defined('NO_SESSION')) {
    // Get descriptions for company country and state
    if (Registry::get('settings.Company.company_country')) {
        Registry::set('settings.Company.company_country_descr', fn_get_country_name(Registry::get('settings.Company.company_country')));
    }
    if (Registry::get('settings.Company.company_state')) {
        Registry::set('settings.Company.company_state_descr', fn_get_state_name(Registry::get('settings.Company.company_state'), Registry::get('settings.Company.company_country')));
示例#3
0
/**
 * Enable/disable revisions objects
 */
function fn_settings_actions_general_active_revisions_objects(&$new_value, $old_value)
{
    $old = Registry::get('settings.General.active_revisions_objects');
    include_once DIR_CORE . 'fn.revisions.php';
    fn_init_revisions();
    parse_str($new_value, $new);
    $revisions = Registry::get('revisions');
    $skip = array();
    $show_notification = false;
    if ($revisions) {
        foreach ($old as $key => $rec) {
            if ($rec == 'N' && isset($new[$key])) {
                fn_create_revision_tables();
                fn_revisions_set_object_active($key);
                fn_echo(fn_get_lang_var('creating_revisions') . ' ' . fn_get_lang_var($revisions['objects'][$key]['title']));
                fn_revisions_delete_objects($key);
                fn_revisions_create_objects($key, true);
                fn_echo(' ' . fn_get_lang_var('done') . '<br>');
                $show_notification = true;
            } elseif ($rec == 'Y' && !isset($new[$key])) {
                fn_echo(fn_get_lang_var('deleting_revisions') . ' ' . fn_get_lang_var($revisions['objects'][$key]['title']));
                fn_revisions_delete_objects($key);
                fn_echo(' ' . fn_get_lang_var('done') . '<br>');
            }
            $skip[] = $key;
        }
        if (!empty($new)) {
            foreach ($new as $object => $_v) {
                if (!in_array($object, $skip)) {
                    fn_create_revision_tables();
                    fn_revisions_set_object_active($object);
                    fn_echo(fn_get_lang_var('creating_revisions') . ' ' . fn_get_lang_var($revisions['objects'][$object]['title']));
                    fn_revisions_delete_objects($object);
                    fn_revisions_create_objects($object, true);
                    fn_echo(' ' . fn_get_lang_var('done') . '<br>');
                    $show_notification = true;
                }
            }
        }
        if ($show_notification) {
            $msg = fn_get_lang_var('warning_create_workflow');
            $msg = str_replace('[link]', fn_url("revisions_workflow.manage", 'A'), $msg);
            fn_set_notification('E', fn_get_lang_var('warning'), $msg, true);
        }
    }
}