Code Duplication    Length = 22-22 lines in 2 locations

manager/includes/document.parser.class.inc.php 2 locations

@@ 4947-4968 (lines=22) @@
4944
     * @param string $context . Default is an empty string which indicates the method should automatically pick 'web (frontend) or 'mgr' (backend)
4945
     * @return string
4946
     */
4947
    public function getLoginUserID($context = '')
4948
    {
4949
        $out = false;
4950
4951
        if (!empty($context)) {
4952
            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4953
                $out = $_SESSION[$context . 'InternalKey'];
4954
            }
4955
        } else {
4956
            switch (true) {
4957
                case ($this->isFrontend() && isset ($_SESSION['webValidated'])): {
4958
                    $out = $_SESSION['webInternalKey'];
4959
                    break;
4960
                }
4961
                case ($this->isBackend() && isset ($_SESSION['mgrValidated'])): {
4962
                    $out = $_SESSION['mgrInternalKey'];
4963
                    break;
4964
                }
4965
            }
4966
        }
4967
        return $out;
4968
    }
4969
4970
    /**
4971
     * Returns current user name
@@ 4976-4997 (lines=22) @@
4973
     * @param string $context . Default is an empty string which indicates the method should automatically pick 'web (frontend) or 'mgr' (backend)
4974
     * @return string
4975
     */
4976
    public function getLoginUserName($context = '')
4977
    {
4978
        $out = false;
4979
4980
        if (!empty($context)) {
4981
            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4982
                $out = $_SESSION[$context . 'Shortname'];
4983
            }
4984
        } else {
4985
            switch (true) {
4986
                case ($this->isFrontend() && isset ($_SESSION['webValidated'])): {
4987
                    $out = $_SESSION['webShortname'];
4988
                    break;
4989
                }
4990
                case ($this->isBackend() && isset ($_SESSION['mgrValidated'])): {
4991
                    $out = $_SESSION['mgrShortname'];
4992
                    break;
4993
                }
4994
            }
4995
        }
4996
        return $out;
4997
    }
4998
4999
    /**
5000
     * Returns current login user type - web or manager