<?php require_once 'class.tlonuserdocument.php'; TlonUserDocument::updateAll('ellak', time());
/** * @param string $authtoken Authentication token. * @param string $messages serialized Array of messages. * @param int $rcptack Date of last update. * @return TlonSoapResponse Result */ public function sendMessages($authtoken, $messages, $rcptack) { $now = time(); if ($user = TlonUser::getByAuthToken($authtoken)) { if ($rcptack > 0 && $rcptack < $now) { // sanity check TlonUserDocument::updateAll($user['username'], $rcptack); } $msgs = $this->stdClassToArray(unserialize($messages)); $received = array(); $outgoing = $this->_getMessages($user['username']); foreach ($msgs as $msg) { if (($res = $this->_sendOperations($user['username'], $msg['docid'], $msg['operations'])) !== false) { $received[$msg['msgid']] = true; array_push($dbg, $this->integrateMessages($msg['docid'])); } else { return $this->returnFailure($authtoken, array('f' => $msg, 'm' => $msgs)); } } return $this->returnSuccess($authtoken, array('received' => $received, 'outgoing' => $outgoing, 'time' => $now)); } else { return $this->returnFailure($authtoken); } }