Server sync

This commit is contained in:
2019-10-05 00:34:18 +02:00
parent 4cc305e8b5
commit d72c6c0dde
11 changed files with 163 additions and 16 deletions

View File

@@ -3,7 +3,7 @@
/*
CATC Project
https://git.lutran.fr/franzz/catc
Copyright (C) 2015 François Lutran
Copyright (C) 2019 François Lutran
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ ToolBox::cleanPost($_REQUEST);
$sToken = isset($_REQUEST['token'])?$_REQUEST['token']:'';
$sAction = isset($_REQUEST['a'])?$_REQUEST['a']:'';
$sNickName = isset($_REQUEST['nickname'])?$_REQUEST['nickname']:'';
$iApiKey = isset($_GET['api'])?$_GET['api']:'';
$iApiKey = isset($_REQUEST['api'])?$_REQUEST['api']:'';
$sContent = isset($_POST['content'])?$_POST['content']:'';
$iId = isset($_REQUEST['id'])?$_REQUEST['id']:0;
$sTitle = isset($_REQUEST['title'])?$_REQUEST['title']:'';
@@ -71,6 +71,9 @@ elseif($sAction!='' && $bLoggedIn)
case 'set_def':
$sResult = $oCATC->setDef($iId, $sTitle, $sDesc);
break;
case 'server_push': //Sends db to server
$sResult = $oCATC->pushToServer();
break;
default:
$sResult = CATC::getJsonResult(false, CATC::NOT_FOUND);
}
@@ -81,6 +84,12 @@ elseif($sAction!='' && !$bLoggedIn)
{
switch ($sAction)
{
case 'server_update': //update db with sent data
$sResult = $oCATC->updateServer();
break;
case 'file_update':
$sResult = $oCATC->updateFile();
break;
default:
$sResult = CATC::getJsonResult(false, CATC::NOT_FOUND);
}