<?php

namespace ModulesGarden\Servers\ProxmoxCloudVps\App\Helpers;

/*
File:   BuildUrl.php
Date:   28.05.2020
Author: Tomasz Bielecki (tomasz.bi@modulesgarden.com)
Class BuildUrl
*/

class BuildUrl extends \ModulesGarden\Servers\ProxmoxCloudVps\Core\Helper\BuildUrl
{

    public static function getSelfUrl()
    {
        $host   = $GLOBALS['CONFIG']['SystemURL'] ? $GLOBALS['CONFIG']['SystemURL'] : $_SERVER['HTTP_HOST'];
        $url = \parse_url( $host );
        $surfix = $_SERVER['PHP_SELF'];

        $parms = $_GET;
        $url = "{$url['scheme']}://{$url['host']}{$surfix}";
        if($parms)
        {
            $url = $url.'?'.http_build_query($parms);
        }

        return $url;
    }


    public static function isClientArea()
    {
        return defined('CLIENTAREA');
    }

}