Subversion Repositories oidplus

Rev

Rev 1060 | Rev 1131 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1060 Rev 1130
Line 71... Line 71...
71
 
71
 
72
$files[] = 'var oidplus_webpath = '.js_escape(OIDplus::webpath(null, OIDplus::PATH_RELATIVE_TO_ROOT)).';';
72
$files[] = 'var oidplus_webpath = '.js_escape(OIDplus::webpath(null, OIDplus::PATH_RELATIVE_TO_ROOT)).';';
73
 
73
 
74
// The CSRF token is set by index.php
74
// The CSRF token is set by index.php
75
// TODO: can there race-conditions if we set csrf_token here? Or should we set it as inline-script in index.php ?
75
// TODO: can there race-conditions if we set csrf_token here? Or should we set it as inline-script in index.php ?
76
$files[] = 'var csrf_token = '.js_escape(isset($_COOKIE['csrf_token']) ? $_COOKIE['csrf_token'] : '').';';
76
$files[] = 'var csrf_token = '.js_escape($_COOKIE['csrf_token'] ?? '').';';
77
 
77
 
78
$files[] = 'var samesite_policy = '.js_escape(OIDplus::baseConfig()->getValue('COOKIE_SAMESITE_POLICY','Strict')).';';
78
$files[] = 'var samesite_policy = '.js_escape(OIDplus::baseConfig()->getValue('COOKIE_SAMESITE_POLICY','Strict')).';';
79
 
79
 
80
$files[] = process_file(__DIR__ . '/includes/oidplus_functions.js');
80
$files[] = process_file(__DIR__ . '/includes/oidplus_functions.js');
81
$files[] = process_file(__DIR__ . '/includes/oidplus_language.js');
81
$files[] = process_file(__DIR__ . '/includes/oidplus_language.js');
82
$files[] = process_file(__DIR__ . '/includes/oidplus_base.js');
82
$files[] = process_file(__DIR__ . '/includes/oidplus_base.js');
83
 
83
 
84
# ---
84
# ---
85
 
85
 
-
 
86
/**
-
 
87
 * @param string $filename
-
 
88
 * @return string
-
 
89
 */
86
function process_file($filename) {
90
function process_file(string $filename): string {
87
        global $do_minify;
91
        global $do_minify;
88
 
92
 
89
        $filename_min = preg_replace('/\.[^.]+$/', '.min.js', $filename);
93
        $filename_min = preg_replace('/\.[^.]+$/', '.min.js', $filename);
90
        $filename_full = $filename;
94
        $filename_full = $filename;
91
 
95