mirror of
https://github.com/monstra-cms/monstra.git
synced 2025-08-06 13:16:54 +02:00
Updated the method to get the server protocol
This edit will make the HTTP protocol to be automatic, so if you have a SSL Certificate, the Monstra will know and will make your urls more friendly.
This commit is contained in:
@@ -93,7 +93,8 @@
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function find($url) {
|
public static function find($url) {
|
||||||
$pos = strpos($url, 'http://');
|
$https = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == strtolower('on')) ? 'https://' : 'http://';
|
||||||
|
$pos = strpos($url, $https);
|
||||||
if ($pos === false) { $url_output = Option::get('siteurl') . $url; } else { $url_output = $url; }
|
if ($pos === false) { $url_output = Option::get('siteurl') . $url; } else { $url_output = $url; }
|
||||||
return $url_output;
|
return $url_output;
|
||||||
}
|
}
|
||||||
@@ -109,7 +110,7 @@
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function base() {
|
public static function base() {
|
||||||
return 'http://' . rtrim(rtrim($_SERVER['HTTP_HOST'], '\\/') . dirname($_SERVER['PHP_SELF']), '\\/');
|
$https = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == strtolower('on')) ? 'https://' : 'http://';
|
||||||
|
return $https . rtrim(rtrim($_SERVER['HTTP_HOST'], '\\/') . dirname($_SERVER['PHP_SELF']), '\\/');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user