Beispiel #1
0
// Load all available locale defintions:
locales_load_available_defs();
switch ($action) {
    case 'abort_update':
        // Update was aborted
        break;
    case 'update':
    case 'confirm_update':
        // UPDATE regional settings
        // Check that this action request is not a CSRF hacked request:
        $Session->assert_received_crumb('locales');
        // Check permission:
        $current_User->check_perm('options', 'edit', true);
        param('newdefault_locale', 'string', true);
        $Settings->set('default_locale', $newdefault_locale);
        if (!$Messages->has_errors() && locale_updateDB()) {
            $Settings->dbupdate();
            $Messages->add(T_('Regional settings updated.'), 'success');
            // Redirect so that a reload doesn't write to the DB twice:
            header_redirect('?ctrl=locales' . ($loc_transinfo ? '&loc_transinfo=1' : ''), 303);
            // Will EXIT
            // We have EXITed already at this point!!
        }
        break;
    case 'updatelocale':
    case 'createlocale':
        // CREATE/EDIT locale
        // Check that this action request is not a CSRF hacked request:
        $Session->assert_received_crumb('locales');
        // Check permission:
        $current_User->check_perm('options', 'edit', true);
Beispiel #2
0
param('action', 'string');
param('edit_locale', 'string');
param('loc_transinfo', 'integer', 0);
// Load all available locale defintions:
locales_load_available_defs();
switch ($action) {
    case 'update':
        // UPDATE regional settings
        // Check that this action request is not a CSRF hacked request:
        $Session->assert_received_crumb('locales');
        // Check permission:
        $current_User->check_perm('options', 'edit', true);
        param('newdefault_locale', 'string', true);
        $Settings->set('default_locale', $newdefault_locale);
        if (!$Messages->has_errors()) {
            locale_updateDB();
            $Settings->dbupdate();
            $Messages->add(T_('Regional settings updated.'), 'success');
            // Redirect so that a reload doesn't write to the DB twice:
            header_redirect('?ctrl=locales' . ($loc_transinfo ? '&loc_transinfo=1' : ''), 303);
            // Will EXIT
            // We have EXITed already at this point!!
        }
        // load locales from DB into $locales array:
        // fp> not sure we need this...
        locale_overwritefromDB();
        break;
    case 'updatelocale':
    case 'createlocale':
        // CREATE/EDIT locale
        // Check that this action request is not a CSRF hacked request: