|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright (C) 2013 KO GmbH <copyright@kogmbh.com>
|
|
|
|
@ -33,14 +34,11 @@
|
|
|
|
|
* @source: http://www.webodf.org/
|
|
|
|
|
* @source: http://gitorious.org/webodf/webodf/
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// OCP\JSON::checkLoggedIn();
|
|
|
|
|
// OCP\JSON::checkAppEnabled('office');
|
|
|
|
|
// session_write_close();
|
|
|
|
|
|
|
|
|
|
$postBody = file_get_contents('php://input');
|
|
|
|
|
|
|
|
|
|
function bogusSession($i) {
|
|
|
|
|
function bogusSession($i){
|
|
|
|
|
$bs = array();
|
|
|
|
|
$bs["denomination"] = "[$i] bogus session";
|
|
|
|
|
$bs["id"] = "$i";
|
|
|
|
@ -51,16 +49,23 @@ function bogusSession($i) {
|
|
|
|
|
return $bs;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$command = isset($_POST['command']) ? $_POST['command'] : '';
|
|
|
|
|
|
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
|
if (preg_match('/^session-list/', $postBody) === 1) { // session-list
|
|
|
|
|
$bogusSessionList = array();
|
|
|
|
|
$bogusSessionList["session_list"] = array(bogusSession(0), bogusSession(1));
|
|
|
|
|
print json_encode($bogusSessionList, JSON_PRETTY_PRINT)."\n";
|
|
|
|
|
} else if (preg_match('/^join-session:/', $postBody) === 1) { // join
|
|
|
|
|
print "true";
|
|
|
|
|
} else if (preg_match('/^sync-ops:/', $postBody) === 1) { // sync
|
|
|
|
|
// completely bogus
|
|
|
|
|
print '{"result":"newOps","ops":[],"headSeq":-1}';
|
|
|
|
|
} else {
|
|
|
|
|
print "unknown command"; // TODO send HTTP 400 response
|
|
|
|
|
|
|
|
|
|
switch ($command){
|
|
|
|
|
case 'session-list':
|
|
|
|
|
$bogusSessionList = array();
|
|
|
|
|
$bogusSessionList["session_list"] = array(bogusSession(0), bogusSession(1));
|
|
|
|
|
print json_encode($bogusSessionList, JSON_PRETTY_PRINT) . "\n";
|
|
|
|
|
break;
|
|
|
|
|
case 'join-session':
|
|
|
|
|
print "true";
|
|
|
|
|
break;
|
|
|
|
|
case 'sync-ops':
|
|
|
|
|
// completely bogus
|
|
|
|
|
print '{"result":"newOps","ops":[],"headSeq":-1}';
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
print "unknown command"; // TODO send HTTP 400 response
|
|
|
|
|
}
|
|
|
|
|