コード例 #1
0
* needs please look at the /overrides module directory or refer to
* http://kb.appixia.com for more information.
*
*/
include dirname(__FILE__) . '/../../config/config.inc.php';
require_once dirname(__FILE__) . '/engine/Engine.php';
require_once dirname(__FILE__) . '/engine/Helpers.php';
require_once dirname(__FILE__) . '/Helpers.php';
// handle the request
$request = CartAPI_Engine::handleRequest();
if ($request === false) {
    die('ERROR');
}
CartAPI_Handlers_Helpers::preInit($request['metadata']);
require_once dirname(__FILE__) . '/../../init.php';
CartAPI_Handlers_Helpers::setServerNotices();
// mark as an appixia mobile endpoint
// TODO: add some validation of user agent and such, or maybe move this line to the app itself alltogether (maybe should originate from the server at all)
CartAPI_Handlers_Helpers::setAppixiaMobileEngine();
// define all supported operations
$request_router = array('GetSingleItem' => 'Items', 'GetItemList' => 'Items', 'GetCategoryList' => 'Categories', 'BuyerLogin' => 'Login', 'BuyerRegister' => 'Login', 'GetOrderUpdate' => 'Order', 'GetShippingMethods' => 'Order', 'GetPaymentMethods' => 'Order');
// find the correct operation handler
$operation = $request['metadata']['X-OPERATION'];
$func_name = 'Handle_' . $operation;
$handler = $request_router[$operation];
$handler_filename = $handler . '.php';
$class_name = 'CartAPI_Handlers_' . $handler;
// load the correct file
if (!file_exists(dirname(__FILE__) . '/overrides/' . $handler_filename)) {
    // load the base
    require_once dirname(__FILE__) . '/' . $handler_filename;