first commit
This commit is contained in:
154
socket/Pohoda.php
Normal file
154
socket/Pohoda.php
Normal file
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
|
||||
// ##############################################################
|
||||
require_once '../include/config.php';
|
||||
require_once './functions.php';
|
||||
require_once 'Pohoda.Functions.php';
|
||||
require_once './common.php';
|
||||
// ##############################################################
|
||||
|
||||
// Allow NIL Extension
|
||||
// $GLOBALS['xmlrpc_null_extension']=true;
|
||||
|
||||
$POHODA_Request_sig = [['struct', 'struct']];
|
||||
$POHODA_Request_doc = '';
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
function POHODA_InvoicesCall($params)
|
||||
{
|
||||
$val = $params->getparam(0);
|
||||
$param = php_xmlrpc_decode($val);
|
||||
|
||||
// logError(__FILE__, __LINE__, print_r($param, true), true);
|
||||
|
||||
if (!POHODA_checkSession($param['requestParams']['sessionId'])) {
|
||||
return POHODA_unauthorized();
|
||||
}
|
||||
|
||||
// logError(__FILE__, __LINE__, "orders2", true);
|
||||
|
||||
include 'Pohoda.Invoices.php';
|
||||
|
||||
return POHODA_Invoices($param);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
function POHODA_OrdersCall($params)
|
||||
{
|
||||
$val = $params->getparam(0);
|
||||
$param = php_xmlrpc_decode($val);
|
||||
|
||||
// logError(__FILE__, __LINE__, print_r($param, true), true);
|
||||
// logError(__FILE__, __LINE__, "orders", true);
|
||||
|
||||
if (!POHODA_checkSession($param['requestParams']['sessionId'])) {
|
||||
return POHODA_unauthorized();
|
||||
}
|
||||
|
||||
// logError(__FILE__, __LINE__, "orders2", true);
|
||||
|
||||
include 'Pohoda.Orders.php';
|
||||
|
||||
return POHODA_Orders($param);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
function POHODA_ContactsCall($params)
|
||||
{
|
||||
$val = $params->getparam(0);
|
||||
$param = php_xmlrpc_decode($val);
|
||||
|
||||
if (!POHODA_checkSession($param['requestParams']['sessionId'])) {
|
||||
return POHODA_unauthorized();
|
||||
}
|
||||
|
||||
// logError(__FILE__, __LINE__, print_r($param, true), true);
|
||||
|
||||
include 'Pohoda.Contacts.php';
|
||||
|
||||
return POHODA_Contacts($param);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
function POHODA_ProductsCall($params)
|
||||
{
|
||||
$val = $params->getparam(0);
|
||||
$param = php_xmlrpc_decode($val);
|
||||
|
||||
if (!POHODA_checkSession($param['requestParams']['sessionId'])) {
|
||||
return POHODA_unauthorized();
|
||||
}
|
||||
|
||||
// logError(__FILE__, __LINE__, print_r($param, true), true);
|
||||
|
||||
include 'Pohoda.Products.php';
|
||||
|
||||
return POHODA_Products($param);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
function POHODA_ClientLogin($params)
|
||||
{
|
||||
$val = $params->getparam(0);
|
||||
$param = php_xmlrpc_decode($val);
|
||||
|
||||
// logError(__FILE__, __LINE__, print_r($param, true), true);
|
||||
|
||||
return POHODA_login($param);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
function POHODA_ClientLogout($params)
|
||||
{
|
||||
$val = $params->getparam(0);
|
||||
$param = php_xmlrpc_decode($val);
|
||||
|
||||
if (!POHODA_checkSession($param['requestParams']['sessionId'])) {
|
||||
return POHODA_unauthorized();
|
||||
}
|
||||
|
||||
// logError(__FILE__, __LINE__, print_r($param, true), true);
|
||||
|
||||
return POHODA_logout($param);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
$server = new xmlrpc_server([
|
||||
'INVOICES' => [
|
||||
'function' => 'POHODA_InvoicesCall',
|
||||
'signature' => $POHODA_Request_sig,
|
||||
'docstring' => $POHODA_Request_doc,
|
||||
],
|
||||
'CONTACTS' => [
|
||||
'function' => 'POHODA_ContactsCall',
|
||||
'signature' => $POHODA_Request_sig,
|
||||
'docstring' => $POHODA_Request_doc,
|
||||
],
|
||||
'LOGIN' => [
|
||||
'function' => 'POHODA_ClientLogin',
|
||||
'signature' => $POHODA_Request_sig,
|
||||
'docstring' => $POHODA_Request_doc,
|
||||
],
|
||||
'LOGOUT' => [
|
||||
'function' => 'POHODA_ClientLogout',
|
||||
'signature' => $POHODA_Request_sig,
|
||||
'docstring' => $POHODA_Request_doc,
|
||||
],
|
||||
'ORDERS' => [
|
||||
'function' => 'POHODA_OrdersCall',
|
||||
'signature' => $POHODA_Request_sig,
|
||||
'docstring' => $POHODA_Request_doc,
|
||||
],
|
||||
'PRODUCTS' => [
|
||||
'function' => 'POHODA_ProductsCall',
|
||||
'signature' => $POHODA_Request_sig,
|
||||
'docstring' => $POHODA_Request_doc,
|
||||
],
|
||||
]);
|
||||
Reference in New Issue
Block a user