static function ProcessRequest($action)
 {
     global $mybb;
     switch ($action) {
         case AsyncRequestTypes::$LoadMostRecentMessages:
             return MessageLoader::LoadFromBeforeStartDate(new DateTime(), 20);
         case AsyncRequestTypes::$PostMessage:
             return MessagePoster::PostMessage($mybb->user, get_ip(), $_POST['badgerchat_message']);
         default:
             return "Unknown request type";
     }
 }
            $fname = "get/m_" . $countedfilenamepart . ".txt";
            $fhandle = fopen($fname, "w");
            if ($fhandle) {
                // TODO: harden more - stripping_tags is not sufficient: ensure only valid length + valid chars
                $message = strip_tags($_GET['m']);
                fwrite($fhandle, $message, $this->MAXLENGTH);
                fwrite($fhandle, "\n", 1);
                fflush($fhandle);
                if (fclose($fhandle)) {
                    $result = true;
                }
            }
            if (!$this->releaseFileLock($handleToCounter)) {
                $result = false;
            }
            fclose($handleToCounter);
        } catch (Exception $e) {
            // TODO: log exception echo "<p>"+$e->getMessage()+"</p>";
            $result = false;
        }
        return $result;
    }
}
$poster = new MessagePoster();
if (isset($_GET['m'])) {
    if ($poster->process($_GET['m'])) {
        print "OK";
    } else {
        print "ERROR";
    }
}