', '{', '}', '|', '\\', '^', '~', '`']; $unallowed_uri_chars_encoded = array_map('urlencode', $unallowed_uri_chars); if (isset($_SERVER['REQUEST_URI'])) { $_SERVER['REQUEST_URI'] = str_replace($unallowed_uri_chars, $unallowed_uri_chars_encoded, $_SERVER['REQUEST_URI']); } // Same as above, but for PHP_SELF which does not contain URL params // Usually, PHP_SELF also differs from REQUEST_URI in that PHP_SELF is URL decoded and REQUEST_URI is exactly what the client sent $unallowed_uri_chars = array_merge($unallowed_uri_chars, ['#', '[', ']']); $unallowed_uri_chars_encoded = array_merge($unallowed_uri_chars_encoded, array_map('urlencode', ['#', '[', ']'])); $_SERVER['SCRIPT_NAME'] = str_replace($unallowed_uri_chars, $unallowed_uri_chars_encoded, $_SERVER['SCRIPT_NAME']); // Note: need to substitute \ for / for Windows. $tikiroot = str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])); // remove beginning dot if it is a relative path on the filesystem if (php_sapi_name() == 'cli') { $tikiroot = preg_replace('/^\.\//', '/', $tikiroot); if ($tikiroot == '.') { $tikiroot = ''; } } if ($dir_level > 0) { $tikiroot = preg_replace('#(/[^/]+){' . $dir_level . '}$#', '', $tikiroot); chdir($tikipath); } if (substr($tikiroot, -1, 1) != '/') { $tikiroot .= '/'; } if (substr($tikipath, -1, 1) != '/') { $tikipath .= '/'; } // Add global filter for xajax and cookie // AJAX_TODO? global $inputConfiguration; if (empty($inputConfiguration)) { $inputConfiguration = []; } array_unshift( $inputConfiguration, [ 'staticKeyFilters' => [ 'cookietab' => 'int', 'callback' => 'word', ], 'staticKeyFiltersForArrays' => [ ] ] ); require_once('lib/init/initlib.php'); TikiInit::appendIncludePath($tikipath);