SiteData::$tables, 'passwordLength' => SiteData::$passwordLength)), LOCK_EX); }); FakeRecaptcha::install(function ($post) use ($file) { $token = $post['event']['token'] ?? ''; if ($token === 'unreachable') return FALSE; if ($token === 'api-error') return '{"error":{"code":403,"status":"PERMISSION_DENIED"}}'; $action = $file === XXX_ROOT . '/publish/login.php' ? 'login' : 'submit'; return json_encode(array('tokenProperties' => array( 'valid' => in_array($token, array('pass', 'wrong-host', 'wrong-action'), TRUE), 'hostname' => $token === 'wrong-host' ? 'evil.example' : 'site.test', 'action' => $token === 'wrong-action' ? 'other' : $action, ))); }); if (!isset($_SERVER['HTTP_X_TEST_PLAIN'])) $_SERVER['HTTPS'] = 'on'; // Apache with UseCanonicalName Off also takes SERVER_NAME from the Host header $_SERVER['SERVER_NAME'] = preg_replace('/:\d+$/', '', $_SERVER['HTTP_HOST'] ?? ''); $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_TEST_ADDRESS'] ?? '192.0.2.1'; $_SERVER['SCRIPT_FILENAME'] = $file; $_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'] = substr($file, strlen(XXX_ROOT)); chdir(dirname($file)); return $file; } if (!is_string($xxx_page = xxx_page_route())) return $xxx_page; require $xxx_page;