Server sync
This commit is contained in:
13
index.php
13
index.php
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user