diff --git a/src/mibew/libs/operator.php b/src/mibew/libs/operator.php index 8771d1bb..da4eb714 100644 --- a/src/mibew/libs/operator.php +++ b/src/mibew/libs/operator.php @@ -526,77 +526,6 @@ function append_query($link, $pv) return "$link$infix$pv"; } -/** - * Check if operator is logged in or not. - * - * It can automatically redirect operators, who not logged in to the login page. - * Triggers 'operatorCheckLoginFail' event when check failed and pass into it - * an associative array with folloing keys: - * - 'requested_page': string, page where login check was failed. - * - * @param boolean $redirect Indicates if operator should be redirected to - * login page. Default value is true. - * @return null|array Array with operator info if operator is logged in and - * null otherwise. - * - * @deprecated - */ -function check_login($redirect = true) -{ - if (!isset($_SESSION[SESSION_PREFIX . "operator"])) { - if (isset($_COOKIE[REMEMBER_OPERATOR_COOKIE_NAME])) { - list($login, $pwd) = preg_split('/\x0/', base64_decode($_COOKIE[REMEMBER_OPERATOR_COOKIE_NAME]), 2); - $op = operator_by_login($login); - $can_login = $op - && isset($pwd) - && isset($op['vcpassword']) - && calculate_password_hash($op['vclogin'], $op['vcpassword']) == $pwd - && !operator_is_disabled($op); - if ($can_login) { - $_SESSION[SESSION_PREFIX . "operator"] = $op; - - return $op; - } - } - - // Get requested page - $requested = $_SERVER['PHP_SELF']; - if ($_SERVER['REQUEST_METHOD'] == 'GET' && $_SERVER['QUERY_STRING']) { - $requested .= "?" . $_SERVER['QUERY_STRING']; - } - - // Trigger fail event - $args = array('requested_page' => $requested); - $dispatcher = EventDispatcher::getInstance(); - $dispatcher->triggerEvent('operatorCheckLoginFail', $args); - - // Redirect operator if need - if ($redirect) { - $_SESSION['backpath'] = $requested; - header("Location: " . MIBEW_WEB_ROOT . "/operator/login"); - exit; - } else { - return null; - } - } - - return $_SESSION[SESSION_PREFIX . "operator"]; -} - -/** - * Force the admin to set a password after the installation - * - * @param array $operator Operator's array - * @deprecated - */ -function force_password($operator) -{ - if (check_password_hash($operator['vclogin'], $operator['vcpassword'], '')) { - header("Location: " . MIBEW_WEB_ROOT . "/operator/operator/1/edit"); - exit; - } -} - function get_logged_in() { return isset($_SESSION[SESSION_PREFIX . "operator"])