Code Duplication    Length = 22-22 lines in 2 locations

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

@@ 4968-4989 (lines=22) @@
4965
     * @param string $context . Default is an empty string which indicates the method should automatically pick 'web (frontend) or 'mgr' (backend)
4966
     * @return string
4967
     */
4968
    public function getLoginUserID($context = '')
4969
    {
4970
        $out = false;
4971
4972
        if (!empty($context)) {
4973
            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4974
                $out = $_SESSION[$context . 'InternalKey'];
4975
            }
4976
        } else {
4977
            switch (true) {
4978
                case ($this->isFrontend() && isset ($_SESSION['webValidated'])): {
4979
                    $out = $_SESSION['webInternalKey'];
4980
                    break;
4981
                }
4982
                case ($this->isBackend() && isset ($_SESSION['mgrValidated'])): {
4983
                    $out = $_SESSION['mgrInternalKey'];
4984
                    break;
4985
                }
4986
            }
4987
        }
4988
        return $out;
4989
    }
4990
4991
    /**
4992
     * Returns current user name
@@ 4997-5018 (lines=22) @@
4994
     * @param string $context . Default is an empty string which indicates the method should automatically pick 'web (frontend) or 'mgr' (backend)
4995
     * @return string
4996
     */
4997
    public function getLoginUserName($context = '')
4998
    {
4999
        $out = false;
5000
5001
        if (!empty($context)) {
5002
            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
5003
                $out = $_SESSION[$context . 'Shortname'];
5004
            }
5005
        } else {
5006
            switch (true) {
5007
                case ($this->isFrontend() && isset ($_SESSION['webValidated'])): {
5008
                    $out = $_SESSION['webShortname'];
5009
                    break;
5010
                }
5011
                case ($this->isBackend() && isset ($_SESSION['mgrValidated'])): {
5012
                    $out = $_SESSION['mgrShortname'];
5013
                    break;
5014
                }
5015
            }
5016
        }
5017
        return $out;
5018
    }
5019
5020
    /**
5021
     * Returns current login user type - web or manager