mirror of
https://github.com/reactos/web.git
synced 2024-11-26 21:20:28 +00:00
[ROSWEB] Query the provider using the same protocol that is used by the visitor.
Fixes PHP warning messages on pure HTTPS sites (like our current website).
This commit is contained in:
parent
de955cdaac
commit
ebb6068c17
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
/*
|
||||
PROJECT: ReactOS RosWeb Component for sharing layout and user information between website subsystems
|
||||
LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation
|
||||
LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
|
||||
PURPOSE: Counterpart to rosweb.php for providing the information by using Drupal-internal functions
|
||||
COPYRIGHT: Copyright 2015 Colin Finck <colin@reactos.org>
|
||||
COPYRIGHT: Copyright 2015-2018 Colin Finck <colin@reactos.org>
|
||||
*/
|
||||
|
||||
function get_page_theme($theme, $wrapper)
|
||||
@ -27,7 +27,6 @@
|
||||
|
||||
// Save the variables from our query string
|
||||
$rosweb_part = $_GET["part"];
|
||||
$rosweb_tls = $_GET["tls"];
|
||||
|
||||
// Recreate the $_GET array with only the "q" variable propagated to Drupal.
|
||||
// This lets Drupal know about the page language we're accessing.
|
||||
@ -35,13 +34,8 @@
|
||||
|
||||
// Set the $base_url for Drupal.
|
||||
// This is mandatory for all pathes to work properly with this bootstrapping method.
|
||||
// The provider is always queried over HTTP, so we cannot rely on $_SERVER["HTTPS"] here to know whether the user accesses the website over HTTPS.
|
||||
$base_url = ($rosweb_tls ? "https" : "http") . "://" . $_SERVER["HTTP_HOST"];
|
||||
|
||||
// Even then, Drupal still checks $_SERVER["HTTPS"] at some points, so it's value needs to be accordingly.
|
||||
// For example, logins on the HTTPS site won't be noticed if this is not set.
|
||||
if($rosweb_tls)
|
||||
$_SERVER["HTTPS"] = "on";
|
||||
$protocol = (array_key_exists("HTTPS", $_SERVER) && $_SERVER["HTTPS"] == "on") ? "https" : "http";
|
||||
$base_url = $protocol . "://" . $_SERVER["HTTP_HOST"];
|
||||
|
||||
// Bootstrap Drupal.
|
||||
// This pollutes the global namespace with many Drupal-specific variables and functions and is the sole reason we have to use this provider approach.
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
/*
|
||||
* PROJECT: ReactOS Website
|
||||
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
||||
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
|
||||
* PURPOSE: ReactOS RosWeb Component for sharing layout and user information between website subsystems
|
||||
* COPYRIGHT: Copyright 2015-2017 Colin Finck (colin@reactos.org)
|
||||
* COPYRIGHT: Copyright 2015-2018 Colin Finck (colin@reactos.org)
|
||||
*/
|
||||
|
||||
class RosWeb
|
||||
@ -105,9 +105,9 @@
|
||||
private function _queryProvider($part)
|
||||
{
|
||||
$q = ($this->_language == "en") ? "" : $this->_language;
|
||||
$tls = (array_key_exists("HTTPS", $_SERVER) && $_SERVER["HTTPS"] == "on") ? "1" : "0";
|
||||
$protocol = (array_key_exists("HTTPS", $_SERVER) && $_SERVER["HTTPS"] == "on") ? "https" : "http";
|
||||
|
||||
$fp = fopen(sprintf("http://%s/rosweb/rosweb-provider-%s.php?q=%s&part=%s&tls=%s", $_SERVER["HTTP_HOST"], $this->_provider, $q, $part, $tls), "r", false, $this->_context);
|
||||
$fp = fopen(sprintf("%s://%s/rosweb/rosweb-provider-%s.php?q=%s&part=%s", $protocol, $_SERVER["HTTP_HOST"], $this->_provider, $q, $part), "r", false, $this->_context);
|
||||
$ret = stream_get_contents($fp);
|
||||
fclose($fp);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user