function submitWordList($user, $params) { // check for achievements, win/loss, publish; return scores + words $matchID = getParam('m'); $m = Store::get(Store::MATCH, $matchID); if (!$m) { // catch this trigger_error("ERROR: s Invalid mid ({$matchID}) user {$user}", E_USER_ERROR); } $words = getParam('w') ? getParam('w') : array(); $participants = $m->getParticipants(); if (array_key_exists($user, $participants)) { $m->updateParticipant($user, $words); } else { trigger_error("ERROR: s user {$user} not in match {$matchID}", E_USER_ERROR); } Store::set(Store::MATCH, $matchID, $m); $scores = $m->getScores(); //TAG:SCORES if ($GLOBALS['on']['scores']) { publishScore($user, $scores[$user]); } //TAG:ACHIEVEMENTS if ($GLOBALS['on']['achievements']) { require_once 'Achievements.php'; Achievements::grantAchievements($user, $scores[$user]); } restReturn($scores); }