use proper namespace and class

This commit is contained in:
Roland Gruber 2017-09-16 22:16:35 +02:00
parent f2c78d6992
commit 749021a175
1 changed files with 10 additions and 8 deletions

View File

@ -1,4 +1,5 @@
<?php <?php
namespace LAM\AJAX;
/* /*
$Id$ $Id$
@ -47,18 +48,19 @@ if (startSecureSession(false, true) === false) {
setlanguage(); setlanguage();
lamAjax::handleRequest(); $ajax = new Ajax();
$ajax->handleRequest();
/** /**
* Manages all AJAX requests. * Manages all AJAX requests.
*/ */
class lamAjax { class Ajax {
/** /**
* Manages an AJAX request. * Manages an AJAX request.
*/ */
public static function handleRequest() { public function handleRequest() {
lamAjax::setHeader(); $this->setHeader();
// check token // check token
validateSecurityToken(false); validateSecurityToken(false);
@ -84,11 +86,11 @@ class lamAjax {
$jsonInput = $_POST['jsonInput']; $jsonInput = $_POST['jsonInput'];
if ($function == 'passwordStrengthCheck') { if ($function == 'passwordStrengthCheck') {
lamAjax::checkPasswordStrength($jsonInput); $this->checkPasswordStrength($jsonInput);
} }
enforceUserIsLoggedIn(); enforceUserIsLoggedIn();
if ($function == 'passwordChange') { if ($function == 'passwordChange') {
lamAjax::managePasswordChange($jsonInput); $this->managePasswordChange($jsonInput);
} }
elseif ($function == 'upload') { elseif ($function == 'upload') {
include_once('../../lib/upload.inc'); include_once('../../lib/upload.inc');
@ -115,7 +117,7 @@ class lamAjax {
* *
* @param array $input input parameters * @param array $input input parameters
*/ */
public static function managePasswordChange($input) { private static function managePasswordChange($input) {
$return = $_SESSION['account']->setNewPassword($input); $return = $_SESSION['account']->setNewPassword($input);
echo json_encode($return); echo json_encode($return);
} }
@ -125,7 +127,7 @@ class lamAjax {
* *
* @param array $input input parameters * @param array $input input parameters
*/ */
public static function checkPasswordStrength($input) { private function checkPasswordStrength($input) {
$password = $input['password']; $password = $input['password'];
$result = checkPasswordStrength($password, null, null); $result = checkPasswordStrength($password, null, null);
echo json_encode(array("result" => $result)); echo json_encode(array("result" => $result));