Code Duplication    Length = 22-22 lines in 2 locations

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

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