. */ require_once(dirname(__DIR__) . "/helpers/auth.php"); require_once(ROOT_DIR . "/helpers/lang.php"); require_once(ROOT_DIR . "/helpers/track.php"); require_once(ROOT_DIR . "/helpers/utils.php"); require_once(ROOT_DIR . "/helpers/config.php"); $auth = new uAuth(); $action = uUtils::postString('action'); $positionId = uUtils::postInt('posid'); $comment = uUtils::postString('comment'); $config = uConfig::getInstance(); $lang = (new uLang($config))->getStrings(); if (empty($action) || empty($positionId)) { uUtils::exitWithError($lang["servererror"]); } $position = new uPosition($positionId); if (!$position->isValid || (!$auth->isAuthenticated() || (!$auth->isAdmin() && $auth->user->id !== $position->userId))) { uUtils::exitWithError($lang["servererror"]); } switch ($action) { case 'update': $position->comment = $comment; if ($position->update() === false) { uUtils::exitWithError($lang["servererror"]); } break; case 'delete': if ($position->delete() === false) { uUtils::exitWithError($lang["servererror"]); } break; default: uUtils::exitWithError($lang["servererror"]); break; } uUtils::exitWithSuccess(); ?>