Code Duplication    Length = 22-22 lines in 2 locations

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

@@ 4929-4950 (lines=22) @@
4926
     * @param string $context . Default is an empty string which indicates the method should automatically pick 'web (frontend) or 'mgr' (backend)
4927
     * @return string
4928
     */
4929
    public function getLoginUserID($context = '')
4930
    {
4931
        $out = false;
4932
4933
        if (!empty($context)) {
4934
            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4935
                $out = $_SESSION[$context . 'InternalKey'];
4936
            }
4937
        } else {
4938
            switch (true) {
4939
                case ($this->isFrontend() && isset ($_SESSION['webValidated'])): {
4940
                    $out = $_SESSION['webInternalKey'];
4941
                    break;
4942
                }
4943
                case ($this->isBackend() && isset ($_SESSION['mgrValidated'])): {
4944
                    $out = $_SESSION['mgrInternalKey'];
4945
                    break;
4946
                }
4947
            }
4948
        }
4949
        return $out;
4950
    }
4951
4952
    /**
4953
     * Returns current user name
@@ 4958-4979 (lines=22) @@
4955
     * @param string $context . Default is an empty string which indicates the method should automatically pick 'web (frontend) or 'mgr' (backend)
4956
     * @return string
4957
     */
4958
    public function getLoginUserName($context = '')
4959
    {
4960
        $out = false;
4961
4962
        if (!empty($context)) {
4963
            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4964
                $out = $_SESSION[$context . 'Shortname'];
4965
            }
4966
        } else {
4967
            switch (true) {
4968
                case ($this->isFrontend() && isset ($_SESSION['webValidated'])): {
4969
                    $out = $_SESSION['webShortname'];
4970
                    break;
4971
                }
4972
                case ($this->isBackend() && isset ($_SESSION['mgrValidated'])): {
4973
                    $out = $_SESSION['mgrShortname'];
4974
                    break;
4975
                }
4976
            }
4977
        }
4978
        return $out;
4979
    }
4980
4981
    /**
4982
     * Returns current login user type - web or manager