1. Import
This commit is contained in:
130
html/mobile/licenceXML.php
Normal file
130
html/mobile/licenceXML.php
Normal file
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
/*=======================================================================
|
||||
*
|
||||
* licenceXML.php
|
||||
*
|
||||
* Autor: Marc Vollmann
|
||||
*
|
||||
=======================================================================*/
|
||||
|
||||
include_once ("../include/mcglobal.inc.php");
|
||||
// include_once ("../include/auth.inc.php");
|
||||
// include_once ('../include/email/htmlMimeMail.php');
|
||||
include_once ("../include/inc_APP.inc.php");
|
||||
include_once ("../include/inc_parseXML.inc.php");
|
||||
|
||||
|
||||
getLanguage(__FILE__);
|
||||
|
||||
getCurrentScript(__FILE__);
|
||||
|
||||
|
||||
|
||||
// ***********************
|
||||
// *** Initialisations ***
|
||||
// ***********************
|
||||
|
||||
|
||||
// $messageReqRawData = file_get_contents('php://input');
|
||||
getSecHttpVars("1", array("data"));
|
||||
$messageReq = $data;
|
||||
// $messageReq = mcDecode($messageReq);
|
||||
|
||||
$currentTime = getDateTime("0");
|
||||
$currentClientIP = trim($_SERVER['REMOTE_ADDR']);
|
||||
writeToFile("../log/mobile.log", $currentTime . " | " . $currentClientIP);
|
||||
// writeToFile("../log/mobile.log", $messageReqRawData);
|
||||
writeToFile("../log/mobile.log", $messageReq);
|
||||
writeToFile("../log/mobile.log", "-------------------------------------------------------------------------------------------");
|
||||
|
||||
|
||||
// Check for POST raw data
|
||||
$functionName = getSingleTagContent($messageReq, "<id>", "</id>");
|
||||
$licKey = getSingleTagContent($messageReq, "<licencekey>", "</licencekey>");
|
||||
|
||||
|
||||
// Decode
|
||||
$licKey = mcDecode($licKey);
|
||||
|
||||
|
||||
|
||||
// HARDCODED START ENVIRONMENT
|
||||
// $functionName = "getLicenceData";
|
||||
// $licKey = "L1000000001";
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// **************
|
||||
// * XML Output *
|
||||
// **************
|
||||
|
||||
$retVal = "";
|
||||
$xmlOut = "";
|
||||
$xmlNoErrOut .= "<err_no>0</err_no>\n<err_desc>OK</err_desc>\n";
|
||||
$xmlErrOut .= "<err_no>100</err_no>\n<err_desc>Currently not implemented.</err_desc>\n";
|
||||
|
||||
if ($functionName == "getLicenceData") :
|
||||
|
||||
if ($transactionHandle != "") :
|
||||
// $xmlOut .= "<transaction_no>" . $transaction_no . "</transaction_no>\n";
|
||||
endif;
|
||||
|
||||
$xmlOut .= "<data>\n";
|
||||
|
||||
if ($functionName != "") :
|
||||
if (function_exists($functionName)) :
|
||||
|
||||
if ($functionName == "getLicenceData") :
|
||||
$retVal = call_user_func_array($functionName, array($licKey)); // Check licence data
|
||||
$retValLen = count($retVal);
|
||||
|
||||
if (!is_array($retVal[0]) && $retVal[0] != "0") :
|
||||
$xmlOut .= $retVal[1] . $retVal[2];
|
||||
else :
|
||||
// if ($retValLen > 0) :
|
||||
$xmlOut .= "<licapp_list>\n";
|
||||
for ($i = 0; $i < $retValLen; $i++) :
|
||||
$xmlOut .= "<licapp id=\"" . $retVal[$i][0] . "\">\n";
|
||||
$xmlOut .= " <name><![CDATA[" . mcEncode($retVal[$i][1]) . "]]></name>\n";
|
||||
$xmlOut .= " <authreq>" . $retVal[$i][2] . "</authreq>\n";
|
||||
$xmlOut .= " <appurl><![CDATA[" . mcEncode($retVal[$i][3]) . "]]></appurl>\n";
|
||||
$xmlOut .= " <templateurl><![CDATA[" . mcEncode($retVal[$i][4]) . "]]></templateurl>\n";
|
||||
$xmlOut .= " <licenceurl><![CDATA[" . mcEncode($retVal[$i][5]) . "]]></licenceurl>\n";
|
||||
$xmlOut .= "</licapp>\n";
|
||||
endfor;
|
||||
$xmlOut .= "</licapp_list>\n";
|
||||
// endif;
|
||||
endif;
|
||||
|
||||
// elseif ($functionName == "xxx") :
|
||||
/*
|
||||
$retVal = call_user_func_array($functionName, array($actionMode, $rpId, $rpType, $rpObjType, $rpObjId, $rpText, $rpConfidential, $hq_id, $usr_id)); // DB actions for a report
|
||||
$xmlOut .= "<reports>\n";
|
||||
$xmlOut .= "<report>\n";
|
||||
$xmlOut .= "<action>" . $actionMode . "</action>\n";
|
||||
$xmlOut .= "<rp_id>" . $rpId . "</rp_id>\n";
|
||||
$xmlOut .= "<state>" . $retVal . "</state>\n";
|
||||
$xmlOut .= "</report>\n";
|
||||
$xmlOut .= "</reports>\n";
|
||||
*/
|
||||
|
||||
else :
|
||||
$xmlOut .= "<err_no>103</err_no>\n";
|
||||
$xmlOut .= "<err_desc>Function does not exist in API.</err_desc>\n";
|
||||
endif;
|
||||
else :
|
||||
$xmlOut .= "<err_no>102</err_no>\n";
|
||||
$xmlOut .= "<err_desc>Specified function does not exist.</err_desc>\n";
|
||||
endif;
|
||||
else :
|
||||
$xmlOut .= "<err_no>101</err_no>\n";
|
||||
$xmlOut .= "<err_desc>No function specified.</err_desc>\n";
|
||||
endif;
|
||||
|
||||
$xmlOut .= "</data>\n";
|
||||
endif;
|
||||
|
||||
echo $xmlOut;
|
||||
?>
|
||||
Reference in New Issue
Block a user