Commit cb394542 authored by Chris Graham's avatar Chris Graham
Browse files

Fixed MANTIS-4769 (Disable static cache when a POST form token is present)

parent 7e88e81c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -48,6 +48,8 @@ function generate_csrf_token()
{
    static $token = null; // So we only have one per screen (otherwise we can get huge numbers in our table)

    $GLOBALS['STATIC_CACHE_ENABLED'] = false;

    if ($token === null) {
        require_code('crypt');
        $token = get_rand_password();
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ function init__symbols()
        'LOAD_PAGE' => true,
        'FRACTIONAL_EDITABLE' => true,
        'PAGE_TITLE' => true,
        'INSERT_SPAMMER_BLACKHOLE' => true,
    );
    $EXTRA_SYMBOLS = null;
    $CANONICAL_URL = null;
+8 −0
Original line number Diff line number Diff line
@@ -294,6 +294,7 @@ function build_closure_tempcode($type, $name, $parameters, $escaping = null)
            case 'PAGE_LINK':
            case 'LOAD_PAGE':
            case 'LOAD_PANEL':
            case 'INSERT_SPAMMER_BLACKHOLE':
                break;

            default:
@@ -1337,6 +1338,12 @@ function handle_symbol_preprocessing($seq_part, &$children)
            require_javascript('ajax');
            require_javascript('fractional_edit');
            return;

        case 'INSERT_SPAMMER_BLACKHOLE':
            if (get_bot_type() === null) {
                $GLOBALS['STATIC_CACHE_ENABLED'] = false;
            }
            return;
    }
}

@@ -1396,6 +1403,7 @@ class Tempcode
                                case 'PAGE_LINK':
                                case 'LOAD_PAGE':
                                case 'LOAD_PANEL':
                                case 'INSERT_SPAMMER_BLACKHOLE':
                                    $pp_bits[] = array(array(), TC_SYMBOL, $seq_part[3], $seq_part[1]);
                                    break;
                            }
+1 −0
Original line number Diff line number Diff line
@@ -342,6 +342,7 @@ function compile_template($data, $template_name, $theme, $lang, $tolerate_errors
                                case '"BLOCK"':
                                case '"LOAD_PAGE"':
                                case '"LOAD_PANEL"':
                                case '"INSERT_SPAMMER_BLACKHOLE"':
                                    foreach ($stack as $level_test) { // Make sure if it's a LOOP then we evaluate the parameters early, as these have extra bindings we don't know about
                                        if (($level_test[3] === PARSE_DIRECTIVE) && (isset($level_test[5][1])) && (isset($level_test[5][1][0])) && ($level_test[5][1][0] === '"LOOP"')) { // For a loop, we need to do full evaluation of symbol parameters as it may be bound to a loop variable
                                            $tpl_funcs = array();